[Fusionforge-commits] r10459 - trunk/src/www/tracker/admin

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Sun Sep 12 20:04:11 CEST 2010


Author: nerville
Date: 2010-09-12 20:04:10 +0200 (Sun, 12 Sep 2010)
New Revision: 10459

Modified:
   trunk/src/www/tracker/admin/form-clonetracker.php
   trunk/src/www/tracker/admin/form-customizelist.php
   trunk/src/www/tracker/admin/form-workflow.php
Log:
header + php warning

Modified: trunk/src/www/tracker/admin/form-clonetracker.php
===================================================================
--- trunk/src/www/tracker/admin/form-clonetracker.php	2010-09-12 17:46:26 UTC (rev 10458)
+++ trunk/src/www/tracker/admin/form-clonetracker.php	2010-09-12 18:04:10 UTC (rev 10459)
@@ -1,44 +1,65 @@
 <?php
-//
-//	FORM TO CLONE A TRACKER
-//
-		$g =& group_get_object(forge_get_config('template_group'));
-		if (!$g || !is_object($g)) {
-			exit_error('Error','Unable to Create Template Group Object');
-		} elseif ($g->isError()) {
-			exit_error('Error',$g->getErrorMessage());
-		} else {
-			$atf = new ArtifactTypeFactory($g);
-			if (!$atf || !is_object($atf)) {
-				exit_error('Error','Unable to Create Template Group Object');
-			} elseif ($atf->isError()) {
-				exit_error('Error',$atf->atfetErrorMessaatfe());
+/**
+ * FusionForge Tracker Cloning Form
+ *
+ * Copyright 2010, FusionForge Team
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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
+ */
+
+$g =& group_get_object(forge_get_config('template_group'));
+if (!$g || !is_object($g)) {
+	exit_error('Error','Unable to Create Template Group Object');
+} elseif ($g->isError()) {
+	exit_error('Error',$g->getErrorMessage());
+} else {
+	$atf = new ArtifactTypeFactory($g);
+	if (!$atf || !is_object($atf)) {
+		exit_error('Error','Unable to Create Template Group Object');
+	} elseif ($atf->isError()) {
+		exit_error('Error',$atf->atfetErrorMessaatfe());
+	} else {
+		$ata = & $atf->getArtifactTypes();
+		$ids = array();
+		$titles = array();
+		for ($i=0; $i<count($ata); $i++) {
+			if (!$ata[$i] || $ata[$i]->isError()) {
+//skip it
 			} else {
-				$ata =& $atf->getArtifactTypes();
-				for ($i=0; $i<count($ata); $i++) {
-					if (!$ata[$i] || $ata[$i]->isError()) {
-//skip it
-					} else {
-						$ids[]=$ata[$i]->getID();
-						$titles[]=$g->getPublicName().'::'.$ata[$i]->getName();
-					}
-				}
+				$ids[]=$ata[$i]->getID();
+				$titles[]=$g->getPublicName().'::'.$ata[$i]->getName();
+			}
+		}
 
-				$ath->adminHeader(array ('title'=>_('Clone Tracker')));
+		$ath->adminHeader(array ('title'=>_('Clone Tracker')));
 
-				echo "<h1>"._('Clone Tracker')."</h1>";
+		echo "<h1>"._('Clone Tracker')."</h1>";
 
-				?>
-				<p><?php echo _('Choose the template tracker to clone. The site administrator will have to set up trackers with default values and set permissions properly so you can access them.') ?></p>
-				<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
-				<input type="hidden" name="clone_tracker" value="y" />
-				<p><strong><?php echo _('WARNING!!! Cloning this tracker will duplicate all the fields and all the elements from those fields into this tracker. There is nothing to prevent you from cloning multiple times or making a huge mess. You have been warned!') ?></strong></p>
-				<p><?php echo html_build_select_box_from_arrays($ids,$titles,'clone_id','',false); ?></p>
-				<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
-				</form>
-				<?php
-				$ath->footer(array());
-			}
-		}
-
+		?>
+		<p><?php echo _('Choose the template tracker to clone. The site administrator will have to set up trackers with default values and set permissions properly so you can access them.') ?></p>
+		<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
+		<input type="hidden" name="clone_tracker" value="y" />
+		<div class="warning" ><?php echo _('WARNING!!! Cloning this tracker will duplicate all the fields and all the elements from those fields into this tracker. There is nothing to prevent you from cloning multiple times or making a huge mess. You have been warned!') ?></div>
+		<p><?php echo html_build_select_box_from_arrays($ids,$titles,'clone_id','',false); ?></p>
+		<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" />
+		</form>
+<?php
+		$ath->footer(array());
+	}
+}
 ?>

