Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
authorJoey Hess <joey@kitenet.net>
Mon, 3 May 2010 20:03:06 +0000 (16:03 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 3 May 2010 20:03:06 +0000 (16:03 -0400)
IkiWiki/Plugin/skeleton.pm.example
IkiWiki/Plugin/websetup.pm
IkiWiki/Render.pm
debian/changelog
doc/bugs/deletion_warnings.mdwn [new file with mode: 0644]
doc/forum/Can_OpenID_users_be_adminusers__63__.mdwn
doc/plugins/websetup.mdwn
doc/plugins/write.mdwn
doc/setup.mdwn
templates/page.tmpl

index ddf2996d64ace9c2dce9a6f9e6222f041de85e98..a404e24af074ad3be5b75f7b9b2c0cf5e4bf7393 100644 (file)
@@ -24,6 +24,7 @@ sub import {
        hook(type => "format", id => "skeleton", call => \&format);
        hook(type => "pagetemplate", id => "skeleton", call => \&pagetemplate);
        hook(type => "templatefile", id => "skeleton", call => \&templatefile);
+       hook(type => "pageactions", id => "skeleton", call => \&pageactions);
        hook(type => "delete", id => "skeleton", call => \&delete);
        hook(type => "change", id => "skeleton", call => \&change);
        hook(type => "cgi", id => "skeleton", call => \&cgi);
@@ -146,6 +147,14 @@ sub templatefile (@) {
        debug("skeleton plugin running as a templatefile hook");
 }
 
+sub pageactions (@) {
+       my %params=@_;
+       my $page=$params{page};
+
+       debug("skeleton plugin running as a pageactions hook");
+       return ();
+}
+
 sub delete (@) {
        my @files=@_;
 
index d444c0a3d2b67e228737d592d66a04b082876960..4d2e611ebe17af3bbbaaed3b54002df89aaf811d 100644 (file)
@@ -102,7 +102,7 @@ sub showfields ($$$@) {
        }
 
        my $section=defined $plugin
-               ? sprintf(gettext("%s plugin:"), $plugininfo{section}).$plugin
+               ? sprintf(gettext("%s plugin:"), $plugininfo{section})." ".$plugin
                : "main";
        my %enabledfields;
        my $shownfields=0;
@@ -265,6 +265,8 @@ sub showform ($$) {
        my $cgi=shift;
        my $session=shift;
 
+       IkiWiki::needsignin($cgi, $session);
+
        if (! defined $session->param("name") || 
            ! IkiWiki::is_admin($session->param("name"))) {
                error(gettext("you are not logged in as an admin"));
@@ -501,9 +503,10 @@ sub formbuilder_setup (@) {
        my %params=@_;
 
        my $form=$params{form};
-       if ($form->title eq "preferences") {
-               push @{$params{buttons}}, "Wiki Setup";
-               if ($form->submitted && $form->submitted eq "Wiki Setup") {
+       if ($form->title eq "preferences" &&
+           IkiWiki::is_admin($params{session}->param("name"))) {
+               push @{$params{buttons}}, "Setup";
+               if ($form->submitted && $form->submitted eq "Setup") {
                        showform($params{cgi}, $params{session});
                        exit;
                }
index cf6943e7d705c8d4fb3b9fd40f74af5d909c6897..a824ba5396e489714d069148878d5c3ea95a9868 100644 (file)
@@ -112,7 +112,14 @@ sub genpage ($$) {
                }
        }
 
-       if ($actions) {
+       my @actions;
+       run_hooks(pageactions => sub {
+               push @actions, map { { action => $_ } } 
+                       grep { defined } shift->(page => $page);
+       });
+       $template->param(actions => \@actions);
+
+       if ($actions || @actions) {
                $template->param(have_actions => 1);
        }
 
index 789fda1cea207ac3df60fae704303e9008fcb7c6..9fb9607a34d3640a2e6c9035cffb544d9c972f4d 100644 (file)
@@ -6,6 +6,11 @@ ikiwiki (3.20100502) UNRELEASED; urgency=low
   * In html5 mode, use all the nice new semantic tags. Care was taken
     to not change the id/class named used in the CSS, so only CSS
     that refers to tag types needed to be changed.
+  * Add ACTIONS variable to page.tmpl, which allows plugins to add arbitrary
+    links to the action bar without modifying the template further.
+    (COMMENTSLINK and DISCUSSIONLINK could be folded into this, but
+    are kept separate for now to avoid breaking modified templates.)
+  * websetup: Only display Setup button on admins' preferences page. 
 
  -- Joey Hess <joeyh@debian.org>  Sun, 02 May 2010 13:22:50 -0400
 
diff --git a/doc/bugs/deletion_warnings.mdwn b/doc/bugs/deletion_warnings.mdwn
new file mode 100644 (file)
index 0000000..c887937
--- /dev/null
@@ -0,0 +1,86 @@
+Seen while deleting a blog's calendar pages:
+
+--[[Joey]] 
+
+<pre>
+   427250f..ff6c054  master     -> origin/master
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+Use of uninitialized value $file in pattern match (m//) at /usr/share/perl5/IkiWiki.pm line 688.
+Use of uninitialized value $file in substitution (s///) at /usr/share/perl5/IkiWiki.pm line 668.
+Use of uninitialized value $base in exists at /usr/share/perl5/IkiWiki.pm line 692.
+</pre>
+
index 7599e71e5c10ce60a6e3bd8032cb2c69bb95882d..17c60c4239b798f9d6f88483617588446b5e7e34 100644 (file)
@@ -62,7 +62,7 @@ index 0bf100a..77b467a 100644
 
 >>>> So you can see if the two usernames/openids match. If the end is "0",
 >>>> they don't match. If nothing is logged, you have not enabled the websetup plugin.
->>>> If the end if "1" you should see the "Wiki Setup" button, if not the
+>>>> If the end if "1" you should see the "Setup" button, if not the
 >>>> problem is not in determining if you're an admin, but elsewhere..
 >>>> --[[Joey]]
 
index b4d23ba9cfbf85d08dce8a3556ffc45730a29263..a20a3248945780b22b3673c7653a3aa99e58f83b 100644 (file)
@@ -2,7 +2,7 @@
 [[!tag type/web]]
 
 This plugin allows wiki admins to configure the wiki using a web interface,
-rather than editing the setup file directly. A "Wiki Setup" button is added
+rather than editing the setup file directly. A "Setup" button is added
 to the admins' preferences page.
 
 Warning: This plugin rewrites your setup file. Any comments or unusual
index 5e7042c3b5d22c9a90a0c63a02a7d8b1615f81d2..3b1d770ebcd951004866c9cb1002088fa2eb6ab8 100644 (file)
@@ -319,6 +319,15 @@ should return the name of the template file to use (relative to the
 template directory), or undef if it doesn't want to change the default
 ("page.tmpl").
 
+### pageactions
+
+       hook(type => "pageactions", id => "foo", call => \&pageactions);
+
+This hook allows plugins to add arbitrary actions to the action bar on a
+page (next to Edit, RecentChanges, etc). The hook is passed a "page"
+parameter, and can return a list of html fragments to add to the action
+bar.
+
 ### sanitize
 
        hook(type => "sanitize", id => "foo", call => \&sanitize);
index 2d4da553615cc52c71c053e81dd23b8deeafa3a7..3ea0022ccfc18ed09331924f7e9b5a25db25df17 100644 (file)
@@ -89,7 +89,7 @@ These range from changing the wiki's name, to enabling [[plugins]],
 to banning users and locking pages.
 
 If you log in as the admin user you configured earlier, and go to
-your Preferences page, you can click on "Wiki Setup" to customize many
+your Preferences page, you can click on "Setup" to customize many
 wiki settings and plugins.
 
 Some settings cannot be configured on the web, for security reasons or
index 195ce788683d1308586595a9a9efac346d4a6d31..8a9911fae05a20645978734dab37e8c5cbc9dbf5 100644 (file)
 <TMPL_IF NAME="PREFSURL">
 <li><a href="<TMPL_VAR PREFSURL>">Preferences</a></li>
 </TMPL_IF>
+<TMPL_IF NAME="ACTIONS">
+<TMPL_LOOP NAME="ACTIONS">
+<li><TMPL_VAR ACTION></li>
+</TMPL_LOOP>
+</TMPL_IF>
 <TMPL_IF NAME="COMMENTSLINK">
-<li><TMPL_VAR COMMENTSLINK><br /></li>
+<li><TMPL_VAR COMMENTSLINK></li>
 <TMPL_ELSE>
 <TMPL_IF NAME="DISCUSSIONLINK">
-<li><TMPL_VAR DISCUSSIONLINK><br /></li>
+<li><TMPL_VAR DISCUSSIONLINK></li>
 </TMPL_IF>
 </TMPL_IF>
 </ul>