Commit Graph

1071 Commits

Author SHA1 Message Date
Alex Schroeder
ea391981ec Put matching pages into the same form as search.
This works if we later handle a stand-alone match parameter like we handle the search parameter.
We just fake an action.
2014-11-24 22:32:11 +01:00
Alex Schroeder
ad381843ef Search form: fix HTML issues 2014-11-23 21:22:29 +01:00
Alex Schroeder
fc3ecfeec9 Reorganizing the Search Form
Introducing  (0, 1, 2); supporting  (2);
adding .
2014-11-23 19:37:27 +01:00
Alex Schroeder
155b60131f Fixed comment handling.
A simple $comment eq '' resulted in previews if page edits to no
longer work. The correct test is defined $comment and $comment eq ''.
2014-11-11 11:17:29 +01:00
Alex Schroeder
d46ef89b83 Unlock Wiki menu lists locks.
If no locks are set, the menu is not shown.
If the menu is shown, the known locks are listed.
2014-11-11 11:04:58 +01:00
Alex Schroeder
f3f257e775 Simplified handling of $NewComment
A long time ago, $NewComment was the default text for the comment form,
ie. aftertext. That's why the code still had some comparisons of
aftertext with $NewComment. Now that $NewComment is a label in the
comment form and no longer the content of the text area, these tests can
be removed.
2014-11-10 09:48:12 +01:00
Alex Schroeder
fe157be337 Yet another attempt at fixing encoding issues.
To facilitate future debugging, STDERR now also gets the UTF-8 layer.

Apparently CGI does not decode UTF-8 encoded URL parameters. Handle this
case in GetParam.

PageHtml can be called when STDOUT already has the UTF-8 layer. It needs
to be able to handle both cases. That's why we call binmode without any
layers and then we call binmode with the UTF-8 layer again. Now it will
work for RSS files as well.

Unrelated fix: In order to force a decent Etag header even if no index
file exists (and thus $LastUpdate is undef), we use $Now as an
alternative.
2014-11-01 00:52:55 +01:00
Alex Schroeder
a57b14e371 PageHtml no longer uses utf8 layer
binmode adding utf8 layer to STDOUT resulted in double encoded pages
included via PageHtml. On my homepage I was appending the comments to
every page using the following code:

    my $target = $CommentsPrefix . $id;
    my $page = '';
    $page = PageHtml($target) if $IndexHash{$target};
    print $q->div({-class=>'comment'},
                  $q->h2(T('Comments')),
                  $page);
2014-10-31 23:50:28 +01:00
Alex Schroeder
3b61cf585e Caching: Fixed tests.
There is no problem generating an Etag header even if a Last Modified
header is provided.
2014-10-31 23:49:41 +01:00
Alex Schroeder
5fed01ba66 wiki.pl: Fix caching.
Previously, if calling GetHeader with 'nocache', this would get passed
on to GetHttpHeader as $ts. The code would then produce an etag header
with a value of 'nocache'. This is now fixed. A long comment now
explains how it is supposed to work to reduce confusion in the future.
2014-10-31 09:27:27 +01:00
Alex Schroeder
068796ce6d use CGI qw/-utf8/
This option should allow automatic encoding and decoding of
parameters. This saves a few lines and solves an encoding error:
previously, searching for a text containing non-ASCII characters would
result in double-encoded text fields.
2014-10-10 17:15:28 +02:00
Alex Schroeder
c8f606f9dc $q->endform to $q->end_form
When updating to CGI 4.06, it turns out that $q->endform
is no longer defined.
2014-10-10 16:43:01 +02:00
Alex Schroeder
5e6616d38a UserCanEditOrDie text preferred
It turns out that one of the tests in lock.t relied on the exact wording
of the error message. I decided to use the same wording for all
instances: "Editing not allowed: %s is read-only" and no longer using
"Editing not allowed for %s".
2014-09-12 15:30:20 +02:00
Alex Schroeder
95fb328010 New convenience function UserCanEditOrDie
Closes bug #41625 "ban-quick-editors.pl can hide the error message".
DoPost now uses the same code as DoEdit and thus it will display the
error message, which solves the issue for ban-quick-editors.pl. Added a
test to demonstrate it.
2014-09-12 15:20:06 +02:00
Alex Schroeder
087067ac52 We have chosen a wrong way to compare $text with $id. It should be better now.
This also fixes recent test added to creole.t
2014-09-11 16:47:18 +03:00
Alex Schroeder
d795f6543d Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2014-09-10 22:59:36 +02:00
Alex Schroeder
83ceb48246 Avoid Save button for comments after rollback
If you clicked on the Save button after rolling pack a comment page, the
content of the comment page would be deleted.
2014-09-10 22:56:54 +02:00
Alex Schroeder
e580d247c1 Fixed free links to nonexisting pages (now [[foo bar]] results in [[foo_bar?]] instead of [[foo_bar?|foo bar]]) 2014-09-03 15:25:13 +03:00
Alex Schroeder
4663488166 Makefile: more fixing for prepare target
The prepare target didn't handle wiki.pl itself correctly. This has been
fixed. The command to add the git tag was changed from sed to perl, like
for the other targets. As emoji.pl and smiles.pl refer to permanent
anchors, the addition of the anchor parameter to AddModuleDescription
was obviously misguided and I reverted it.
2014-08-24 22:20:50 +02:00
Alex Schroeder
939ebc336d Handle AddModuleDescription for translations
The Makefile didn't add tag information for translation files when
running 'make prepare'. This has been fixed. As we cannot have a slash
in the file name, as slashes get escaped in UrlEncode, a new parameter
was added to AddModuleDescription and the Makefile will now set this
parameter for translation files such that the source link will point to
the correct directory ("translations/").
2014-08-24 21:25:38 +02:00
Alex Schroeder
e3591b9e86 Fix module description to handle version tag.
This makes sure that "make prepare" works once again by allowing an
optional argument to AddModuleDescription with the tag.
AddModuleDescription now also takes an optional anchor which is used by
emoji.pl and smiles.pl.

