Przeglądaj źródła

- New implementation of the UIExtKeyWidget that is no longer limited to editing an attribute of an object
- When needed the drop-down list of organizations is replaced by an autocomplete

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1284 a333f486-631f-4898-b8df-5754b55c2be0

dflaven 14 lat temu
rodzic
commit
5c25d176fc
1 zmienionych plików z 11 dodań i 19 usunięć
  1. 11 19
      js/extkeywidget.js

+ 11 - 19
js/extkeywidget.js

@@ -13,12 +13,12 @@
 //   along with this program; if not, write to the Free Software
 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
+function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper)
 {
 	this.id = id;
-	this.sClass = sClass;
-	this.sAttCode = sAttCode;
-	this.sSuffix = sSuffix;
+	this.sTargetClass = sTargetClass;
+	this.sFilter = sFilter;
+	this.sTitle = sTitle;
 	this.emptyHtml = ''; // content to be displayed when the search results are empty (when opening the dialog) 
 	this.emptyOnClose = true; // Workaround for the JQuery dialog being very slow when opening and closing if the content contains many INPUT tags
 	this.oWizardHelper = oWizHelper;
@@ -60,9 +60,8 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
 		}
 		var theMap = { sAttCode: me.sAttCode,
 				   iInputId: me.id,
-				   sSuffix: me.sSuffix,
-				   'class': me.sClass,
-				   sValue: value,
+				   sTitle: me.sTitle,
+				   sTargetClass: me.sTargetClass,
 				   operation: 'objectSearchForm'
 				 }
 	
@@ -123,9 +122,9 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
 	
 	this.DoSearchObjects = function(id)
 	{
-		var theMap = { sAttCode: me.sAttCode,
+		var theMap = { sTargetClass: me.sTargetClass,
 					   iInputId: me.id,
-					   sSuffix: me.sSuffix
+					   sFilter: me.sFilter
 					 }
 		
 		// Gather the parameters from the search form
@@ -151,7 +150,6 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
 		}
 		
 		theMap['sRemoteClass'] = theMap['class'];  // swap 'class' (defined in the form) and 'remoteClass'
-		theMap['class'] = me.sClass;
 		theMap.operation = 'searchObjectsToSelect'; // Override what is defined in the form itself
 		
 		sSearchAreaId = '#dr_'+me.id;
@@ -187,11 +185,9 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
 		$('#label_'+this.id).addClass('ac_dlg_loading');
 
 		// Query the server again to get the display name of the selected object
-		var theMap = { sAttCode: me.sAttCode,
+		var theMap = { sTargetClass: me.sTargetClass,
 				   iInputId: me.id,
 				   iObjectId: iObjectId,
-				   sSuffix: me.sSuffix,
-				   'class': me.sClass,
 				   operation: 'getObjectName'
 				 }
 	
@@ -246,10 +242,8 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
 			$('#label_'+me.id).addClass('ac_dlg_loading');
 		}
 		me.oWizardHelper.UpdateWizard();
-		var theMap = { sAttCode: me.sAttCode,
+		var theMap = { sTargetClass: me.sTargetClass,
 				   iInputId: me.id,
-				   sSuffix: me.sSuffix,
-				   'class': me.sClass,
 				   'json': me.oWizardHelper.ToJSON(),
 				   operation: 'objectCreationForm'
 				 }
@@ -309,10 +303,8 @@ function ExtKeyWidget(id, sClass, sAttCode, sSuffix, bSelectMode, oWizHelper)
 		if (CheckFields(sFormId, true))
 		{
 			$('#'+sFormId).block();
-			var theMap = { sAttCode: me.sAttCode,
+			var theMap = { sTargetClass: me.sTargetClass,
 					   iInputId: me.id,
-					   sSuffix: me.sSuffix,
-					   'class': me.sClass,
 					   'json': me.oWizardHelper.ToJSON()
 					 }