Example #1
0
 function Head($name = 'edit[content]')
 {
     global $WikiTheme;
     foreach (array("Wikiwyg.js", "Wikiwyg/Toolbar.js", "Wikiwyg/Preview.js", "Wikiwyg/Wikitext.js", "Wikiwyg/Wysiwyg.js", "Wikiwyg/Phpwiki.js", "Wikiwyg/HTML.js", "Wikiwyg/Toolbar.js") as $js) {
         $WikiTheme->addMoreHeaders(Javascript('', array('src' => $this->BasePath . '/' . $js, 'language' => 'JavaScript')));
     }
     $doubleClickToEdit = ($GLOBALS['request']->getPref('doubleClickEdit') or ENABLE_DOUBLECLICKEDIT) ? 'true' : 'false';
     if ($GLOBALS['request']->getArg('mode') && $GLOBALS['request']->getArg('mode') == 'wysiwyg') {
         return JavaScript($this->_jsdefault . "\n            window.onload = function() {\n            var wikiwyg = new Wikiwyg.Phpwiki();\n            var config = {\n            doubleClickToEdit:  {$doubleClickToEdit},\n            javascriptLocation: data_path+'/themes/default/Wikiwyg/',\n            toolbar: {\n\t        imagesLocation: data_path+'/themes/default/Wikiwyg/images/',\n\t\tcontrolLayout: [\n\t\t       'save','preview','save_button','|',\n\t\t       'p','|',\n\t\t       'h2', 'h3', 'h4','|',\n\t\t       'bold', 'italic', '|',\n                       'sup', 'sub', '|',\n                       'toc',\n                       'wikitext','|',\n\t\t       'pre','|',\n\t\t       'ordered', 'unordered','hr','|',\n\t\t       'link','|',\n                       'table'\n\t\t       ],\n\t\tstyleSelector: [\n\t\t       'label', 'p', 'h2', 'h3', 'h4', 'pre'\n\t\t\t\t], \n\t\tcontrolLabels: {\n\t               save:     '" . _("Apply changes") . "',\n\t\t       cancel:   '" . _("Exit toolbar") . "',\n\t\t       h2:       '" . _("Title 1") . "',\n\t\t       h3:       '" . _("Title 2") . "',\n\t\t       h4:       '" . _("Title 3") . "',\n\t\t       verbatim: '" . _("Verbatim") . "',\n                       toc:   '" . _("Table of content") . "', \n                       wikitext:   '" . _("Insert Wikitext section") . "', \n                       sup:      '" . _("Sup") . "', \n                       sub:      '" . _("Sub") . "',\n                       preview:  '" . _("Preview") . "',   \n                       save_button:'" . _("Save") . "'   \n\t              }\n            },\n            wysiwyg: {\n                iframeId: 'iframe0'\n            },\n\t    wikitext: {\n\t      supportCamelCaseLinks: true\n\t    }\n            };\n            var div = document.getElementById(\"" . $this->_htmltextid . "\");\n            wikiwyg.createWikiwygArea(div, config);\n            wikiwyg_divs.push(wikiwyg);\n            wikiwyg.editMode();}");
     }
 }
Example #2
0
 function EditToolbar()
 {
     global $WikiTheme;
     $this->tokens = array();
     //FIXME: enable Undo button for all other buttons also, not only the search/replace button
     if (JS_SEARCHREPLACE) {
         $this->tokens['JS_SEARCHREPLACE'] = 1;
         $undo_btn = $WikiTheme->getImageURL("ed_undo.png");
         $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png");
         // JS_SEARCHREPLACE from walterzorn.de
         $js = Javascript("\nuri_undo_btn   = '" . $undo_btn . "'\nmsg_undo_alt   = '" . _("Undo") . "'\nuri_undo_d_btn = '" . $undo_d_btn . "'\nmsg_undo_d_alt = '" . _("Undo disabled") . "'\nmsg_do_undo    = '" . _("Operation undone") . "'\nmsg_replfound  = '" . _("Substring \"\\1\" found \\2 times. Replace with \"\\3\"?") . "'\nmsg_replnot    = '" . _("String \"%s\" not found.") . "'\nmsg_repl_title     = '" . _("Search & Replace") . "'\nmsg_repl_search    = '" . _("Search for") . "'\nmsg_repl_replace_with = '" . _("Replace with") . "'\nmsg_repl_ok        = '" . _("OK") . "'\nmsg_repl_close     = '" . _("Close") . "'\n");
         if (empty($WikiTheme->_headers_printed)) {
             $WikiTheme->addMoreHeaders($js);
             $WikiTheme->addMoreAttr('body', "SearchReplace", " onload='define_f()'");
         } else {
             // from an actionpage: WikiBlog, AddComment, WikiForum
             printXML($js);
         }
     } else {
         $WikiTheme->addMoreAttr('body', "editfocus", "document.getElementById('edit-content]').editarea.focus()");
     }
     if (ENABLE_EDIT_TOOLBAR) {
         $js = JavaScript('', array('src' => $WikiTheme->_findData("toolbar.js")));
         if (empty($WikiTheme->_headers_printed)) {
             $WikiTheme->addMoreHeaders($js);
         } else {
             // from an actionpage: WikiBlog, AddComment, WikiForum
             printXML($js);
             printXML(JavaScript('define_f()'));
         }
     }
     require_once "lib/WikiPluginCached.php";
     $cache = WikiPluginCached::newCache();
     $dbi = $GLOBALS['request']->getDbh();
     // regenerate if number of pages changes (categories, pages, templates)
     $key = $dbi->numPages();
     $key .= '+categories+plugin' . (isBrowserSafari() ? '+safari' : '');
     if (TOOLBAR_PAGELINK_PULLDOWN) {
         $key .= "+pages";
     }
     if (TOOLBAR_TEMPLATE_PULLDOWN) {
         $key .= "+templates_" . $dbi->getTimestamp();
     }
     $id = $cache->generateId($key);
     $content = $cache->get($id, 'toolbarcache');
     if (!empty($content)) {
         $this->tokens['EDIT_TOOLBAR'] =& $content;
     } else {
         $content = $this->_generate();
         // regenerate buttons every 1 hr/6 hrs
         $cache->save($id, $content, DEBUG ? '+3600' : '+21600', 'toolbarcache');
         $this->tokens['EDIT_TOOLBAR'] =& $content;
     }
 }
Example #3
0
 function showForm(&$dbi, &$request, $args, $allrelations)
 {
     global $WikiTheme;
     $action = $request->getPostURL();
     $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's'));
     $pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
     $help = Button('submit:semsearch[help]', "?", false);
     $svalues = empty($allrelations) ? "" : join("','", $allrelations);
     $reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')");
     $querybox = HTML::textarea(array('name' => 's', 'title' => _("Enter a valid query expression"), 'rows' => 4, 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), $args['s']);
     $submit = Button('submit:semsearch[relations]', _("Search"), false, array('title' => 'Move to help page. No seperate window'));
     $instructions = _("Search in all specified pages for the expression.");
     $form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => '0', 'width' => '100%'), HTML::tr(HTML::td(_("Pagename(s): "), $pagefilter), HTML::td(array('align' => 'right'), $help)), HTML::tr(HTML::td(array('colspan' => 2), $querybox))), HTML::br(), HTML::div(array('align' => 'center'), $submit));
     return $form;
 }
Example #4
0
 function initGlobals()
 {
     global $request;
     static $already = 0;
     if (!$already) {
         $script_url = deduce_script_name();
         $script_url .= '/' . $GLOBALS['group_name'];
         if (DEBUG & _DEBUG_REMOTE and isset($_GET['start_debug'])) {
             $script_url .= "?start_debug=" . $_GET['start_debug'];
         }
         $folderArrowPath = dirname($this->_findData('images/folderArrowLoading.gif'));
         $pagename = $request->getArg('pagename');
         $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("wikilens.js"))));
         $js = "var data_path = '" . javascript_quote_string(DATA_PATH) . "';\n" . "var script_url= '" . javascript_quote_string($script_url) . "';\n" . "var stylepath = data_path+'/" . javascript_quote_string($this->_theme) . "/';\n" . "var folderArrowPath = '" . javascript_quote_string($folderArrowPath) . "';\n" . "var use_path_info = " . (USE_PATH_INFO ? "true" : "false") . ";\n";
         $this->addMoreHeaders(JavaScript($js));
         $already = 1;
     }
 }
