当前位置: 首页>>代码示例>>PHP>>正文


PHP Button函数代码示例

本文整理汇总了PHP中Button函数的典型用法代码示例。如果您正苦于以下问题:PHP Button函数的具体用法?PHP Button怎么用?PHP Button使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Button函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PurgePage

function PurgePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML::p(array('class' => 'error'), _("Sorry, this page does not exist."));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $purgeB = Button('submit:verify', _("Purge Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $fieldset = HTML::fieldset(HTML::p(fmt("You are about to purge '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'purge')), HTML::div(array('class' => 'toolbar'), $purgeB, $WikiTheme->getButtonSeparator(), $cancelB)));
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html = HTML($fieldset, HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::p(array('class' => 'error'), _("Someone has edited the page!")), HTML::p(fmt("Since you started the purge process, someone has saved a new version of %s.  Please check to make sure you still want to permanently purge the page from the database.", $pagelink)));
    } else {
        // Real purge.
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->purgePage($pagename);
        $dbi->touch();
        $html = HTML::div(array('class' => 'feedback'), fmt("Purged page '%s' successfully.", $pagename));
    }
    GeneratePage($html, _("Purge Page"));
}
开发者ID:hugcoday,项目名称:wiki,代码行数:35,代码来源:purgepage.php

示例2: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $request->setArg('action', false);
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($goto = $request->getArg('goto')) {
         // The user has pressed 'Go'; process request
         $request->setArg('goto', false);
         $target = $goto['target'];
         if ($dbi->isWikiPage($target)) {
             $url = WikiURL($target, 0, 1);
         } else {
             $url = WikiURL($target, array('action' => 'edit'), 1);
         }
         $request->redirect($url);
         // User should see nothing after redirect
         return '';
     }
     $action = $request->getURLtoSelf();
     $form = HTML::form(array('action' => $action, 'method' => 'post'));
     $form->pushContent(HiddenInputs($request->getArgs()));
     $textfield = HTML::input(array('type' => 'text', 'size' => $size, 'name' => 'goto[target]'));
     $button = Button('submit:goto[go]', _("Go"), false);
     $form->pushContent($textfield, $button);
     return $form;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:26,代码来源:GoTo.php

示例3: RemovePage

function RemovePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s.  Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
    } else {
        // Codendi specific: remove the deleted wiki page from ProjectWantedPages
        $projectPageName = 'ProjectWantedPages';
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        require_once PHPWIKI_DIR . "/lib/loadsave.php";
        $pagehandle = $dbi->getPage($projectPageName);
        if ($pagehandle->exists()) {
            // don't replace default contents
            $current = $pagehandle->getCurrentRevision();
            $version = $current->getVersion();
            $text = $current->getPackedContent();
            $meta = $current->_data;
        }
        $text = str_replace("* [{$pagename}]", "", $text);
        $meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
        $meta['author'] = user_getname();
        $pagehandle->save($text, $version + 1, $meta);
        //Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
        require_once 'common/wiki/lib/WikiPage.class.php';
        $wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
        $wiki_page->resetPermissions();
        // Real delete.
        //$pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->deletePage($pagename);
        $dbi->touch();
        $link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
        $html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
    }
    GeneratePage($html, _("Remove Page"));
}
开发者ID:nterray,项目名称:tuleap,代码行数:57,代码来源:removepage.php

示例4: showNotify

 function showNotify(&$request, $messages, $page, $pagelist, $verified)
 {
     $isNecessary = !$this->contains($pagelist, $page);
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs(array('verify' => 1)), HiddenInputs($request->getArgs(), false, array('verify')), $messages, HTML::p(_("Your current watchlist: "), $this->showWatchList($pagelist)));
     if ($isNecessary) {
         $form->pushContent(HTML::p(_("New watchlist: "), $this->showWatchList($this->addpagelist($page, $pagelist))), HTML::p(sprintf(_("Do you %s want to add this page \"%s\" to your WatchList?"), $verified ? _("really") : "", $page)), HTML::p(Button('submit:add', _("Yes")), HTML::Raw(' '), Button('submit:cancel', _("Cancel"))));
     } else {
         $form->pushContent(HTML::p(fmt("The page %s is already watched!", $page)), HTML::p(Button('submit:edit', _("Edit")), HTML::Raw(' '), Button('submit:cancel', _("Cancel"))));
     }
     $fieldset = HTML::fieldset(HTML::legend("Watch Page"), $form);
     return $fieldset;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:12,代码来源:WatchPage.php

