* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Fusionforge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
global $gfplugins;
$this->Plugin() ;
$this->name = "wiki" ;
$this->text = "Wiki" ; // To show in the tabs, use...
+ $this->installdir = 'wiki';
$this->hooks[] = "groupmenu";
$this->hooks[] = "groupisactivecheckbox" ; // The "use ..." checkbox in editgroupinfo
- $this->hooks[] = "groupisactivecheckboxpost" ; //
+ $this->hooks[] = "groupisactivecheckboxpost" ; //
$this->hooks[] = "project_admin_plugins"; // to show up in the project admin page
$this->hooks[] = 'search_engines';
$this->hooks[] = 'full_search_engines';
$this->hooks[] = 'cssfile';
+ $this->hooks[] = 'project_public_area';
$this->hooks[] = 'activity';
+ $this->hooks[] = 'site_admin_option_hook';
}
- function CallHook ($hookname, $params) {
+ function CallHook ($hookname, & $params) {
global $G_SESSION,$HTML;
if (is_array($params) && isset($params['group']))
$group_id=$params['group'];
- $use_wikiplugin = getIntFromRequest('use_wikiplugin');
if ($hookname == "groupmenu") {
- $project = &group_get_object($group_id);
+ $project = group_get_object($group_id);
if (!$project || !is_object($project))
return;
if ($project->isError())
if ( $project->usesPlugin ( $this->name ) ) {
$params['TITLES'][]=$this->text;
$params['DIRS'][]='/wiki/g/'.$project->getUnixName().'/HomePage';
+ $params['ADMIN'][]='';
} else {
$this->hooks["groupmenu"] = "";
//$params['TITLES'][]=$this->text." [Off]";
- //$params['DIRS'][]='/plugins/wiki/index.php?off=true';
+ //$params['DIRS'][]='/wiki/index.php?off=true';
}
if (isset($params['toptab'])) {
(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
}
- } elseif ($hookname == "groupisactivecheckbox") {
- //Check if the group is active
- $group = &group_get_object($group_id);
- echo "<tr>";
- echo "<td>";
- echo ' <input type="checkbox" name="use_wikiplugin" value="1" ';
- // checked or unchecked?
- if ( $group->usesPlugin ( $this->name ) ) {
- echo "checked=\"checked\"";
- }
- echo " /><br/>";
- echo "</td>";
- echo "<td>";
- echo "<strong>Use ".$this->text." Plugin</strong>";
- echo "</td>";
- echo "</tr>";
- } elseif ($hookname == "groupisactivecheckboxpost") {
- $group = &group_get_object($group_id);
- if ( $use_wikiplugin == 1 ) {
- $group->setPluginUse ( $this->name );
- } else {
- $group->setPluginUse ( $this->name, false );
- }
} elseif ($hookname == "project_admin_plugins") {
// this displays the link in the project admin options page to its administration page.
$group_id = $params['group_id'];
- $group = &group_get_object($group_id);
+ $group = group_get_object($group_id);
if ( $group->usesPlugin ( $this->name ) ) {
- echo '<p><a href="/plugins/wiki/wikiadmin.php?id=' . $group->getID() . '&type=admin&pluginname=' . $this->name . '">' . _('Wiki Admin') . '</a></p>';
+ echo '<p><a href="/wiki/wikiadmin.php?group_id=' . $group->getID() . '&type=admin&pluginname=' . $this->name . '">' . _('Wiki Admin') . '</a></p>';
}
} elseif ($hookname == 'search_engines') {
// FIXME: when the hook is called, the group_id is not set.
$searchManager->addSearchEngine(
SEARCH__TYPE_IS_WIKI,
new WikiSearchEngine(SEARCH__TYPE_IS_WIKI,
- 'WikiHtmlSearchRenderer',
- _("This projects's wiki"), $group_id)
+ 'WikiHtmlSearchRenderer',
+ _("This project's wiki"), $group_id)
);
}
}
// FIXME: when the hook is called, the group_id is not set.
// So I use the global variable instead.
$group_id = $GLOBALS['group_id'];
- $group = &group_get_object($group_id);
+ $group = group_get_object($group_id);
if ($group->usesPlugin ( $this->name)) {
global $gfwww, $gfcommon, $gfplugins;
require_once('plugins/wiki/common/WikiHtmlSearchRenderer.class.php');
}
}
} elseif ($hookname == 'cssfile') {
- if (strncmp(preg_replace('/^\/+/', '/', $_SERVER['REQUEST_URI']), '/wiki/', 6) == 0) {
+ if (defined('PHPWIKI_BASE_URL')) {
+ use_stylesheet('/wiki/themes/fusionforge/fusionforge.css');
+ use_stylesheet('/wiki/themes/fusionforge/fusionforge-print.css', 'print');
echo '<link rel="alternate" type="application/x-wiki" title="Edit this page!" href="'.$_SERVER['PHP_SELF'].'?action=edit" />';
- echo '<link rel="stylesheet" type="text/css" href="/wiki/themes/fusionforge/fusionforge.css" />';
echo "\n".'<link rel="alternate stylesheet" type="text/css" href="/wiki/themes/fusionforge/fusionforge-fullscreen.css" media="screen" title="Fullscreen" />';
echo "\n".'<link rel="alternate stylesheet" type="text/css" href="/wiki/themes/fusionforge/fusionforge-autonumbering.css" title="Autonumbering" />';
echo "\n".'<link rel="alternate stylesheet" type="text/css" href="/wiki/themes/fusionforge/fusionforge-rereading.css" title="Rereading Mode" />';
- echo "\n".'<link rel="stylesheet" type="text/css" href="/wiki/themes/fusionforge/fusionforge-print.css" media="print" />';
echo "\n".'<base href="'.PHPWIKI_BASE_URL.'" />';
echo "\n";
}
+ } elseif ($hookname == "project_public_area") {
+ $project = group_get_object($params['group_id']);
+ if (!$project || !is_object($project)) {
+ return;
+ }
+ if ($project->isError()) {
+ return;
+ }
+ if ( $project->usesPlugin ( $this->name ) ) {
+ echo '<div class="public-area-box">';
+ print '<a href="'. util_make_url ('/wiki/g/'.$project->getUnixName().'/HomePage').'">';
+ print html_image("ic/wiki20g.png","20","20",array("alt"=>"Wiki"));
+ print ' Wiki';
+ print '</a>';
+ echo '</div>';
+ }
} elseif ($hookname == 'activity') {
- $group = &group_get_object($group_id);
+ $group = group_get_object($params['group_id']);
+ if (!$group || !is_object($group)) {
+ return;
+ }
+ if ($group->isError()) {
+ return;
+ }
if ($group->usesPlugin ( $this->name)) {
// Add activities from the wiki plugin if active.
// Only major edits are included.
$group_name = $group->getUnixName();
$data = unserialize($arr['versiondata']);
if (!isset($cache[$data['author']])) {
- $r = db_query_params ('SELECT user_name FROM users WHERE realname = $1',
+ $r = db_query_params ('SELECT user_name, user_id FROM users WHERE realname = $1',
array ($data['author']));
if ($a = db_fetch_array($r)) {
$cache[$data['author']] = $a['user_name'];
+ $cache[$data['author_id']] = $a['user_id'];
} else {
$cache[$data['author']] = '';
+ $cache[$data['author_id']] = '';
}
}
$arr['user_name'] = $cache[$data['author']];
+ $arr['user_id'] = $cache[$data['author_id']];
$arr['realname'] = $data['author'];
$arr['icon']=html_image("ic/wiki20g.png","20","20",array("alt"=>"Wiki"));
$arr['title'] = 'Wiki Page '.$arr['pagename'];
- $arr['link'] = '/wiki/g/'.$group_name.'/'.urlencode($arr['pagename']);
+ $arr['link'] = '/wiki/g/'.$group_name.'/'.rawurlencode($arr['pagename']);
$arr['description']= $arr['title'];
$params['results'][] = $arr;
}
}
}
- }
+ }
+ }
+
+ function site_admin_option_hook($params) {
+ echo '<li>'.util_make_link('/wiki/wikilist.php', _('List of active wikis in Forge')).'</li>';
}
}