Example #5
0
 function EditToolbar()
 {
     global $WikiTheme;
     $this->tokens = array();
     //FIXME: enable Undo button for all other buttons also, not only the search/replace button
     if (JS_SEARCHREPLACE) {
         $this->tokens['JS_SEARCHREPLACE'] = 1;
         $undo_btn = $WikiTheme->getImageURL("ed_undo.png");
         $undo_d_btn = $WikiTheme->getImageURL("ed_undo_d.png");
         // JS_SEARCHREPLACE from walterzorn.de
         $WikiTheme->addMoreHeaders(Javascript("\nvar f, sr_undo, replacewin, undo_buffer=new Array(), undo_buffer_index=0;\n\nfunction define_f() {\n   f=document.getElementById('editpage');\n   f.editarea=document.getElementById('edit[content]');\n   sr_undo=document.getElementById('sr_undo');\n   undo_enable(false);\n   f.editarea.focus();\n}\nfunction undo_enable(bool) {\n   if (bool) {\n     sr_undo.src='" . $undo_btn . "';\n     sr_undo.alt='" . _("Undo") . "';\n     sr_undo.disabled = false;\n   } else {\n     sr_undo.src='" . $undo_d_btn . "';\n     sr_undo.alt='" . _("Undo disabled") . "';\n     sr_undo.disabled = true;\n     if(sr_undo.blur) sr_undo.blur();\n  }\n}\nfunction replace() {\n   replacewin = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,height=90,width=450');\n   replacewin.window.document.write('<html><head><title>" . _("Search & Replace") . "</title><style type=\"text/css\"><'+'!'+'-- body, input {font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:10pt;font-weight:bold;} td {font-size:9pt}  --'+'></style></head><body bgcolor=\"#dddddd\" onload=\"if(document.forms[0].ein.focus) document.forms[0].ein.focus(); return false;\"><form><center><table><tr><td align=\"right\">'+'" . _("Search") . ":</td><td align=\"left\"><input type=\"text\" name=\"ein\" size=\"45\" maxlength=\"500\"></td></tr><tr><td align=\"right\">'+' " . _("Replace with") . ":</td><td align=\"left\"><input type=\"text\" name=\"aus\" size=\"45\" maxlength=\"500\"></td></tr><tr><td colspan=\"2\" align=\"center\"><input type=\"button\" value=\" " . _("OK") . " \" onclick=\"if(self.opener)self.opener.do_replace(); return false;\">&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\"" . _("Close") . "\" onclick=\"self.close(); return false;\"></td></tr></table></center></form></body></html>');\n   replacewin.window.document.close();\n   return false;\n}\nfunction do_replace() {\n   var txt=undo_buffer[undo_buffer_index]=f.editarea.value, ein=new RegExp(replacewin.document.forms[0].ein.value,'g'), aus=replacewin.document.forms[0].aus.value;\n   if (ein==''||ein==null) {\n      if (replacewin) replacewin.window.document.forms[0].ein.focus();\n      return;\n   }\n   var z_repl=txt.match(ein)? txt.match(ein).length : 0;\n   txt=txt.replace(ein,aus);\n   ein=ein.toString().substring(1,ein.toString().length-2);\n   result(z_repl, '" . sprintf(_("Substring \"%s\" found %s times. Replace with \"%s\"?"), "'+ein+'", "'+z_repl+'", "'+aus+'") . "', txt, '" . sprintf(_("String \"%s\" not found."), "'+ein+'") . "');\n   replacewin.window.focus();\n   replacewin.window.document.forms[0].ein.focus();\n   return false;\n}\nfunction result(zahl,frage,txt,alert_txt) {\n   if (zahl>0) {\n      if(window.confirm(frage)==true) {\n         f.editarea.value=txt;\n         undo_save();\n         undo_enable(true);\n      }\n   } else alert(alert_txt);\n}\nfunction do_undo() {\n   if(undo_buffer_index==0) return;\n   else if(undo_buffer_index>0) {\n      f.editarea.value=undo_buffer[undo_buffer_index-1];\n      undo_buffer[undo_buffer_index]=null;\n      undo_buffer_index--;\n      if(undo_buffer_index==0) {\n         alert('" . _("Operation undone") . "');\n         undo_enable(false);\n      }\n   }\n}\n//save a snapshot in the undo buffer\nfunction undo_save() {\n   undo_buffer[undo_buffer_index]=f.editarea.value;\n   undo_buffer_index++;\n   undo_enable(true);\n}\n"));
         $WikiTheme->addMoreAttr('body', "SearchReplace", " onload='define_f()'");
     } else {
         $WikiTheme->addMoreAttr('body', "editfocus", "document.getElementById('edit[content]').editarea.focus()");
     }
     if (ENABLE_EDIT_TOOLBAR) {
         $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $WikiTheme->_findData("toolbar.js"))));
     }
     include_once "lib/WikiPluginCached.php";
     $cache = WikiPluginCached::newCache();
     $dbi = $GLOBALS['request']->getDbh();
     // regenerate if number of pages changes (categories, pages, templates)
     $key = $dbi->numPages();
     $key .= '+categories+plugin';
     if (TOOLBAR_PAGELINK_PULLDOWN) {
         $key .= "+pages";
     }
     if (TOOLBAR_TEMPLATE_PULLDOWN) {
         $key .= "+templates_" . $dbi->getTimestamp();
     }
     $id = $cache->generateId($key);
     $content = $cache->get($id, 'toolbarcache');
     if (!empty($content)) {
         $this->tokens['EDIT_TOOLBAR'] =& $content;
     } else {
         $content = $this->_generate();
         // regenerate buttons every 3600 seconds
         $cache->save($id, $content, '+3600', 'toolbarcache');
         $this->tokens['EDIT_TOOLBAR'] =& $content;
     }
 }
Example #6
0
 function showForm(&$dbi, &$request, $args)
 {
     $action = $request->getPostURL();
     $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'direction'));
     $pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
     $query = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this link. These are pagenames. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
     $dirsign_switch = JavaScript("\nfunction dirsign_switch() {\n  var d = document.getElementById('dirsign')\n  d.innerHTML = (d.innerHTML == ' =&gt; ') ? ' &lt;= ' : ' =&gt; '\n}\n");
     $dirsign = " => ";
     $in = $out = array('name' => 'direction', 'type' => 'radio', 'onChange' => 'dirsign_switch()');
     $out['value'] = 'out';
     $out['id'] = 'dir_out';
     if ($args['direction'] == 'out') {
         $out['checked'] = 'checked';
     }
     $in['value'] = 'in';
     $in['id'] = 'dir_in';
     if ($args['direction'] == 'in') {
         $in['checked'] = 'checked';
         $dirsign = " <= ";
     }
     $direction = HTML(HTML::input($out), HTML::label(array('for' => 'dir_out'), _("outgoing")), HTML::input($in), HTML::label(array('for' => 'dir_in'), _("incoming")));
     /*
     $direction = HTML::select(array('name'=>'direction',
                                     'onChange' => 'dirsign_switch()'));
     $out = array('value' => 'out');
     if ($args['direction']=='out') $out['selected'] = 'selected';
     $in = array('value' => 'in');
     if ($args['direction']=='in') {
         $in['selected'] = 'selected';
         $dirsign = " <= ";
     }
     $direction->pushContent(HTML::option($out, _("outgoing")));
     $direction->pushContent(HTML::option($in, _("incoming")));
     */
     $submit = Button('submit:search', _("LinkSearch"), false);
     $instructions = _("Search in pages for links with the matching name.");
     $form = HTML::form(array('action' => $action, 'method' => 'GET', 'accept-charset' => $GLOBALS['charset']), $dirsign_switch, $hiddenfield, $instructions, HTML::br(), $pagefilter, HTML::strong(HTML::tt(array('id' => 'dirsign'), $dirsign)), $query, HTML::raw('&nbsp;'), $direction, HTML::raw('&nbsp;'), $submit);
     return $form;
 }
Example #7
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     if (empty($this->source)) {
         return '';
     }
     $html = HTML();
     if (empty($WikiTheme->_asciiSVG)) {
         $js = JavaScript('', array('src' => $WikiTheme->_findData('ASCIIsvg.js')));
         if (empty($WikiTheme->_headers_printed)) {
             $WikiTheme->addMoreHeaders($js);
         } else {
             $html->pushContent($js);
         }
         $WikiTheme->_asciiSVG = 1;
         // prevent duplicates
     }
     // extract <script>
     if (preg_match("/^(.*)<script>(.*)<\\/script>/ism", $this->source, $m)) {
         $this->source = $m[1];
         $args['script'] = $m[2];
     }
     $embedargs = array('width' => $args['width'], 'height' => $args['height'], 'script' => $this->source);
     // additional onmousemove argument
     if ($args['onmousemove']) {
         $embedargs['onmousemove'] = $args['onmousemove'];
     }
     // we need script='data' and not script="data"
     $embed = new AsciiSVG_HTML("embed", $embedargs);
     $html->pushContent($embed);
     if ($args['script']) {
         $html->pushContent(JavaScript($args['script']));
     }
     return $html;
 }
