'[pagename]', // just for a single page. 'noheader' => false, 'exclude_from' => _("PgsrcTranslation").','._("InterWikiMap"))); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor,markup or all // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); if ($page == _("WantedPages")) $page = ""; // 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. // TODO: Move this to backend/dumb/WantedPagesIter.php if (!$page) $GLOBALS['WikiTheme']->addPageListColumn( array('wanted' => array('_PageList_Column_WantedPages_wanted', 'custom:wanted', _("Wanted From"), 'left'))); $pagelist = new PageList($page ? '' : 'pagename,wanted', $exclude, $args); // search button? if ($exclude_from) $exclude_from = $pagelist->explodePageList($exclude_from); else $exclude_from = array(); $pagelist->_wpagelist = array(); if (!$page) { $allpages_iter = $dbi->getAllPages(false, false); while ($page_handle = $allpages_iter->next()) { $name = $page_handle->getName(); if (in_array($name, $exclude_from)) continue; $links = $page_handle->getPageLinks(true); // include_empty while ($link_handle = $links->next()) { if (! $dbi->isWikiPage($linkname = $link_handle->getName())) { $pagelist->addPage($linkname); //if (!array_key_exists($linkname, $this->_wpagelist)) $pagelist->_wpagelist[$linkname][] = $name; } } } } elseif ($dbi->isWikiPage($page)) { //only get WantedPages links for one page $page_handle = $dbi->getPage($page); $links = $page_handle->getPageLinks(true); // include_empty while ($link_handle = $links->next()) { if (! $dbi->isWikiPage($linkname = $link_handle->getName())) { $pagelist->addPage($linkname); //if (!array_key_exists($linkname, $this->_wpagelist)) $pagelist->_wpagelist[$linkname][] = 1; } } } /* if ($sortby) { ksort($this->_wpagelist); arsort($this->_wpagelist); }*/ if (!$noheader) { if ($page) $pagelist->setCaption(sprintf(_("Wanted Pages for %s (%d total):"), $page, count($pagelist->_wpagelist))); else $pagelist->setCaption(sprintf(_("Wanted Pages in this wiki (%d total):"), count($pagelist->_wpagelist))); } // reference obviously doesn't work, so force an update to add _wpagelist to parentobj if (isset($pagelist->_columns[1]) and $pagelist->_columns[1]->_field == 'wanted') $pagelist->_columns[1]->parentobj =& $pagelist; return $pagelist; } }; // which links to the missing page class _PageList_Column_WantedPages_wanted extends _PageList_Column { function _PageList_Column_WantedPages_wanted (&$params) { $this->parentobj =& $params[3]; $this->_PageList_Column($params[0],$params[1],$params[2]); } function _getValue(&$page, $revision_handle) { $html = false; foreach($this->parentobj->_wpagelist[$page->getName()] as $page) { if ($html) $html->pushContent(',', WikiLink($page)); else $html = HTML(WikiLink($page)); } return $html; } } // $Log: not supported by cvs2svn $ // Revision 1.12 2004/10/04 23:39:34 rurban // just aesthetics // // Revision 1.11 2004/04/20 00:56:00 rurban // more paging support and paging fix for shorter lists // // Revision 1.10 2004/04/18 01:44:02 rurban // more sortby+limit support // // Revision 1.9 2004/04/10 04:15:06 rurban // sf.net 927122 Suggestion // // Revision 1.8 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // // Revision 1.7 2003/12/19 06:57:49 carstenklapp // Bugfix: Enclose FullTextSearch query with quotes when the [Wiki Word] // contains spaces. // // Revision 1.6 2003/11/19 17:08:23 carstenklapp // New feature: Clicking on the number of citations in the links column // now does a FullTextSearch for the WantedPage link! // // Revision 1.5 2003/03/25 21:05:27 dairiki // Ensure pagenames are strings. // // Revision 1.4 2003/01/18 22:14:24 carstenklapp // Code cleanup: // Reformatting & tabs to spaces; // Added copyleft, getVersion, getDescription, rcs_id. // // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>