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


PHP HiddenInputs函数代码示例

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


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

示例1: 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

示例2: 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

示例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)
 {
     if ($request->getArg('action') != 'browse') {
         if ($request->getArg('action') != _("PhpWikiAdministration/SetAcl")) {
             return $this->disabled("(action != 'browse')");
         }
     }
     if (!ENABLE_PAGEPERM) {
         return $this->disabled("ENABLE_PAGEPERM = false");
     }
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     $post_args = $request->getArg('admin_setacl');
     $next_action = 'select';
     $pages = array();
     if ($p && !$request->isPost()) {
         $pages = $p;
     } elseif ($this->_list) {
         $pages = $this->_list;
     }
     $header = HTML::fieldset();
     if ($p && $request->isPost() && !empty($post_args['acl']) && 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->setaclPages($request, array_keys($p), $request->getArg('acl'));
         }
         if ($post_args['action'] == 'select') {
             if (!empty($post_args['acl'])) {
                 $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,mtime,owner,author";
     }
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('perm' => new _PageList_Column_perm('perm', _("Permission")), 'acl' => new _PageList_Column_acl('acl', _("ACL")))));
     $pagelist->addPageList($pages);
     if ($next_action == 'verify') {
         $button_label = _("Yes");
         $header = $this->setaclForm($header, $post_args, $pages);
         $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently change access rights to the selected files?"))));
     } else {
         $button_label = _("Change Access Rights");
         $header = $this->setaclForm($header, $post_args, $pages);
         $header->pushContent(HTML::legend(_("Select the pages where to change access rights")));
     }
     $buttons = HTML::p(Button('submit:admin_setacl[acl]', $button_label, 'wikiadmin'), Button('submit:admin_setacl[cancel]', _("Cancel"), 'button'));
     $header->pushContent($buttons);
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_setacl')), HiddenInputs(array('admin_setacl[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)));
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:64,代码来源:WikiAdminSetAcl.php

示例8: showForm

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

示例9: 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

示例10: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if (!$lang) {
         return $this->error(_("This internal action page cannot viewed.") . "\n" . _("You can only use it via the _WikiTranslation plugin."));
     }
     $this->lang = $lang;
     //action=save
     if (!empty($translate) and isset($translate['submit']) and $request->isPost()) {
         $trans = $translate["content"];
         if (empty($trans) or $trans == $pagename) {
             $header = HTML(HTML::h2(_("Translation Error!")), HTML::p(_("Your translated text is either empty or equal to the untranslated text. Please try again.")));
         } else {
             //save translation in a users subpage
             $user = $request->getUser();
             $homepage = $user->_HomePagehandle;
             $transpagename = $homepage->getName() . SUBPAGE_SEPARATOR . _("ContributedTranslations");
             $page = $dbi->getPage($transpagename);
             $current = $page->getCurrentRevision();
             $version = $current->getVersion();
             if ($version) {
                 $text = $current->getPackedContent() . "\n";
                 $meta = $current->_data;
             } else {
                 $text = '';
                 $meta = array('markup' => 2.0, 'author' => $user->getId());
             }
             $text .= $user->getId() . " " . Iso8601DateTime() . "\n" . "* " . sprintf(_("Translate '%s' to '%s' in *%s*"), $pagename, $trans, $lang);
             $text .= "\n  <verbatim>locale/po/{$lang}.po:\n  msgid \"" . $pagename . "\"\n  msgstr \"" . $trans . "\"\n  </verbatim>";
             $meta['summary'] = sprintf(_("Translate %s to %s in %s"), substr($pagename, 0, 15), substr($trans, 0, 15), $lang);
             $page->save($text, $version + 1, $meta);
             // TODO: admin notification
             return HTML(HTML::h2(_("Thanks for adding this translation!")), HTML::p(fmt("Your translated text doesn't yet appear in this %s, but the Administrator will pick it up and add to the installation.", WIKI_NAME)), fmt("Your translation is stored in %s", WikiLink($transpagename)));
         }
     }
     $trans = $this->translate($pagename, $lang, 'en');
     //Todo: google lookup or at least a google lookup button.
     if (isset($header)) {
         $header = HTML($header, fmt("From english to %s: ", HTML::strong($lang)));
     } else {
         $header = fmt("From english to %s: ", HTML::strong($lang));
     }
     $button_label = _("Translate");
     $buttons = HTML::p(Button('submit:translate[submit]', $button_label, 'wikiadmin'), Button('submit:translate[cancel]', _("Cancel"), 'button'));
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, HTML::textarea(array('class' => 'wikiedit', 'name' => 'translate[content]', 'id' => 'translate[content]', 'rows' => 4, 'cols' => $request->getPref('editWidth'), 'wrap' => 'virtual'), $trans), HiddenInputs($request->getArgs(), false, array('translate')), HiddenInputs(array('translate[action]' => $pagename, 'require_authority_for_post' => WIKIAUTH_BOGO)), $buttons);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:46,代码来源:TranslateText.php

