Closed simon-r-white closed 9 years ago
Your first question requires some thinking, but I'm sure there's a way that only requires a few simple things to get the "relative to now" thing working. I will write up a proof of concept tomorrow, and explain why it works.
To answer your question in the entry title
field. The links to other data are given captions based on dokuwiki's own useheading setting. I'm guessing your wiki uses the 'Never' setting, so all links show their name as the page ID. Strata respects this setting, so if you change it to 'content' or higher, you'll automatically see nicer links using the entry title field as the caption.
Furthermore, the entry title field is automatically filled based on the title of the page the datablock is on (or the fragment that is used to identify the data block). For example:
<data TODO>
</data>
Would be enough to give the page an entry title. The entry title would then be equal to the page's title as dokuwiki sees it -- which is the first header on the page. You can override this behaviour by giving an entry title yourself, the entry title you give will be used for the block.
The query building is really low-level, and should not really be touched. Unless you want to add either new comparison operators, or to change the semantics of the query language itself, there should be another way get what you want.
For most value-related things, such as the relative times, the only change needed is the implementation of a type. The idea behind types in Strata is that they form a kind of layer around the low-level querying mechanism. The types are used for normalisation of user input (when a string in the query or data entry goes into the database), and for the display of values (when a string comes from a query and goes to the browser).
Your idea of 'TODAY+7days' is a good example of a string of user input. A type can easily handle that by normalizing it to the internal time format (which you correctly found is the unix timestamp).
As a proof of concept, I have written a relativedate
type that allows you to do both the comparison you are looking for, and to also display times relative to the current time (like "in 3 days", "in 4 hours", "2 hours ago", etc.). Because I realised that people leave open their browser tabs a lot, I've also made sure that the displayed time difference updates through a short piece of javascript...
You can find this type in the dokuwiki-plugin-stratatimetypes plugin. The readme over there should get you going.
Let me know if that helps! And if it does, feel free to close this issue.
That's brilliant. Many thanks for doing that so quickly.
I can honestly say that with your strata plugin, dokuwiki is the best thing ever... I'm now using it to organise everything I do at work.
Again, thank you very much.
(Also, thanks for the answer on the useheadings setting... didn't realise strata obeyed that setting).
I'm using the strata plugin as a sort of to-do list manager, adding a TODO class entry on pages and then generating a table on the front page.
Part of my data structure includes Creation and Deadline times.
It would be nice to be able to compare these with the current time, and say one week ahead, to highlight impending tasks/meetings/deadlines
I've extended strata with a new type, which I've called datetime:
So an example entry looks like:
It would be nice to have a table of the form:
I'd love to be able to extend strata myself... but I don't really follow the - what seems complex to me - code that handles all the clever query building part; which is where I'd imagine this needs to be included.
An approach would be to include some sort of replacement-key, that gets converted to the right date format, then compared to the stored Unix-epoch representation of the date(time) type.
strtotime()
should be able to construct these times with offsets.(As a complete aside... in my entries I've got the entry title field... which is a nice human readable label for the to-do item. Can someone tell me how to replace the
?todo "Link"
column with links but the text being the nice entry title. I didn't really follow how the entry title field is used, grep-ing the source code was not much help to me).