Modified: trunk/src/www/tracker/admin/form-customizelist.php
===================================================================
--- trunk/src/www/tracker/admin/form-customizelist.php	2010-09-12 17:46:26 UTC (rev 10458)
+++ trunk/src/www/tracker/admin/form-customizelist.php	2010-09-12 18:04:10 UTC (rev 10459)
@@ -1,78 +1,98 @@
 <?php
-//
-//	FORM TO UPDATE ARTIFACT TYPES
-//
-		$ath->adminHeader(array ('title'=>_('Customize Browse List'),'pagename'=>'tracker_admin_customize_liste','titlevals'=>array($ath->getName())));
+/**
+ * FusionForge Artifact update Form
+ *
+ * Copyright 2010, FusionForge Team
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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
+ */
 
-		/*
-			List of possible user built Selection Boxes for an ArtifactType
-		*/
-		$efarr =& $ath->getExtraFields();
-		
-		$browse_fields = explode(',',$ath->getBrowseList());
-		?>
+$ath->adminHeader(array ('title'=>_('Customize Browse List'),'pagename'=>'tracker_admin_customize_liste','titlevals'=>array($ath->getName())));
 
-		<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
-		<input type="hidden" name="customize_list" value="y" />
-		<p>
-		<?php echo _('Set order of the fields that will be displayed on the browse view of your tracker:') ?>
-		</p>
+/*
+	List of possible user built Selection Boxes for an ArtifactType
+*/
+$efarr = $ath->getExtraFields();
+
+$browse_fields = explode(',',$ath->getBrowseList());
+?>
+
+<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
+<input type="hidden" name="customize_list" value="y" />
+<p>
+<?php echo _('Set order of the fields that will be displayed on the browse view of your tracker:') ?>
+</p>
 		
-		<?php
-		// Display regular fields.
-		$fields = array (
-			'summary' => _('Summary'),
-			'open_date' => _('Open Date'),
-			'status_id' => _('State'),
-			'priority'  => _('Priority'),
-			'assigned_to' => _('Assigned To'),
-			'submitted_by' => _('Submitted By'),
-			'close_date' => _('Close Date'),
-			'details' => _('Detailed description'),
-			'related_tasks' => _('Related tasks')
-		);
+<?php
+// Display regular fields.
+$fields = array (
+		'summary' => _('Summary'),
+		'open_date' => _('Open Date'),
+		'status_id' => _('State'),
+		'priority'  => _('Priority'),
+		'assigned_to' => _('Assigned To'),
+		'submitted_by' => _('Submitted By'),
+		'close_date' => _('Close Date'),
+		'details' => _('Detailed description'),
+		'related_tasks' => _('Related tasks')
+	);
 
-    	if(count($ath->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_STATUS)) > 0) {
-      		unset($fields['status_id']);
-    	}
+if(count($ath->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_STATUS)) > 0) {
+	unset($fields['status_id']);
+}
 
-		// Extra fields
-		foreach ($efarr as $f) {
-			$fields[$f[0]] = $f['field_name'];
-		}
+// Extra fields
+foreach ($efarr as $f) {
+	$fields[$f[0]] = $f['field_name'];
+}
 
-		asort($fields);
+asort($fields);
 
