示例#1
0
 private static function getQuickEdit($title, $result)
 {
     global $wgServer;
     // build the array of users for the quick note link sorted by
     // the # of bytes changed descending, i.e. more is better
     $users = array();
     $sorted = $result['users_len'];
     if (!$sorted) {
         return;
     }
     asort($sorted, SORT_NUMERIC);
     $sorted = array_reverse($sorted);
     foreach ($sorted as $s => $len) {
         $u = User::newFromName($s);
         if (!$u) {
             // handle anons
             $u = new User();
             $u->setName($s);
         }
         $users[] = $u;
     }
     $editURL = Title::makeTitle(NS_SPECIAL, "QuickEdit")->getFullURL() . '?type=editform&target=' . urlencode($title->getFullText());
     $class = "class='button secondary' style='float: left;'";
     $link = "<script type='text/javascript'>var gQuickEditUrl = \"{$editURL}\";</script>";
     $link .= "<a id='qe_button' title='" . wfMsg("rcpatrol_quick_edit_title") . "' href='' {$class} onclick=\"return initPopupEdit(gQuickEditUrl) ;\">" . htmlspecialchars(wfMsg('rcpatrol_quick_edit_button')) . "</a> ";
     $qn = str_replace("href", " title='" . wfMsg("rcpatrol_quick_note_title") . "' {$class} href", QuickNoteEdit::getQuickNoteLinkMultiple($title, $users));
     $link = $qn . $link;
     //make sure we load the clientscript here so we can post load those buttons
     $link .= HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false);
     return $link;
 }