Example #8
0
 function redirect($url, $noreturn = true)
 {
     $bogus = defined('DISABLE_HTTP_REDIRECT') && DISABLE_HTTP_REDIRECT;
     if (!$bogus) {
         header("Location: {$url}");
         /*
          * "302 Found" is not really meant to be sent in response
          * to a POST.  Worse still, according to (both HTTP 1.0
          * and 1.1) spec, the user, if it is sent, the user agent
          * is supposed to use the same method to fetch the
          * redirected URI as the original.
          *
          * That means if we redirect from a POST, the user-agent
          * supposed to generate another POST.  Not what we want.
          * (We do this after a page save after all.)
          *
          * Fortunately, most/all browsers don't do that.
          *
          * "303 See Other" is what we really want.  But it only
          * exists in HTTP/1.1
          *
          * FIXME: this is still not spec compliant for HTTP
          * version < 1.1.
          */
         $status = $this->httpVersion() >= 1.1 ? 303 : 302;
         $this->setStatus($status);
     }
     if ($noreturn) {
         $this->discardOutput();
         // This might print the gzip headers. Not good.
         $this->buffer_output(false);
         include_once 'lib/Template.php';
         $tmpl = new Template('redirect', $this, array('REDIRECT_URL' => $url));
         $tmpl->printXML();
         $this->finish();
     } elseif ($bogus) {
         // Safari needs window.location.href = targeturl
         return JavaScript("\n              function redirect(url) {\n                if (typeof location.replace == 'function')\n                  location.replace(url);\n                else if (typeof location.assign == 'function')\n                  location.assign(url);\n                else if (self.location.href)\n                  self.location.href = url;\n                else\n                  window.location = url;\n              }\n              redirect('" . addslashes($url) . "')");
     }
 }
Example #9
0
    function calendarInit($force = false)
    {
        $dbi = $GLOBALS['request']->getDbh();
        // display flat calender dhtml in the sidebar
        if ($force or $dbi->isWikiPage($this->calendarBase())) {
            $jslang = @$GLOBALS['LANG'];
            $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('jscalendar/calendar-phpwiki.css'), 'all'));
            $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData('jscalendar/calendar' . (DEBUG ? '' : '_stripped') . '.js'))));
            if (!($langfile = $this->_findData("jscalendar/lang/calendar-{$jslang}.js"))) {
                $langfile = $this->_findData("jscalendar/lang/calendar-en.js");
            }
            $this->addMoreHeaders(JavaScript('', array('src' => $langfile)));
            $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData('jscalendar/calendar-setup' . (DEBUG ? '' : '_stripped') . '.js'))));
            // Get existing date entries for the current user
            require_once "lib/TextSearchQuery.php";
            $iter = $dbi->titleSearch(new TextSearchQuery("^" . $this->calendarBase() . SUBPAGE_SEPARATOR, true, "auto"));
            $existing = array();
            while ($page = $iter->next()) {
                if ($page->exists()) {
                    $existing[] = basename($page->_pagename);
                }
            }
            if (!empty($existing)) {
                $js_exist = '{"' . join('":1,"', $existing) . '":1}';
                //var SPECIAL_DAYS = {"2004-05-11":1,"2004-05-12":1,"2004-06-01":1}
                $this->addMoreHeaders(JavaScript('
/* This table holds the existing calender entries for the current user
 *  calculated from the database
 */

var SPECIAL_DAYS = ' . javascript_quote_string($js_exist) . ';

/* This function returns true if the date exists in SPECIAL_DAYS */
function dateExists(date, y, m, d) {
    var year = date.getFullYear();
    m = m + 1;
    m = m < 10 ? "0" + m : m;  // integer, 0..11
    d = d < 10 ? "0" + d : d;  // integer, 1..31
    var date = year+"-"+m+"-"+d;
    var exists = SPECIAL_DAYS[date];
    if (!exists) return false;
    else return true;
}
// This is the actual date status handler.
// Note that it receives the date object as well as separate
// values of year, month and date.
function dateStatusFunc(date, y, m, d) {
    if (dateExists(date, y, m, d)) return "existing";
    else return false;
}
'));
            } else {
                $this->addMoreHeaders(JavaScript('
function dateStatusFunc(date, y, m, d) { return false;}'));
            }
        }
    }
Example #10
0
 function Textarea($textarea, $wikitext, $name = 'edit[content]')
 {
     $out = HTML($textarea);
     $out->pushContent(JavaScript("editor_generate('" . $name . "');", array('version' => 'JavaScript1.2', 'defer' => 1)));
     return $out;
 }
Example #11
0
 function initLiveSearch()
 {
     if (!$this->HTML_DUMP_SUFFIX) {
         $this->addMoreAttr('body', 'LiveSearch', HTML::Raw(" onload=\"liveSearchInit()"));
         $this->addMoreHeaders(JavaScript('var liveSearchURI="' . WikiURL(_("TitleSearch"), false, true) . '";'));
         $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData('livesearch.js'))));
     }
 }
