Is there a way to get a permanent link (permalink) to the current version of a DokuWiki page? - wiki

Is there a way to generate a permanent link to the current version of a page? I can get a link to previous versions (for example https://www.dokuwiki.org/faq:support?rev=1354115567) by clicking Old Revisions.

Using ?rev=0 in the URL will always take you to the current revision at the time. Maybe a null-edit would help (the content doesn't change and you may get a edit history entry).
Now, if you have actual access to the fileserver where your DW is hosted, you can fetch the id of the most recent revision (the at-the-moment-current-one) by first checking the id of the latest edit in Old Revisions, then going to the ${DOKUWIKI}/data/attic directory and checking the numbers that correspond to the pagename that you want. There will be one file with a more recent id (a higher numeric value) which, if I'm not mistaken, corresponds to the current revision. For example, for a last edit of mypage.1263571254.txt.gz you might find one higher index of, say, mypage.1291408231.txt.gz.
EDIT: the same value does show somewhere in the rendered page's source. If you have section editing enabled and the buttons do show up in the page, search the source (CTRL+U on most browsers) for form class="button btn_secedit", then continue reading until you read an input element with name="rev" and a value= that should correspond to the number of the current revision.
Using that found id as the argument of ?rev= should reveal if it is the correct one and as a result get you the permalink to this revision.
Note: I have not tried this in my own install.

Related

How to Make Relative Href Work in SvelteKit?

I want to build a Web app with SvelteKit with one page listing all items (with potential search query parameters), and then one page for each individual item. If I had to build this the old school way with everything generated in the backend, my paths would be /items/ for a the listing of items, and /items/123 for item 123, etc. That is, to go to the page of item 123, a link will with href="123" will work no matter if you are currently at the index (/items/) or at the page of one particuler item (/items/[id]).
With SvelteKit, if I create files routes/items/index.svelte and routes/items/[id].svelte, then routes/items/index.svelte will have path /items, without a trailing slash, and as a result a link with href="123" will lead to /123, resulting in a "not found" error.
This same link will work however from the page of an individual item, say, /items/456.
This is radically different from what you would have in the traditional HTML model, where a link from /items/ (or /items/index.html) would work the same as a link from /items/[id].html.
Now in svelte.config.js there is a trailingSlash option you can set to always so that routes/items/index.svelte corresponds to path /items/, but then routes/items/[id].svelte has path /items/[id]/ and we have the same problem again: one href value cannot work from both the index and the page of an individual item.
The only way I see right now is to use absolute path, but it's not very composable. My guess is that there is something I am doing wrong.
You're not missing anything - it's not currently possible in SvelteKit to have a trailing slash for some pages but not for others. There is an open GitHub issue you may be interested in that proposes adding additional trailingSlash options. This issue cites the exact problem you described:
The trailingSlash options introduced in #1404 don't make it straightforward to add trailing slashes to index pages but not to leaf pages. For example you might want to have /blog/ and /blog/some-post rather than /blog and /blog-some-post, since that allows the index page to contain relative links.
Until that feature is added, you'll need to use absolute paths.

Drupal 8 Webform: how to display text input on one page on the next page?

I am trying to develop a multistep webform in Drupal 8 using Webform 8.x-5.1. I have written a WebformHandler that extends Drupal\webform\Plugin\WebformHandlerBase and made it available to the webform.
In the first step of the webform, I collect a text-field. I would like to display the value of that text-field in an HTML element (Advanced HTML/Text or Basic HTML) on the second page after doing some computation.
I have overwritten submitForm() in the WebformHandler and in it assign the value I want to the HTML element as follows:
$form['elements']['page_name']
['advanced_html_element']['#text'] = '...my HTML...';
Using ksm() I can see that this assignment works, but the the HTML element is not rendered with my HTML: the element is either invisible or contains the initial value set up in the form editor.
Clearly I'm missing something. Should I be using something other than submitForm? Can anyone help me?
It's been a long haul, but I've finally worked out how to do what I want to. The following works for me.
Firstly, I discovered the method validateForm in WebformHandlerBase. On each page in a form with multiple pages, you will find that the following methods are called in the order given here:
submitForm (called once)
alterForm(called possibly more than once)
validateForm (called once)
The name validateForm leads me to believe I may be misusing this method, but that is where I set up the elements on the following page that I wish to programmatically initialise. It works, so what the hey!
In validateForm, I initialise the elements that appear on the following page as follows:
$form_state->setValue(<element name>, <data structure>);
The <element name> is the name you give the element in the form editor ("Build" tab). The <data structure> has to be correct, of course: I suggest you find the appropriate structure by first filling in the element on the next page manually and seeing what turns up in $form_state.
There is also a $form_state->getValue(<element name>), which seems to me to mean that $form_state can also be used for storing session data, say in hidden fields. I initially used Drupal::service('tempstore.private')->get('xxx') for storing data that had to be available across page boundaries, but $form_state might be a cleaner solution.
I hope this helps someone: I spent a horribly long time trying to get this to work.

Getting crash when trying to set General Link value on sitecore

I am working on a template that have a General Link field, when I am trying to set the Insert link on Sitecore Content Editor I am getting below crash:
I am working on Sitecore 8.0 (rev.150121)
Even though the other General link options is working fine:
Insert media link
Insert external link
Insert anchor
Insert email
Insert JavaScript
I added a new field to the same template as a general link filed as well and it is working fine even for the Insert link option.
when I view the Raw value for the item I found that the link had a default value set to "" when I removed it and save all is working fine, the other testing link that I added do not have this default value, and the field on the template itself do not have such value or any default value.
This is a duplication of the question found on the Sitecore StackExchange here. Just to avoid any open question, here is the answer as provided in the same question:
The issue you reported was fixed in Sitecore Experience Platform 8.0 rev. 150621 (8.0 Update-4) and you can upgrade your solution to address the problem.
Please take a look at the reference number 416281 in Sitecore CMS release notes on for additional details on the fix: https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/8%200/Sitecore%20Experience%20Platform%2080%20Update4/Release%20notes
If upgrade is not an option for you, we suggest you implement the following workaround to resolve the issue on your current solution:
Place the attached Sitecore.Support.416281 assembly to the \bin folder of your solution;
Open /sitecore/system/Field types/Link Types/General Link item in the Core database;
Clean up its Control field;
Put Sitecore.Support.416281 in the Assembly field and Sitecore.Support.Link in the Class field;
Save changes.
Please download the assembly : https://www.dropbox.com/s/hl7ho6wmnca8u2y/Sitecore.Support.416281.dll?dl=0

What would be the SQL script to generate Sitecore Broken Link Report

I'm helping our Editors to clean up broken links and have been looking for answers to the following:
The Broken Link Report cannot be exported or sorted so it's not very useful (we have many broken links ~2000). Is there a SQL script that I can run to create the same report?
If an Editor fix a link, Rerun the report doesn't seem to take the item off the report. Does she have to Rebuild Link Database every time?
The Links button in the menu is helpful, but it is listing All Versions of referrers. Is there a SQL script to find only the lastest version?
When delete or archive an item and let Sitecore remove broke links, will all the affected items be published?
We are dealing with a large report (~2000 items) due to not maintaining it diligently. The goal is to reduce the number to 100~200 and keep it under control from now on. Any general advice on how to clean up broken links report is appreciated.
For your first (and partly third) questions:
In the Core database you can check what gets executed on the click of the Broken Link Report (the item that defines it is located in : /sitecore/content/Documents and settings/All users/Start menu/Right/Reporting Tools/Scan for Broken Links.
The application that gets started is /Applications/Tools/Broken Links.aspx, so if we look at *webroot*/sitecore/shell/Applications/Tools/Broken Links/Broken links.xml, we can see that the code used for it is Sitecore.Shell.Applications.Tools.BrokenLinks.BrokenLinksForm in the Sitecore.Client assembly.
Using Reflector you can see what it's executing. For your requirements, what I would say would be the easiest is to create your own version of the BrokenLinksForm, possibly simply adding an export functionality on it, or modify the code so it only takes the latest version. From looking at it very quickly I think the code to change (which is actually in the nested Scanner class) is:
...
foreach (ItemLink link in Globals.LinkDatabase.GetBrokenLinks(database))
{
list.Add(link);
}
...
You could possibly check whether the link item is the latest version, possibly by using something like
...
var version = link.GetSourceItem();
if (version.Versions.GetLatestVersion().Version == link.SourceItemVersion)
{
list.Add(link);
}
...
While you're at it you could of course also put in some sorting functionality :-)
It doesn't translate 1-on-1 with the Links button in the menu, but it should give you some pointers in the right direction.
As to your 2nd question: I believe that yes, the Link database does need to be rebuilt. I don't know if Sitecore has a schedule set up by default, but you could create your own agent in the <scheduling> node in the web.config to do this after X time.
Your last question: If you delete or archive an item and have Sitecore remove the broken links the affected items will, by default, not be published. If you have an auto-publish set up it'll show up of course.

Umbraco error in Document Types

A long time ago I first setup a website in Umbraco. This seemed to be working fine.
I have now come back to it about a year later, and was initially getting the following error when selecting a Document Type (any document type in the Settings tab):
A bit weird, because earlier I didn't have this issue, but fine. I do what it says, and add <identity impersonate="true"/> to the <system.web> node in web.config.
While it does fix the initial issue, I now have the following on all document types:
When trying to create a new Document Type, I get the same kind of error, but then the ReturnUrl part is ReturnUrl=/umbraco/create.aspx?nodeId=init&nodeType=inittemplates&nodeName=Templates&rnd=20.2&rndo=21.2&nodeId=init&nodeType=inittemplates&nodeName=Templates&rnd=20.2&rndo=21.2' - but only if I tick the box 'Create template for this item'. The same happens when I try and create a Template.
After Googleing I came up with this: our.umbraco post with similar issue. One (unconfirmed) solution is that there's an illegal name in a document type/ template - but I haven't changed anything, and might be fixed by going into the database.
I did check the /masterpages folder, the only 'strange' characters in there are - and _.
In my Document Types I have on named 'Textpage (Two col)' and another named 'News & Events list'. I'm a bit hesitant to just delete them, since I don't have enough Umbraco knoledge to be sure this will fix my issue...
Is there any known solution for this, or will I also have to go into the database (and if so, whereabouts?)
I'm running Umbraco 4.7.2, assembly version 1.0.4500.21031.
I've hosted this site with GoDaddy.com - I don't know if that would be relevant.
[Update 1]
As per Tom Maton's comment:
The requirepermissions should be set to false, and have been.
in Appsettings I've set this:
<add key="umbracoUseMediumTrust" value="true" />
And I've added Trusted_Connection=yes to the connectionstring.
the problem remains.
[Update 2]
Tried the solution amelvin provided, but no dice. Doctypes and templates still give the error. I'm getting more certain it's some security issues. Which folder would correspond to the Templates? Would that be the masterpages folder? If so, what kind of permissions does that one need?
It could be that you don't have full trust on your Go Daddy environment?
Check this post out http://our.umbraco.org/forum/getting-started/installing-umbraco/17856-Umbraco-on-GoDaddy-Shared-Hosting
Could help resolve your issue.
The error could be a knock on from permissions errors as yet unsolved.
But the error is thrown if the content page does not have a template assigned or if Umbraco thinks it doesn't have a template. If absolutely nothing has changed to the site then it could be that the umbraco.config file has somehow got corrupted (it will contain all the doctype/template cross reference info). This can be fixed by right clicking on the top 'content' node and choose 'republish entire website'.
Secondly navigate to the settings | document types (if you can now) and check the templates dropdown on the first tab of the appropriate document type. If its set to 'please select' then this error will get thrown when any page tries to render without a valid template assigned. If a default template is assigned - then go to that template and re-publish it - Umbraco may have lost it.
If this does not work then check if the template is assigned properly. Go to the same place in the content tree as the problem page and try to add a node with the desired doctype. If no choices are offered then it could be that the parent tab no longer allows the correct doctypes as children nodes, so go back to the doctypes and check the allowed children (second tab) of the parent node.
If none of this works without odd errors being thrown then its a mystery!
Here are a list of Permissions required for Umbraco http://our.umbraco.org/wiki/reference/files-and-folders/permissions
Or you could use one of the steps below to check all the folder permissions.
http://our.umbraco.org/wiki/reference/files-and-folders/permissions/perform-permissions-check
Or install this package. http://our.umbraco.org/projects/backoffice-extensions/ugolive this will allow you to check the permissions are correctly setup.