示例5: showForm

 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;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:15,代码来源:SemanticSearchAdvanced.php

示例6: showForm

 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 == ' => ') ? ' <= ' : ' => '\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;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:39,代码来源:LinkSearch.php

示例7: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     // no action=replace support yet
     if ($request->getArg('action') != 'browse') {
         return $this->disabled("(action != 'browse')");
     }
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     //TODO: support p from <!plugin-list !>
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     if (!$p) {
         $p = $this->_list;
     }
     $post_args = $request->getArg('admin_replace');
     $next_action = 'select';
     $pages = array();
     if ($p && !$request->isPost()) {
         $pages = $p;
     }
     if ($p && $request->isPost() && empty($post_args['cancel'])) {
         // without individual PagePermissions:
         if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
             $request->_notAuthorized(WIKIAUTH_ADMIN);
             $this->disabled("! user->isAdmin");
         }
         if ($post_args['action'] == 'verify' and !empty($post_args['from'])) {
             // Real action
             return $this->searchReplacePages($dbi, $request, array_keys($p), $post_args['from'], $post_args['to']);
         }
         if ($post_args['action'] == 'select') {
             if (!empty($post_args['from'])) {
                 $next_action = 'verify';
             }
             foreach ($p as $name => $c) {
                 $pages[$name] = 1;
             }
         }
     }
     if ($next_action == 'select' and empty($pages)) {
         // List all pages to select from.
         //TODO: check for permissions and list only the allowed
         $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
     }
     if ($next_action == 'verify') {
         $args['info'] = "checkbox,pagename,hi_content";
     }
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array_merge($args, array('types' => array('hi_content' => new _PageList_Column_content('rev:hi_content', _("Content"))))));
     $pagelist->addPageList($pages);
     $header = HTML::p();
     if (empty($post_args['from'])) {
         $header->pushContent(HTML::p(HTML::em(_("Warning: The search string cannot be empty!"))));
     }
     if ($next_action == 'verify') {
         $button_label = _("Yes");
         $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently search & replace text in the selected files?"))));
         $this->replaceForm($header, $post_args);
     } else {
         $button_label = _("Search & Replace");
         $this->replaceForm($header, $post_args);
         $header->pushContent(HTML::p(_("Select the pages to search:")));
     }
     $buttons = HTML::p(Button('submit:admin_replace[rename]', $button_label, 'wikiadmin'), Button('submit:admin_replace[cancel]', _("Cancel"), 'button'));
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_replace')), HiddenInputs(array('admin_replace[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:65,代码来源:WikiAdminSearchReplace.php

示例8: authorContribs

 function authorContribs($rev)
 {
     $author = $rev->get('author');
     if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/", $author)) {
         return '';
     }
     return HTML('(', Button(array('action' => _("RecentChanges"), 'format' => 'contribs', 'author' => $author, 'days' => 360), _("contribs"), $author), ' | ', Button(array('action' => _("RecentChanges"), 'format' => 'contribs', 'owner' => $author, 'days' => 360), _("new pages"), $author), ')');
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:8,代码来源:RecentChanges.php

示例9: run


//.........这里部分代码省略.........
                     }
                     if (empty($values)) {
                         if ($input['method']) {
                             $input['value'] = xmlrequest($input['method']);
                         } elseif ($s = $request->getArg($input['name'])) {
                             $input['value'] = $s;
                         }
                     } elseif (is_array($values)) {
                         $name = $input['name'];
                         unset($input['name']);
                         foreach ($values as $val) {
                             $input = array('value' => $val);
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['selected'] = 'selected';
                                 } else {
                                     unset($input['selected']);
                                 }
                             }
                             //$select->pushContent(HTML::option($input, $val));
                         }
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     break;
                 case 'pulldown':
                     $values = $input['value'];
                     unset($input['value']);
                     unset($input['type']);
                     $select = HTML::select($input);
                     if (is_string($values)) {
                         $values = explode(",", $values);
                     }
                     if (empty($values) and $s = $request->getArg($input['name'])) {
                         $select->pushContent(HTML::option(array('value' => $s), $s));
                     } elseif (is_array($values)) {
                         $name = $input['name'];
                         unset($input['name']);
                         foreach ($values as $val) {
                             $input = array('value' => $val);
                             if ($request->getArg($name)) {
                                 if ($request->getArg($name) == $val) {
                                     $input['selected'] = 'selected';
                                 } else {
                                     unset($input['selected']);
                                 }
                             }
                             $select->pushContent(HTML::option($input, $val));
                         }
                     }
                     $form->pushContent($text, $nbsp, $select);
                     break;
                 case 'reset':
                 case 'hidden':
                     $form->pushContent(HTML::input($input));
                     break;
                     // change the order of inputs, by explicitly placing a submit button here.
                 // change the order of inputs, by explicitly placing a submit button here.
                 case 'submit':
                     //$input['type'] = 'submit';
                     if (empty($input['value'])) {
                         $input['value'] = $buttontext ? $buttontext : $action;
                     }
                     unset($input['text']);
                     if (empty($input['class'])) {
                         $input['class'] = $class;
                     }
                     if ($nobr) {
                         $form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
                     } else {
                         $form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
                     }
                     // unset the default submit button
                     $already_submit = 1;
                     break;
             }
         }
     }
     if ($request->getArg('start_debug')) {
         $form->pushContent(HTML::input(array('name' => 'start_debug', 'value' => $request->getArg('start_debug'), 'type' => 'hidden')));
     }
     if (!USE_PATH_INFO) {
         $form->pushContent(HiddenInputs(array('pagename' => $basepage)));
     }
     if (!$already_submit) {
         if (empty($buttontext)) {
             $buttontext = $action;
         }
         $submit = Button('submit:', $buttontext, $class);
         if ($cancel) {
             $form->pushContent(HTML::span(array('class' => $class), $submit, Button('submit:cancel', _("Cancel"), $class)));
         } else {
             $form->pushContent(HTML::span(array('class' => $class), $submit));
         }
     }
     return $form;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:101,代码来源:WikiFormRich.php