Example #12
0
 function showForm(&$dbi, &$request, $args)
 {
     global $WikiTheme;
     $action = $request->getPostURL();
     $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'semsearch', 'relation', 'attribute'));
     $pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
     $allrelations = $dbi->listRelations(false, false, true);
     $svalues = empty($allrelations) ? "" : join("','", $allrelations);
     $reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')");
     $relation = HTML::input(array('name' => 'relation', 'value' => $args['relation'], 'title' => _("Filter by this relation. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:10em', 'acdropdown' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), '');
     $queryrel = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this link. These are pagenames. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
     $relsubmit = Button('submit:semsearch[relations]', _("Relations"), false);
     // just testing some dhtml... not yet done
     $enhancements = HTML();
     $nbsp = HTML::raw('&nbsp;');
     $this_uri = $_SERVER['REQUEST_URI'] . '#';
     $andbutton = new Button(_("AND"), $this_uri, 'wikiaction', array('onclick' => "addquery('rel', 'and')", 'title' => _("Add an AND query")));
     $orbutton = new Button(_("OR"), $this_uri, 'wikiaction', array('onclick' => "addquery('rel', 'or')", 'title' => _("Add an OR query")));
     if (DEBUG) {
         $enhancements = HTML::span($andbutton, $nbsp, $orbutton);
     }
     $instructions = _("Search in pages for a relation with that value (a pagename).");
     $form1 = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => 0, 'cellspacing' => 2), HTML::colgroup(array('span' => 6)), HTML::thead(HTML::tr(HTML::th('Pagefilter'), HTML::th('Relation'), HTML::th(), HTML::th('Links'), HTML::th())), HTML::tbody(HTML::tr(HTML::td($pagefilter, ": "), HTML::td($relation), HTML::td(HTML::strong(HTML::tt('  ::  '))), HTML::td($queryrel), HTML::td($nbsp, $relsubmit, $nbsp, $enhancements)))));
     $allattrs = $dbi->listRelations(false, true, true);
     if (empty($allrelations) and empty($allattrs)) {
         // be nice to the dummy.
         $this->_norelations_warning = 1;
     }
     $svalues = empty($allattrs) ? "" : join("','", $allattrs);
     $attdef = JavaScript("var semsearch_attributes = new Array('" . $svalues . "')\n" . "var semsearch_op = new Array('" . join("','", $this->_supported_operators) . "')");
     // TODO: We want some more tricks: Autofill the base unit of the selected
     // attribute into the s area.
     $attribute = HTML::input(array('name' => 'attribute', 'value' => $args['attribute'], 'title' => _("Filter by this attribute name. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:10em', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'array:semsearch_attributes'), '');
     $attr_op = HTML::input(array('name' => 'attr_op', 'value' => $args['attr_op'], 'title' => _("Comparison operator. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:2em', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'array:semsearch_op'), '');
     $queryatt = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this numeric attribute value. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'false', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'plugin:SemanticSearch page=' . $args['page'] . ' attribute=^[S] attr_op==~'), '');
     $andbutton = new Button(_("AND"), $this_uri, 'wikiaction', array('onclick' => "addquery('attr', 'and')", 'title' => _("Add an AND query")));
     $orbutton = new Button(_("OR"), $this_uri, 'wikiaction', array('onclick' => "addquery('attr', 'or')", 'title' => _("Add an OR query")));
     if (DEBUG) {
         $enhancements = HTML::span($andbutton, $nbsp, $orbutton);
     }
     $attsubmit = Button('submit:semsearch[attributes]', _("Attributes"), false);
     $instructions = HTML::span(_("Search in pages for an attribute with that numeric value."), "\n");
     if (DEBUG) {
         $instructions->pushContent(HTML(" ", new Button(_("Advanced..."), _("SemanticSearchAdvanced"))));
     }
     $form2 = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $attdef, $hiddenfield, HiddenInputs(array('relation' => '')), $instructions, HTML::br(), HTML::table(array('border' => 0, 'cellspacing' => 2), HTML::colgroup(array('span' => 6)), HTML::thead(HTML::tr(HTML::th('Pagefilter'), HTML::th('Attribute'), HTML::th('Op'), HTML::th('Value'), HTML::th())), HTML::tbody(HTML::tr(HTML::td($pagefilter, ": "), HTML::td($attribute), HTML::td($attr_op), HTML::td($queryatt), HTML::td($nbsp, $attsubmit, $nbsp, $enhancements)))));
     return HTML($form1, $form2);
 }
Example #13
0
/** Conditionally display content based of whether javascript is supported.
 *
 * This conditionally (on the client side) displays one of two alternate
 * contents depending on whether the client supports javascript.
 *
 * NOTE:
 * The content you pass as arguments to this function must be block-level.
 * (This is because the <noscript> tag is block-level.)
 *
 * @param mixed $if_content Content to display if the browser supports
 * javascript.
 *
 * @param mixed $else_content Content to display if the browser does
 * not support javascript.
 *
 * @return XmlContent
 */
function IfJavaScript($if_content = false, $else_content = false)
{
    $html = array();
    if ($if_content) {
        $xml = AsXML($if_content);
        $js = sprintf('document.write("%s");', addcslashes($xml, "..!@\\..ÿ"));
        $html[] = JavaScript($js);
    }
    if ($else_content) {
        $html[] = HTML::noscript(false, $else_content);
    }
    return HTML($html);
}
Example #14
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $attributes = $attrib ? explode(",", $attrib) : array();
     $photos = array();
     $html = HTML();
     $count = 0;
     // check all parameters
     // what type do we have?
     if (!$src) {
         $showdesc = 'none';
         $src = $request->getArg('pagename');
         $error = $this->fromLocation($src, $photos);
     } else {
         $error = $this->fromFile($src, $photos, $url);
     }
     if ($error) {
         return $this->error($error);
     }
     if ($numcols < 1) {
         $numcols = 1;
     }
     if ($align != 'left' && $align != 'center' && $align != 'right') {
         $align = 'center';
     }
     if (count($photos) == 0) {
         return;
     }
     if (in_array("sort", $attributes)) {
         sort($photos);
     }
     if ($p) {
         $mode = "normal";
     }
     if ($mode == "column") {
         $mode = "normal";
         $numcols = "1";
     }
     // set some fixed properties for each $mode
     if ($mode == 'thumbs' || $mode == 'tiles') {
         $attributes = array_merge($attributes, "alt");
         $attributes = array_merge($attributes, "nowrap");
         $cellwidth = 'auto';
         // else cell won't nowrap
         $width = 50;
     } elseif ($mode == 'list') {
         $numcols = 1;
         $cellwidth = "auto";
         $width = 50;
     } elseif ($mode == 'slide') {
         $tableheight = 0;
         $cell_width = 0;
         $numcols = count($photos);
         $keep = $photos;
         while (list($key, $value) = each($photos)) {
             list($x, $y, $s, $t) = @getimagesize($value['src']);
             if ($height != 'auto') {
                 $y = $this->newSize($y, $height);
             }
             if ($width != 'auto') {
                 $y = round($y * $this->newSize($x, $width) / $x);
             }
             if ($x > $cell_width) {
                 $cell_width = $x;
             }
             if ($y > $tableheight) {
                 $tableheight = $y;
             }
         }
         $tableheight += 50;
         $photos = $keep;
         unset($x, $y, $s, $t, $key, $value, $keep);
     }
     $row = HTML();
     $duration = 1000 * $duration;
     if ($mode == 'slide') {
         $row->pushContent(JavaScript("\ni = 0;\nfunction display_slides() {\n  j = i - 1;\n  cell0 = document.getElementsByName('wikislide' + j);\n  cell = document.getElementsByName('wikislide' + i);\n  if (cell0.item(0) != null)\n    cell0.item(0).style.display='none';\n  if (cell.item(0) != null)\n    cell.item(0).style.display='block';\n  i += 1;\n  if (cell.item(0) == null) i = 0;\n  setTimeout('display_slides()',{$duration});\n}\ndisplay_slides();"));
     }
     while (list($key, $value) = each($photos)) {
         if ($p && basename($value["name"]) != "{$p}") {
             continue;
         }
         if ($h && basename($value["name"]) == "{$h}") {
             $color = $hlcolor ? $hlcolor : $bgcolor;
         } else {
             $color = $bgcolor;
         }
         // $params will be used for each <img > tag
         $params = array('src' => $value["name"], 'src_tile' => $value["name_tile"], 'border' => "0", 'alt' => ($value["desc"] != "" and in_array("alt", $attributes)) ? $value["desc"] : basename($value["name"]));
         if (!@empty($value['location'])) {
             $params = array_merge($params, array("location" => $value['location']));
         }
         // check description
         switch ($showdesc) {
             case 'none':
                 $value["desc"] = '';
                 break;
             case 'name':
                 $value["desc"] = basename($value["name"]);
                 break;
             case 'desc':
                 break;
             default:
                 // 'both'
                 if (!$value["desc"]) {
                     $value["desc"] = basename($value["name"]);
                 }
                 break;
         }
         // FIXME: get getimagesize to work with names with spaces in it.
         // convert $value["name"] from webpath to local path
         $size = @getimagesize($value["name"]);
         // try " " => "\\ "
         if (!$size and !empty($value["src"])) {
             $size = @getimagesize($value["src"]);
             if (!$size) {
                 trigger_error("Unable to getimagesize(" . $value["name"] . ")", E_USER_NOTICE);
             }
         }
         $newwidth = $this->newSize($size[0], $width);
         if ($mode == 'thumbs' || $mode == 'tiles' || $mode == 'list') {
             if (!empty($size[0])) {
                 $newheight = round(50 * $size[1] / $size[0]);
             } else {
                 $newheight = '';
             }
             if ($height == 'auto') {
                 $height = 150;
             }
         } else {
             $newheight = $this->newSize($size[1], $height);
         }
         if ($width != 'auto' && $newwidth > 0) {
             $params = array_merge($params, array("width" => $newwidth));
         }
         if ($height != 'auto' && $newheight > 0) {
             $params = array_merge($params, array("height" => $newheight));
         }
         // cell operations
         $cell = array('align' => "center", 'valign' => "top", 'bgcolor' => "{$color}");
         if ($cellwidth != 'auto') {
             if ($cellwidth == 'equal') {
                 $newcellwidth = round(100 / $numcols) . "%";
             } else {
                 if ($cellwidth == 'image') {
                     $newcellwidth = $newwidth;
                 } else {
                     $newcellwidth = $cellwidth;
                 }
             }
             $cell = array_merge($cell, array("width" => $newcellwidth));
         }
         if (in_array("nowrap", $attributes)) {
             $cell = array_merge($cell, array("nowrap" => "nowrap"));
         }
         //create url to display single larger version of image on page
         $url = WikiURL($request->getPage(), array("p" => basename($value["name"]))) . "#" . basename($value["name"]);
         $b_url = WikiURL($request->getPage(), array("h" => basename($value["name"]))) . "#" . basename($value["name"]);
         $url_text = $link ? HTML::a(array("href" => "{$url}"), basename($value["desc"])) : basename($value["name"]);
         if (!$p) {
             if ($mode == 'normal' || $mode == 'slide') {
                 if (!@empty($params['location'])) {
                     $params['src'] = $params['location'];
                 }
                 unset($params['location'], $params['src_tile']);
                 $url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$url}"), HTML::img($params))) : HTML::img($params);
             } else {
                 $keep = $params;
                 if (!@empty($params['src_tile'])) {
                     $params['src'] = $params['src_tile'];
                 }
                 unset($params['location'], $params['src_tile']);
                 $url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$url}"), ImageTile::image_tile($params))) : HTML::img($params);
                 $params = $keep;
                 unset($keep);
             }
         } else {
             if (!@empty($params['location'])) {
                 $params['src'] = $params['location'];
             }
             unset($params['location'], $params['src_tile']);
             $url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$b_url}"), HTML::img($params))) : HTML::img($params);
         }
         if ($mode == 'list') {
             $url_text = HTML::a(array("id" => basename($value["name"])), $url_text);
         }
         // here we use different modes
         if ($mode == 'tiles') {
             $row->pushContent(HTML::td($cell, HTML::table(array("cellpadding" => 1, "border" => 0), HTML::tr(HTML::td(array("valign" => "top", "rowspan" => 2), $url_image), HTML::td(array("valign" => "top", "nowrap" => 0), HTML::span(array('class' => 'boldsmall'), $url_text), HTML::br(), HTML::span(array('class' => 'gensmall'), $size[0] . " x " . $size[1] . " pixels"))))));
         } elseif ($mode == 'list') {
             $desc = $showdesc != 'none' ? $value["desc"] : '';
             $row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'boldsmall'), $url_text)));
             $row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'gensmall'), $size[0] . " x " . $size[1] . " pixels")));
             if ($desc != '') {
                 $row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'gensmall'), $desc)));
             }
         } elseif ($mode == 'thumbs') {
             $desc = $showdesc != 'none' ? HTML::p(HTML::a(array("href" => "{$url}"), $url_text)) : '';
             $row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc)));
         } elseif ($mode == 'normal') {
             $desc = $showdesc != 'none' ? HTML::p($value["desc"]) : '';
             $row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc)));
         } elseif ($mode == 'slide') {
             if ($newwidth == 'auto' || !$newwidth) {
                 $newwidth = $this->newSize($size[0], $width);
             }
             if ($newwidth == 'auto' || !$newwidth) {
                 $newwidth = $size[0];
             }
             if ($newheight != 'auto') {
                 $newwidth = round($size[0] * $newheight / $size[1]);
             }
             $desc = $showdesc != 'none' ? HTML::p($value["desc"]) : '';
             if ($count == 0) {
                 $cell = array('style' => 'display: block; ' . 'position: absolute; ' . 'left: 50% ; ' . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
             } else {
                 $cell = array('style' => 'display: none; ' . 'position: absolute ;' . 'left: 50% ;' . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
             }
             if ($align == 'left' || $align == 'right') {
                 if ($count == 0) {
                     $cell = array('style' => 'display: block; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
                 } else {
                     $cell = array('style' => 'display: none; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
                 }
             }
             $row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc)));
             $count++;
         } elseif ($mode == 'row') {
             $desc = $showdesc != 'none' ? HTML::p($value["desc"]) : '';
             $row->pushContent(HTML::table(array("style" => "display: inline"), HTML::tr(HTML::td($url_image)), HTML::tr(HTML::td(array("class" => "gensmall", "style" => "text-align: center; " . "background-color: {$color}"), $desc))));
         } else {
             return $this->error(fmt("Invalid argument: %s=%s", 'mode', $mode));
         }
         // no more images in one row as defined by $numcols
         if (($key + 1) % $numcols == 0 || $key + 1 == count($photos) || $p) {
             if ($mode == 'row') {
                 $html->pushcontent(HTML::span($row));
             } else {
                 $html->pushcontent(HTML::tr($row));
             }
             $row->setContent('');
         }
     }
     //create main table
     $table_attributes = array("border" => 0, "cellpadding" => 5, "cellspacing" => 2, "width" => $tablewidth);
     if (!@empty($tableheight)) {
         $table_attributes = array_merge($table_attributes, array("height" => $tableheight));
     }
     if ($mode != 'row') {
         $html = HTML::table($table_attributes, $html);
     }
     // align all
     return HTML::div(array("align" => $align), $html);
 }
