[Fusionforge-commits] r8687 - trunk/gforge/www/tracker/admin

Olivier Meunier musicoliv at libremir.placard.fr.eu.org
Mon Jan 25 14:37:24 CET 2010


Author: musicoliv
Date: 2010-01-25 14:37:24 +0100 (Mon, 25 Jan 2010)
New Revision: 8687

Added:
   trunk/gforge/www/tracker/admin/form-deleteextrafieldelement.php
Modified:
   trunk/gforge/www/tracker/admin/form-addextrafield.php
   trunk/gforge/www/tracker/admin/index.php
   trunk/gforge/www/tracker/admin/updates.php
Log:
Adds the option to delete an element of a custom field of a tracker

Modified: trunk/gforge/www/tracker/admin/form-addextrafield.php
===================================================================
--- trunk/gforge/www/tracker/admin/form-addextrafield.php	2010-01-24 21:40:26 UTC (rev 8686)
+++ trunk/gforge/www/tracker/admin/form-addextrafield.php	2010-01-25 13:37:24 UTC (rev 8687)
@@ -49,14 +49,20 @@
 
 					echo '<td>';
 					for ($j=0; $j <$optrows; $j++)
-				
+					{
+						echo $elearray[$j]['element_name'];				
 						echo '<a href="'.getStringFromServer('PHP_SELF').'?update_opt=1&amp;id='.
 						$elearray[$j]['element_id'].'&amp;group_id='.$group_id.'&amp;atid='. $ath->getID() .'&amp;boxid='.
 						$efarr[$i]['extra_field_id'].'">'.
-						$elearray[$j]['element_name'].' ['._('Edit').']</a><br />';
-
-					} else {
-						echo '<td>';
+						' ['._('Edit').']</a>';
+						echo '<a href="'.getStringFromServer('PHP_SELF').'?delete_opt=1&amp;id='.
+						$elearray[$j]['element_id'].'&amp;group_id='.$group_id.'&amp;atid='. $ath->getID() .'&amp;boxid='.
+						$efarr[$i]['extra_field_id'].'">'.
+						' ['._('Delete').']</a>';
+						echo '<br />';
+					}
+				} else {
+					echo '<td>';
 				}
 				
 				echo '</td>';

Added: trunk/gforge/www/tracker/admin/form-deleteextrafieldelement.php
===================================================================
--- trunk/gforge/www/tracker/admin/form-deleteextrafieldelement.php	                        (rev 0)
+++ trunk/gforge/www/tracker/admin/form-deleteextrafieldelement.php	2010-01-25 13:37:24 UTC (rev 8687)
@@ -0,0 +1,54 @@
+<?php
+//
+//  FORM TO DELETE POP-UP CHOICES FOR A BOX
+//
+	/*
+		Allow deletion of a Choice for a Pop-up Box
+	*/
+	$boxid = getIntFromRequest('boxid');
+	$ac = new ArtifactExtraField($ath,$boxid);
+	if (!$ac || !is_object($ac)) {
+		exit_error('Error','Unable to create ArtifactExtraField Object');
+	} elseif ($ac->isError()) {
+		exit_error('Error',$ac->getErrorMessage());
+	} else {
+		$id = getStringFromRequest('id');
+		$ao = new ArtifactExtraFieldElement($ac,$id);
+		if (!$ao || !is_object($ao)) {
+			exit_error('Error','Unable to create ArtifactExtraFieldElement Object');
+		} elseif ($ao->isError()) {
+			exit_error('Error',$ao->getErrorMessage());
+		} else {
+			$title = sprintf(_('Remove a custom field element in %s'), $ath->getName()) ;
+			$ath->adminHeader(array('title'=>$title));
+
+			echo '
+				<h2>'.$title.'</h2>';
+
+			?>
+			<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&amp;atid='.$ath->getID(); ?>" method="post">
+			<input type="hidden" name="delete_opt" value="y" />
+			<input type="hidden" name="id" value="<?php echo $ao->getID(); ?>" />
+			<input type="hidden" name="boxid" value="<?php echo $boxid; ?>" />
+
+			<p>
+			<strong><?php echo _('Element') ?>:</strong>&nbsp;
+			<?php echo $ao->getName(); ?></p>
+			<p>
+			<input type="checkbox" name="sure" value="1" /><?php echo _("I'm Sure.") ?><br />
+			<input type="checkbox" name="really_sure" value="1" /><?php echo _("I'm Really Sure.") ?>
+			</p>
+			<p>
+			<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
+			</form>
+			<?php
+			$ath->footer(array());
+		}
+	}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Modified: trunk/gforge/www/tracker/admin/index.php
===================================================================
--- trunk/gforge/www/tracker/admin/index.php	2010-01-24 21:40:26 UTC (rev 8686)
+++ trunk/gforge/www/tracker/admin/index.php	2010-01-25 13:37:24 UTC (rev 8687)
@@ -85,7 +85,7 @@
 		$actions = array('add_extrafield', 'customize_list', 'workflow', 'workflow_roles', 'add_opt',
 			'updownorder_opt', 'post_changes_order', 'post_changes_alphaorder', 'copy_opt', 'add_canned',
 			'clone_tracker', 'uploadtemplate', 'downloadtemplate', 'downloadcurrenttemplate', 
-			'update_canned', 'update_box', 'update_opt', 'delete', 'deleteextrafield','update_type');
+			'update_canned', 'update_box', 'update_opt', 'delete', 'delete_opt', 'deleteextrafield','update_type');
 		$action = '';
 		foreach ($actions as $a) {
 			if (getStringFromRequest($a)) {
@@ -154,6 +154,10 @@
 
 		include $gfwww.'tracker/admin/form-updateextrafieldelement.php';
 
+	} elseif ($action == 'delete_opt') {
+
+		include $gfwww.'tracker/admin/form-deleteextrafieldelement.php';
+
 	} elseif ($action == 'delete') {
 
 		include $gfwww.'tracker/admin/form-deletetracker.php';

Modified: trunk/gforge/www/tracker/admin/updates.php
===================================================================
--- trunk/gforge/www/tracker/admin/updates.php	2010-01-24 21:40:26 UTC (rev 8686)
+++ trunk/gforge/www/tracker/admin/updates.php	2010-01-25 13:37:24 UTC (rev 8687)
@@ -434,5 +434,30 @@
 			$atw = new ArtifactWorkflow($ath, $field_id);
     		$atw->saveAllowedRoles($from, $next, $role);
 			$feedback .= _('Workflow saved');
+		} elseif (getStringFromRequest('delete_opt')) {
+			$sure = getStringFromRequest('sure');
+			$really_sure = getStringFromRequest('really_sure');
+
+			$id = getStringFromRequest('id');
+			$boxid = getStringFromRequest('boxid');
+			$ab = new ArtifactExtraField($ath,$boxid);
+			if (!$ab || !is_object($ab)) {
+				$feedback .= 'Unable to create ArtifactExtraField Object';
+			} elseif ($ab->isError()) {
+				$feedback .= $ab->getErrorMessage();			
+			} else {
+				$ao = new ArtifactExtraFieldElement($ab,$id);
+				if (!$ao || !is_object($ao)) {
+					$feedback .= 'Unable to create ArtifactExtraFieldElement Object';
+				} else {
+					if (!$sure || !$really_sure || !$ao->delete()) {
+						$feedback .= _('Error deleting an element').': '.$ao->getErrorMessage();
+						$ao->clearError();
+					} else {
+						$feedback .= _('Element deleted');
+						$next = 'add_extrafield';
+					}
+				}
+			}
 		}
 		?>




More information about the Fusionforge-commits mailing list