-		// Display fields
-		foreach ($fields as $f => $name) {
-			$pos = array_search($f, $browse_fields);
-			echo "<input type=\"text\" name=\"browse_fields[$f]\" value=\"" .
-				 (($pos !== false) ? $pos + 1 : '') .
-				 "\" size=\"3\" maxlength=\"3\" /> " .
-				 $name .
-				 "<br />\n";
-		}	
-		
-		$keys=array_keys($efarr);
-		$rows=count($keys);
-		if ($rows > 0) {
-			for ($k=0; $k < $rows; $k++) {
-				$i=$keys[$k];
-				$pos = array_search($i, $browse_fields);
-				echo "<input type=\"text\" name=\"browse_fields[$i]\" value=\"" .
-				 	 (($pos !== false) ? $pos + 1 : '') .
-				 	 "\" size=\"3\" maxlength=\"3\" /> " .
-					 $efarr[$i]['field_name'] .
-					 "<br />\n";
-			}
-		}
-		?>
+// Display fields
+foreach ($fields as $f => $name) {
+	$pos = array_search($f, $browse_fields);
+	echo "<input type=\"text\" name=\"browse_fields[$f]\" value=\"" .
+		 (($pos !== false) ? $pos + 1 : '') .
+		 "\" size=\"3\" maxlength=\"3\" /> " .
+		 $name .
+		 "<br />\n";
+}	
 
-		<p>
-		<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
-		</form>
-		<?php
+$keys=array_keys($efarr);
+$rows=count($keys);
+if ($rows > 0) {
+	for ($k=0; $k < $rows; $k++) {
+		$i=$keys[$k];
+		$pos = array_search($i, $browse_fields);
+		echo "<input type=\"text\" name=\"browse_fields[$i]\" value=\"" .
+		 	 (($pos !== false) ? $pos + 1 : '') .
+		 	 "\" size=\"3\" maxlength=\"3\" /> " .
+			 $efarr[$i]['field_name'] .
+			 "<br />\n";
+	}
+}
+?>
 
-		$ath->footer(array());
+<p>
+<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
+</form>
+<?php
 
+$ath->footer(array());
+
 ?>

Modified: trunk/src/www/tracker/admin/form-workflow.php
===================================================================
--- trunk/src/www/tracker/admin/form-workflow.php	2010-09-12 17:46:26 UTC (rev 10458)
+++ trunk/src/www/tracker/admin/form-workflow.php	2010-09-12 18:04:10 UTC (rev 10459)
@@ -1,112 +1,132 @@
 <?php
 
+/**
+ * FusionForge Update Artifact Type Form
+ *
+ * Copyright 2010, FusionForge Team
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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
+ */
+
 require_once('common/tracker/ArtifactWorkflow.class.php');
 
-//
-//	FORM TO UPDATE ARTIFACT TYPES
-//
-		$has_error = false;
-		$error_msg = '';
-		$efarr =& $ath->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_STATUS);
-    	if (count($efarr) === 0) {
-    		$has_error = true;
-    		$error_msg .= _('To create a workflow, you need first to create a custom field of type \'Status\'.');
-    	} elseif (count($efarr) !== 1) {
-			// Internal error.
-			$has_error = true;
-    		$error_msg .= 'Internal error: Illegal number of status fields (WKFL01).';
-    	}
+$has_error = false;
+$error_msg = '';
+$efarr = $ath->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_STATUS);
+if (count($efarr) === 0) {
+	$has_error = true;
+   	$error_msg .= _('To create a workflow, you need first to create a custom field of type \'Status\'.');
+} elseif (count($efarr) !== 1) {
+	// Internal error.
+	$has_error = true;
+   	$error_msg .= 'Internal error: Illegal number of status fields (WKFL01).';
+}
     	
-		$ath->adminHeader(array ('title'=> _('Configure workflow'),'pagename'=>'tracker_admin_customize_liste','titlevals'=>array($ath->getName())));
+$ath->adminHeader(array ('title'=> _('Configure workflow'),'pagename'=>'tracker_admin_customize_liste','titlevals'=>array($ath->getName())));
 