This commit also updates all the translation files and makes sure that
they all use AddModuleDescription.
2014-08-24 12:31:15 +02:00
Alex Schroeder
025d174047 diff3 output decoded as UTF-8
Without this decoding, calling diff3 leads to UTF-8 corruption.
2014-08-24 09:01:58 +02:00
Alex Schroeder
1fd81f0aef Get rid of "Updates in the last 1 day"
If it's one day, write "Updates in the last day" instead.
2014-08-24 08:46:03 +02:00
Alex Schroeder
ebcf178095 Merge branch 'ad/module-description' 2014-08-22 09:09:03 +02:00
Alex Schroeder
09aa40ae18 AddModuleDescription uses FreeToNormal
This makes sure that links to pages with spaces in their names have
spaces translated to underscores.
2014-08-21 22:22:10 +02:00
Alex Schroeder
0b9ff539e1 Fix Recent Changes pagination
The commit "RcHtml: fix generating More... links" introduced a bug. The
first page after clicking a More... link was the default page again. The
computation of the new FROM parameter wasn't working when neither UPTO
nor DAYS was set (as is the case when you look at the default Recent
Changes). A simple defaulting to $RcDefault did the trick.
2014-08-21 07:53:55 +02:00
Alex Schroeder
cc67b7e830 AddModuleDescription: allow modules without wiki pages 2014-08-21 05:44:00 +03:00
Alex Schroeder
04cdc08ee3 AddModuleDescripton() 2014-08-21 04:35:53 +03:00
Alex Schroeder
498d43b1ed Help users unlock a wiki.
When a lock is blocking the user, offer them a way to unlock the wiki.

Also, update the German translations.
2014-08-21 01:08:25 +02:00
Alex Schroeder
1b7da21542 Fix removal of newline warning 2014-08-20 17:08:12 +02:00
Alex Schroeder
2ff3c7638a Use -- to delimit args from filenames.
This applies to the calls of diff and diff3. -- is required to
indicate the end of command line arguments, so that filenames that
start with dashes will not cause any trouble. Of course, since no one
will ever set his $TempDir to something like that, it is not critical.
2014-08-20 17:07:58 +02:00
Alex Schroeder
a0eca49688 Fix edit link for the homepage.
The universal edit button link in the HTML header did not work when
looking at the home page if the home page did not appear in the URL.
2014-08-15 09:38:32 +02:00
Alex Schroeder
69d70d818b Refactor: Some code extracted from GetHeader
The code was moved into the new subroutine GetHeaderTitle.
2014-08-13 15:55:23 +02:00
Alex Schroeder
00910c7e84 GetFooterLinks avoids useless link. 2014-08-06 12:25:54 +02:00
Alex Schroeder
de3e7a8ed3 Allow mixed mode lists.
OpenHtmlEnvironment now accepts fourth parameter that defines similar
tags.