示例10: getFormElements

 function getFormElements()
 {
     global $WikiTheme;
     $request =& $this->request;
     $page =& $this->page;
     $h = array('action' => 'edit', 'pagename' => $page->getName(), 'version' => $this->version, 'edit[pagetype]' => $this->meta['pagetype'], 'edit[current_version]' => $this->_currentVersion);
     $el['HIDDEN_INPUTS'] = HiddenInputs($h);
     $el['EDIT_TEXTAREA'] = $this->getTextArea();
     if (ENABLE_CAPTCHA) {
         $el = array_merge($el, $this->Captcha->getFormElements());
     }
     $el['SUMMARY_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit[summary]', 'name' => 'edit[summary]', 'size' => 50, 'maxlength' => 256, 'value' => $this->meta['summary']));
     $el['MINOR_EDIT_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[minor_edit]', 'id' => 'edit[minor_edit]', 'checked' => (bool) $this->meta['is_minor_edit']));
     $el['OLD_MARKUP_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[markup]', 'value' => 'old', 'checked' => $this->meta['markup'] < 2.0, 'id' => 'useOldMarkup', 'onclick' => 'showOldMarkupRules(this.checked)'));
     $el['OLD_MARKUP_CONVERT'] = $this->meta['markup'] < 2.0 ? Button('submit:edit[edit_convert]', _("Convert"), 'wikiaction') : '';
     $el['LOCKED_CB'] = HTML::input(array('type' => 'checkbox', 'name' => 'edit[locked]', 'id' => 'edit[locked]', 'disabled' => (bool) (!$this->user->isadmin()), 'checked' => (bool) $this->locked));
     $el['PREVIEW_B'] = Button('submit:edit[preview]', _("Preview"), 'wikiaction');
     //if (!$this->isConcurrentUpdate() && $this->canEdit())
     $el['SAVE_B'] = Button('submit:edit[save]', _("Save"), 'wikiaction');
     $el['IS_CURRENT'] = $this->version == $this->current->getVersion();
     $el['WIDTH_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editWidth]', 'id' => 'pref[editWidth]', 'value' => $request->getPref('editWidth'), 'onchange' => 'this.form.submit();'));
     $el['HEIGHT_PREF'] = HTML::input(array('type' => 'text', 'size' => 3, 'maxlength' => 4, 'class' => "numeric", 'name' => 'pref[editHeight]', 'id' => 'pref[editHeight]', 'value' => $request->getPref('editHeight'), 'onchange' => 'this.form.submit();'));
     $el['SEP'] = $WikiTheme->getButtonSeparator();
     $el['AUTHOR_MESSAGE'] = fmt("Author will be logged as %s.", HTML::em($this->user->getId()));
     return $el;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:26,代码来源:editpage.php

