[Fusionforge-commits] r10889 - in trunk/src/plugins/wiki: common www

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Fri Oct 8 09:35:17 CEST 2010


Author: aljeux
Date: 2010-10-08 09:35:17 +0200 (Fri, 08 Oct 2010)
New Revision: 10889

Modified:
   trunk/src/plugins/wiki/common/WikiPlugin.class.php
   trunk/src/plugins/wiki/common/WikiSearchEngine.class.php
   trunk/src/plugins/wiki/www/g
Log:
Update wiki plugin, add hook to display wiki icon in summary page.

Modified: trunk/src/plugins/wiki/common/WikiPlugin.class.php
===================================================================
--- trunk/src/plugins/wiki/common/WikiPlugin.class.php	2010-10-07 21:07:05 UTC (rev 10888)
+++ trunk/src/plugins/wiki/common/WikiPlugin.class.php	2010-10-08 07:35:17 UTC (rev 10889)
@@ -37,14 +37,14 @@
 		$this->hooks[] = 'search_engines';
 		$this->hooks[] = 'full_search_engines';
 		$this->hooks[] = 'cssfile';
+		$this->hooks[] = 'project_public_area';
 		$this->hooks[] = 'activity';
 	}
 
-	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);
 			if (!$project || !is_object($project))
@@ -65,29 +65,6 @@
 			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'];
@@ -130,9 +107,9 @@
 				}
 			}
 		} elseif ($hookname == 'cssfile') {
-			if (strncmp(preg_replace('/^\/+/', '/', $_SERVER['REQUEST_URI']), '/wiki/', 6) == 0) {
+			if (defined('PHPWIKI_BASE_URL')) {
 				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="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" />';
@@ -140,6 +117,22 @@
 				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);
 			if ($group->usesPlugin ( $this->name)) {
@@ -173,16 +166,19 @@
 						$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'];

Modified: trunk/src/plugins/wiki/common/WikiSearchEngine.class.php
===================================================================
--- trunk/src/plugins/wiki/common/WikiSearchEngine.class.php	2010-10-07 21:07:05 UTC (rev 10888)
+++ trunk/src/plugins/wiki/common/WikiSearchEngine.class.php	2010-10-08 07:35:17 UTC (rev 10889)
@@ -38,7 +38,7 @@
 		$this->groupId = $groupId;
 		$this->rendererClassName = $rendererClassName;
 		
-		$this->SearchEngine($type, $rendererClassName, $label);
+		$this->GFSearchEngine($type, $rendererClassName, $label);
 	}
 	
 	function isAvailable($parameters) {

Modified: trunk/src/plugins/wiki/www/g
===================================================================
--- trunk/src/plugins/wiki/www/g	2010-10-07 21:07:05 UTC (rev 10888)
+++ trunk/src/plugins/wiki/www/g	2010-10-08 07:35:17 UTC (rev 10889)
@@ -1,4 +1,4 @@
-<?php // -*-php-*- $Id: g 7679 2010-09-09 13:25:20Z vargenau $
+<?php // -*-php-*- $Id: g 7708 2010-09-22 18:19:06Z vargenau $
 
 /*
  * Copyright (C) 2008-2010 Alcatel-Lucent




More information about the Fusionforge-commits mailing list