示例11: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $this->_args = $this->getArgs($argstr, $request);
     extract($this->_args);
     if (!$page) {
         return '';
     }
     $this->hidden_pagemeta = array('_cached_html');
     $this->readonly_pagemeta = array('hits', 'passwd');
     $dbi = $request->getDbh();
     $p = $dbi->getPage($page);
     $pagemeta = $p->getMetaData();
     $this->chunk_split = false;
     // Look at arguments to see if submit was entered. If so,
     // process this request before displaying.
     //
     if ($request->isPost() and $request->_user->isAdmin() and $request->getArg('metaedit')) {
         $metafield = trim($request->getArg('metafield'));
         $metavalue = trim($request->getArg('metavalue'));
         $meta = $request->getArg('meta');
         $changed = 0;
         // meta[__global[_upgrade][name]] => 1030.13
         foreach ($meta as $key => $val) {
             if ($val != $pagemeta[$key] and !in_array($key, $this->readonly_pagemeta)) {
                 $changed++;
                 $p->set($key, $val);
             }
         }
         if ($metafield and !in_array($metafield, $this->readonly_pagemeta)) {
             // __global[_upgrade][name] => 1030.13
             if (preg_match('/^(.*?)\\[(.*?)\\]$/', $metafield, $matches)) {
                 list(, $array_field, $array_key) = $matches;
                 $array_value = $pagemeta[$array_field];
                 $array_value[$array_key] = $metavalue;
                 if ($pagemeta[$array_field] != $array_value) {
                     $changed++;
                     $p->set($array_field, $array_value);
                 }
             } elseif ($pagemeta[$metafield] != $metavalue) {
                 $changed++;
                 $p->set($metafield, $metavalue);
             }
         }
         if ($changed) {
             $dbi->touch();
             $url = $request->getURLtoSelf(false, array('meta', 'metaedit', 'metafield', 'metavalue'));
             $request->redirect($url);
             // The rest of the output will not be seen due to the
             // redirect.
             return '';
         }
     }
     // Now we show the meta data and provide entry box for new data.
     $html = HTML();
     //$html->pushContent(HTML::h3(fmt("Existing page-level metadata for %s:",
     //                                $page)));
     //$dl = $this->_display_values('', $pagemeta);
     //$html->pushContent($dl);
     if (!$pagemeta) {
         // FIXME: invalid HTML
         $html->pushContent(HTML::p(fmt("No metadata for %s", $page)));
         $table = HTML();
     } else {
         $table = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0));
         $this->_fixupData($pagemeta);
         $table->pushContent($this->_showhash("MetaData('{$page}')", $pagemeta));
     }
     if ($request->_user->isAdmin()) {
         $action = $request->getPostURL();
         $hiddenfield = HiddenInputs($request->getArgs());
         $instructions = _("Add or change a page-level metadata 'key=>value' pair. Note that you can remove a key by leaving the value-box empty.");
         $keyfield = HTML::input(array('name' => 'metafield'), '');
         $valfield = HTML::input(array('name' => 'metavalue'), '');
         $button = Button('submit:metaedit', _("Submit"), false);
         $form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $hiddenfield, $table, $instructions, HTML::br(), $keyfield, ' => ', $valfield, HTML::raw('&nbsp;'), $button);
         $html->pushContent($form);
     } else {
         $html->pushContent(HTML::em(_("Requires WikiAdmin privileges to edit.")));
     }
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:81,代码来源:EditMetaData.php

