Browse Source

File or image upload is not supported (and thus disabled) when using the [+] button to create a new object inside a popup dialog.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4236 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 9 năm trước cách đây
mục cha
commit
a946094c23

+ 10 - 3
application/cmdbabstract.class.inc.php

@@ -663,11 +663,11 @@ EOF
 											}
 											$sTip = addslashes($sTip);
 											$oPage->add_ready_script("$('#synchro_$sInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
+											$sComments = $sSynchroIcon;
 										}
 
 										// Attribute is read-only
 										$sHTMLValue = "<span id=\"field_{$sInputId}\">".$this->GetAsHTML($sAttCode).'</span>';
-										$sComments = $sSynchroIcon;
 									}
 									else
 									{
@@ -3199,8 +3199,15 @@ EOF
 				$oImage = utils::ReadPostedDocument("attr_{$sFormPrefix}{$sAttCode}", 'fcontents');
 				$aSize = utils::GetImageSize($oImage->GetData());
 				$oImage = utils::ResizeImageToFit($oImage, $aSize[0], $aSize[1], $oAttDef->Get('storage_max_width'), $oAttDef->Get('storage_max_height'));
-				$aOtherData = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", array(), 'raw_data');
-				$value = array('fcontents' => $oImage, 'remove' => $aOtherData['remove']);
+				$aOtherData = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data');
+				if (is_array($aOtherData))
+				{
+					$value = array('fcontents' => $oImage, 'remove' => $aOtherData['remove']);
+				}
+				else
+				{
+					$value = null;
+				}
 			}
 			elseif ($oAttDef->GetEditClass() == 'RedundancySetting')
 			{

+ 11 - 1
application/ui.extkeywidget.class.inc.php

@@ -452,7 +452,17 @@ EOF
 		$sDialogTitle = '';
 		$oPage->add('<div id="ac_create_'.$this->iId.'"><div class="wizContainer" style="vertical-align:top;"><div id="dcr_'.$this->iId.'">');
 		$oPage->add("<h1>".MetaModel::GetClassIcon($this->sTargetClass)."&nbsp;".Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($this->sTargetClass))."</h1>\n");
-	 	cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), array('formPrefix' => $this->iId, 'noRelations' => true));	
+		$aFieldsFlags = array();
+		$aFieldsComments = array();
+		foreach(MetaModel::ListAttributeDefs($this->sTargetClass) as $sAttCode => $oAttDef)
+		{
+			if (($oAttDef instanceof AttributeBlob) || (false))
+			{
+				$aFieldsFlags[$sAttCode] = OPT_ATT_READONLY;
+				$aFieldsComments[$sAttCode] = '&nbsp;<img src="../images/transp-lock.png" style="vertical-align:middle" title="'.htmlentities(Dict::S('UI:UploadNotSupportedInThisMode')).'"/>';
+			}
+		}
+	 	cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), array('formPrefix' => $this->iId, 'noRelations' => true, 'fieldsFlags' => $aFieldsFlags, 'fieldsComments' => $aFieldsComments));	
 		$oPage->add('</div></div></div>');
 //		$oPage->add_ready_script("\$('#ac_create_$this->iId').dialog({ width: $(window).width()*0.8, height: 'auto', autoOpen: false, modal: true, title: '$sDialogTitle'});\n");
 		$oPage->add_ready_script("\$('#ac_create_$this->iId').dialog({ width: 'auto', height: 'auto', maxHeight: $(window).height() - 50, autoOpen: false, modal: true, title: '$sDialogTitle'});\n");

+ 1 - 0
dictionaries/de.dictionary.itop.ui.php

@@ -1111,5 +1111,6 @@ Wenn Aktionen mit Trigger verknüpft sind, bekommt jede Aktion eine Auftragsnumm
 	'ExcelExport:Statistics' => 'Statistik',
 	'portal:legacy_portal' => 'Endbenutzer-Portal',
 	'portal:backoffice' => 'iTop Backend',
+	'UI:UploadNotSupportedInThisMode' => 'Die Modifizierung von Bildern oder Dateien wird in diesem Modus nicht unterstützt.',
 ));
 ?>

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

@@ -1330,4 +1330,5 @@ When associated with a trigger, each action is given an "order" number, specifyi
 	'UI:ToggleFullScreen' => 'Toggle Maximize / Minimize',
 	'UI:Button:ResetImage' => 'Recover the previous image',
 	'UI:Button:RemoveImage' => 'Remove the image',
+	'UI:UploadNotSupportedInThisMode' => 'The modification of images or files is not supported in this mode.',
 ));

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

@@ -1173,4 +1173,5 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
 	'UI:ToggleFullScreen' => 'Agrandir / Minimiser',
 	'UI:Button:ResetImage' => 'Récupérer l\'image initiale',
 	'UI:Button:RemoveImage' => 'Supprimer l\'image',
+	'UI:UploadNotSupportedInThisMode' => 'La modification d\'images ou de fichiers n\'est pas supportée dans ce mode.',
 ));

+ 1 - 0
js/extkeywidget.js

@@ -333,6 +333,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
 	{
 		if (me.bSelectMode)
 		{
+			$('#fstatus_'+me.id).html('');
 		}
 		else
 		{