[Fusionforge-commits] r13499 - in trunk/src/common/docman: . actions views

Franck VILLAUME nerville at fusionforge.org
Tue Jun 14 18:45:29 CEST 2011


Author: nerville
Date: 2011-06-14 18:45:29 +0200 (Tue, 14 Jun 2011)
New Revision: 13499

Modified:
   trunk/src/common/docman/Document.class.php
   trunk/src/common/docman/actions/addfile.php
   trunk/src/common/docman/views/addfile.php
Log:
add support to stateid for new file submission

Modified: trunk/src/common/docman/Document.class.php
===================================================================
--- trunk/src/common/docman/Document.class.php	2011-06-14 14:15:07 UTC (rev 13498)
+++ trunk/src/common/docman/Document.class.php	2011-06-14 16:45:29 UTC (rev 13499)
@@ -105,12 +105,13 @@
 	 *	@param	string	The filename of this document. Can be a URL.
 	 *	@param	string	The filetype of this document. If filename is URL, this should be 'URL';
 	 *	@param	string	The contents of this document.
-	 *	@param	int	The doc_group id of the doc_groups table.
+	 *	@param	int		The doc_group id of the doc_groups table.
 	 *	@param	string	The title of this document.
 	 *	@param	string	The description of this document.
+	 *	@param	int		The state id of the document. At creation, can not be deleted status.
 	 *	@return	boolean	success.
 	 */
-	function create($filename, $filetype, $data, $doc_group, $title, $description) {
+	function create($filename, $filetype, $data, $doc_group, $title, $description, $stateid = 0) {
 		if (strlen($title) < 5) {
 			$this->setError(_('Title Must Be At Least 5 Characters'));
 			return false;
@@ -127,7 +128,11 @@
 		if (session_loggedin()) {
 			$perm =& $this->Group->getPermission();
 			if ($perm && is_object($perm) && $perm->isDocEditor()) {
-				$doc_initstatus = '1';
+				if ($stateid && $stateid != 2) {
+					$doc_initstatus = $stateid;
+				} else {
+					$doc_initstatus = '1';
+				}
 			}
 		}
 

Modified: trunk/src/common/docman/actions/addfile.php
===================================================================
--- trunk/src/common/docman/actions/addfile.php	2011-06-14 14:15:07 UTC (rev 13498)
+++ trunk/src/common/docman/actions/addfile.php	2011-06-14 16:45:29 UTC (rev 13499)
@@ -42,6 +42,7 @@
 $manual_path = getStringFromRequest('manual_path');
 $type = getStringFromRequest('type');
 $name = getStringFromRequest('name');
+$stateid = getIntFromRequest('stateid');
 
 if (!$doc_group || $doc_group == 100) {
 	//cannot add a doc unless an appropriate group is provided
@@ -142,7 +143,7 @@
 	}
 }
 
-if (!$d->create($uploaded_data_name, $uploaded_data_type, $data, $doc_group, $title, $description)) {
+if (!$d->create($uploaded_data_name, $uploaded_data_type, $data, $doc_group, $title, $description, $stateid)) {
 	if (forge_check_perm('docman', $group_id, 'approve')) {
 		session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$doc_group.'&error_msg='.urlencode($d->getErrorMessage()));
 	} else {

Modified: trunk/src/common/docman/views/addfile.php
===================================================================
--- trunk/src/common/docman/views/addfile.php	2011-06-14 14:15:07 UTC (rev 13498)
+++ trunk/src/common/docman/views/addfile.php	2011-06-14 16:45:29 UTC (rev 13499)
@@ -160,7 +160,6 @@
 	$params = array() ;
 	/* name must be details !!! if name = data then nothing is displayed */
 	$params['name'] = 'details';
-	$params['width'] = "800";
 	$params['height'] = "300";
 	$params['body'] = "";
 	$params['group'] = $group_id;
@@ -185,6 +184,17 @@
 					</td>
 				</tr>';
 	}
+	if (forge_check_perm('docman', $group_id, 'approve')) {
+		echo '
+				<tr>
+					<td>
+						<strong>'. _('Status of that document').'</strong>
+					</td><td>';
+		doc_get_state_box('xzxz', 2); /**no direct deleted status */
+		echo '
+					</td>
+				</tr>';
+	}
 	echo '	</table>';
 	echo '<span>'.utils_requiredField() .' '. _('Mandatory fields').'</span>';
 	echo '	<div class="docmanSubmitDiv">




More information about the Fusionforge-commits mailing list