]> sipb.mit.edu Git - ikiwiki.git/commitdiff
support for internal-use page types
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 29 Jan 2008 04:08:48 +0000 (23:08 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 29 Jan 2008 04:08:48 +0000 (23:08 -0500)
If a page type starts with an underscore, hide it from the list of page types
in the edit form, and don't allow editing pages of that type. This allows
for plugins to add page types for internal use.

IkiWiki/CGI.pm

index 5de90e1a84782fda2f8c8d093ee00a6d3b9151d7..5062a448f08bc72161ab4757a55ca037566d7a29 100644 (file)
@@ -341,7 +341,7 @@ sub cgi_editpage ($$) { #{{{
        if (exists $pagesources{$page} && $form->field("do") ne "create") {
                $file=$pagesources{$page};
                $type=pagetype($file);
-               if (! defined $type) {
+               if (! defined $type || $type=~/^_/) {
                        error(sprintf(gettext("%s is not an editable page"), $page));
                }
                if (! $form->submitted) {
@@ -470,7 +470,8 @@ sub cgi_editpage ($$) { #{{{
                        
                        my @page_types;
                        if (exists $hooks{htmlize}) {
-                               @page_types=keys %{$hooks{htmlize}};
+                               @page_types=grep { !/^_/ }
+                                       keys %{$hooks{htmlize}};
                        }
                        
                        $form->tmpl_param("page_select", 1);