Import / Delete a Tiddler dynamically

I read some other discussions here and I think it is possible.
So I found this here (copied and adapted from other threads), but I am unable to give over the file name xxx.tid. :roll_eyes:

<$button actions=<<$action-sendmessage $message="tm-perform-import" $param="$:/Import" $autoOpenOnImport="yes"/>> >
import
</$button>

Hi Springer,

thanks for our answers.
Why I cannot use the node.js is, that finally (in a few weeks) the wiki will used on a Sharepoint (company) server as aspx file. Actually we are testing some sandbox files and the results are GREAT :partying_face: The acceptance by the users is outstanding :star_struck:

Of course it could be possible to spilt the files but this will extend the service expense. One of the ideas here is that we have one production wiki and some development wikis managed by different teams. If the content in one the development wikis is released the tiddler will be exported and stored in a folder. As the editor agreed with the team about the file name the content at the beginning of the process it is easy to manage the the file by replacing the file.

I found some similar discussions here with tm-perform-import but have no final solution found yet.

Hi linonetwo,

I cannot use the node.js version because the final version will be used on n Sharepoint (company) server. :slightly_smiling_face:

Hi Stefan,
Did you have a closer look at: https://tiddlywiki.com/#Alice%20in%20Wonderland tiddler.

It uses the “_canonical_uri” field to “import” a tiddler on demand. You can search tiddlywiki.com for this term to find more info. eg: How to embed PDFs or external images

IMO you should be able to run some tests with that info.

So the whole “hokus pokus” is done to reduce service cost? Can you be more specific, how the service costs are calculated?

1 Like

Hi Mario,

the idea is good but not working for me.

I created a tiddler xxx.tid

caption: Welcome
created: 20230522085558890
creator: Stefan Pazdera
modified: 20230522085628576
modifier: Stefan Pazdera
tags: TableOfContents
title: 0.0.0.0. Welcome 1

\define myActions()
<$action-listops $tiddler="Inhaltsverzeichnis" $tags="+$:/tags/SideBar"/>
<$action-listops $tiddler="TableOfContents" $tags="-$:/tags/SideBar"/>
<$action-setfield $tiddler="$:/language" text="$:/languages/de-DE"/>
<$action-navigate $to="0.0.0.1. Willkommen"/>
\end

<$tiddler tiddler="Inhaltsverzeichnis">
<$button actions=<<myActions>> >
Switch to GERMAN 
</$button>
</$tiddler>