Example #15
0
 function sidebar_link()
 {
     extract($this->_args);
     $pagetitle = $show_minor ? _("RecentEdits") : _("RecentChanges");
     global $request;
     $sidebarurl = WikiURL($pagetitle, array('format' => 'sidebar'), 'absurl');
     $addsidebarjsfunc = "function addPanel() {\n" . "    window.sidebar.addPanel (\"" . sprintf("%s - %s", WIKI_NAME, $pagetitle) . "\",\n" . "       \"{$sidebarurl}\",\"\");\n" . "}\n";
     $jsf = JavaScript($addsidebarjsfunc);
     global $WikiTheme;
     $sidebar_button = $WikiTheme->makeButton("sidebar", 'javascript:addPanel();', 'sidebaricon');
     $addsidebarjsclick = asXML(HTML::small(array('style' => 'font-weight:normal;vertical-align:middle;'), $sidebar_button));
     $jsc = JavaScript("if ((typeof window.sidebar == 'object') &&\n" . "    (typeof window.sidebar.addPanel == 'function'))\n" . "   {\n" . "       document.write('{$addsidebarjsclick}');\n" . "   }\n");
     return HTML(new RawXML("\n"), $jsf, new RawXML("\n"), $jsc);
 }
Example #16
0
 function format($changes)
 {
     include_once 'lib/InlineParser.php';
     $html = HTML(HTML::h2(false, $this->headline()));
     if ($desc = $this->description()) {
         $html->pushContent($desc);
     }
     if ($this->_args['daylist']) {
         $html->pushContent(new OptionsButtonBars($this->_args));
     }
     $last_date = '';
     $lines = false;
     $first = true;
     while ($rev = $changes->next()) {
         if (($date = $this->date($rev)) != $last_date) {
             if ($lines) {
                 $html->pushContent($lines);
             }
             // for user contributions no extra date line
             $html->pushContent(HTML::h3($date));
             $lines = HTML::ul();
             $last_date = $date;
         }
         // enforce view permission
         if (mayAccessPage('view', $rev->_pagename)) {
             $lines->pushContent($this->format_revision($rev));
             if ($first) {
                 $this->setValidators($rev);
             }
             $first = false;
         }
     }
     if ($lines) {
         $html->pushContent($lines);
     }
     if ($first) {
         if ($this->_args['daylist']) {
             $html->pushContent(JavaScript("document.getElementById('rc-action-body').style.display='block';"));
         }
         $html->pushContent(HTML::p(array('class' => 'rc-empty'), $this->empty_message()));
     }
     return $html;
 }
