]> sipb.mit.edu Git - ikiwiki.git/commitdiff
use cgitemplate, remove misctemplate
authorJoey Hess <joey@kitenet.net>
Wed, 5 Jan 2011 21:15:38 +0000 (17:15 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 5 Jan 2011 21:15:38 +0000 (17:15 -0400)
IkiWiki.pm
IkiWiki/Plugin/comments.pm
IkiWiki/Plugin/getsource.pm
IkiWiki/Plugin/goto.pm
IkiWiki/Plugin/openid.pm
IkiWiki/Plugin/search.pm
IkiWiki/Plugin/websetup.pm
debian/changelog
doc/todo/want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both.mdwn

index 35e64d81568f6c98aedf18af682c77836310fc8b..799236f35fc2e26cbbfa8a84abb711b53bffc809 100644 (file)
@@ -1916,39 +1916,6 @@ sub template ($;@) {
        template_depends(shift, undef, @_);
 }
 
        template_depends(shift, undef, @_);
 }
 
-sub misctemplate ($$;@) {
-       my $title=shift;
-       my $content=shift;
-       my %params=@_;
-       
-       my $template=template("page.tmpl");
-
-       my $page="";
-       if (exists $params{page}) {
-               $page=delete $params{page};
-       }
-       run_hooks(pagetemplate => sub {
-               shift->(
-                       page => $page,
-                       destpage => $page,
-                       template => $template,
-               );
-       });
-       templateactions($template, "");
-
-       $template->param(
-               dynamic => 1,
-               title => $title,
-               wikiname => $config{wikiname},
-               content => $content,
-               baseurl => $config{url}.'/',
-               html5 => $config{html5},
-               %params,
-       );
-       
-       return $template->output;
-}
-
 sub templateactions ($$) {
        my $template=shift;
        my $page=shift;
 sub templateactions ($$) {
        my $template=shift;
        my $page=shift;
index 156d71daf8749759a09c4fa8929a9fec912e37b7..1287590a77ecb833a8a80f2b4d5a48ec12de971e 100644 (file)
@@ -504,7 +504,7 @@ sub editcomment ($$) {
                        IkiWiki::saveindex();
 
                        IkiWiki::printheader($session);
                        IkiWiki::saveindex();
 
                        IkiWiki::printheader($session);
-                       print IkiWiki::misctemplate(gettext(gettext("comment stored for moderation")),
+                       print IkiWiki::cgitemplate($cgi, gettext(gettext("comment stored for moderation")),
                                "<p>".
                                gettext("Your comment will be posted after moderator review").
                                "</p>");
                                "<p>".
                                gettext("Your comment will be posted after moderator review").
                                "</p>");
@@ -660,7 +660,7 @@ sub commentmoderation ($$) {
        IkiWiki::run_hooks(format => sub {
                $out = shift->(page => "", content => $out);
        });
        IkiWiki::run_hooks(format => sub {
                $out = shift->(page => "", content => $out);
        });
-       print IkiWiki::misctemplate(gettext("comment moderation"), $out);
+       print IkiWiki::cgitemplate($cgi, gettext("comment moderation"), $out);
        exit;
 }
 
        exit;
 }
 
index b362de7264175d9468c4207dcacf9153ade356a5..0a21413bdb9f9cdd591c93cf1785a3e4993d556e 100644 (file)
@@ -61,7 +61,7 @@ sub cgi_getsource ($) {
                IkiWiki::cgi_custom_failure(
                        $cgi,
                        "404 Not Found",
                IkiWiki::cgi_custom_failure(
                        $cgi,
                        "404 Not Found",
-                       IkiWiki::misctemplate(gettext("missing page"),
+                       IkiWiki::cgitemplate($cgi, gettext("missing page"),
                                "<p>".
                                sprintf(gettext("The page %s does not exist."),
                                        htmllink("", "", $page)).
                                "<p>".
                                sprintf(gettext("The page %s does not exist."),
                                        htmllink("", "", $page)).
@@ -72,7 +72,7 @@ sub cgi_getsource ($) {
        if (! defined pagetype($pagesources{$page})) {
                IkiWiki::cgi_custom_failure(
                        $cgi->header(-status => "403 Forbidden"),
        if (! defined pagetype($pagesources{$page})) {
                IkiWiki::cgi_custom_failure(
                        $cgi->header(-status => "403 Forbidden"),
-                       IkiWiki::misctemplate(gettext("not a page"),
+                       IkiWiki::cgitemplate($cgi, gettext("not a page"),
                                "<p>".
                                sprintf(gettext("%s is an attachment, not a page."),
                                        htmllink("", "", $page)).
                                "<p>".
                                sprintf(gettext("%s is an attachment, not a page."),
                                        htmllink("", "", $page)).
index 0eb83fc208de611d05a016ff8fc63c2c6913f1c8..6b596ac8b6af95641dec071071e5be38b3898f87 100644 (file)
@@ -56,7 +56,7 @@ sub cgi_goto ($;$) {
                IkiWiki::cgi_custom_failure(
                        $q,
                        "404 Not Found",
                IkiWiki::cgi_custom_failure(
                        $q,
                        "404 Not Found",
-                       IkiWiki::misctemplate(gettext("missing page"),
+                       IkiWiki::cgitemplate($q, gettext("missing page"),
                                "<p>".
                                sprintf(gettext("The page %s does not exist."),
                                        htmllink("", "", $page)).
                                "<p>".
                                sprintf(gettext("The page %s does not exist."),
                                        htmllink("", "", $page)).
index ce0990e40442ea63d762ac20ddcd3e1ed0420c38..bd67384f21a91477239df3c48c598cf837ea09b6 100644 (file)
@@ -84,7 +84,7 @@ sub openid_selector {
        );
 
        IkiWiki::printheader($session);
        );
 
        IkiWiki::printheader($session);
-       print IkiWiki::misctemplate("signin", $template->output);
+       print IkiWiki::cgitemplate($q, "signin", $template->output);
        exit;
 }
 
        exit;
 }
 
index 78eb750b5f670caabe5840a51f589319eccf1204..3f0b7c9ad4c657db023be5e489f069768dc8201a 100644 (file)
@@ -227,20 +227,21 @@ sub setupfiles () {
                        "database_dir .\n".
                        "template_dir ./templates\n");
                
                        "database_dir .\n".
                        "template_dir ./templates\n");
                
-               # Avoid omega interpreting anything in the misctemplate
+               # Avoid omega interpreting anything in the cgitemplate
                # as an omegascript command.
                # as an omegascript command.
-               my $misctemplate=IkiWiki::misctemplate(gettext("search"), "\0",
+               eval q{use IkiWiki::CGI};
+               my $template=IkiWiki::cgitemplate(undef, gettext("search"), "\0",
                        searchform => "", # avoid showing the small search form
                );
                eval q{use HTML::Entities};
                error $@ if $@;
                        searchform => "", # avoid showing the small search form
                );
                eval q{use HTML::Entities};
                error $@ if $@;
-               $misctemplate=encode_entities($misctemplate, '\$');
+               $template=encode_entities($template, '\$');
 
                my $querytemplate=readfile(IkiWiki::template_file("searchquery.tmpl"));
 
                my $querytemplate=readfile(IkiWiki::template_file("searchquery.tmpl"));
-               $misctemplate=~s/\0/$querytemplate/;
+               $template=~s/\0/$querytemplate/;
 
                writefile("query", $config{wikistatedir}."/xapian/templates",
 
                writefile("query", $config{wikistatedir}."/xapian/templates",
-                       $misctemplate);
+                       $template);
                $setup=1;
        }
 }
                $setup=1;
        }
 }
index 6a51903016830c17339f2130a964f87708ae15b0..0a3d90aec0d9654269fd70c63f6e9825f219c6a8 100644 (file)
@@ -447,10 +447,10 @@ sub showform ($$) {
                        IkiWiki::saveindex();
                        IkiWiki::unlockwiki();
 
                        IkiWiki::saveindex();
                        IkiWiki::unlockwiki();
 
-                       # Print the top part of a standard misctemplate,
+                       # Print the top part of a standard cgitemplate,
                        # then show the rebuild or refresh, live.
                        my $divider="\0";
                        # then show the rebuild or refresh, live.
                        my $divider="\0";
-                       my $html=IkiWiki::misctemplate("setup", $divider);
+                       my $html=IkiWiki::cgitemplate($cgi, "setup", $divider);
                        IkiWiki::printheader($session);
                        my ($head, $tail)=split($divider, $html, 2);
                        print $head."<pre>\n";
                        IkiWiki::printheader($session);
                        my ($head, $tail)=split($divider, $html, 2);
                        print $head."<pre>\n";
index 4ed9bb8b2bb17728f675914b7292ca6f91b6e97d..4cf0a2965f8d04be2362ba4daf017be07e103793 100644 (file)
@@ -3,15 +3,16 @@ ikiwiki (3.20101232) UNRELEASED; urgency=low
   * tag: Do not include tagbase in rss/atom category tags. (Giuseppe Bilotta)
   * tag: Improve display of tags with a slash in their names.
     (Giuseppe Bilotta)
   * tag: Do not include tagbase in rss/atom category tags. (Giuseppe Bilotta)
   * tag: Improve display of tags with a slash in their names.
     (Giuseppe Bilotta)
-  * Fix base url when previewing. Was broken by base changes in last release.
   * Fix redirect to use a full url. Was broken (in theory) by baseurl
     changes in last release.
   * Fix redirect to use a full url. Was broken (in theory) by baseurl
     changes in last release.
-  * Temporarily revert one part of the multiple url support in the last
-    release. Non-edit pages are now back to having `<base>` set to
-    the site's main url.
+  * Fix `<base>` output by cgi to have a full url again, broken by last
+    release.
   * Fix permalinks to recentchanges items and comments, broken by last
     release.
   * Fix permalinks to recentchanges items and comments, broken by last
     release.
-  * Export three cgi env vars needed for CGI->url to work.
+  * Export three cgi env vars needed for CGI->url to work. Fixed
+    openid breakage from last release.
+  * Removed `IkiWiki::misctemplate()` function. Any plugins using
+    it should use `IkiWiki::cgitemplate()` instead.
 
  -- Joey Hess <joeyh@debian.org>  Tue, 04 Jan 2011 16:00:55 -0400
 
 
  -- Joey Hess <joeyh@debian.org>  Tue, 04 Jan 2011 16:00:55 -0400
 
index 143bf0edcdaa79dd4e37cb1758c187be0083a55a..534a099b6f628dbf16b6460e8189eb9e6583a7f3 100644 (file)
@@ -1,6 +1,6 @@
 ## current status
 
 ## current status
 
-99% of the way there, but:
+[[done]] again! :)
 
 * CGI pages, with the exception of edit pages, set `<base>` to
   `$config{url}`
 
 * CGI pages, with the exception of edit pages, set `<base>` to
   `$config{url}`
@@ -15,6 +15,8 @@
   generate a better baseurl. Not sure yet what to do; may have to thread
   a cgi parameter through all the calls to misctemplate. --[[Joey]]
 
   generate a better baseurl. Not sure yet what to do; may have to thread
   a cgi parameter through all the calls to misctemplate. --[[Joey]]
 
+  > Fixed, cgitemplate is used now. --[[Joey]] 
+
 * Using `do=goto` to go to a comment or recentchanges item
   will redirect to the `$config{url}`-based url, since the
   permalinks are made to be absolute urls now.
 * Using `do=goto` to go to a comment or recentchanges item
   will redirect to the `$config{url}`-based url, since the
   permalinks are made to be absolute urls now.