This wiki is based on the ~OpenSource project [[TiddlyWiki|https://tiddlywiki.com/]].

and a My Alice Tiddler:

Unfortunatly this message appear:

Trying to load external content from 0.0.0.0. Welcome 1.tid

If this message doesn't disappear, either the tiddler content type doesn't match the type of the external content, or you may be using a browser that doesn't support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText

Than I changed the xxx.tid to a html version (I do not bring the html code here it is to long) and I also changed the content-type field to “html”.

The good thing is, it will be shown correct. But the button is not working (also links to other tiddlers) :frowning:
I am still looking to solve it via $:/Import as described above but still unable to handover the information to use xxx.tid.

<$button actions=<<$action-sendmessage $message="tm-perform-import" $param="$:/Import" $autoOpenOnImport="yes"/>> >
import
</$button>

Hi Mario,

the expence is mainly calculated by working time of the editor to manage the content.
We don’t want to have moderated workshops to have the content availabe. The teams needs to be indepentent as much as possible.

tm-perform-import is a command that expects the content to be already loaded from the server to the client. It does not activate any “read from server” action.

Since you wrote, that an xxx.html file could be loaded into TW I do suspect there is a permission problem.

IMO this attempt tm-xxx-import will be “blocked” by the same mechanism that prevents the _canonical_uri from loading a .tid file. I don’t know for sure, but I think the sharepoint server just “blocks the xxx.tid” GET command. I can not test atm, since I don’t have a sharepoint account atm.


I suppose, you do not want to open a browser “load file dialogue”. right?

Hi Mario,
you are 100% right I cannot have a dialog.

I found this discussion : Choose a default directory with the <$browse> widget - Discussion - Talk TW (tiddlywiki.org)

I copied this source to a sandbox Tiddler:

\define rename-import(new-name)
<$action-sendmessage $message="tm-perform-import" $param="$:/Import"/>

<$action-sendmessage $message="tm-rename-tiddler" from={{{[[$:/Import]links[]first[]]}}} to=$new-name$/>

<$action-setfield $tiddler=$new-name$ tags=[[Image]]/>
\end

\define image-block(image-name)
<$navigator>
<$browse />
</$navigator>

<$list filter="[[$:/Import]plugin-type[import]]">
<$button actions=<<rename-import $image-name$>>>
import
</$button>
</$list>

Image name : [[$image-name$]]
{{$image-name$}}
\end

<<image-block "plop">>

If I select my xxx.tid and press the import button than I got (more or less) in the “plop” Tiddler my xxx.tid imported.
Now my question is (sorry I am not a developer for web based content) is :

> What I have to add/remove/change in this code to import xxx.tid without having a dialog before pressing the “Import” button?

Exported in what format? If it is .json, maybe you can serve them using a static server, and fetch them, then pass the json to $tw.wiki.addTiddler. This can be done in a html wiki. And this process can be written as a JS tiddlywiki plugin.

And this reminds me of TiddlyWeb service, that loads user note from a server.

If your company needs consultant, perhaps you can set a contract with What is Jeremy’s business model? ?

And what does

manage the the file by replacing the file.

mean?

Hi linonetwo,

Tiddlywiki, among other wiki solutions, is currently undergoing an evaluation to see if the requirements that are needed are met.
Only when TiddlyWiki proves viable will the company even consider investing in any way.
There are still major hurdles in terms of maintenance and service costs. In particular because the use of many TiddlyWikis is possible.

To answer your question:
If I have a button (or something similar) what is importing the external file “./team_1/xxx.tid” once implemented, than I can change the “xxx.tid” without changing the origin Wiki file.
Why? The Wiki is based in a folder with limited access rights only the editors can make changes. The folder team_1 (and other) can have access rights for different teams. Therfore no additional service is required by the editor.
And, secondally, the Wiki file keeps smallm due to the fact that the, espected huge files from the teams, will be imported only by request.

Stefan

1 Like
  • I have implemented TiddlyWiki for a client in SharePoint and would be happy to assist.
  • I suspect there are other ways to tackle the workflow you are seeking be it manual or partially automated, however I don’t understand the business requirements enough to explore all the possibilities.

I am guessing, based on limited information, but my suspicion is you can leverage existing mechanisms, such as the Import mechanism or drag and drop in including to or from an iframe, but with custom interventions to make it easier for non tiddlywiki enthusiasts.

Continuing the discussion from Import / Delete a Tiddler dynamically:

I made some progress to import a tiddler by pressing a button and also identified the last hurdle to overcome.

This code is working fine, and after the selction and pressing the import button the tiddler will be opened:

<$navigator>
<$browse/>
</$navigator>

<$button>

<$list filter="[[$:/Import]plugin-type[import]]">
<$action-sendmessage $message="tm-perform-import" $param="$:/Import"/>
<$action-navigate $to={{{[[$:/Import]links[]first[]]}}}/>
</$list>

Import
</$button>

I know also that the BrowseWidget is passing the files will in the JavaScript object event.target.files.

Is it possible bypass the dialog and to fill the object event.target.files directly?

Any experiances here?

A short answer;

  • There are limitations to stop security breaches allowing files to be opened or imported without the use of an interactive dialogue.
  • My work around is to store the full path and filename and on click, copy this to the clipboard, then in the open (or save dialogue) ctrl-V to paste the full path and filename then open/save.

I think it will help if you understand that $Navigator didn’t just provide a file selection dialog. After you select the file, $Navigator actually imports the selected file into an intermediate format in the tiddler “$:/Import” (with field “Plugin-type”=“import”) which can be used for import preview. You can verify this by editing the tiddler “$:/Import” after you have selected the file and BEFORE you press your “Import” button.

The tm message “tm-perform-import” didn’t trigger the importing of the selected file, it triggers the conversion of those already imported intermediate tiddlers in “$:/Import” into actual tiddlers.

So the dialog and file importing goes together in $Navigator. It is implemented that way in the underlying js/browser.

Hi https://talk.tiddlywiki.org/u/jacng,

So far understood.
What I don‘t understand is why it is not possible to load a defined tiddler by pressing a button.
Why the user has to perform a dialog and selection process before?

Stefan

It’s because of user awareness. Browser want to make sure, that users are aware what’s going on so they can decide what happens with their data. … The behaviour is primarily controlled by internal browser privacy and security protection mechanisms.

SharePoint has a REST API, that can be used to load files without those dialogues. I think it should be possible to use a _canonical_uri configuration, that would allow us to load .tid files. … But there is still a chance that access to .tid files is blocked on the server level. … Reading and understanding the docs and some experiments will be needed.

At the moment TW uses an internal function that is activated if a _canonical_uri is detected. IMO this function will need to be adjusted to know how to access the SharePoint API.

Hi pmario,

That’s ok for the user awareness. I can live with a button that says “do you really want to load xxx.tid?” . So far as I know the tiddler in the node.js version form tiddlywinks will be loaded also “by request”.

I tried it with the _canonical_uri and it works with html files but not with *.tid files.
The problem here is that the loaded tiddler-file is in a “nutshell”. If I have a link in this tiddler (as html) to the origin wiki it is not working. That means I can use them only if there is no interactions.

I will not give up to look for a solution :smiley:

That’s no option. The browser open-file dialogue is an operating system dialogue, that is activated by the browser. Browsers do not have javascript functions, that will allow us direct access to file-based information.

There is a file API for browser extensions, but they still need user interaction to be triggered. …

I’m not at home atm, so I can not test any SharePoint API functions. As I wrote it needs a bit more studying of the docs and some experiments. … The whole thing is interesting, since you are not the first one, that has to use SharePoint in a “locked down” enterprise environment.

1 Like

@stefan_from_germany just keep in mind that TiddlyWiki Leverages the universal client, the browser, and it is this client that has being targeted for scams and advertising for decades now. If we can find a way to take control of the import or export of content from a website (or tiddlywiki) without the users knowledge, we will have found something the scumbags of the world look for every day.

  • I feel your pain because we are just trying to make it easy for the users of our software.

However rather than trying to take on the very difficult challenge, to change the world, I think you can get an equivalent by other means. As usual it depends on the users, their level of engagement, skills etc… how far you need to go.

But first, I am not sure the premises in your first post are completely valid.

  • Perhaps import them all “to start with” and only show a subset.
  • Provide a mechanism to detect use and hide chapters not accessed

Not withstanding the above,

  • interaction with another source or wiki can be done through an iframe or better yet a plugin library (see below). Drag and drop packages between wikis in the same window.
    • As raised earlier, with an iframe the chapter may never be installed, just viewed.
  • You may be able to generate an innerwiki designed for accessing content choices (needs more research).
  • A plugin library can be used to browse and list, install, or remove chapters packaged as plugins but, you may want to build a custom view of the import plugins from library, to hide the normal plugin and/or import interface and add a delete/remove button (but I still question the necessity).
  • Content, if not too big, can be loaded from data: links, or bookmarklets either in the browser or packaged for other html pages.