示例11: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if ($exclude) {
         if (!is_array($exclude)) {
             $exclude = explode(',', $exclude);
         }
     }
     if ($page == _("WantedPages")) {
         $page = "";
     }
     // The PageList class can't handle the 'count' column needed
     // for this table
     $this->pagelist = array();
     // There's probably a more memory-efficient way to do this (eg
     // a tailored SQL query via the backend, but this gets the job
     // done.
     if (!$page) {
         $include_empty = false;
         $allpages_iter = $dbi->getAllPages($include_empty, $sortby, $limit);
         while ($page_handle = $allpages_iter->next()) {
             $name = $page_handle->getName();
             if ($name == _("InterWikiMap")) {
                 continue;
             }
             if (!in_array($name, $exclude)) {
                 $this->_iterateLinks($page_handle, $dbi);
             }
         }
     } else {
         if ($page && ($pageisWikiPage = $dbi->isWikiPage($page))) {
             //only get WantedPages links for one page
             $page_handle = $dbi->getPage($page);
             $this->_iterateLinks($page_handle, $dbi);
             if (!$request->getArg('count')) {
                 $args['count'] = count($this->pagelist);
             } else {
                 $args['count'] = $request->getArg('count');
             }
         }
     }
     ksort($this->pagelist);
     arsort($this->pagelist);
     $this->_rows = HTML();
     $caption = false;
     $this->_messageIfEmpty = _("<none>");
     if ($page) {
         // link count always seems to be 1 for a single page so
         // omit count column
         foreach ($this->pagelist as $key => $val) {
             $row = HTML::li(WikiLink((string) $key, 'unknown'));
             $this->_rows->pushContent($row);
         }
         if (!$noheader) {
             if ($pageisWikiPage) {
                 $pagelink = WikiLink($page);
             } else {
                 $pagelink = WikiLink($page, 'unknown');
             }
             $c = count($this->pagelist);
             $caption = fmt("Wanted Pages for %s (%d total):", $pagelink, $c);
         }
         return $this->_generateList($caption);
     } else {
         $spacer = new RawXml("&nbsp;&nbsp;&nbsp;&nbsp;");
         // Clicking on the number in the links column does a
         // FullTextSearch for the citations of the WantedPage
         // link.
         foreach ($this->pagelist as $key => $val) {
             $key = (string) $key;
             // TODO: Not sure why, but this
             // string cast type-coersion
             // does seem necessary here.
             // Enclose any FullTextSearch keys containing a space
             // with quotes in oder to request a defnitive search.
             $searchkey = strstr($key, ' ') === false ? $key : "\"{$key}\"";
             $row = HTML::tr(HTML::td(array('align' => 'right'), Button(array('s' => $searchkey), $val, _("FullTextSearch")), HTML::td(HTML($spacer, WikiLink($key, 'unknown')))));
             $this->_rows->pushContent($row);
         }
         $c = count($this->pagelist);
         if (!$noheader) {
             $caption = sprintf(_("Wanted Pages in this wiki (%d total):"), $c);
         }
         $this->_columns = array(_("Count"), _("Page Name"));
         if ($c > 0) {
             return $this->_generateTable($caption);
         } else {
             return HTML(HTML::p($caption), HTML::p($messageIfEmpty));
         }
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:91,代码来源:WantedPagesOld.php

示例12: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     return $this->disabled("This action is blocked by administrator. Sorry for the inconvenience !");
     if (!DEBUG) {
         return $this->disabled("WikiAdminChmod not yet enabled. Set DEBUG to try it.");
     }
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     if (!$p) {
         $p = $this->_list;
     }
     $post_args = $request->getArg('admin_chmod');
     $next_action = 'select';
     $pages = array();
     if ($p && !$request->isPost()) {
         $pages = $p;
     }
     if ($p && $request->isPost() && !empty($post_args['chmod']) && empty($post_args['cancel'])) {
         // without individual PagePermissions:
         if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
             $request->_notAuthorized(WIKIAUTH_ADMIN);
             $this->disabled("! user->isAdmin");
         }
         if ($post_args['action'] == 'verify') {
             // Real action
             return $this->chmodPages($dbi, $request, array_keys($p), $post_args['perm']);
         }
         if ($post_args['action'] == 'select') {
             if (!empty($post_args['perm'])) {
                 $next_action = 'verify';
             }
             foreach ($p as $name => $c) {
                 $pages[$name] = 1;
             }
         }
     }
     if ($next_action == 'select' and empty($pages)) {
         // List all pages to select from.
         $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
     }
     if ($next_action == 'verify') {
         $args['info'] = "checkbox,pagename,perm,author,mtime";
     }
     $args['types'] = array('perm' => new _PageList_Column_chmod_perm('perm', _("Permission")));
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args);
     $pagelist->addPageList($pages);
     $header = HTML::p();
     if ($next_action == 'verify') {
         $button_label = _("Yes");
         $header = $this->chmodForm($header, $post_args);
         $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently change the selected files?"))));
     } else {
         $button_label = _("Chmod");
         $header = $this->chmodForm($header, $post_args);
         $header->pushContent(HTML::p(_("Select the pages to change:")));
     }
     $buttons = HTML::p(Button('submit:admin_chmod[chmod]', $button_label, 'wikiadmin'), Button('submit:admin_chmod[cancel]', _("Cancel"), 'button'));
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_chmod')), HiddenInputs(array('admin_chmod[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:61,代码来源:WikiAdminChmod.php

示例13: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     if (is_array($argstr)) {
         // can do with array also.
         $args =& $argstr;
         if (!isset($args['order'])) {
             $args['order'] = 'reverse';
         }
     } else {
         $args = $this->getArgs($argstr, $request);
     }
     $user = $request->getUser();
     if (empty($args['user'])) {
         if ($user->isAuthenticated()) {
             $args['user'] = $user->UserName();
         } else {
             $args['user'] = '';
         }
     }
     if (!$args['user'] or $args['user'] == ADMIN_USER) {
         if (BLOG_DEFAULT_EMPTY_PREFIX) {
             $args['user'] = '';
             // "Blogs/day" pages
         } else {
             $args['user'] = ADMIN_USER;
             // "Admin/Blogs/day" pages
         }
     }
     $parent = empty($args['user']) ? '' : $args['user'] . SUBPAGE_SEPARATOR;
     $sp = HTML::Raw('&middot; ');
     $prefix = $base = $parent . $this->_blogPrefix('wikiblog');
     if ($args['month']) {
         $prefix .= SUBPAGE_SEPARATOR . $args['month'];
     }
     $pages = $dbi->titleSearch(new TextSearchQuery("^" . $prefix . SUBPAGE_SEPARATOR, true, 'posix'));
     $html = HTML();
     $i = 0;
     while ($page = $pages->next() and $i < $args['count']) {
         $rev = $page->getCurrentRevision(false);
         if ($rev->get('pagetype') != 'wikiblog') {
             continue;
         }
         $i++;
         $blog = $this->_blog($rev);
         //$html->pushContent(HTML::h3(WikiLink($page, 'known', $rev->get('summary'))));
         $html->pushContent($rev->getTransformedContent('wikiblog'));
     }
     if ($args['user'] == $user->UserName() or $args['user'] == '') {
         $html->pushContent(Button(array('action' => 'WikiBlog', 'mode' => 'add'), _("New entry"), $base));
     }
     if (!$i) {
         return HTML(HTML::h3(_("No Blog Entries")), $html);
     }
     if (!$args['noheader']) {
         return HTML(HTML::h3(sprintf(_("Blog Entries for %s:"), $this->_monthTitle($args['month']))), $html);
     } else {
         return $html;
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:59,代码来源:BlogJournal.php

示例14: showDiff

function showDiff(&$request)
{
    $pagename = $request->getArg('pagename');
    if (is_array($versions = $request->getArg('versions'))) {
        // Version selection from pageinfo.php display:
        rsort($versions);
        list($version, $previous) = $versions;
    } else {
        $version = $request->getArg('version');
        $previous = $request->getArg('previous');
    }
    // abort if page doesn't exist
    $dbi = $request->getDbh();
    $page = $request->getPage();
    $current = $page->getCurrentRevision(false);
    if ($current->getVersion() < 1) {
        $html = HTML::div(array('class' => 'wikitext', 'id' => 'difftext'), HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))));
        require_once 'lib/Template.php';
        GeneratePage($html, sprintf(_("Diff: %s"), $pagename), false);
        return;
        //early return
    }
    if ($version) {
        if (!($new = $page->getRevision($version))) {
            NoSuchRevision($request, $page, $version);
        }
        $new_version = fmt("version %d", $version);
    } else {
        $new = $current;
        $new_version = _("current version");
    }
    if (preg_match('/^\\d+$/', $previous)) {
        if (!($old = $page->getRevision($previous))) {
            NoSuchRevision($request, $page, $previous);
        }
        $old_version = fmt("version %d", $previous);
        $others = array('major', 'minor', 'author');
    } else {
        switch ($previous) {
            case 'author':
                $old = $new;
                while ($old = $page->getRevisionBefore($old)) {
                    if ($old->get('author') != $new->get('author')) {
                        break;
                    }
                }
                $old_version = _("revision by previous author");
                $others = array('major', 'minor');
                break;
            case 'minor':
                $previous = 'minor';
                $old = $page->getRevisionBefore($new);
                $old_version = _("previous revision");
                $others = array('major', 'author');
                break;
            case 'major':
            default:
                $old = $new;
                while ($old && $old->get('is_minor_edit')) {
                    $old = $page->getRevisionBefore($old);
                }
                if ($old) {
                    $old = $page->getRevisionBefore($old);
                }
                $old_version = _("predecessor to the previous major change");
                $others = array('minor', 'author');
                break;
        }
    }
    $new_link = WikiLink($new, '', $new_version);
    $old_link = $old ? WikiLink($old, '', $old_version) : $old_version;
    $page_link = WikiLink($page);
    $html = HTML::div(array('class' => 'wikitext', 'id' => 'difftext'), HTML::p(fmt("Differences between %s and %s of %s.", $new_link, $old_link, $page_link)));
    $otherdiffs = HTML::p(_("Other diffs:"));
    $label = array('major' => _("Previous Major Revision"), 'minor' => _("Previous Revision"), 'author' => _("Previous Author"));
    foreach ($others as $other) {
        $args = array('action' => 'diff', 'previous' => $other);
        if ($version) {
            $args['version'] = $version;
        }
        if (count($otherdiffs->getContent()) > 1) {
            $otherdiffs->pushContent(", ");
        } else {
            $otherdiffs->pushContent(" ");
        }
        $otherdiffs->pushContent(Button($args, $label[$other]));
    }
    $html->pushContent($otherdiffs);
    if ($old and $old->getVersion() == 0) {
        $old = false;
    }
    $html->pushContent(HTML::Table(PageInfoRow(_("Newer page:"), $new, $request, empty($version)), PageInfoRow(_("Older page:"), $old, $request, false)));
    if ($new && $old) {
        $diff = new Diff($old->getContent(), $new->getContent());
        if ($diff->isEmpty()) {
            $html->pushContent(HTML::hr(), HTML::p(_("Content of versions "), $old->getVersion(), _(" and "), $new->getVersion(), _(" is identical.")));
            // If two consecutive versions have the same content, it is because the page was
            // renamed, or metadata changed: ACL, owner, markup.
            // We give the reason by printing the summary.
            if ($new->getVersion() - $old->getVersion() == 1) {
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:diff.php

示例15: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     if ($request->getArg('action') != 'browse') {
         if (!$request->getArg('action') == _("PhpWikiAdministration/SetExternal")) {
             return $this->disabled("(action != 'browse')");
         }
     }
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     if (!$p) {
         $p = $this->_list;
     }
     $post_args = $request->getArg('admin_external');
     if (!$request->isPost() and empty($post_args['external'])) {
         $post_args['external'] = $args['external'];
     }
     $pages = array();
     if ($p && !$request->isPost()) {
         $pages = $p;
     }
     if ($p && $request->isPost() && !empty($post_args['button']) && empty($post_args['cancel'])) {
         // without individual PagePermissions:
         if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
             $request->_notAuthorized(WIKIAUTH_ADMIN);
             $this->disabled("! user->isAdmin");
         }
         // Real action
         return $this->setExternalPages($dbi, $request, array_keys($p));
     }
     $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args);
     $pagelist->addPageList($pages);
     $header = HTML::fieldset();
     $button_label = _("Set pages to external");
     $header->pushContent(HTML::legend(_("Select the pages to set as external")));
     $buttons = HTML::p(Button('submit:admin_external[button]', $button_label, 'wikiadmin'), Button('submit:admin_external[cancel]', _("Cancel"), 'button'));
     $header->pushContent($buttons);
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_external')), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)));
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:41,代码来源:WikiAdminSetExternal.php


注:本文中的Button函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。