/** * {@inheritdoc} */ protected function getEditHtml() { if (class_exists('\\Bitrix\\Main\\UI\\FileInput', true) && $this->getSettings('IMAGE') === true) { $html = FileInput::createInstance(array('name' => $this->getEditInputName('_FILE'), 'description' => $this->getSettings('DESCRIPTION_FIELD'), 'upload' => $this->getSettings('UPLOAD'), 'allowUpload' => 'I', 'medialib' => $this->getSettings('MEDIALIB'), 'fileDialog' => $this->getSettings('FILE_DIALOG'), 'cloud' => $this->getSettings('CLOUD'), 'delete' => $this->getSettings('DELETE'), 'edit' => $this->getSettings('EDIT'), 'maxCount' => 1))->show($this->getValue()); } else { $html = \CFileInput::Show($this->getEditInputName('_FILE'), $this->getValue() > 0 ? $this->getValue() : 0, array('IMAGE' => $this->getSettings('IMAGE') === true ? 'Y' : 'N', 'PATH' => 'Y', 'FILE_SIZE' => 'Y', 'ALLOW_UPLOAD' => 'I'), array('upload' => $this->getSettings('UPLOAD'), 'medialib' => $this->getSettings('MEDIALIB'), 'file_dialog' => $this->getSettings('FILE_DIALOG'), 'cloud' => $this->getSettings('CLOUD'), 'del' => $this->getSettings('DELETE'), 'description' => $this->getSettings('DESCRIPTION_FIELD'))); } if ($this->getValue()) { $html .= '<input type="hidden" name="' . $this->getEditInputName() . '" value=' . $this->getValue() . '>'; } return $html; }
function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName) { global $APPLICATION; if (strLen(trim($strHTMLControlName["FORM_NAME"])) <= 0) { $strHTMLControlName["FORM_NAME"] = "form_element"; } $name = preg_replace("/[^a-zA-Z0-9_]/i", "x", htmlspecialcharsbx($strHTMLControlName["VALUE"])); if (is_array($value["VALUE"])) { $value["VALUE"] = $value["VALUE"]["VALUE"]; $value["DESCRIPTION"] = $value["DESCRIPTION"]["VALUE"]; } if ($strHTMLControlName["MODE"] == "FORM_FILL" && CModule::IncludeModule('fileman')) { return CFileInput::Show($strHTMLControlName["VALUE"], $value["VALUE"], array("PATH" => "Y", "IMAGE" => "N", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"))), array('upload' => false, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $arProperty["WITH_DESCRIPTION"] == "Y" ? array("VALUE" => $value["DESCRIPTION"], "NAME" => $strHTMLControlName["DESCRIPTION"]) : false)); } else { $return = '<input type="text" name="' . htmlspecialcharsbx($strHTMLControlName["VALUE"]) . '" id="' . $name . '" size="' . $arProperty["COL_COUNT"] . '" value="' . htmlspecialcharsEx($value["VALUE"]) . '">'; if ($arProperty["WITH_DESCRIPTION"] == "Y" && '' != trim($strHTMLControlName["DESCRIPTION"])) { $return .= ' <span title="' . GetMessage("IBLOCK_PROP_FILEMAN_DESCRIPTION_TITLE") . '">' . GetMessage("IBLOCK_PROP_FILEMAN_DESCRIPTION_LABEL") . ':<input name="' . htmlspecialcharsEx($strHTMLControlName["DESCRIPTION"]) . '" value="' . htmlspecialcharsEx($value["DESCRIPTION"]) . '" size="18" type="text"></span>'; } return $return; } }
public static function InputFile($strInputName, $strImageID = "", $showInfo = false, $fileInput = false, $servInput = false, $pathInput = false, $descInput = false, $delInput = false, $scaleIcon = false, $cloudInput = false) { return CFileInput::Show($strInputName, $strImageID, $showInfo, array('upload' => $fileInput, 'medialib' => $pathInput, 'file_dialog' => $servInput, 'cloud' => $cloudInput, 'del' => $delInput, 'description' => $descInput)); }
if (!array_key_exists($ar["ID"], $arProperties)) { $arProperties[$ar["ID"]] = array(); } if ($ar["PROPERTY_TYPE"] === "L") { $arProperties[$ar["ID"]][$ar["PROPERTY_VALUE_ID"]] = $ar["VALUE_ENUM"]; } else { $arProperties[$ar["ID"]][$ar["PROPERTY_VALUE_ID"]] = $ar["VALUE"]; } } } foreach ($arSelectedProps as $aProp) { $v = ''; foreach ($arProperties[$aProp['ID']] as $property_value_id => $property_value) { $res = ''; if ($aProp['PROPERTY_TYPE'] == 'F') { $res = CFileInput::Show('NO_FIELDS[' . $property_value_id . ']', $property_value, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxImageSize, "MIN_SIZE" => $minImageSize), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)); } elseif ($aProp['PROPERTY_TYPE'] == 'G') { $t = GetSectionName($property_value); if ($t) { $res = $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminSectionEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("SPS_ELSEARCH_SECTION_EDIT") . '">' . $t['ID'] . '</a>]'; } } elseif ($aProp['PROPERTY_TYPE'] == 'E') { $t = GetElementName($property_value); if ($t) { $res = $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminElementEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("SPS_ELSEARCH_ELEMENT_EDIT") . '">' . $t['ID'] . '</a>]'; } } else { $res = htmlspecialcharsex($property_value); } if ($res != "") { $v .= ($v != '' ? ' / ' : '') . $res;
"> <input type="button" name="browse" value="..." onClick="BtnClick2()"></td> </tr> <tr class="heading"> <td colspan="2"><?php echo GetMessage("IB_E_DESCRIPTION"); ?> </td> </tr> <tr class="adm-detail-file-row"> <td class="adm-detail-valign-top"><?php echo GetMessage("IB_E_PICTURE"); ?> </td> <td> <?php echo CFileInput::Show('PICTURE', $str_PICTURE, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"))), array('upload' => true, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => true, 'description' => false)); ?> </td> </tr> <?php if (COption::GetOptionString("iblock", "use_htmledit", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td colspan="2" align="center"> <?php CFileMan::AddHTMLEditorFrame("DESCRIPTION", $str_DESCRIPTION, "DESCRIPTION_TYPE", $str_DESCRIPTION_TYPE, array('height' => 450, 'width' => '100%')); ?> </td> </tr> <?php } else {
"W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"), ), )); ?> <?else:?> <?echo CFileInput::Show("DETAIL_PICTURE", ($ID > 0 && !$bCopy? $str_DETAIL_PICTURE: 0), array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array( "W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"), ), ), array( 'upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => true, ) ); ?> <?endif?> </td> </tr> <? $tabControl->EndCustomField("DETAIL_PICTURE", "");
function GetEditFormHTML($arUserField, $arHtmlControl) { CModule::IncludeModule("fileman"); $arHtmlControl["VALIGN"] = "middle"; $arHtmlControl["ROWCLASS"] = "adm-detail-file-row"; if (($p = strpos($arHtmlControl["NAME"], "[")) > 0) { $strOldIdName = substr($arHtmlControl["NAME"], 0, $p) . "_old_id" . substr($arHtmlControl["NAME"], $p); } else { $strOldIdName = $arHtmlControl["NAME"] . "_old_id"; } return CFileInput::Show($arHtmlControl["NAME"], $arHtmlControl["VALUE"], array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => 200, "H" => 200)), array('upload' => $arUserField["EDIT_IN_LIST"] == "Y", 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => true, 'description' => false)) . '<input type="hidden" name="' . $strOldIdName . '" value="' . $arHtmlControl["VALUE"] . '">'; }
function getImageField($property_value_id, $property_value) { $res = CFileInput::Show('NO_FIELDS[' . $property_value_id . ']', $property_value, array('IMAGE' => 'Y', 'PATH' => false, 'FILE_SIZE' => false, 'DIMENSIONS' => false, 'IMAGE_POPUP' => false, 'MAX_SIZE' => array('W' => 50, 'H' => 50), 'MIN_SIZE' => array('W' => 1, 'H' => 1)), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)); $res = preg_replace('!<script[^>]*>.*</script>!isU', '', $res); return $res; }
"> <input type="button" name="browse" value="..." onClick="BtnClick2()"></td> </tr> <tr class="heading"> <td colspan="2"><?php echo GetMessage("IB_E_DESCRIPTION"); ?> </td> </tr> <tr class="adm-detail-file-row"> <td class="adm-detail-valign-top"><?php echo GetMessage("IB_E_PICTURE"); ?> </td> <td> <?php echo CFileInput::Show('PICTURE', $str_PICTURE, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => 200, "H" => 200)), array('upload' => true, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => true, 'description' => false)); ?> </td> </tr> <?php if (COption::GetOptionString("iblock", "use_htmledit", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td colspan="2" align="center"> <?php CFileMan::AddHTMLEditorFrame("DESCRIPTION", $str_DESCRIPTION, "DESCRIPTION_TYPE", $str_DESCRIPTION_TYPE, array('height' => 450, 'width' => '100%')); ?> </td> </tr> <?php } else {
function fShowFilePropertyField($name, $property_fields, $values, $max_file_size_show=50000) { global $crmMode; $disableFiles = (isset($crmMode) && $crmMode); $res = ""; if (CModule::IncludeModule('fileman')) { if (!is_array($values) || empty($values)) $values = array("n0" => 0); if ($property_fields["MULTIPLE"] == "N") { foreach($values as $key => $val) { if(is_array($val)) $file_id = $val["VALUE"]; else $file_id = $val; $res = CFileInput::Show( $name."[".$key."]", $file_id, array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => 200, "H" => 170), ), array( 'upload' => !$disableFiles, 'del' => !$disableFiles, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'description' => false ) ); } } else { $inputName = array(); foreach($values as $key=>$val) { if(is_array($val)) $inputName[$name."[".$key."]"] = $val["VALUE"]; else $inputName[$name."[".$key."]"] = $val; } $res = CFileInput::ShowMultiple($inputName, $name."[n#IND#]", array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => 200, "H" => 170), ), false, array( 'upload' => !$disableFiles, 'del' => !$disableFiles, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'description' => false )); } } return $res; }
function Display() { $sDefAction = $sDefTitle = ""; if(!$this->bEditMode) { if(!empty($this->link)) { $sDefAction = "BX.adminPanel.Redirect([], '".CUtil::JSEscape($this->link)."', event);"; $sDefTitle = $this->title; } else { $this->aActions = array_values($this->aActions); foreach($this->aActions as $action) { if($action["DEFAULT"] == true) { $sDefAction = $action["ACTION"] ? htmlspecialcharsbx($action["ACTION"]) : "BX.adminPanel.Redirect([], '".CUtil::JSEscape($action["LINK"])."', event)" ; $sDefTitle = (!empty($action["TITLE"])? $action["TITLE"]:$action["TEXT"]); break; } } } } $sMenuItems = ""; if(!empty($this->aActions)) $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions)); ?> <tr class="adm-list-table-row<?php echo isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true ? ' footer' : ''; echo $this->bEditMode ? ' adm-table-row-active' : ''; ?> "<?php echo $sMenuItems != "" ? ' oncontextmenu="return ' . $sMenuItems . ';"' : ''; echo $sDefAction != "" ? ' ondblclick="' . $sDefAction . '"' . (!empty($sDefTitle) ? ' title="' . GetMessage("admin_lib_list_double_click") . ' ' . $sDefTitle . '"' : '') : ''; ?> > <? if(count($this->pList->arActions)>0 || $this->pList->bCanBeEdited): $check_id = RandString(5); ?> <td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?php echo $this->bReadOnly ? ' adm-list-table-checkbox-disabled' : ''; ?> "><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="ID[]" id="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> " value="<?php echo $this->id; ?> " autocomplete="off" title="<?php echo GetMessage("admin_lib_list_check"); ?> "<?php echo $this->bReadOnly ? ' disabled="disabled"' : ''; echo $this->bEditMode ? ' checked="checked" disabled="disabled"' : ''; ?> /><label class="adm-designed-checkbox-label adm-checkbox" for="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> "></label></td> <? endif; if($this->pList->bShowActions): if(!empty($this->aActions)): ?> <td class="adm-list-table-cell adm-list-table-popup-block" onclick="BX.adminList.ShowMenu(this.firstChild, this.parentNode.oncontextmenu(), this.parentNode);"><div class="adm-list-table-popup" title="<?php echo GetMessage("admin_lib_list_actions_title"); ?> "></div></td> <? else: ?> <td class="adm-list-table-cell"></td> <? endif; endif; end($this->pList->aVisibleHeaders); $last_id = key($this->pList->aVisibleHeaders); reset($this->pList->aVisibleHeaders); $bVarsFromForm = ($this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs)); foreach($this->pList->aVisibleHeaders as $id=>$header_props) { $field = $this->aFields[$id]; if($this->bEditMode && isset($field["edit"])) { if($bVarsFromForm && $_REQUEST["FIELDS"]) $val = $_REQUEST["FIELDS"][$this->id][$id]; else $val = $this->arRes[$id]; $val_old = $this->arRes[$id]; echo '<td class="adm-list-table-cell', (isset($header_props['align']) && $header_props['align']? ' align-'.$header_props['align']: ''), (isset($header_props['valign']) && $header_props['valign']? ' valign-'.$header_props['valign']: ''), ($id === $last_id? ' adm-list-table-cell-last': ''), '">'; if(is_array($val_old)) { foreach($val_old as $k=>$v) echo '<input type="hidden" name="FIELDS_OLD['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']['.htmlspecialcharsbx($k).']" value="'.htmlspecialcharsbx($v).'">'; } else { echo '<input type="hidden" name="FIELDS_OLD['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="'.htmlspecialcharsbx($val_old).'">'; } switch($field["edit"]["type"]) { case "checkbox": echo '<input type="hidden" name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="N">'; echo '<input type="checkbox" name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="Y"'.($val=='Y'?' checked':'').'>'; break; case "select": echo '<select name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']"'.$this->__AttrGen($field["edit"]["attributes"]).'>'; foreach($field["edit"]["values"] as $k=>$v) echo '<option value="'.htmlspecialcharsbx($k).'" '.($k==$val?' selected':'').'>'.htmlspecialcharsbx($v).'</option>'; echo '</select>'; break; case "input": if(!$field["edit"]["attributes"]["size"]) $field["edit"]["attributes"]["size"] = "10"; echo '<input type="text" '.$this->__AttrGen($field["edit"]["attributes"]).' name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="'.htmlspecialcharsbx($val).'">'; break; case "calendar": if(!$field["edit"]["attributes"]["size"]) $field["edit"]["attributes"]["size"] = "10"; echo '<span style="white-space:nowrap;"><input type="text" '.$this->__AttrGen($field["edit"]["attributes"]).' name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="'.htmlspecialcharsbx($val).'">'; echo CAdminCalendar::Calendar('FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']').'</span>'; break; case "file": echo CFileInput::Show( 'FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']', $val, $field["edit"]["showInfo"], $field["edit"]["inputs"] ); break; default: echo $field["edit"]['value']; } echo '</td>'; } else { if(!is_array($this->arRes[$id])) $val = trim($this->arRes[$id]); else $val = $this->arRes[$id]; if(isset($field["view"])) { switch($field["view"]["type"]) { case "checkbox": if($val=='Y') $val = htmlspecialcharsex(GetMessage("admin_lib_list_yes")); else $val = htmlspecialcharsex(GetMessage("admin_lib_list_no")); break; case "select": if($field["edit"]["values"][$val]) $val = htmlspecialcharsex($field["edit"]["values"][$val]); break; case "file": if ($val > 0) $val = CFileInput::Show( 'NO_FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']', $val, $field["view"]["showInfo"], $field["view"]["inputs"] ); else $val = ''; break; case "html": $val = $field["view"]['value']; break; default: $val = htmlspecialcharsex($val); break; } } else { $val = htmlspecialcharsex($val); } echo '<td class="adm-list-table-cell', (isset($header_props['align']) && $header_props['align']? ' align-'.$header_props['align']: ''), (isset($header_props['valign']) && $header_props['valign']? ' valign-'.$header_props['valign']: ''), ($id === $last_id? ' adm-list-table-cell-last': ''), '">'; echo ((string)$val <> ""? $val: ' '); if(isset($field["edit"]) && $field["edit"]["type"] == "calendar") CAdminCalendar::ShowScript(); echo '</td>'; } } ?> </tr> <? }
function _ShowFilePropertyField($name, $property_fields, $values, $max_file_size_show = 50000, $bVarsFromForm = false) { global $bCopy, $historyId; static $maxSize = array(); if (empty($maxSize)) { $detailImageSize = (int) Main\Config\Option::get('iblock', 'detail_image_size'); $maxSize = array('W' => $detailImageSize, 'H' => $detailImageSize); unset($detailImageSize); } CModule::IncludeModule('fileman'); $bVarsFromForm = false; if (empty($values) || $bCopy || !is_array($values)) { $values = array("n0" => 0); } if ($property_fields["MULTIPLE"] == "N") { foreach ($values as $key => $val) { if (is_array($val)) { $file_id = $val["VALUE"]; } else { $file_id = $val; } if ($historyId > 0) { echo CFileInput::Show($name . "[" . $key . "]", $file_id, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxSize)); } else { echo CFileInput::Show($name . "[" . $key . "]", $file_id, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxSize), array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"] == "Y")); } break; } } else { $inputName = array(); foreach ($values as $key => $val) { if (is_array($val)) { $inputName[$name . "[" . $key . "]"] = $val["VALUE"]; } else { $inputName[$name . "[" . $key . "]"] = $val; } } if (class_exists('\\Bitrix\\Main\\UI\\FileInput', true)) { echo \Bitrix\Main\UI\FileInput::createInstance(array("name" => $name . "[n#IND#]", "id" => $name . "[n#IND#]_" . mt_rand(1, 1000000), "description" => $property_fields["WITH_DESCRIPTION"] == "Y", "allowUpload" => "F", "allowUploadExt" => $property_fields["FILE_TYPE"]) + ($historyId > 0 ? array("delete" => false, "edit" => false) : array("upload" => true, "medialib" => true, "fileDialog" => true, "cloud" => true)))->show($inputName); } else { if ($historyId > 0) { echo CFileInput::ShowMultiple($inputName, $name . "[n#IND#]", array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxSize), false); } else { echo CFileInput::ShowMultiple($inputName, $name . "[n#IND#]", array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxSize), false, array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"] == "Y")); } } } }
function _ShowFilePropertyField($name, $property_fields, $values, $max_file_size_show = 50000, $bVarsFromForm = false) { global $bCopy, $historyId; CModule::IncludeModule('fileman'); $bVarsFromForm = false; if (!is_array($values) || $bCopy || empty($values)) { $values = array("n0" => 0); } if ($property_fields["MULTIPLE"] == "N") { foreach ($values as $key => $val) { if (is_array($val)) { $file_id = $val["VALUE"]; } else { $file_id = $val; } if ($historyId > 0) { echo CFileInput::Show($name . "[" . $key . "]", $file_id, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size")))); } else { echo CFileInput::Show($name . "[" . $key . "]", $file_id, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"))), array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"] == "Y")); } break; } } else { $inputName = array(); foreach ($values as $key => $val) { if (is_array($val)) { $inputName[$name . "[" . $key . "]"] = $val["VALUE"]; } else { $inputName[$name . "[" . $key . "]"] = $val; } } if ($historyId > 0) { echo CFileInput::ShowMultiple($inputName, $name . "[n#IND#]", array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"))), false); } else { echo CFileInput::ShowMultiple($inputName, $name . "[n#IND#]", array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"))), false, array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"] == "Y")); } } }
function _ShowFilePropertyField($name, $property_fields, $values, $max_file_size_show=50000, $bVarsFromForm = false) { global $bCopy, $historyId; CModule::IncludeModule('fileman'); $bVarsFromForm = false; if(!is_array($values) || $bCopy || empty($values)) { $values = array( "n0" => 0, ); } if($property_fields["MULTIPLE"] == "N") { foreach($values as $key => $val) { if(is_array($val)) $file_id = $val["VALUE"]; else $file_id = $val; if($historyId > 0) echo CFileInput::Show($name."[".$key."]", $file_id, array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array( "W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"), ), )); else echo CFileInput::Show($name."[".$key."]", $file_id, array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array( "W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"), ), ), array( 'upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"]=="Y", )); break; } } else { $inputName = array(); foreach($values as $key=>$val) { if(is_array($val)) $inputName[$name."[".$key."]"] = $val["VALUE"]; else $inputName[$name."[".$key."]"] = $val; } if (class_exists('\Bitrix\Main\UI\FileInput', true)) { echo \Bitrix\Main\UI\FileInput::createInstance(( array( "name" => $name."[n#IND#]", "description" => $property_fields["WITH_DESCRIPTION"]=="Y" ) + ($historyId > 0 ? array( "delete" => false, "edit" => false ) : array( "upload" => true, "medialib" => true, "fileDialog" => true, "cloud" => true )) ))->show($inputName); } else if($historyId > 0) echo CFileInput::ShowMultiple($inputName, $name."[n#IND#]", array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array( "W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"), ), ), false); else echo CFileInput::ShowMultiple($inputName, $name."[n#IND#]", array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array( "W" => COption::GetOptionString("iblock", "detail_image_size"), "H" => COption::GetOptionString("iblock", "detail_image_size"), ), ), false, array( 'upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => $property_fields["WITH_DESCRIPTION"]=="Y", )); } }
/** * Генерирует HTML для редактирования поля * @return mixed */ protected function genEditHTML() { return \CFileInput::Show($this->getEditInputName('_FILE'), $this->getValue() > 0 ? $this->getValue() : 0, array("IMAGE" => "N", "PATH" => "Y", "FILE_SIZE" => "Y", "ALLOW_UPLOAD" => "I"), array('upload' => true, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => true, 'description' => false)); }
<td width="40%" class="adm-detail-valign-top"><?php echo $tabControl->GetCustomLabelHTML(); ?> :</td> <td width="60%"> <?php if ($historyId > 0) { ?> <?php echo CFileInput::Show("DETAIL_PICTURE", $str_DETAIL_PICTURE, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => 200, "H" => 200))); ?> <?php } else { ?> <?php echo CFileInput::Show("DETAIL_PICTURE", $ID > 0 && !$bCopy ? $str_DETAIL_PICTURE : 0, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => array("W" => 200, "H" => 200)), array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => true)); ?> <?php } ?> </td> </tr> <?php $tabControl->EndCustomField("DETAIL_PICTURE", ""); $tabControl->BeginCustomField("DETAIL_TEXT", GetMessage("IBLOCK_FIELD_DETAIL_TEXT"), $arIBlock["FIELDS"]["DETAIL_TEXT"]["IS_REQUIRED"] === "Y"); ?> <tr class="heading" id="tr_DETAIL_TEXT_LABEL"> <td colspan="2"><?php echo $tabControl->GetCustomLabelHTML(); ?> </td>
function getImageField($property_value_id, $property_value) { global $viewFileParams; $res = CFileInput::Show('NO_FIELDS[' . $property_value_id . ']', $property_value, $viewFileParams, array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)); $res = preg_replace('!<script[^>]*>.*</script>!isU', '', $res); return $res; }
function Display() { $sDefAction = $sDefTitle = ""; if (!$this->bEditMode) { if (!empty($this->link)) { if (true == $this->boolBX) { $sDefAction = "(new BX.CAdminDialog({\n\t\t\t\t\t\t'content_url': '" . $this->link . (!(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) ? '&bxsku=Y' : '') . "&bxpublic=Y&" . bitrix_sessid_get() . "',\n\t\t\t\t\t\t'content_post': 'from_module=iblock',\n\t\t\t\t\t\t'draggable': true,\n\t\t\t\t\t\t'resizable': true,\n\t\t\t\t\t\t'buttons': [BX.CAdminDialog.btnSave, BX.CAdminDialog.btnCancel]\n\t\t\t\t\t})).Show();"; } else { $sDefAction = "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($this->link) . "', event);"; } $sDefTitle = $this->title; } else { foreach ($this->aActions as $action) { if ($action["DEFAULT"] == true) { if (true == $this->boolBX) { $sDefAction = "(new BX.CAdminDialog({\n\t\t\t\t\t\t'content_url': '" . CUtil::addslashes($action["ACTION"]) . "',\n\t\t\t\t\t\t'content_post': '" . (!(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) ? '&bxsku=Y' : '') . "&bxpublic=Y&from_module=iblock&" . bitrix_sessid_get() . "',\n\t\t\t\t\t\t'draggable': true,\n\t\t\t\t\t\t'resizable': true,\n\t\t\t\t\t\t'buttons': [BX.CAdminDialog.btnSave, BX.CAdminDialog.btnCancel]\n\t\t\t\t\t})).Show();"; } else { $sDefAction = $action["ACTION"] ? htmlspecialcharsbx($action["ACTION"]) : "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($action["LINK"]) . "', event)"; } $sDefTitle = !empty($action["TITLE"]) ? $action["TITLE"] : $action["TEXT"]; break; } } } } $sMenuItems = ""; if (!empty($this->aActions)) { $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions)); } ?> <tr class="adm-list-table-row<?php echo isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true ? ' footer' : ''; echo $this->bEditMode ? ' adm-table-row-active' : ''; ?> "<?php echo $sMenuItems != "" ? ' oncontextmenu="return ' . $sMenuItems . ';"' : ''; echo $sDefAction != "" ? ' ondblclick="' . $sDefAction . '"' . (!empty($sDefTitle) ? ' title="' . GetMessage("admin_lib_list_double_click") . ' ' . $sDefTitle . '"' : '') : ''; ?> > <?php if (count($this->pList->arActions) > 0 || $this->pList->bCanBeEdited) { $check_id = RandString(5); ?> <td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?php echo $this->bReadOnly ? ' adm-list-table-checkbox-disabled' : ''; ?> "><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="SUB_ID[]" id="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> " value="<?php echo $this->id; ?> " autocomplete="off" title="<?php echo GetMessage("admin_lib_list_check"); ?> "<?php echo $this->bReadOnly ? ' disabled="disabled"' : ''; echo $this->bEditMode ? ' checked="checked" disabled="disabled"' : ''; ?> /><label class="adm-designed-checkbox-label adm-checkbox" for="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> "></label></td> <?php } if ($this->pList->bShowActions) { if (!empty($this->aActions)) { ?> <td class="adm-list-table-cell adm-list-table-popup-block" onclick="BX.adminSubList.ShowMenu(this.firstChild, this.parentNode.oncontextmenu(), this.parentNode);"><div class="adm-list-table-popup" title="<?php echo GetMessage("admin_lib_list_actions_title"); ?> "></div></td> <?php } else { ?> <td class="adm-list-table-cell"></td> <?php } } end($this->pList->aVisibleHeaders); $last_id = key($this->pList->aVisibleHeaders); reset($this->pList->aVisibleHeaders); $bVarsFromForm = $this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs); foreach ($this->aHeaders as $id => $header_props) { if (!in_array($id, $this->pList->arVisibleColumns)) { continue; } $field = $this->aFields[$id]; if ($this->bEditMode && isset($field["edit"])) { if ($bVarsFromForm && $_REQUEST["FIELDS"]) { $val = $_REQUEST["FIELDS"][$this->id][$id]; } else { $val = $this->arRes[$id]; } $val_old = $this->arRes[$id]; echo '<td class="adm-list-table-cell', isset($header_props['align']) && $header_props['align'] ? ' align-' . $header_props['align'] : '', isset($header_props['valign']) && $header_props['valign'] ? ' valign-' . $header_props['valign'] : '', $id === $last_id ? ' adm-list-table-cell-last' : '', '">'; if (is_array($val_old)) { foreach ($val_old as $k => $v) { echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . '][' . htmlspecialcharsbx($k) . ']" value="' . htmlspecialcharsbx($v) . '">'; } } else { echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val_old) . '">'; } switch ($field["edit"]["type"]) { case "checkbox": echo '<input type="hidden" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="N">'; echo '<input type="checkbox" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="Y"' . ($val == 'Y' ? ' checked' : '') . '>'; break; case "select": echo '<select name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']"' . $this->__AttrGen($field["edit"]["attributes"]) . '>'; foreach ($field["edit"]["values"] as $k => $v) { echo '<option value="' . htmlspecialcharsbx($k) . '" ' . ($k == $val ? ' selected' : '') . '>' . htmlspecialcharsex($v) . '</option>'; } echo '</select>'; break; case "input": if (!$field["edit"]["attributes"]["size"]) { $field["edit"]["attributes"]["size"] = "10"; } echo '<input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">'; break; case "calendar": if (!$field["edit"]["attributes"]["size"]) { $field["edit"]["attributes"]["size"] = "10"; } echo '<span style="white-space:nowrap;"><input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">'; echo CAdminCalendar::Calendar('FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']') . '</span>'; break; case "file": echo CFileInput::Show('FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']', $val, $field["edit"]["showInfo"], $field["edit"]["inputs"]); break; default: echo $field["edit"]['value']; } echo '</td>'; } else { if (!is_array($this->arRes[$id])) { $val = trim($this->arRes[$id]); } else { $val = $this->arRes[$id]; } if (isset($field["view"])) { switch ($field["view"]["type"]) { case "checkbox": if ($val == 'Y') { $val = htmlspecialcharsex(GetMessage("admin_lib_list_yes")); } else { $val = htmlspecialcharsex(GetMessage("admin_lib_list_no")); } break; case "select": if ($field["edit"]["values"][$val]) { $val = htmlspecialcharsex($field["edit"]["values"][$val]); } break; case "file": if ($val > 0) { $val = CFileInput::Show('NO_FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']', $val, $field["view"]["showInfo"], $field["view"]["inputs"]); } else { $val = ''; } break; case "html": $val = $field["view"]['value']; break; default: $val = htmlspecialcharsex($val); break; } } else { $val = htmlspecialcharsex($val); } echo '<td class="adm-list-table-cell', isset($header_props['align']) && $header_props['align'] ? ' align-' . $header_props['align'] : '', isset($header_props['valign']) && $header_props['valign'] ? ' valign-' . $header_props['valign'] : '', $id === $last_id ? ' adm-list-table-cell-last' : '', '">'; echo (string) $val != "" ? $val : ' '; if (isset($field["edit"]) && $field["edit"]["type"] == "calendar") { CAdminCalendar::ShowScript(); } echo '</td>'; } } echo '</tr>'; }
'description' => $prop["WITH_DESCRIPTION"]=="Y", ) ); } } else { $arEditHTML[] = CFileInput::Show($VALUE_NAME, $prop["VALUE"], array( "IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxImageSize, "MIN_SIZE" => $minImageSize, ), array( 'upload' => true, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => true, 'description' => $prop["WITH_DESCRIPTION"]=="Y", ) ); } } elseif(($prop['PROPERTY_TYPE']=='G') && ($last_property_id!=$prop["ID"])) { $VALUE_NAME = 'FIELDS['.$f_TYPE.$f_ID.'][PROPERTY_'.$prop['ID'].'][]'; $arValues = array(); foreach($arProperties[$prop["ID"]] as $g_prop)
</td> <td><?php if ($bCopy) { ?> <input type="hidden" name="FLASH_IMAGE" value="<?php echo $str_FLASH_IMAGE; ?> "> <?php } ?> <?php if (class_exists('\\Bitrix\\Main\\UI\\FileInput', true)) { echo \Bitrix\Main\UI\FileInput::createInstance(array("name" => "FLASH_IMAGE", "description" => false, "allowUpload" => "I", "upload" => true, "medialib" => true, "fileDialog" => true, "cloud" => true, "delete" => true, "maxCount" => 1))->show($str_FLASH_IMAGE); } else { echo CFileInput::Show("FLASH_IMAGE", $str_FLASH_IMAGE, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y"), array('upload' => true, 'medialib' => true, 'file_dialog' => true, 'cloud' => true, 'del' => true, 'description' => false)); } ?> </td> </tr> <tr id="eFlashUrl" style="display: none;"> <td><?php echo GetMessage("ADV_BANNER_NO_LINK"); ?> :<?php if ($isEditMode) { ?> <span class="required"><sup>1</sup></span><?php } ?> </td>
function getImageField($property_value_id, $property_value) { $res = CFileInput::Show('NO_FIELDS[' . $property_value_id . ']', $property_value, array("IMAGE" => "Y", "PATH" => false, "FILE_SIZE" => false, "DIMENSIONS" => false, "IMAGE_POPUP" => false, "MAX_SIZE" => array("W" => 50, "H" => 50), "MIN_SIZE" => array("W" => 1, "H" => 1)), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)); $res = preg_replace('!<script[^>]*>.*</script>!isU', '', $res); return $res; }
} } if (is_array($arItems['PROPERTIES'])) { foreach ($arItems['PROPERTIES'] as $propID => $propValue) { if (isset($props[$propID])) { $arProp = $props[$propID]; if (isset($arProp['USER_TYPE']) && !empty($arProp['USER_TYPE']) && is_array($arProp['PROPERTY_USER_TYPE']) && array_key_exists('GetPublicViewHTML', $arProp['PROPERTY_USER_TYPE'])) { if (is_array($propValue)) { foreach ($propValue as $valueKey => $value) { $propValue[$valueKey] = call_user_func_array($arProp['PROPERTY_USER_TYPE']['GetPublicViewHTML'], array($arProp, array('VALUE' => $value), array())); } } } else { if ($arProp['PROPERTY_TYPE'] == 'F') { if (is_array($propValue)) { $res = CFileInput::Show('NO_FIELDS[' . $propID . ']', $propValue, array('IMAGE' => 'Y', 'PATH' => false, 'FILE_SIZE' => false, 'DIMENSIONS' => false, 'IMAGE_POPUP' => false, 'MAX_SIZE' => array('W' => 50, 'H' => 50), 'MIN_SIZE' => array('W' => 1, 'H' => 1)), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false)); $propValue = preg_replace('!<script[^>]*>.*</script>!isU', '', $res); } } else { if ($arProp['PROPERTY_TYPE'] == 'E') { if (is_array($propValue)) { foreach ($propValue as $valueKey => $id) { if ($id > 0) { $arElements[] =& $arResult['PRODUCTS'][$productID]['PROPERTIES'][$propID][$valueKey]; } } $arArrays[$productID . '_' . $propID] =& $arResult['PRODUCTS'][$productID]['PROPERTIES'][$propID]; } else { if ($propValue > 0) { $arElements[] =& $arResult['PRODUCTS'][$productID]['PROPERTIES'][$propID]; }