Not logged in. · Lost password · Register

All posts by Carsten (12)

topic: extra slash in opening <button> tag  in the forum: Community dokuwiki.org
Avatar
Carsten #1
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
Gee, thanks!   :-)

Quote by SFITCS:
Anyone can modify those pages so the edit buttons are always visible

Ah, sorry. I only noticed that the problem was with the Edit buttons, and didn't really bother to check login vs. logout (and my DokuWiki instance is differently configured ;-) ).
topic: extra slash in opening <button> tag  in the forum: Community dokuwiki.org
Avatar
Carsten #2
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 51156
Hi,
I cannot see the attachment that you're referring to, but as the code that I mentioned is about the Edit buttons, which are only rendered when the user is logged in, it seems quite obvious that this problem cannot be seen when not logged in.  :-)

Best regards,
Carsten
topic: extra slash in opening <button> tag  in the forum: Community dokuwiki.org
Avatar
Carsten #3
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
Subject: extra slash in opening <button> tag
Hi all,

being logged in at https://www.dokuwiki.org, looking at e.g. https://www.dokuwiki.org/features, the Edit buttons seem to have an extra slash at the end of the opening <button> tags, e.g.

<button type="submit" title="DokuWiki Features" />Edit</button>

A (known) bug?

Best regards,
Carsten
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #4
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36747
Quote by turnermm:
I have Notepad++ set for 4 spaces=1 tab, but when it loses its settings, it doesn't tell me, and I end of up with both spaces and tabs.

I've not checked, but I think Git can be setup to help with it: http://stackoverflow.com/questions/3372822/git-trim-whites…

What's most important is that I don't get commits in which a great  many alterations are shown because of a change in spacing.

If you're concerned about the output of git diff, it has several options to ignore such changes in spacing.

E.g. I used them to make sure that I didn't accidentally change something other than whitespace in the second patch.  ;-)
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #5
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36745
Need a second post for the second patch. Somehow this forum system doesn't handle file attachments well...
The author has attached one file to this post:
0002-Remove-trailing-whitespace.patch.txt 72.9 kBytes
You have no permission to open this file.
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #6
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36736
Hi,

Quote by turnermm:
I would very much appreciate the UTF-8 and BOM patches.  Notepad++ loses its settings every once in a while and without realizing it, I've occasionally inserted BOM's, which can cause php parsing errors.

I attach two patches against latest "download" branch (commit 338a36a): One removes UTF-8 BOM, one trailing whitespace.

If you apply them with git am < patchname.patch.txt command, things should work well. (Copy and paste probably won't, due to the delicate UTF-8 encoding in the BOM-related patch and pure whitespace in the second -- I have to admit though, that until now, I've never used git am myself.  ;-) )

Btw., I use the excellent UltraEdit text editor (unfortunately and accidentally, one of its very few weaknesses is handling encodings and conversions among encodings).


I'm working on a new branch which posts a link to the currently saved ebook:
https://github.com/turnermm/epub/commits/download

 Great! Looking forward to it!   :-)  


Btw., what about indentation rules?
I see that sometimes four spaces are used, sometimes TAB characters, sometimes a different number of spaces, and sometime mixes of spaces and TABs... care to reconcile them?
(Personally, I prefer four spaces for indentation, and never use TABs at all.)
The author has attached one file to this post:
0001-Remove-UTF-8-BOMs.patch.txt 2.1 kBytes
You have no permission to open this file.
This post was edited 2 times, last on 2013-01-25, 22:55 by Carsten.
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #7
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36727
Quote by turnermm:
$user= cleanID(rawurldecode($_POST['client'])) . '/';

Thanks, that works!
I attach the final patch that I used, could you please apply it to your repository?  :-D
(Sorry for the .txt extension to the patch, but without it, the forum rejects it as invalid attachment.)

Btw., would you be interested in some additional patches fixing white-space issues? e.g. remove trailing white-space, remove UTF-8 BOMs, Tab vs. Space indentation, etc.?
The author has attached one file to this post:
0001-Fix-handling-of-usernames-with-upper-case-letters.patch.txt 1,145 Bytes
You have no permission to open this file.
This post was edited on 2013-01-25, 10:24 by Carsten.
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #8
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36724
Quote by turnermm:
I hadn't fully understood where the problem was.

The patch was just of cosmetic nature, to fix the output of echo, where the username was still upper-case.
Of course, both your alternatives achieve the same.  :-)

The real problem however is that the plugin somewhere creates the directory media/epub/Carsten with upper-case username, and I've not yet found where or why this occurs.
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #9
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36719
Quote by turnermm:
https://github.com/turnermm/epub/archive/master.zip.

Let me know if that fixes your path problem.

Thanks! Unfortunately, the epub plugin somewhere else still creates the directory media/epub/Carsten (upper-case C), and as a consequence, the call to rename() following the changes that you made complains (correctly) that the target directory (lower-case c) does not exist. (Thus, the rename fails and no download link to the epub appears.)
I had a look if I found the place where the upper-case directory is created, but couldn't find it.

Btw., what do you think of this patch?

diff --git a/scripts/epub_utils.php b/scripts/epub_utils.php
index 2fb966e..b8f0d5a 100644
--- a/scripts/epub_utils.php
+++ b/scripts/epub_utils.php
@@ -431,8 +431,7 @@ NAVPOINT;
                        $newname = mediaFN("epub:$user:$epub_file");

                        if(rename ($oldname , $newname )) {
-                          if($user) $user= str_replace('/',':',$user);
-                          echo "New Ebook: epub:" . $user . "$epub_file\n" ;
+                          echo "New Ebook: " . $newname;
                        }
                }

------

As for page locking, that wouldn't solve the problem of collisions, because a second book with the same timestamp would overwrite the first once the lock was released--however unlikely.