Example #17
0
    /**
     * Produce our javascript.
     *
     * This is used to resize the iframe to fit the content.
     * Currently it only works if the transcluded document comes
     * from the same server as the wiki server.
     *
     * @access private
     */
    function _js()
    {
        static $seen = false;
        if ($seen) {
            return '';
        }
        $seen = true;
        return JavaScript('
          function adjust_iframe_height(frame) {
            var content = frame.contentDocument;
            try {
                frame.height = content.height + 2 * frame.marginHeight;
            }
            catch (e) {
              // Can not get content.height unless transcluded doc
              // is from the same server...
              return;
            }
          }

          window.addEventListener("resize", function() {
            f = this.document.body.getElementsByTagName("iframe");
            for (var i = 0; i < f.length; i++)
              adjust_iframe_height(f[i]);
          }, false);
          ');
    }
Example #18
0
    function format($changes)
    {
        $this->_itemcount = 0;
        $pagename = $this->_args['page'];
        $fmt = _RecentChanges_HtmlFormatter::format($changes);
        $fmt->action = _("PageHistory");
        $html[] = $fmt;
        $html[] = HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'diff'));
        if (USE_PATH_INFO) {
            $action = WikiURL($pagename);
        } else {
            $action = SCRIPT_NAME;
            $html[] = HTML::input(array('type' => 'hidden', 'name' => 'pagename', 'value' => $pagename));
        }
        return HTML(HTML::form(array('method' => 'get', 'action' => $action, 'id' => 'diff-select'), $html), "\n", JavaScript('
        var diffCkBoxes = document.forms["diff-select"].elements["versions[]"];

        function diffCkBox_onclick() {
            var nchecked = 0, box = diffCkBoxes;
            for (i = 0; i < box.length; i++)
                if (box[i].checked) nchecked++;
            if (nchecked == 2)
                this.form.submit();
            else if (nchecked > 2) {
                for (i = 0; i < box.length; i++)
                    if (box[i] != this) box[i].checked = 0;
            }
        }

        for (i = 0; i < diffCkBoxes.length; i++)
            diffCkBoxes[i].onclick = diffCkBox_onclick;'));
    }
Example #19
0
 /**
  * HTML widget display
  *
  * This needs to be put in the <body> section of the page.
  *
  * @param pagename    Name of the page to rate
  * @param version     Version of the page to rate (may be "" for current)
  * @param imgPrefix   Prefix of the names of the images that display the rating
  *                    You can have two widgets for the same page displayed at
  *                    once iff the imgPrefix-s are different.
  * @param dimension   Id of the dimension to rate
  * @param small       Makes a smaller ratings widget if non-false
  *
  * Limitations: Currently this can only print the current users ratings.
  *              And only the widget, but no value (for buddies) also.
  */
 function RatingWidgetHtml($pagename, $version, $imgPrefix, $dimension, $small = false)
 {
     global $WikiTheme, $request;
     $dbi =& $request->_dbi;
     $version = $dbi->_backend->get_latest_version($pagename);
     $pageid = sprintf("%u", crc32($pagename));
     // MangleXmlIdentifier($pagename)
     $imgId = 'RateIt' . $pageid;
     $actionImgName = 'RateIt' . $pageid . 'Action';
     //$rdbi =& $this->_rdbi;
     $rdbi = RatingsDb::getTheRatingsDb();
     // check if the imgPrefix icons exist.
     if (!$WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk0.png", true)) {
         $imgPrefix = '';
     }
     // Protect against \'s, though not \r or \n
     $reImgPrefix = $this->_javascript_quote_string($imgPrefix);
     $reImgId = $this->_javascript_quote_string($imgId);
     $reActionImgName = $this->_javascript_quote_string($actionImgName);
     $rePagename = $this->_javascript_quote_string($pagename);
     //$dimension = $args['pagename'] . "rat";
     $html = HTML::span(array("class" => "rateit-widget", "id" => $imgId));
     for ($i = 0; $i < 2; $i++) {
         $ok[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Ok" . $i . ".png");
         // empty
         $nk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk" . $i . ".png");
         // rated
         $rk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Rk" . $i . ".png");
         // pred
     }
     if (empty($this->userid)) {
         $user = $request->getUser();
         $this->userid = $user->getId();
     }
     if (empty($this->rating)) {
         $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension);
         if (!$this->rating and empty($this->pred)) {
             $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension);
         }
     }
     for ($i = 1; $i <= 10; $i++) {
         $j = $i / 2;
         $a1 = HTML::a(array('href' => "javascript:clickRating('{$reImgPrefix}','{$rePagename}','{$version}'," . "'{$reImgId}','{$dimension}',{$j})"));
         $img_attr = array();
         $img_attr['src'] = $nk[$i % 2];
         if ($this->rating) {
             $img_attr['src'] = $ok[$i % 2];
             $img_attr['onmouseover'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$j},0,1)";
             $img_attr['onmouseout'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$this->rating},0,1)";
         } else {
             if (!$this->rating and $this->pred) {
                 $img_attr['src'] = $rk[$i % 2];
                 $img_attr['onmouseover'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$j},1,1)";
                 $img_attr['onmouseout'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$this->pred},1,1)";
             } else {
                 $img_attr['onmouseover'] = "displayRating('{$reImgId}','{$reImgPrefix}',{$j},0,1)";
                 $img_attr['onmouseout'] = "displayRating('{$reImgId}','{$reImgPrefix}',0,0,1)";
             }
         }
         //$imgName = 'RateIt'.$reImgId.$i;
         $img_attr['id'] = $imgId . $i;
         $img_attr['alt'] = $img_attr['id'];
         $a1->pushContent(HTML::img($img_attr));
         //$a1->addToolTip(_("Rate the topic of this page"));
         $html->pushContent($a1);
         //This adds a space between the rating smilies:
         //if (($i%2) == 0) $html->pushContent("\n");
     }
     $html->pushContent(HTML::Raw("&nbsp;"));
     $a0 = HTML::a(array('href' => "javascript:clickRating('{$reImgPrefix}','{$rePagename}','{$version}'," . "'{$reImgId}','{$dimension}','X')"));
     $msg = _("Cancel your rating");
     $imgprops = array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), 'id' => $imgId . $imgPrefix . 'Cancel', 'alt' => $msg, 'title' => $msg);
     if (!$this->rating) {
         $imgprops['style'] = 'display:none';
     }
     $a0->pushContent(HTML::img($imgprops));
     $a0->addToolTip($msg);
     $html->pushContent($a0);
     /*} elseif ($pred) {
           $msg = _("No opinion");
           $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"),
                                              'id'  => $imgPrefix.'Cancel',
                                              'alt' => $msg)));
           //$a0->addToolTip($msg);
           //$html->pushContent($a0);
       }*/
     $img_attr = array();
     $img_attr['src'] = $WikiTheme->_findData("images/spacer.png");
     $img_attr['id'] = $actionImgName;
     $img_attr['alt'] = $img_attr['id'];
     $img_attr['height'] = 15;
     $img_attr['width'] = 20;
     $html->pushContent(HTML::img($img_attr));
     // Display your current rating if there is one, or the current prediction
     // or the empty widget.
     $pred = empty($this->pred) ? 0 : $this->pred;
     $js = '';
     if (!empty($this->avg)) {
         $js .= "avg['{$reImgId}']={$this->avg}; numusers['{$reImgId}']={$this->numusers};\n";
     }
     if ($this->rating) {
         $js .= "rating['{$reImgId}']={$this->rating}; prediction['{$reImgId}']={$pred};\n";
         $html->pushContent(JavaScript($js . "displayRating('{$reImgId}','{$reImgPrefix}',{$this->rating},0,1);"));
     } elseif (!empty($this->pred)) {
         $js .= "rating['{$reImgId}']=0; prediction['{$reImgId}']={$this->pred};\n";
         $html->pushContent(JavaScript($js . "displayRating('{$reImgId}','{$reImgPrefix}',{$this->pred},1,1);"));
     } else {
         $js .= "rating['{$reImgId}']=0; prediction['{$reImgId}']=0;\n";
         $html->pushContent(JavaScript($js . "displayRating('{$reImgId}','{$reImgPrefix}',0,0,1);"));
     }
     return $html;
 }
Example #20
0
 function _jsFlipAll()
 {
     return JavaScript("\nfunction flipAll(formObj) {\n  var isFirstSet = -1;\n  for (var i=0; i < formObj.length; i++) {\n      fldObj = formObj.elements[i];\n      if ((fldObj.type == 'checkbox') && (fldObj.name.substring(0,2) == 'p[')) { \n         if (isFirstSet == -1)\n           isFirstSet = (fldObj.checked) ? true : false;\n         fldObj.checked = (isFirstSet) ? false : true;\n       }\n   }\n}");
 }
Example #21
0
 function load()
 {
     $this->addMoreHeaders(JavaScript("var ta;\nvar skin = '" . $this->_name . "';\n"));
     $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("wikibits.js"))));
     if (isBrowserIE()) {
         $ver = browserVersion();
         if ($ver > 5.1 and $ver < 5.9) {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE55Fixes.css'), 'all'));
         } elseif ($ver > 5.5 and $ver < 7.0) {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE60Fixes.css'), 'all'));
         } elseif ($ver >= 7.0) {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE70Fixes.css'), 'all'));
         } else {
             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE50Fixes.css'), 'all'));
         }
         unset($ver);
         $this->addMoreHeaders("\n");
         $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("IEFixes.js"))));
         $this->addMoreHeaders("\n");
         $this->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />'));
     }
     $this->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
     // CSS file defines fonts, colors and background images for this
     // style.  The companion '*-heavy.css' file isn't defined, it's just
     // expected to be in the same directory that the base style is in.
     // This should result in phpwiki-printer.css being used when
     // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
     $this->setDefaultCSS('PhpWiki', array('' => 'monobook.css', 'print' => 'commonPrint.css'));
     // This allows one to manually select "Printer" style (when browsing page)
     // to see what the printer style looks like.
     $this->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
     $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
     $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
     /**
      * The logo image appears on every page and links to the HomePage.
      */
     $this->addImageAlias('logo', 'MonoBook-Logo.png');
     //$this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
     /**
      * The Signature image is shown after saving an edited page. If this
      * is set to false then the "Thank you for editing..." screen will
      * be omitted.
      */
     $this->addImageAlias('signature', "Signature.png");
     // Uncomment this next line to disable the signature.
     $this->addImageAlias('signature', false);
     /*
      * Link icons.
      */
     /*
     $this->setLinkIcon('http');
     $this->setLinkIcon('https');
     $this->setLinkIcon('ftp');
     $this->setLinkIcon('mailto');
     //$this->setLinkIcon('interwiki');
     */
     $this->setLinkIcon('wikiuser');
     //$this->setLinkIcon('*', 'url');
     // front or after
     //$this->setLinkIconAttr('after');
     //$this->setButtonSeparator("\n | ");
     /**
      * WikiWords can automatically be split by inserting spaces between
      * the words. The default is to leave WordsSmashedTogetherLikeSo.
      */
     //$this->setAutosplitWikiWords(false);
     /**
      * Layout improvement with dangling links for mostly closed wiki's:
      * If false, only users with edit permissions will be presented the
      * special wikiunknown class with "?" and Tooltip.
      * If true (default), any user will see the ?, but will be presented
      * the PrintLoginForm on a click.
      */
     $this->setAnonEditUnknownLinks(false);
     /*
      * You may adjust the formats used for formatting dates and times
      * below.  (These examples give the default formats.)
      * Formats are given as format strings to PHP strftime() function See
      * http://www.php.net/manual/en/function.strftime.php for details.
      * Do not include the server's zone (%Z), times are converted to the
      * user's time zone.
      */
     $this->setDateFormat("%B %d, %Y");
     $this->setTimeFormat("%H:%M");
     /*
      * To suppress times in the "Last edited on" messages, give a
      * give a second argument of false:
      */
     //$this->setDateFormat("%B %d, %Y", false);
 }
