[Fusionforge-commits] r11845 - trunk/src/common/widget

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Mon Dec 20 14:45:08 CET 2010


Author: nerville
Date: 2010-12-20 14:45:07 +0100 (Mon, 20 Dec 2010)
New Revision: 11845

Modified:
   trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php
   trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php
Log:
use same category name, rework sql to deal with status

Modified: trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php	2010-12-20 11:04:45 UTC (rev 11844)
+++ trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php	2010-12-20 13:45:07 UTC (rev 11845)
@@ -108,7 +108,7 @@
     }
 
     function getCategory() {
-	    return 'Documents';
+	    return 'Documents-Manager';
     }
     function getDescription() {
 	    return _("List documents that you are currently monitoring, by project.<br />To cancel any of the monitored items just click on the trash icon next to the item label.");

Modified: trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php	2010-12-20 11:04:45 UTC (rev 11844)
+++ trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php	2010-12-20 13:45:07 UTC (rev 11845)
@@ -33,7 +33,7 @@
 		$pm = ProjectManager::instance();
 		$project = $pm->getProject($request->get('group_id'));
 		if ($project && $this->canBeUsedByProject($project)) {
-			$this->content['title'] = _('Latest Published Documents');
+			$this->content['title'] = _('5 Latest Published Documents');
 		}
 	}
 
@@ -51,29 +51,38 @@
 			<table summary="Latest publish documents" class="width-100p100">
 				<tr class="table-header">
 					<th class="align-left" scope="col">
+						'._('Date').'
+					</th>
+					<th scope="col">
 						'._('Filename').'
 					</th>
 					<th scope="col">
 						'._('Title').'
 					</th>
 					<th scope="col">
-						'._('Description').'
-					</th>
-					<th scope="col">
-						'._('Date').'
-					</th>
-					<th scope="col">
 						'._('Author').'
-					</th>
-				</tr>';
+					</th>';
+		if (session_loggedin() && (user_ismember($group_id) || user_ismember(1,'A'))) {
+			echo		'<th scope="col">
+						' ._('Status').'
+					</th>';
+		}
+		echo		'</tr>';
 
-		$res_files = db_query_params('SELECT filename, title, description, updatedate, realname
+		$qpa = db_construct_qpa();
+		$qpa = db_construct_qpa($qpa, 'SELECT filename, title, updatedate, createdate, realname, state_name
 						FROM docdata_vw
 						WHERE group_id=$1
-						AND stateid=$2
-						ORDER BY filename,updatedate DESC',
-					array ($group_id,'2'));
+						AND stateid=$2',
+					array($group_id, '1'));
 
+		if (session_loggedin() && (user_ismember($group_id) || user_ismember(1,'A'))) {
+			$qpa = db_construct_qpa($qpa, ' OR stateid=$1 OR stateid=$2 OR stateid=$3', array('3','4','5'));
+		}
+
+		$qpa = db_construct_qpa($qpa, ' ORDER BY updatedate,createdate DESC LIMIT 5',array());
+		$res_files = db_query_qpa($qpa);
+
 		$rows_files = db_numrows($res_files);
 		if (!$res_files || $rows_files < 1) {
 			echo db_error();
@@ -81,33 +90,38 @@
 			echo '<tr><td colspan="6"><strong>'._('This Project Has Not Published Any Documents').'</strong></td></tr>';
 		} else {
 			for ($f=0; $f<$rows_files; $f++) {
-				$updatedate = getdate(db_result($res_files, $f, 'updatedate'));
+				$updatedate = db_result($res_files, $f, 'updatedate');
+				$createdate = db_result($res_files, $f, 'createdate');
+				$realdate = ($updatedate >= $createdate) ? $updatedate : $createdate;
+				$displaydate = getdate($realdate);
 				$filename = db_result($res_files,$f,'filename');
 				$title = db_result($res_files,$f,'title');
-				$description = db_result($res_files,$f,'description');
 				$realname = db_result($res_files,$f,'realname');
+				$statename = db_result($res_files,$f,'state_name');
 				echo '
 					<tr class="align-center">
-						<td class="align-left">
+						<td>'
+							. $displaydate["month"] . ' ' . $displaydate["mday"] . ', ' . $displaydate["year"] .
+						'</td>
+						<td>
 							<strong>' . $filename . '</strong>
 						</td>
 						<td>'
 							.$title.'
 						</td>
-						<td>'
-							. $description .
-						'</td>
-						<td>'
-							. $updatedate["month"] . ' ' . $updatedate["mday"] . ', ' . $updatedate["year"] .
-						'</td>
 						<td >'
 							. $realname .
-						'</td>
-					</tr>';
+						'</td>';
+				if (session_loggedin() && (user_ismember($group_id) || user_ismember(1,'A'))) {
+					echo	'<td>'
+							. $statename .
+						'</td>';
+				}
+				echo	'</tr>';
 			}
 		}
 		echo '</table>';
-		echo '<div class="underline-link">' . util_make_link('/docman/?group_id='.$group_id, _('Browse Documents Project')) . '</div>';
+		echo '<div class="underline-link">' . util_make_link('/docman/?group_id='.$group_id, _('Browse Documents Manager')) . '</div>';
 	}
 
 	function isAvailable() {
@@ -119,11 +133,11 @@
 	}
 
 	function getCategory() {
-		return 'Document Manager';
+		return 'Documents-Manager';
 	}
 
 	function getDescription() {
-		return _(' List the most recent documents published by team project.');
+		return _(' List the 5 most recent documents published by team project.');
 	}
 
 }




More information about the Fusionforge-commits mailing list