예제 #1
0
define("MESSAGE_FIELD_NO", 1083);
define("MESSAGE_FIELD_YES", 1082);
//Polymod messages
define("MESSAGE_PAGE_FIELD_INDEXABLE", 322);
//checks rights
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
    header("Location: " . PATH_ADMIN_SPECIAL_ENTRY_WR . "?cms_message_id=" . MESSAGE_PAGE_CLEARANCE_ERROR . "&" . session_name() . "=" . session_id());
    exit;
}
//load page objects and vars
$moduleCodename = $_POST["moduleCodename"] ? $_POST["moduleCodename"] : $_GET["moduleCodename"];
$object = new CMS_poly_object_definition($_POST["object"]);
$field = new CMS_poly_object_field($_POST["field"]);
$label = new CMS_object_i18nm($field->getValue("labelID"));
$description = new CMS_object_i18nm($field->getValue("descriptionID"));
$availableLanguagesCodes = CMS_object_i18nm::getAvailableLanguages();
$cms_message = "";
// ****************************************************************
// ** ACTIONS MANAGEMENT                                         **
// ****************************************************************
switch ($_POST["cms_action"]) {
    case "validate":
        //checks and assignments
        $field->setDebug(false);
        if (!$_POST["label" . $availableLanguagesCodes[0]] || !$_POST["type"]) {
            $cms_message .= $cms_language->getMessage(MESSAGE_FORM_ERROR_MANDATORY_FIELDS);
        }
    case 'switchexplanation':
    case "newtype":
        if ($_POST["label" . $availableLanguagesCodes[0]]) {
            foreach ($availableLanguagesCodes as $aLanguageCode) {
 /** 
  * Get the default language code for this module
  * Comes from parameters or Constant
  * Upgrades constant with parameter found
  *
  * @return String the language codename
  * @access public
  */
 function getDefaultLanguageCodename()
 {
     if (!defined("MOD_" . io::strtoupper($this->getCodename()) . "_DEFAULT_LANGUAGE")) {
         $polymodLanguages = CMS_object_i18nm::getAvailableLanguages();
         define("MOD_" . io::strtoupper($this->getCodename()) . "_DEFAULT_LANGUAGE", $polymodLanguages[0]);
     }
     return constant("MOD_" . io::strtoupper($this->getCodename()) . "_DEFAULT_LANGUAGE");
 }