creole.pl now passes 'ol|ul' as fourth parameter to OpenHtmlEnvironment.

In addition to that, the creole.pl code was refactored a little bit to
remove copy-pasted part.
2014-08-05 22:59:17 +02:00
Alex Schroeder
c526d5aa6f RcHtml: fix generating More... links
When using days for RecentChanges, the More... links after the first
one reverted to $RcDefault instead of keeping the same time period.
This is now fixed.
2014-08-03 01:01:42 +02:00
Alex Schroeder
22009e6b4b Search & Replace: use → instead of -> 2014-07-28 11:35:36 +02:00
Alex Schroeder
61d2bc7ff8 Code style and refactoring. 2014-07-21 20:48:47 +02:00
Alex Schroeder
4cc690e7d6 Code style.
Simplify A ? A : B to A || B.
2014-07-18 14:11:08 +02:00
Alex Schroeder
5d54c524b0 Code style and refactoring 2014-07-18 13:15:29 +02:00
Alex Schroeder
16c628da4e RSS 3.0 doesn't need HTML quoted. 2014-07-16 10:44:13 +02:00
Alex Schroeder
77dc34059a Don't store host names.
Get rid of the option $UseLookup. Remove GetRemoteHost and rename
GetRemoteAddress to GetRemoteHost. Thus, it now returns IP number only.
2014-07-11 19:09:33 +02:00
Alex Schroeder
c90faef9e4 Refactoring 2014-07-10 15:04:47 +02:00
Alex Schroeder
316dffbd5d Additional features for journal syntax.
If you set 0 as the number of entries for More... pages, the More...
button will be disabled completely (e.g. <journal 3,0> to show only 3
entries without giving a link to other pages).

You can specify initial offset by using journal:OFFSET (e.g. <journal:3
5 "News_\d+"> will skip first three news pages).

The :OFFSET syntax might be confusing, but it is quite easy to remember:
in bash ${arr:3:5} will get five elements of array arr starting with the
third index (fourth element, thus the offset is 3). Therefore, to make
it even more confusing, it is now possible to write previous example as
<journal:3:5 "News_\d+">.

Now you can use <titles> to get links without displaying the contents.
It accepts exactly the same arguments as <journal>. For example
<titles:3 5 "News_\d+">.
2014-07-03 12:58:48 +02:00
Alex Schroeder
72a5e130f5 GetParam: only call utf8::decode on defined values
In some recent versions of Perl such as v5.18.0, when $foo is undef,
utf8::decode($foo) modifies $foo to '' (defined null string). This
causes problems. When the Preview button is clicked, for example, a
nomal page is shown instead of the preview, because of this. Thus, we
need to avoid calling utf8::decode on undefined value.
2014-07-01 09:33:17 +02:00
Alex Schroeder
5649d20722 pageidx file now no longer contains all those ones
Previously, the pageidx file contained the serialized hash. If we had
two pages A and B, it contained A 1 B 1. When you install this version,
your wiki will report extra pages of "1" until you delete your pageidx
file, or until you create a new page (which will delete your pageidx
file).
2014-06-22 23:28:56 +02:00
Alex Schroeder
7cc80996f3 Raw RSS adds "minor: 1" for minor changes
If you looked at an URL like the following, you wouldn't know which
items referred to minor changes and which didn't. They all looked the
same.
http://localhost/cgi-bin/wiki.pl?action=rc;showedit=1;raw=1

This change adds "minor: 1" to items caused by minor changes, and
oddmuse-curl.el (the Oddmuse Mode for Emacs), handles this.
2014-06-22 23:14:55 +02:00
Alex Schroeder
3ec36d54fa Merge branch 'as/no-more-page-subdirectories' 2014-06-21 21:30:27 +02:00
Alex Schroeder
f9d15783d2 Fix two issues with $NewComment.
Display $NewComment above comment textarea.

'c' is now an access key to focus comment textarea.
2014-06-16 11:06:20 +02:00
Alex Schroeder
52fe7e998a Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse into as/no-more-page-subdirectories 2014-06-16 10:32:31 +02:00