-		/*
-			List of possible user built Selection Boxes for an ArtifactType
-		*/
-    	if (!$has_error) {
+/*
+	List of possible user built Selection Boxes for an ArtifactType
+*/
+if (!$has_error) {
     		
-	    	$keys=array_keys($efarr);
-	    	$field_id = $keys[0];
-	    	$field_name = $efarr[$field_id]['field_name'];
+  	$keys=array_keys($efarr);
+   	$field_id = $keys[0];
+   	$field_name = $efarr[$field_id]['field_name'];
 
-	    	$atw = new ArtifactWorkflow($ath, $field_id);
+   	$atw = new ArtifactWorkflow($ath, $field_id);
+
+	$elearray = $ath->getExtraFieldElements($field_id);
+	$states = $elearray;
+
+?>
+	    	
+   	<h2><?php printf(_('Allowed initial values for the %1$s field'), $field_name) ?></h2>
+	<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
+	<input type="hidden" name="field_id" value="<?php echo $field_id ?>" />
+	<input type="hidden" name="workflow" value="1" />
+   	
+<?php 
+	$from = _('From').' ';
+	$to = _('To').' ';
+	$init = _('Initial values').' ';
+
+	$title_arr=array();
+	$title_arr[]=_('From Value');
+	foreach ($elearray as $status) {
+		$title_arr[]=$status['element_name'];		
+	}
+	echo $GLOBALS['HTML']->listTableTop($title_arr, false, ' ');
+	echo "\n";
+
+	// Special treatement for the initial value (in the Submit form).
+	echo '<tr><th style="text-align:left">'.$init.'</th>'."\n";
+	$next = $atw->getNextNodes('100');
+	foreach ($states as $s) {
+		$name = 'wk[100]['. $s['element_id'].']';
+		$value = in_array($s['element_id'], $next)? ' checked="checked"' : '';
+		$str = '<input type="checkbox" name="'.$name.'"'.$value.' />';
+		$str .= ' '.html_image('spacer.gif', 20, 20, array());
+		echo '<td align="center">'.$str.'</td>'."\n";
+	}
+	echo '</tr>'."\n";
+	echo $GLOBALS['HTML']->listTableBottom();
+
+	echo '<h2>'.sprintf(_('Configuring workflow for the %1$s field'), $field_name).'</h2>';
+
+	$count=count($title_arr);
+	$totitle_arr = array();
+	for ($i=0; $i<$count; $i++) {
+		$totitle_arr[] = $title_arr[$i]? $to.$title_arr[$i] : '';
+	}
+	echo $GLOBALS['HTML']->listTableTop($totitle_arr, false, ' ');
 	
-			$elearray = $ath->getExtraFieldElements($field_id);
-			$states = $elearray;
-	    	
-	    	?>
-	    	
-	    	<h2><?php printf(_('Allowed initial values for the %1$s field'), $field_name) ?></h2>
-			<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
-			<input type="hidden" name="field_id" value="<?php echo $field_id ?>" />
-			<input type="hidden" name="workflow" value="1" />
-	    	
-	<?php 
-			$from = _('From').' ';
-			$to = _('To').' ';
-			$init = _('Initial values').' ';
-			
-			$title_arr=array();
-			$title_arr[]=_('From Value');
-			foreach ($elearray as $status) {
-				$title_arr[]=$status['element_name'];		
-			}
-			echo $GLOBALS['HTML']->listTableTop($title_arr, false, ' ');
-			echo "\n";
-			
-			// Special treatement for the initial value (in the Submit form).
-			echo '<tr><th style="text-align:left">'.$init.'</th>'."\n";
-			$next = $atw->getNextNodes('100');
-			foreach ($states as $s) {
-				$name = 'wk[100]['. $s['element_id'].']';
+	foreach ($elearray as $status) {
+		echo '<tr><th style="text-align:left">'.$from.$status['element_name'].'</th>'."\n";
+		$next = $atw->getNextNodes($status['element_id']);
+		foreach ($states as $s) {
+			if ($status['element_id'] !== $s['element_id']) {
+				$name = 'wk['.$status['element_id'].']['. $s['element_id'].']';
 				$value = in_array($s['element_id'], $next)? ' checked="checked"' : '';
 				$str = '<input type="checkbox" name="'.$name.'"'.$value.' />';
+				if ($value) {
+					$url = getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID().'&amp;workflow_roles=1&amp;from='.$status['element_id'].'&amp;next='.$s['element_id'];
+					$str .= ' <a href="'.$url.'" title="Edit roles">'.html_image('ic/acl_roles20.png', 20, 20, array('alt'=>'Edit Roles')).'</a>';
+				} else {
+					$str .= ' '.html_image('spacer.gif', 20, 20, array());
+				}
+			} else {
+				$str = '<input type="checkbox" checked="checked" disabled="disabled" />';
 				$str .= ' '.html_image('spacer.gif', 20, 20, array());
-				echo '<td align="center">'.$str.'</td>'."\n";
 			}
-			echo '</tr>'."\n";
-			echo $GLOBALS['HTML']->listTableBottom();
+			echo '<td align="center">'.$str.'</td>'."\n";
+		}
+		echo '</tr>'."\n";
+	}
+	echo $GLOBALS['HTML']->listTableBottom();
 
-			echo '<h2>'.sprintf(_('Configuring workflow for the %1$s field'), $field_name).'</h2>';
-			
-			$count=count($title_arr);
-			$totitle_arr = array();
-			for ($i=0; $i<$count; $i++) {
-				$totitle_arr[] = $title_arr[$i]? $to.$title_arr[$i] : '';
-			}
-			echo $GLOBALS['HTML']->listTableTop($totitle_arr, false, ' ');
-			
-			foreach ($elearray as $status) {
-				echo '<tr><th style="text-align:left">'.$from.$status['element_name'].'</th>'."\n";
-				$next = $atw->getNextNodes($status['element_id']);
-				foreach ($states as $s) {
-					if ($status['element_id'] !== $s['element_id']) {
-						$name = 'wk['.$status['element_id'].']['. $s['element_id'].']';
-						$value = in_array($s['element_id'], $next)? ' checked="checked"' : '';
-						$str = '<input type="checkbox" name="'.$name.'"'.$value.' />';
-						if ($value) {
-							$url = getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID().'&amp;workflow_roles=1&amp;from='.$status['element_id'].'&amp;next='.$s['element_id'];
-							$str .= ' <a href="'.$url.'" title="Edit roles">'.html_image('ic/acl_roles20.png', 20, 20, array('alt'=>'Edit Roles')).'</a>';
-						} else {
-							$str .= ' '.html_image('spacer.gif', 20, 20, array());
-						}
-					} else {
-						$str = '<input type="checkbox" checked="checked" disabled="disabled" />';
-						$str .= ' '.html_image('spacer.gif', 20, 20, array());
-					}
-					echo '<td align="center">'.$str.'</td>'."\n";
-				}
-				echo '</tr>'."\n";
-			}
-			echo $GLOBALS['HTML']->listTableBottom();
+?>
+<div class="tips">Tip: Click on <?php echo html_image('ic/acl_roles20.png', 20, 20, array('alt'=> _('Edit Roles'))) ?> to configure allowed roles for a transition (all by default).</div>	
+<p>
+<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
+</form>
+<?php
+}
 
-			?>
-			<div class="tips">Tip: Click on <?php echo html_image('ic/acl_roles20.png', 20, 20, array('alt'=> _('Edit Roles'))) ?> to configure allowed roles for a transition (all by default).</div>	
-			<p>
-			<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
-			</form>
-			<?php
-		}
+$ath->footer(array());
 
-		$ath->footer(array());
-
 ?>




More information about the Fusionforge-commits mailing list