diff --git a/application/utils.inc.php b/application/utils.inc.php index 1a2941eb5..89ad22138 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -1671,7 +1671,7 @@ class utils * - an http(s) URL * - the local file system (but only if you are an administrator) * @param string $sPath - * @return string[]|NULL[] + * @return ormDocument|null * @throws Exception */ public static function FileGetContentsAndMIMEType($sPath) @@ -1687,15 +1687,6 @@ class utils 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12.xlsx', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', @@ -1722,8 +1713,13 @@ class utils $sMimeType = 'text/plain'; // Default MIME Type: treat the file as a bunch a characters... $sFileName = 'uploaded-file'; // Default name for downloaded-files $sExtension = '.txt'; // Default file extension in case we don't know the MIME Type - - if (static::IsURL($sPath)) + + if(empty($sPath)) + { + // Empty path (NULL or '') means that there is no input, making an empty document. + $oUploadedDoc = new ormDocument('', '', ''); + } + elseif (static::IsURL($sPath)) { if ($oUploadedDoc = static::IsSelfURL($sPath)) { diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 433a60c47..ad18ee41a 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -5402,8 +5402,9 @@ class AttributeBlob extends AttributeDefinition public function GetAsCSV($sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, $bConvertToPlainText = false) { $sAttCode = $this->GetCode(); - if ($sValue instanceof ormDocument) + if ($sValue instanceof ormDocument && !$sValue->IsEmpty()) { + IssueLog::Info(print_r($sValue, true)); return $sValue->GetDownloadURL(get_class($oHostObject), $oHostObject->GetKey(), $sAttCode); } return ''; // Not exportable in CSV ! @@ -5527,7 +5528,7 @@ class AttributeImage extends AttributeBlob */ public function CheckFormat($value) { - if ($value instanceof ormDocument) + if ($value instanceof ormDocument && !$value->IsEmpty()) { return ($value->GetMainMimeType() == 'image'); } diff --git a/css/light-grey.css b/css/light-grey.css index eebdc3276..33c6822ed 100644 --- a/css/light-grey.css +++ b/css/light-grey.css @@ -85,6 +85,9 @@ table.listResults td .view-image img { .edit-image .view-image { display: inline-block; } +.edit-image .view-image img[src=""], .edit-image .view-image img[src="null"] { + visibility: hidden; +} .edit-image .view-image.dirty.compat { background-image: url("ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png"); } diff --git a/css/light-grey.scss b/css/light-grey.scss index 11b8997c9..202061a97 100644 --- a/css/light-grey.scss +++ b/css/light-grey.scss @@ -107,6 +107,12 @@ table.listResults td .view-image { .view-image { display: inline-block; + img[src=""], + img[src="null"] { + // Hiding "broken" image when src is not set + visibility: hidden; + } + &.dirty { // The image will be modified when saving the changes @@ -835,7 +841,7 @@ table.listResults tr.even td.truncated, .wizContainer table.listResults tr.even } /* Beware: IE6 does not support multiple selector with multiple classes, only the last class is used */ -table.listResults tr.even td.hover.truncated, , .wizContainer table.listResults tr.even td.hover.truncated { +table.listResults tr.even td.hover.truncated, .wizContainer table.listResults tr.even td.hover.truncated { background: #fdf5d0 url(../images/truncated.png?v=#{$version}) bottom repeat-x; } diff --git a/js/edit_image.js b/js/edit_image.js index 0edf8f644..667fd2873 100644 --- a/js/edit_image.js +++ b/js/edit_image.js @@ -28,7 +28,7 @@ $(function() // the constructor _create: function () { var me = this; - me.bLoadedEmpty = (me.options.current_image_url == ''); + me.bLoadedEmpty = (me.options.current_image_url == '' || me.options.current_image_url == null); var sMarkup = ''; sMarkup += '';