if (!$category->isProtected()) { $father = new CMS_moduleCategory($category->getAttribute('parentID')); if (CMS_moduleCategories_catalog::detachCategory($category)) { $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE); $content = array('success' => true); } else { $cms_message = $cms_language->getMessage(MESSAGE_PAGE_ACTION_DELETE_ERROR); } } else { $cms_message = $cms_language->getMessage(MESSAGE_PAGE_ACTION_ERROR_PROTECTED); $category->raiseError('Error during modification of category ' . $category->getID() . '. Category is protected.'); } break; case 'move': $category = new CMS_moduleCategory($categoryId); if (!$category->isProtected()) { $newParent = new CMS_moduleCategory($newParentId); if (!$newParentId) { $newParent->setAttribute('moduleCodename', $codename); } $index++; //+1 because interface start index to 0 and system start it to 1 if (CMS_moduleCategories_catalog::moveCategory($category, $newParent, $index)) { $content = array('success' => true); } else { $cms_message = $cms_language->getMessage(MESSAGE_ERROR_CATEGORY_MOVE); } } else { $cms_message = $cms_language->getMessage(MESSAGE_PAGE_ACTION_ERROR_PROTECTED); $category->raiseError('Error during modification of category ' . $category->getID() . '. Category is protected.'); }
$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({ msg: \'' . io::htmlspecialchars($cms_language->getMessage(MESSAGE_PAGE_PROTECTED_ALERT)) . '\', buttons: Ext.MessageBox.OK, closable: false, icon: Ext.MessageBox.WARNING }); } }', false, false)); } $items[] = $protectedItem; }