[evolvis-commits] r17523: order history and squeeze plugins in

mirabilos at evolvis.org mirabilos at evolvis.org
Fri Sep 2 16:11:47 CEST 2011


Author: mirabilos
Date: 2011-09-02 16:11:47 +0200 (Fri, 02 Sep 2011)
New Revision: 17523

Modified:
   branches/ev48fixes/common/include/Group.class.php
   branches/ev48fixes/common/pm/ProjectTask.class.php
   branches/ev48fixes/common/tracker/Artifact.class.php
   branches/ev48fixes/debian/changelog
   branches/ev48fixes/www/project/admin/editgroupinfo.php
   branches/ev48fixes/www/project/admin/project_admin_utils.php
Log:
order history and squeeze plugins in


Modified: branches/ev48fixes/common/include/Group.class.php
===================================================================
--- branches/ev48fixes/common/include/Group.class.php	2011-09-02 13:49:24 UTC (rev 17522)
+++ branches/ev48fixes/common/include/Group.class.php	2011-09-02 14:11:47 UTC (rev 17523)
@@ -598,32 +598,37 @@
 
 		/* document every change */
 		foreach (array(
-			'group_name' => array(_('group name'), htmlspecialchars($group_name)),
-			'homepage' => array(_('homepage'), $homepage),
-			'short_description' => array(_('short description'), $short_description_e),
-			'register_purpose' => array(_('long description'), $long_description_e),
-			'use_mail' => array(_('mail?'), $use_mail),
-			'use_forum' => array(_('forum?'), $use_forum),
-			'use_pm' => array(_('tasks?'), $use_pm),
-			'use_pm_depend_box' => array(_('use_pm_depend_box'), $use_pm_depend_box),
-			'use_scm' => array(_('scm?'), $use_scm),
-			'use_news' => array(_('news?'), $use_news),
-			'use_docman' => array(_('docs?'), $use_docman),
-			'is_public' => array(_('is_public?'), $is_public),
-			'new_doc_address' => array(_('new_doc_address'), $new_doc_address),
-			'send_all_docs' => array(_('send_all_docs'), $send_all_docs),
-			'use_ftp' => array(_('ftp?'), $use_ftp),
-			'use_tracker' => array(_('tracker?'), $use_tracker),
-			'use_frs' => array(_('files?'), $use_frs),
-			'use_stats' => array(_('stats?'), $use_stats),
-			'use_survey' => array(_('surveys?'), $use_survey),
+			'group_name' => array(_('group name'), htmlspecialchars($group_name), false),
+			'homepage' => array(_('homepage'), $homepage, false),
+			'short_description' => array(_('short description'), $short_description_e, false),
+			'register_purpose' => array(_('long description'), $long_description_e, false),
+			'use_mail' => array(_('mail?'), $use_mail, true),
+			'use_forum' => array(_('forum?'), $use_forum, true),
+			'use_pm' => array(_('tasks?'), $use_pm, true),
+			'use_pm_depend_box' => array(_('use_pm_depend_box'), $use_pm_depend_box, false),
+			'use_scm' => array(_('scm?'), $use_scm, true),
+			'use_news' => array(_('news?'), $use_news, true),
+			'use_docman' => array(_('docs?'), $use_docman, true),
+			'is_public' => array(_('is_public?'), $is_public, true),
+			'new_doc_address' => array(_('new_doc_address'), $new_doc_address, false),
+			'send_all_docs' => array(_('send_all_docs'), $send_all_docs, false),
+			'use_ftp' => array(_('ftp?'), $use_ftp, true),
+			'use_tracker' => array(_('tracker?'), $use_tracker, true),
+			'use_frs' => array(_('files?'), $use_frs, true),
+			'use_stats' => array(_('stats?'), $use_stats, true),
+			'use_survey' => array(_('surveys?'), $use_survey, true),
 		    ) as $dbkey => $va) {
+			$oldvalue = $this->data_array[$dbkey];
 			$newvalue = $va[1];
-			if ($this->data_array[$dbkey] != $newvalue) {
+			if ($oldvalue != $newvalue) {
 				$humanname = $va[0];
+				if ($va[2]) {
+					$oldvalue = $oldvalue ? "true" : "false";
+					$newvalue = $newvalue ? "true" : "false";
+				}
 				$this->addHistory(sprintf(
 				    _('Changed field "%s"'), $humanname),
-				    $this->data_array[$dbkey], $newvalue);
+				    $oldvalue, $newvalue);
 			}
 		}
 
@@ -689,9 +694,6 @@
 		$hook_params['group_description'] = $short_description_e;
 		plugin_hook ("group_update", $hook_params);
 