Example #22
0
 /**
  * HTML widget display
  *
  * This needs to be put in the <body> section of the page.
  *
  * @param pagename    Name of the page to rate
  * @param version     Version of the page to rate (may be "" for current)
  * @param imgPrefix   Prefix of the names of the images that display the rating
  *                    You can have two widgets for the same page displayed at
  *                    once iff the imgPrefix-s are different.
  * @param dimension   Id of the dimension to rate
  * @param small       Makes a smaller ratings widget if non-false
  *
  * Limitations: Currently this can only print the current users ratings.
  *              And only the widget, but no value (for buddies) also.
  */
 function RatingWidgetHtml($pagename, $version, $imgPrefix, $dimension, $small = false)
 {
     global $WikiTheme, $request;
     $imgId = MangleXmlIdentifier($pagename) . $imgPrefix;
     $actionImgName = $imgId . 'RateItAction';
     $dbi =& $GLOBALS['request']->_dbi;
     $version = $dbi->_backend->get_latest_version($pagename);
     //$rdbi =& $this->_rdbi;
     $rdbi = RatingsDb::getTheRatingsDb();
     // check if the imgPrefix icons exist.
     if (!$WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk0.png", true)) {
         $imgPrefix = '';
     }
     // Protect against 's, though not \r or \n
     $reImgPrefix = $this->_javascript_quote_string($imgPrefix);
     $reActionImgName = $this->_javascript_quote_string($actionImgName);
     $rePagename = $this->_javascript_quote_string($pagename);
     //$dimension = $args['pagename'] . "rat";
     $html = HTML::span(array("id" => $imgId));
     for ($i = 0; $i < 2; $i++) {
         $nk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk" . $i . ".png");
         $none[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Rk" . $i . ".png");
     }
     $user = $request->getUser();
     $userid = $user->getId();
     //if (!isset($args['rating']))
     $rating = $rdbi->getRating($userid, $pagename, $dimension);
     if (!$rating) {
         $pred = $rdbi->getPrediction($userid, $pagename, $dimension);
     }
     for ($i = 1; $i <= 10; $i++) {
         $a1 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',' . $i / 2 . ')'));
         $img_attr = array();
         $img_attr['src'] = $nk[$i % 2];
         //if (!$rating and !$pred)
         //  $img_attr['src'] = $none[$i%2];
         $img_attr['name'] = $imgPrefix . $i;
         $img_attr['alt'] = $img_attr['name'];
         $img_attr['border'] = 0;
         $a1->pushContent(HTML::img($img_attr));
         $a1->addToolTip(_("Rate the topic of this page"));
         $html->pushContent($a1);
         //This adds a space between the rating smilies:
         // if (($i%2) == 0) $html->pushContent(' ');
     }
     $html->pushContent(HTML::Raw('&nbsp;'));
     $a0 = HTML::a(array('href' => 'javascript:click(\'' . $reActionImgName . '\',\'' . $rePagename . '\',\'' . $version . '\',\'' . $reImgPrefix . '\',\'' . $dimension . '\',\'X\')'));
     $msg = _("Cancel rating");
     $a0->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), 'name' => $imgPrefix . 'Cancel', 'alt' => $msg)));
     $a0->addToolTip($msg);
     $html->pushContent($a0);
     /*} elseif ($pred) {
           $msg = _("No opinion");
           $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"),
                                              'name'=> $imgPrefix.'Cancel',
                                              'alt' => $msg)));
           //$a0->addToolTip($msg);
           //$html->pushContent($a0);
       }*/
     $img_attr = array();
     $img_attr['src'] = $WikiTheme->_findData("images/RateItAction.png");
     $img_attr['name'] = $actionImgName;
     $img_attr['alt'] = $img_attr['name'];
     //$img_attr['class'] = 'k' . $i;
     $img_attr['border'] = 0;
     $html->pushContent(HTML::img($img_attr));
     // Display the current rating if there is one
     if ($rating) {
         $html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',' . $rating . ',0)'));
     } elseif ($pred) {
         $html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',' . $pred . ',1)'));
     } else {
         $html->pushContent(JavaScript('displayRating(\'' . $reImgPrefix . '\',0,0)'));
     }
     return $html;
 }
Example #23
0
 function _doautocomplete(&$form, $inputtype, &$input, &$values)
 {
     global $request;
     $input['class'] = "dropdown";
     $input['acdropdown'] = "true";
     //$input['autocomplete'] = "OFF";
     $input['autocomplete_complete'] = "true";
     // only match begin: autocomplete_matchbegin, or
     $input['autocomplete_matchsubstring'] = "true";
     if (empty($values)) {
         if ($input['method']) {
             if (empty($input['args'])) {
                 if (preg_match("/^(.*?) (.*)\$/", $input['method'], $m)) {
                     $input['method'] = $m[1];
                     $input['args'] = $m[2];
                 } else {
                     $input['args'] = null;
                 }
             }
             static $tmpArray = 'tmpArray00';
             // deferred remote xmlrpc call
             if (string_starts_with($input['method'], "dynxmlrpc:")) {
                 // how is server + method + args encoding parsed by acdropdown?
                 $input['autocomplete_list'] = substr($input['method'], 3);
                 if ($input['args']) {
                     $input['autocomplete_list'] .= " " . $input['args'];
                 }
                 // static xmlrpc call, local only
             } elseif (string_starts_with($input['method'], "xmlrpc:")) {
                 include_once "lib/XmlRpcClient.php";
                 $values = wiki_xmlrpc_post(substr($input['method'], 7), $input['args']);
             } elseif (string_starts_with($input['method'], "url:")) {
                 include_once "lib/HttpClient.php";
                 $html = HttpClient::quickGet(substr($input['method'], 4));
                 //TODO: how to parse the HTML result into a list?
             } elseif (string_starts_with($input['method'], "dynurl:")) {
                 $input['autocomplete_list'] = substr($input['method'], 3);
             } elseif (string_starts_with($input['method'], "plugin:")) {
                 $dbi = $request->getDbh();
                 $pluginName = substr($input['method'], 7);
                 $basepage = '';
                 require_once "lib/WikiPlugin.php";
                 $w = new WikiPluginLoader();
                 $p = $w->getPlugin($pluginName, false);
                 // second arg?
                 if (!is_object($p)) {
                     trigger_error("invalid input['method'] " . $input['method'], E_USER_WARNING);
                 }
                 $pagelist = $p->run($dbi, @$input['args'], $request, $basepage);
                 $values = array();
                 if (is_object($pagelist) and isa($pagelist, 'PageList')) {
                     foreach ($pagelist->_pages as $page) {
                         if (is_object($page)) {
                             $values[] = $page->getName();
                         } else {
                             $values[] = (string) $page;
                         }
                     }
                 }
             } elseif (string_starts_with($input['method'], "array:")) {
                 // some predefined values (e.g. in a template or themeinfo.php)
                 $input['autocomplete_list'] = $input['method'];
             } else {
                 trigger_error("invalid input['method'] " . $input['method'], E_USER_WARNING);
             }
             if (empty($input['autocomplete_list'])) {
                 $tmpArray++;
                 $input['autocomplete_list'] = "array:" . $tmpArray;
                 $svalues = empty($values) ? "" : join("','", $values);
                 $form->pushContent(JavaScript("var {$tmpArray} = new Array('" . $svalues . "')"));
             }
             if (count($values) == 1) {
                 $input['value'] = $values[0];
             } else {
                 $input['value'] = "";
             }
             unset($input['method']);
             unset($input['args']);
             //unset($input['autocomplete']);
         } elseif ($s = $request->getArg($input['name'])) {
             $input['value'] = $s;
         }
     }
     return true;
 }
 function NoIndex($String)
 {
     $String = JavaScript($String, True);
     $String = "<!-- This text shouldn't be indexed //-->\n" . $String;
     return $String;
 }
 function button_popup($name, $value = "", $class = "", $JavaScript = "", $title = "")
 {
     if (!function_exists("javascript")) {
         require_once "javascript.inc.php";
     }
     $class != "" ? $class = " class=\"" . $class . "\"" : ($class = "");
     $JavaScript != "" ? $JavaScript = " onClick=\"" . addslashes($JavaScript) . "\"" : ($JavaScript = "");
     $title != "" ? $title = " title=\"" . htmlentities($title) . "\"" : ($title = "");
     return JavaScript("document.write('<input type=\"button\" name=\"" . $name . "\" value=\"" . $value . "\"" . $class . $JavaScript . $title . " />');") . "<noscript>&nbsp;</noscript>";
 }
