示例#1
0
$count = 0;
foreach ($all_languages as $aLanguage) {
    if ($item->getFilePath($aLanguage, false, PATH_RELATIVETO_WEBROOT, true) && file_exists($item->getFilePath($aLanguage, true, PATH_RELATIVETO_FILESYSTEM))) {
        $file = new CMS_file($item->getFilePath($aLanguage, true, PATH_RELATIVETO_FILESYSTEM));
        $fileDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
    } else {
        $fileDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
    }
    $fileDatas['module'] = $codename;
    $fileDatas['visualisation'] = RESOURCE_DATA_LOCATION_PUBLIC;
    $maxFileSize = CMS_file::getMaxUploadFileSize('K');
    $mandatory = $aLanguage->getCode() == $cms_module->getDefaultLanguageCodename() ? '<span class="atm-red">*</span> ' : '';
    $items[] = array('title' => $aLanguage->getLabel(), 'xtype' => 'fieldset', 'autoHeight' => true, 'defaultType' => 'textfield', 'defaults' => array('anchor' => '100%', 'allowBlank' => true), 'items' => array(array('fieldLabel' => $mandatory . $cms_language->getMessage(MESSAGE_PAGE_FIELD_LABEL), 'xtype' => 'textfield', 'allowBlank' => !$mandatory, 'name' => 'label_' . $aLanguage->getCode(), 'value' => $item->getLabel($aLanguage, false)), array('fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_DESC), 'xtype' => 'ckeditor', 'name' => 'description_' . $aLanguage->getCode(), 'value' => (string) $item->getDescription($aLanguage, false, false), 'height' => 200, 'editor' => array('scayt_sLang' => $aLanguage->getCode(), 'language' => $cms_language->getCode(), 'customConfig' => PATH_MAIN_WR . '/ckeditor/config.php', 'atmToolbar' => 'BasicLink')), array('fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_FILE), 'xtype' => 'atmFileUploadField', 'name' => 'file_' . $aLanguage->getCode(), 'uploadCfg' => array('file_size_limit' => $maxFileSize, 'file_types_description' => $cms_language->getJSMessage(MESSAGE_ALL_FILE) . ' ...', 'file_types' => '*.*'), 'fileinfos' => $fileDatas)));
    //Thumbnail and protected after first language
    if (!$count) {
        if ($item->getIconPath(false, PATH_RELATIVETO_WEBROOT, true) && file_exists($item->getIconPath(true, PATH_RELATIVETO_FILESYSTEM, true))) {
            $file = new CMS_file($item->getIconPath(true, PATH_RELATIVETO_FILESYSTEM, true));
            $imageDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
        } else {
            $imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
        }
        $imageDatas['module'] = $codename;
        $imageDatas['visualisation'] = RESOURCE_DATA_LOCATION_PUBLIC;
        $items[] = array('xtype' => 'atmImageUploadField', 'fieldLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_THUMBNAIL), 'name' => 'icon', 'uploadCfg' => array('file_size_limit' => $maxFileSize, 'file_types' => '*.jpg;*.png;*.gif', 'file_types_description' => $cms_language->getMessage(MESSAGE_IMAGE) . ' ...'), 'fileinfos' => $imageDatas);
        //Protected status
        $protectedItem = array('fieldLabel' => '<span ext:qtip="' . io::htmlspecialchars($cms_language->getMessage(MESSAGE_PAGE_FIELD_PROTECTED_INFO)) . '" class="atm-help">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_PROTECTED) . '</span>', 'name' => 'protected', 'inputValue' => '1', 'xtype' => 'checkbox', 'checked' => $item->isProtected() ? true : false, 'boxLabel' => $cms_language->getMessage(MESSAGE_PAGE_FIELD_PROTECTED_DESC));
        //add an alert on protected option for non admin users
        if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
            $protectedItem['listeners'] = array('check' => sensitiveIO::sanitizeJSString('function(el, checked) {
				if (checked) {
					Automne.message.popup({