示例12: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     return $this->disabled("This action is blocked by administrator. Sorry for the inconvenience !");
     if ($request->getArg('action') != 'browse') {
         if (!$request->getArg('action') == _("PhpWikiAdministration/Chown")) {
             return $this->disabled("(action != 'browse')");
         }
     }
     $args = $this->getArgs($argstr, $request);
     $this->_args = $args;
     if (empty($args['user'])) {
         $args['user'] = $request->_user->UserName();
     }
     /*if (!empty($args['exclude']))
           $exclude = explodePageList($args['exclude']);
       else
       $exclude = false;*/
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     if (!$p) {
         $p = $this->_list;
     }
     $post_args = $request->getArg('admin_chown');
     if (!$request->isPost() and empty($post_args['user'])) {
         $post_args['user'] = $args['user'];
     }
     $next_action = 'select';
     $pages = array();
     if ($p && !$request->isPost()) {
         $pages = $p;
     }
     if ($p && $request->isPost() && !empty($post_args['chown']) && empty($post_args['cancel'])) {
         // without individual PagePermissions:
         if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
             $request->_notAuthorized(WIKIAUTH_ADMIN);
             $this->disabled("! user->isAdmin");
         }
         // DONE: error message if not allowed.
         if ($post_args['action'] == 'verify') {
             // Real action
             return $this->chownPages($dbi, $request, array_keys($p), $post_args['user']);
         }
         if ($post_args['action'] == 'select') {
             if (!empty($post_args['user'])) {
                 $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']);
     }
     /* // let the user decide which info
         if ($next_action == 'verify') {
            $args['info'] = "checkbox,pagename,owner,mtime";
        }
        */
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args);
     $pagelist->addPageList($pages);
     $header = HTML::p();
     if ($next_action == 'verify') {
         $button_label = _("Yes");
         $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently chown the selected files?"))));
         $header = $this->chownForm($header, $post_args);
     } else {
         $button_label = _("Chown selected pages");
         $header->pushContent(HTML::p(_("Select the pages to change the owner:")));
         $header = $this->chownForm($header, $post_args);
     }
     $buttons = HTML::p(Button('submit:admin_chown[chown]', $button_label, 'wikiadmin'), Button('submit:admin_chown[cancel]', _("Cancel"), 'button'));
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_chown')), HiddenInputs(array('admin_chown[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:75,代码来源:WikiAdminChown.php

示例13: _do_email_verification

 function _do_email_verification(&$request, &$args)
 {
     $dbi = $request->getDbh();
     $pagelist = new PageList('pagename', 0, $args);
     //$args['return_url'] = 'action=email-verification-verified';
     $email = new _PageList_Column_email('email', _("E-Mail"), 'left');
     $emailVerified = new _PageList_Column_emailVerified('emailVerified', _("Verification Status"), 'center');
     $pagelist->_columns[] = $email;
     $pagelist->_columns[] = $emailVerified;
     //This is the best method to find all users (Db and PersonalPage)
     $current_user = $request->_user;
     if (empty($args['verify'])) {
         $group = $request->getGroup();
         $allusers = $group->_allUsers();
     } else {
         $allusers = array_keys($args['user']);
     }
     foreach ($allusers as $username) {
         if (ENABLE_USER_NEW) {
             $user = WikiUser($username);
         } else {
             $user = new WikiUser($request, $username);
         }
         $prefs = $user->getPreferences();
         if ($prefs->get('email')) {
             if (!$prefs->get('userid')) {
                 $prefs->set('userid', $username);
             }
             if (!empty($pagelist->_rows)) {
                 $group = (int) (count($pagelist->_rows) / $pagelist->_group_rows);
             } else {
                 $group = 0;
             }
             $class = $group % 2 ? 'oddrow' : 'evenrow';
             $row = HTML::tr(array('class' => $class));
             $page_handle = $dbi->getPage($username);
             $row->pushContent($pagelist->_columns[0]->format($pagelist, $page_handle, $page_handle));
             $row->pushContent($email->format($pagelist, $prefs, $page_handle));
             if (!empty($args['verify'])) {
                 $prefs->_prefs['email']->set('emailVerified', empty($args['verified'][$username]) ? 0 : 2);
                 $user->setPreferences($prefs);
             }
             $row->pushContent($emailVerified->format($pagelist, $prefs, $args['verify']));
             $pagelist->_rows[] = $row;
         }
     }
     $request->_user = $current_user;
     if (!empty($args['verify'])) {
         return HTML($pagelist->_generateTable(false));
     } else {
         $args['verify'] = 1;
         $args['return_url'] = $request->getURLtoSelf();
         return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs($args, 'wikiadminutils'), HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), HiddenInputs($request->getArgs()), $pagelist->_generateTable(false), HTML::p(Button('submit:', _("Change Verification Status"), 'wikiadmin'), HTML::Raw('&nbsp;'), Button('cancel', _("Cancel"))));
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:55,代码来源:WikiAdminUtils.php

示例14: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post', 'class' => 'wikiadmin', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('action' => $action, 'pagename' => $basepage)));
     $input = array('type' => 'text', 'value' => $default, 'size' => $size);
     switch ($action) {
         case 'loadfile':
             $input['name'] = 'source';
             if (!$default) {
                 $input['value'] = DEFAULT_DUMP_DIR;
             }
             if (!$buttontext) {
                 $buttontext = _("Load File");
             }
             $class = false;
             break;
         case 'login':
             $input['name'] = 'source';
             if (!$buttontext) {
                 $buttontext = _("Login");
             }
             $class = 'wikiadmin';
             break;
         case 'dumpserial':
             $input['name'] = 'directory';
             if (!$default) {
                 $input['value'] = DEFAULT_DUMP_DIR;
             }
             if (!$buttontext) {
                 $buttontext = _("Dump Pages");
             }
             $class = 'wikiadmin';
             break;
         case 'dumphtml':
             $input['name'] = 'directory';
             if (!$default) {
                 $input['value'] = HTML_DUMP_DIR;
             }
             if (!$buttontext) {
                 $buttontext = _("Dump Pages as XHTML");
             }
             $class = 'wikiadmin';
             break;
         case 'upload':
             $form->setAttr('enctype', 'multipart/form-data');
             $form->pushContent(HTML::input(array('name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE, 'type' => 'hidden')));
             $input['name'] = 'file';
             $input['type'] = 'file';
             if (!$buttontext) {
                 $buttontext = _("Upload");
             }
             $class = false;
             // local OS function, so use native OS button
             break;
         default:
             return HTML::p(fmt("WikiForm: %s: unknown action", $action));
     }
     $input = HTML::input($input);
     $input->addTooltip($buttontext);
     $button = Button('submit:', $buttontext, $class);
     if ($request->getArg('start_debug')) {
         $form->pushContent(HTML::input(array('name' => 'start_debug', 'value' => $request->getArg('start_debug'), 'type' => 'hidden')));
     }
     $form->pushContent(HTML::span(array('class' => $class), $input, $button));
     return $form;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:66,代码来源:WikiForm.php

示例15: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     if ($request->getArg('action') != 'browse') {
         if ($request->getArg('action') != _("PhpWikiAdministration/MassRevert")) {
             return $this->disabled("(action != 'browse')");
         }
     }
     $args = $this->getArgs($argstr, $request);
     if (!is_numeric($args['min_age'])) {
         $args['min_age'] = -1;
     }
     $this->_args =& $args;
     /*if (!empty($args['exclude']))
           $exclude = explodePageList($args['exclude']);
       else
       $exclude = false;*/
     $this->preSelectS($args, $request);
     $p = $request->getArg('p');
     if (!$p) {
         $p = $this->_list;
     }
     $post_args = $request->getArg('admin_revert');
     $next_action = 'select';
     $pages = array();
     if ($p && $request->isPost() && !empty($post_args['revert']) && empty($post_args['cancel'])) {
         // check individual PagePermissions
         if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
             $request->_notAuthorized(WIKIAUTH_ADMIN);
             $this->disabled("! user->isAdmin");
         }
         if ($post_args['action'] == 'verify') {
             // Real delete.
             return $this->revertPages($request, array_keys($p));
         }
         if ($post_args['action'] == 'select') {
             $next_action = 'verify';
             foreach ($p as $name => $c) {
                 $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
                 $pages[$name] = $c;
             }
         }
     } elseif ($p && is_array($p) && !$request->isPost()) {
         // from WikiAdminSelect
         $next_action = 'verify';
         foreach ($p as $name => $c) {
             $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
             $pages[$name] = $c;
         }
         $request->setArg('p', false);
     }
     if ($next_action == 'select') {
         // List all pages to select from.
         $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
     }
     $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('revert' => new _PageList_Column_revert('revert', _("Revert")), 'diff' => new _PageList_Column_diff('diff', _("Changes")))));
     $pagelist->addPageList($pages);
     $header = HTML::p();
     if ($next_action == 'verify') {
         $button_label = _("Yes");
         $header->pushContent(HTML::strong(_("Are you sure you want to overwrite the selected files with the previous version?")));
     } else {
         $button_label = _("Revert selected pages");
         $header->pushContent(_("Permanently remove the selected files:"), HTML::br());
         if ($args['min_age'] > 0) {
             $header->pushContent(fmt("Also pages which have been deleted at least %s days.", $args['min_age']));
         } else {
             $header->pushContent(_("List all pages."));
         }
         if ($args['max_age'] > 0) {
             $header->pushContent(" ", fmt("(Pages which have been deleted at least %s days are already checked.)", $args['max_age']));
         }
     }
     $buttons = HTML::p(Button('submit:admin_revert[revert]', $button_label, 'wikiadmin'), Button('submit:admin_revert[cancel]', _("Cancel"), 'button'));
     // TODO: quick select by regex javascript?
     return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_revert')), HiddenInputs(array('admin_revert[action]' => $next_action, 'require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:76,代码来源:WikiAdminMassRevert.php


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