Example #26
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     extract($args);
     $html = HTML();
     $js = JavaScript('', array('src' => $WikiTheme->_findData('ASCIIsvg.js')));
     $html->pushContent($js);
     $values = explode(",", $data);
     // x_min = 0
     // x_max = number of elements in data
     // y_min = 0 or smallest element in data if negative
     // y_max = biggest element in data
     $x_max = sizeof($values) + 1;
     $y_min = min($values);
     if ($y_min > 0) {
         $y_min = 0;
     }
     $y_max = max($values);
     // sum is used for the pie only, so we ignore negative values
     $sum = 0;
     foreach ($values as $value) {
         if ($value > 0) {
             $sum += $value;
         }
     }
     $source = 'initPicture(0,' . $x_max . ',' . $y_min . ',' . $y_max . '); axes(); stroke = "' . $color . '"; strokewidth = 5;';
     if ($type == "bar") {
         $abscisse = 1;
         $source .= 'strokewidth = 10; ';
         foreach ($values as $value) {
             $source .= 'point1 = [' . $abscisse . ', 0];' . 'point2 = [' . $abscisse . ',' . $value . '];' . 'line(point1, point2);';
             $abscisse += 1;
         }
     } else {
         if ($type == "line") {
             $abscisse = 0;
             $source .= 'strokewidth = 3; p = []; ';
             foreach ($values as $value) {
                 $source .= 'for (t = 1; t < 1.01; t += 1) p[p.length] = [' . $abscisse . ', t*' . trim($value) . '];';
                 $abscisse += 1;
             }
             $source .= 'path(p);';
         } else {
             if ($type == "pie") {
                 $source = 'initPicture(-1.1,1.1,-1.1,1.1); stroke = "' . $color . '"; strokewidth = 1;' . 'center = [0, 0]; circle(center, 1);' . 'point = [1, 0]; line(center, point);';
                 $angle = 0;
                 foreach ($values as $value) {
                     if ($value > 0) {
                         $angle += $value / $sum;
                         $source .= 'point = [cos(2*pi*' . $angle . '), sin(2*pi*' . $angle . ')]; line(center, point);';
                     }
                 }
             }
         }
     }
     $embedargs = array('width' => $args['width'], 'height' => $args['height'], 'script' => $source);
     $embed = new SVG_HTML("embed", $embedargs);
     $html->pushContent($embed);
     return $html;
 }
Example #27
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($Longitude === '') {
         return $this->error(fmt("%s parameter missing", "'Longitude'"));
     }
     if ($Latitude === '') {
         return $this->error(fmt("%s parameter missing", "'Latitude'"));
     }
     $maps = JavaScript('', array('src' => "http://maps.google.com/maps?file=api&v=1&key=" . GOOGLE_LICENSE_KEY));
     $id = GenerateId("googlemap");
     switch ($MapType) {
         case "Satellite":
             $type = "_SATELLITE_TYPE";
             break;
         case "Map":
             $type = "_MAP_TYPE";
             break;
         case "Hybrid":
             $type = "_HYBRID_TYPE";
             break;
         default:
             return $this->error(sprintf(_("invalid argument %s"), $MapType));
     }
     $div = HTML::div(array('id' => $id, 'style' => 'width: ' . $width . '; height: ' . $height));
     // TODO: Check for multiple markers or polygons
     if (!$InfoText) {
         $Marker = false;
     }
     // Create a marker whose info window displays the given text
     if ($Marker) {
         if ($InfoText) {
             include_once "lib/BlockParser.php";
             $page = $dbi->getPage($request->getArg('pagename'));
             $rev = $page->getCurrentRevision(false);
             $markup = $rev->get('markup');
             $markertext = TransformText($InfoText, $markup, $basepage);
         }
         $markerjs = JavaScript("\nfunction createMarker(point, text) {\n  var marker = new GMarker(point);\n  var html = text + \"<br><br><font size='-1'>[" . _("new&nbsp;window") . "]</font>\";\n  GEvent.addListener(marker, \"click\", function() {marker.openInfoWindowHtml(html);});\n  return marker;\n}");
     }
     $run = JavaScript("\nvar map = new GMap(document.getElementById('" . $id . "'));\n" . ($SmallMapControl ? "map.addControl(new GSmallMapControl());\n" : "map.addControl(new GLargeMapControl());\n") . "\nmap.addControl(new GMapTypeControl());\nmap.centerAndZoom(new GPoint(" . $Longitude . ", " . $Latitude . "), " . $ZoomFactor . ");\nmap.setMapType(" . $type . ");" . ($Marker ? "\nvar point = new GPoint(" . $Longitude . "," . $Latitude . ");\nvar marker = createMarker(point, '" . $markertext->asXml() . "'); map.addOverlay(marker);" : ""));
     if ($Marker) {
         return HTML($markerjs, $maps, $div, $run);
     } else {
         return HTML($maps, $div, $run);
     }
 }
Example #28
0
 function Textarea_Create($textarea, $wikitext, $name = 'edit[content]')
 {
     $htmltextid = $name;
     $out = HTML(JavaScript("\nvar oFCKeditor = new FCKeditor( '{$htmltextid}' ) ;\noFCKeditor.Value\t= '" . $textarea->_content[0]->asXML() . "';" . $this->_jsdefault . "\noFCKeditor.Create();"), HTML::div(array("id" => $this->_wikitextid, 'style' => 'display:none'), $wikitext), "\n");
     return $out;
 }
Example #29
0
        }
        if ($version) {
            $attr['version'] = $version;
        }
        if ($action == 'browse') {
            unset($attr['action']);
        }
        return $this->makeButton($label, WikiURL($pagename, $attr), $class);
    }
}
$WikiTheme = new Theme_MonoBook('MonoBook');
$WikiTheme->addMoreHeaders(JavaScript('', array('src' => $WikiTheme->_findData("wikibits.js"))));
if (isBrowserIE()) {
    $WikiTheme->addMoreHeaders($WikiTheme->_CSSlink(0, $WikiTheme->_findFile('IEFixes.css'), 'all'));
    $WikiTheme->addMoreHeaders("\n");
    $WikiTheme->addMoreHeaders(JavaScript('', array('src' => $WikiTheme->_findData("IEFixes.js"))));
    $WikiTheme->addMoreHeaders("\n");
    $WikiTheme->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />'));
}
$WikiTheme->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
// CSS file defines fonts, colors and background images for this
// style.  The companion '*-heavy.css' file isn't defined, it's just
// expected to be in the same directory that the base style is in.
// This should result in phpwiki-printer.css being used when
// printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
$WikiTheme->setDefaultCSS('PhpWiki', array('' => 'monobook.css', 'print' => 'commonPrint.css'));
// This allows one to manually select "Printer" style (when browsing page)
// to see what the printer style looks like.
$WikiTheme->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
$WikiTheme->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
$WikiTheme->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');