Ah, but why don't you "tie" the book of definition page epub:mybook to that very name?
Just like the page itself is tied and locked with the name, why not also the epub?
In a sense, the epub would be a part or an "extension" of the normal DokuWiki page.

There are also ACL reasons for keeping the books in the user's namespace.  There could be sites where not all books are meant to be readable by all comers and a namespace can then be easily marked as such.

Wouldn't it be possible to achieve the same with (sub-)namespaces?
Or, if it was possible to turn any page, no matter the namespace, into a book definition page using the <epub...>...</epub>
syntax, (if I understand things correctly) full flexibility regarding the access rights would be possible, but without being required to tie books to usernames (and thus maybe allowing them to be locked with the page, as suggested above)?

The rest of what you ask will take some thinking about.  Your final suggestion about re-building on the fly is not really practical, too much book-keeping required.    As for the download button idea, I'm not sure why this isn't just as easily done by the ebook author, which is what I've done on the fckgLite web site.  But I have to confess that when I am working on the plugin or creating new ebooks, I find it inconvenient that when I move off the page which has created the ebook that the link disappears, which is what happens when I  use the EPUBReader in Firefox.
So that bears some thinking about.

Thanks, this is very much appreciated!

The author could provide of course a download link himself, but he had to manually take action (rebuild the book, update the link for others) whenever a content page that contributes to the book has changed. So I was looking for a way to automatically have the book updated, by one of the means suggested in my former post: at page save time, after more than 24 hours old, etc.
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #10
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36707
Thanks to you both for your replies!

In fact I use my own auth plugin (https://www.dokuwiki.org/auth:cafu_phpbb3) which does no cleaning of the username at all: I was not aware of any cleaning requirements when I wrote the plugin. In fact, it seems to me like upper-case letters in usernames (as opposed to IDs) are possible and allowed in DokuWiki?

As I did not create the .../wiki/data/media/epub/Carsten directory myself, I guess that the epub plugin took the upper-case username from the auth plugin, and used it to create the directory .../wiki/data/media/epub/Carsten

So I believe that Michitux is right, in that the epub plugin should call cleanID().   :-D  ;-)


Myron, I understand how using the username as a component in the path helps with reducing collisions, but I was wondering if the normal page locking of DokuWiki could be used for this purpose instead?

Please let me explain this:
Recently I was asked by a user of my DokuWiki instance if there was an offline edition of the Wiki contents for download.
Of course there wasn't, and so I searched and eventually found your epub plugin, which I value very much.
When I read the plugin Intro page, I understood how I can define a book via a book definition page in the epub namespace, and that ACL rights are co-used to control who can trigger the actual built of a book.

But honestly, the fact that every user is allowed to create every book at every time seems very confusing to me.
Please don't get me wrong, this is not meant as criticism (in fact I'm very grateful for the effort you've invested into the plugin!), but what I would have "expected" the plugin to do is something much simpler:

When the epub:mybook definition page is saved (requiring as usual the proper ACL rights), show as a result on the rendered page a simple "Download" button. Any user who has read access to that page would be able to click the "Download" button and be provided with the generated epub file.

Of course, the "Download" button would not re-generate the .epub file from scratch every time it is clicked, but return a pre-made copy (this is what the "Start" button currently does). The cached copy could automatically be created (only) when the epub:mybook definition page is saved, co-using the regular DokuWiki page lock for its purposes. (This would get rid of the needs for collision prevention through timestamps or hashes in the filename.)

Alternatively, more comfortably but also more complicated, the cached copy could automatically be re-made whenever the epub:mybook definition page has changed, or any of the referenced content pages has changed. I don't know if such re-generations could re-use the DokuWiki page lock as well, as we're not at "Save page" time in this case. (At least not of the epub:mybook definition page, but of a (possibly) referenced content page...)

In summary, with either of these methods, users would only ever see a "Download" button that always and automatically returns (the latest edition of) the book.

What do you think?  ;-)
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #11
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
In reply to post ID 36689
An update:
In lib/exe/fetch.php, I modified function checkFileStatus() to output $file if not found.

It turns out that $file is
.../wiki/data/media/epub/carsten/2013_january_23_09-17-01.epub

Note the lower-case "c" in "Carsten", when the directory name on disk is with a upper-case "C".

It seems to be DokuWiki itself, not the plugin, that converts the upper-case name from the URL (media=epub:Carsten:...) into lower-case.
Or maybe the plugin should have converted the name to lower-case when creating the directory?


To be honest, I wonder why the username is involved at all:
I very much like the idea to define a book on a Wiki page like epub:mybookXY, but wouldn't it be enough to create the related book at media/epub/mybookXY-[timestamp].epub, and let the normal DokuWiki ACL handle everything else (via the access rights to the epub namespace)?
topic: epub: Cannot download generated epub file  in the forum: General Help and Support Plugins
Avatar
Carsten #12
Member since Feb 2011 · 12 posts · Location: Germany
Group memberships: Members
Show profile · Link to this post
Subject: epub: Cannot download generated epub file
Hi all,

I just installed the epub Plugin and created my first book definition.

Creating the book seems to work just fine: After clicking the Start button a window with the details appears, and a link to the generated epub file. The file is also physically present in the webspace; the generated link is, for example:

http://www.cafu.de/wiki//lib/exe/fetch.…?media=epub:Cars…

When I click this link however, "Not Found" appears, and the file doesn't downloard.

I've not been able to determine the cause of this problem: I have upload rights to the epub namespace, the file is on disk, and nothing else seems to look wrong. What can I do?
Close Smaller – Larger + Reply to this post:
Special characters:
Special queries
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-08-22, 02:35:54 (UTC +02:00)