Explorar el Código

- Bug fix: when creating a new object the "Cancel" button must go somewhere !

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1002 a333f486-631f-4898-b8df-5754b55c2be0
dflaven hace 14 años
padre
commit
45dce2f2df

+ 2 - 1
application/cmdbabstract.class.inc.php

@@ -1351,7 +1351,8 @@ EOF
 			$oPage->add("<button type=\"submit\" class=\"action\"><span>".Dict::S('UI:Button:Create')."</span></button>\n");
 		}
 		// Hook the cancel button via jQuery so that it can be unhooked easily as well if needed
-		$oPage->add_ready_script("$('#form_{$this->m_iFormId} button.cancel').click( function() { BackToDetails('$sClass', $iKey)} );");
+		$sDefaultUrl = '../pages/UI.php?operation=cancel';
+		$oPage->add_ready_script("$('#form_{$this->m_iFormId} button.cancel').click( function() { BackToDetails('$sClass', $iKey, '$sDefaultUrl')} );");
 		$oPage->add("</form>\n");
 		
 		$iFieldsCount = count($aFieldsMap);

+ 9 - 2
application/itopwebpage.class.inc.php

@@ -369,9 +369,16 @@ EOF
 			window.history.back();
 		}
 		
-		function BackToDetails(sClass, id)
+		function BackToDetails(sClass, id, sDefaultUrl)
 		{
-			window.location.href = './UI.php?operation=details&class='+sClass+'&id='+id;
+			if (id > 0)
+			{
+				window.location.href = './UI.php?operation=details&class='+sClass+'&id='+id;
+			}
+			else
+			{
+				window.location.href = sDefaultUrl;				
+			}
 		}
 
 		

+ 2 - 0
dictionaries/dictionary.itop.ui.php

@@ -461,6 +461,7 @@ Dict::Add('EN US', 'English', 'English', array(
 	'UI:CSVImport:idField' => 'id (Primary Key)',
 	'UI:Title:BulkImport' => 'iTop - Bulk import',
 	'UI:Title:BulkImport+' => 'CSV Import Wizard',
+	'UI:Title:BulkSynchro_nbItem_ofClass_class' => 'Synchronization of %1$d objects of class %2$s',
 	'UI:CSVImport:ClassesSelectOne' => '-- select one --',
 	'UI:CSVImport:ErrorExtendedAttCode' => 'Internal error: "%1$s" is an incorrect code because "%2$s" is NOT an external key of the class "%3$s"',
 	'UI:CSVImport:ObjectsWillStayUnchanged' => '%1$d objects(s) will stay unchanged.',
@@ -842,6 +843,7 @@ When associated with a trigger, each action is given an "order" number, specifyi
 	'UI:DisplayThisMessageAtStartup' => 'Display this message at startup',
 	'UI:RelationshipGraph' => 'Graphical view',
 	'UI:RelationshipList' => 'List',
+	'UI:OperationCancelled' => 'Operation Cancelled',
 
 	'Portal:Title' => 'iTop user portal',
 	'Portal:Refresh' => 'Refresh',

+ 2 - 0
dictionaries/fr.dictionary.itop.ui.php

@@ -462,6 +462,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
 	'UI:CSVImport:idField' => 'id (Clef primaire)',
 	'UI:Title:BulkImport' => 'iTop - Import massif',
 	'UI:Title:BulkImport+' => 'Assistant d\'import CSV',
+	'UI:Title:BulkSynchro_nbItem_ofClass_class' => 'Synchronisation de %1$d éléments de type %2$s',
 	'UI:CSVImport:ClassesSelectOne' => '-- choisir une valeur --',
 	'UI:CSVImport:ErrorExtendedAttCode' => 'Erreur interne: "%1$s" n\'est pas une code correct car "%2$s" n\'est pas une clef externe de la classe "%3$s"',
 	'UI:CSVImport:ObjectsWillStayUnchanged' => '%1$d objets(s) resteront inchangés.',
@@ -851,6 +852,7 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
 	'UI:DisplayThisMessageAtStartup' => 'Afficher ce message au démarrage',
 	'UI:RelationshipGraph' => 'Vue graphique',
 	'UI:RelationshipList' => 'Liste',
+	'UI:OperationCancelled' => 'Opération Annulée',
 
 	'Portal:Title' => 'Portail utilisateur iTop',
 	'Portal:Refresh' => 'Rafraîchir',

+ 5 - 0
pages/UI.php

@@ -1471,6 +1471,11 @@ EOF
 		);
 		$oP->SetCurrentTab('');
 		break;
+		
+		case 'cancel':
+		$oP->set_title(Dict::S('UI:OperationCancelled'));
+		$oP->add('<h1>'.Dict::S('UI:OperationCancelled').'</h1>');
+		break;
 	
 		default:
 		$oMenuNode = ApplicationMenu::GetMenuNode(ApplicationMenu::GetActiveNodeId());