-		// Log the audit trail
-		$this->addHistory(_('Changed Public Info'), '', '');
-
 		if (!$this->fetchData($this->getID())) {
 			db_rollback();
 			return false;
@@ -1289,7 +1291,8 @@
 	 *  @return	string	database result 
 	 */
 	function setPluginUse($pluginname, $val=true) {
-		if ($val == $this->usesPlugin($pluginname)) {
+		$oldval = $this->usesPlugin($pluginname);
+		if ($val == $oldval) {
 			// State is already good, returning
 			return true ;
 		}
@@ -1301,6 +1304,9 @@
 			return false ;
 		}
 		$plugin_id = db_result($res,0,'plugin_id');
+		$this->addHistory('Changed plugin ' . $pluginname,
+		    $oldval ? "enabled" : "disabled",
+		    $val ? "enabled" : "disabled");
 		// Invalidate cache
 		unset ($this->plugins_data) ;
 		if ($val) {

Modified: branches/ev48fixes/common/pm/ProjectTask.class.php
===================================================================
--- branches/ev48fixes/common/pm/ProjectTask.class.php	2011-09-02 13:49:24 UTC (rev 17522)
+++ branches/ev48fixes/common/pm/ProjectTask.class.php	2011-09-02 14:11:47 UTC (rev 17523)
@@ -665,7 +665,7 @@
 		return db_query_params ('SELECT *
 		FROM project_history_user_vw
 		WHERE project_task_id=$1
-		ORDER BY mod_date ASC',
+		ORDER BY mod_date,project_history_id ASC',
 					array ($this->getID())) ;
 	}
 

Modified: branches/ev48fixes/common/tracker/Artifact.class.php
===================================================================
--- branches/ev48fixes/common/tracker/Artifact.class.php	2011-09-02 13:49:24 UTC (rev 17522)
+++ branches/ev48fixes/common/tracker/Artifact.class.php	2011-09-02 14:11:47 UTC (rev 17523)
@@ -621,7 +621,7 @@
 	 *	@return database result set.
 	 */
 	function getHistory() {
-		return db_query_params ('SELECT * FROM artifact_history_user_vw WHERE artifact_id=$1 ORDER BY entrydate ASC',
+		return db_query_params ('SELECT * FROM artifact_history_user_vw WHERE artifact_id=$1 ORDER BY entrydate,id ASC',
 					array ($this->getID())) ;
 	}
 

Modified: branches/ev48fixes/debian/changelog
===================================================================
--- branches/ev48fixes/debian/changelog	2011-09-02 13:49:24 UTC (rev 17522)
+++ branches/ev48fixes/debian/changelog	2011-09-02 14:11:47 UTC (rev 17523)
@@ -8,8 +8,9 @@
   * Display tooltips on outerTabs and projectTabs
   * Support tooltips in the Extratabs plugin
   * Support tooltips for the Portal link (and everywhere)
+  * Improve history logging and displaying
 
- -- Thorsten Glaser <t.glaser at tarent.de>  Fri, 02 Sep 2011 15:38:47 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de>  Fri, 02 Sep 2011 16:11:20 +0200
 
 gforge (4.8.3+evolvis36) unstable; urgency=low
 

Modified: branches/ev48fixes/www/project/admin/editgroupinfo.php
===================================================================
--- branches/ev48fixes/www/project/admin/editgroupinfo.php	2011-09-02 13:49:24 UTC (rev 17522)
+++ branches/ev48fixes/www/project/admin/editgroupinfo.php	2011-09-02 14:11:47 UTC (rev 17523)
@@ -112,6 +112,9 @@
 	// This is done so plugins can enable/disable themselves from the project
 	$hookParams['group']=$group_id;
 	plugin_hook("groupisactivecheckboxpost",$hookParams);
+
+	// Log the audit trail
+	$group->addHistory(_('Changed Public Info'), '', '');
 }
 
 project_admin_header(array('title'=>_('Edit Group Info').'','group'=>$group->getID()));

Modified: branches/ev48fixes/www/project/admin/project_admin_utils.php
===================================================================
--- branches/ev48fixes/www/project/admin/project_admin_utils.php	2011-09-02 13:49:24 UTC (rev 17522)
+++ branches/ev48fixes/www/project/admin/project_admin_utils.php	2011-09-02 14:11:47 UTC (rev 17523)
@@ -130,7 +130,7 @@
 	$sql="SELECT group_history.field_name,group_history.old_value,group_history.adddate,users.user_name,group_history.new_value ".
 		 "FROM group_history,users ".
 		 "WHERE group_history.mod_by=users.user_id ".
-		 "AND group_id='$group_id' ORDER BY group_history.adddate ASC";
+		 "AND group_id='$group_id' ORDER BY group_history.adddate,group_history.group_history_id ASC";
 	return db_query($sql);
 }		   
 	



More information about the evolvis-commits mailing list