} } $field->setValue("objectID", $object->getID()); if (!$cms_message && $_POST["cms_action"] == "validate") { //save the data $field->writeToPersistence(); header("Location: modules_admin.php?moduleCodename=" . $moduleCodename . "&object=" . $object->getID() . "&field=" . $field->getID() . "&cms_message_id=" . MESSAGE_ACTION_OPERATION_DONE . "&" . session_name() . "=" . session_id()); exit; } elseif ($_POST["cms_action"] != "validate") { $cms_message = ''; } break; } $dialog = new CMS_dialog(); $content = ''; $dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE_APPLICATIONS) . " :: " . $cms_language->getMessage(MESSAGE_PAGE_TITLE, array($object->getLabel($cms_languege))), 'picto_modules.gif'); $dialog->setBacklink("modules_admin.php?moduleCodename=" . $moduleCodename . "&object=" . $object->getID() . "&field=" . $field->getID()); if ($cms_message) { $dialog->setActionMessage($cms_message); } if ($moduleCodename) { $polymod = CMS_modulesCatalog::getByCodename($moduleCodename); } $required = $field->getValue("required") ? ' checked="checked"' : ''; $indexable = $field->getValue("indexable") ? ' checked="checked"' : ''; $searchlist = $field->getValue("searchlist") ? ' checked="checked"' : ''; $searchable = $field->getValue("searchable") ? ' checked="checked"' : ''; $polyModules = CMS_modulesCatalog::getAll("label", true); $poly_types = array(); foreach ($polyModules as $aModule) { $poly_types = array_merge($poly_types, CMS_poly_object_catalog::getObjectsForModule($aModule->getCodename()));
/** * Gets a validation for a given item * * @param integer $itemID The item we want the validations for * @param CMS_user $user The user we want the validations for * @param integer $getEditionType The validation type we want. * by default function return RESOURCE_EDITION_LOCATION then RESOURCE_EDITION_CONTENT then RESOURCE_EDITION_SIBLINGSORDER * @return array(CMS_resourceValidation) The resourceValidations objects, false if none found for the given user. * @access public */ function getValidationByID($itemID, &$user, $getEditionType = false) { if (!$user instanceof CMS_profile_user) { $this->raiseError("User is not a valid CMS_profile_user object"); return false; } if (!$user->hasValidationClearance($this->_codename)) { return false; } if (CMS_poly_object_catalog::hasPrimaryResource($this->getCodename())) { //get object type ID $objectID = CMS_poly_object_catalog::getPrimaryResourceObjectType($this->getCodename()); //get viewvable objects list for current user if (CMS_poly_object_catalog::objectHasCategories($objectID)) { $objects = CMS_poly_object_catalog::getAllObjects($objectID, false, array(), false); //$where = (is_array($objects) && $objects) ? ' and objectID in ('.implode(',',$objects).')' : ''; if (is_array($objects) && $objects) { $where = ' and objectID in (' . implode(',', $objects) . ')'; } else { return false; } } else { $where = ''; } $this->getPrimaryResourceDefinition(); if (!$getEditionType) { $getEditionType = RESOURCE_EDITION_LOCATION + RESOURCE_EDITION_CONTENT; } $sql = "\n\t\t\t\t\tselect\n\t\t\t\t\t\tobjectID as id,\n\t\t\t\t\t\tlocation_rs as location,\n\t\t\t\t\t\tproposedFor_rs as proposedFor,\n\t\t\t\t\t\tvalidationsRefused_rs as validationsRefused,\n\t\t\t\t\t\teditions_rs as editions,\n\t\t\t\t\t\tmod_subobject_integer_edited.id as fieldID\n\t\t\t\t\tfrom\n\t\t\t\t\t\tmod_subobject_integer_edited,\n\t\t\t\t\t\tmod_object_polyobjects,\n\t\t\t\t\t\tresources,\n\t\t\t\t\t\tresourceStatuses\n\t\t\t\t\twhere\n\t\t\t\t\t\tobjectID = '" . $itemID . "'\n\t\t\t\t\t\tand value = id_res\n\t\t\t\t\t\tand object_type_id_moo = '" . $objectID . "'\n\t\t\t\t\t\tand id_moo = objectID\n\t\t\t\t\t\tand objectFieldID = 0\n\t\t\t\t\t\tand objectSubFieldID = 0\n\t\t\t\t\t\tand status_res = id_rs\n\t\t\t\t\t\t{$where}\n\t\t\t\t"; $q = new CMS_query($sql); if ($q->getNumRows() >= 1) { $r = $q->getArray(); $id = $r["id"]; //here, this is an ugly hack to resolve a strange bug (multiple resources for an unique object). //not time to found the real cause for now ... if ($q->getNumRows() > 1) { while ($exceptionFiledID = $q->getValue('fieldID')) { $sql_delete = "delete from mod_subobject_integer_edited where id = '" . $exceptionFiledID . "'"; $q_delete = new CMS_query($sql_delete); } } //search the type of edition //RESOURCE_EDITION_LOCATION if ($r["location"] == RESOURCE_LOCATION_USERSPACE && $r["proposedFor"] != 0 && !($r["validationsRefused"] & RESOURCE_EDITION_LOCATION) && $getEditionType & RESOURCE_EDITION_LOCATION) { $language = $user->getLanguage(); $item = $this->getResourceByID($id); $validation = new CMS_resourceValidation($this->_codename, RESOURCE_EDITION_LOCATION, $item); if (!$validation->hasError()) { $validation->setValidationTypeLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_LOCATIONCHANGE, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME)); $validation->setValidationLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_LOCATIONCHANGE_OFRESOURCE, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME) . " " . io::decodeEntities($item->{$this->_resourceNameMethod}())); $validation->setValidationShortLabel(io::decodeEntities($item->{$this->_resourceNameMethod}())); $previzURL = $item->getPrevizPageURL(); if ($previzURL) { $validation->addHelpUrl($language->getMessage(self::MESSAGE_PAGE_ACTION_PREVIZ), $previzURL); } $validation->setEditorsStack($item->getEditorsStack()); return $validation; } else { return false; } //RESOURCE_EDITION_CONTENT } elseif ($r["location"] == RESOURCE_LOCATION_USERSPACE && $r["proposedFor"] == 0 && ($r["editions"] & RESOURCE_EDITION_CONTENT && !($r["validationsRefused"] & RESOURCE_EDITION_CONTENT)) && $getEditionType & RESOURCE_EDITION_CONTENT) { $language = $user->getLanguage(); $editions = $r["editions"]; //RESOURCE_EDITION_CONTENT $item = $this->getResourceByID($id); $validation = new CMS_resourceValidation($this->_codename, $editions, $item); if (!$validation->hasError()) { $validation->setValidationTypeLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_EDITION, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME)); $validation->setValidationLabel($language->getMessage(self::MESSAGE_MOD_POLYMOD_VALIDATION_EDITION_OFRESOURCE, array($this->_primaryResourceObjectDefinition->getLabel($language)), MOD_POLYMOD_CODENAME) . " " . io::decodeEntities($item->{$this->_resourceNameMethod}())); $validation->setValidationShortLabel(io::decodeEntities($item->{$this->_resourceNameMethod}())); $previzURL = $item->getPrevizPageURL(); if ($previzURL) { $validation->addHelpUrl($language->getMessage(self::MESSAGE_PAGE_ACTION_PREVIZ), $previzURL); } $validation->setEditorsStack($item->getEditorsStack()); return $validation; } else { return false; } } } elseif ($q->getNumRows() == 0) { return false; } else { $this->raiseError("Can't have more than one item for a given ID"); return false; } } else { return false; } }
define("MESSAGE_PAGE_FIELD_MULTI", 190); //checks 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; } $moduleCodename = $_POST["moduleCodename"] ? $_POST["moduleCodename"] : $_GET["moduleCodename"]; $object = new CMS_poly_object_definition($_POST["object"]); $availableLanguagesCodes = CMS_object_i18nm::getAvailableLanguages(); $objectsStructure = CMS_poly_module_structure::getModuleStructure($moduleCodename, true); if ($moduleCodename) { $polymod = CMS_modulesCatalog::getByCodename($moduleCodename); } $dialog = new CMS_dialog(); $content = ''; $dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE_APPLICATIONS) . " :: " . $polymod->getLabel($cms_language) . " :: " . $cms_language->getMessage(MESSAGE_PAGE_TITLE, array($object->getLabel($cms_language))), 'picto_modules.gif'); $dialog->setBacklink("modules_admin.php?moduleCodename=" . $moduleCodename . "&object=" . $object->getID()); if ($cms_message) { $dialog->setActionMessage($cms_message); } $resourceStatus = array(0 => MESSAGE_PAGE_FIELD_RESOURCE_NONE, 1 => MESSAGE_PAGE_FIELD_RESOURCE_PRIMARY, 2 => MESSAGE_PAGE_FIELD_RESOURCE_SECONDARY); $adminEditableStatus = array(0 => MESSAGE_PAGE_FIELD_YES, 1 => MESSAGE_PAGE_FIELD_NO, 2 => MESSAGE_PAGE_FIELD_ONLY_FOR_ADMIN); $objectUseage = CMS_poly_object_catalog::getObjectUsage($object->getID(), true); if (!sizeof($objectUseage)) { $objectUseageLabel = $cms_language->getMessage(MESSAGE_PAGE_FIELD_NO) . '<br />'; } else { $objectUseageLabel = $cms_language->getMessage(MESSAGE_PAGE_FIELD_OBJECT_USED) . ' : <ul>'; foreach ($objectUseage as $anObjectWhichUse) { $objectUseageLabel .= '<li>' . $anObjectWhichUse->getLabel() . '</li>'; } $objectUseageLabel .= '</ul>';
} if ($object->getValue("previewURL")) { $previzInfos = explode('||', $object->getValue("previewURL")); $previewPageID = sensitiveIO::isPositiveInteger($previzInfos[0]) ? $previzInfos[0] : ''; $previewURL = $polymod->convertDefinitionString($previzInfos[1], true); } $content .= ' <tr> <td class="admin" align="right" valign="top" nowrap="nowrap">' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_COMPOSED_LABEL) . '</td> <td class="admin"><input type="text" size="100" name="composedLabel" value="' . $composedLabel . '" class="admin_input_text" /></td> </tr> <tr> <td> </td> <td class="admin"> <fieldset> <legend>' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_OBJECT_EXPLANATION, array($object->getLabel($cms_language))) . '</legend> <br />'; $content .= ' <select name="objectexplanation1" class="admin_input_text" onchange="document.getElementById(\'cms_action\').value=\'switchexplanation\';document.frm.submit();"> <option value="">' . $cms_language->getMessage(MESSAGE_PAGE_CHOOSE) . '</option>'; $content .= CMS_poly_module_structure::viewObjectInfosList($moduleCodename, $cms_language, $_POST['objectexplanation1'], $object->getID()); $content .= ' </select><br />'; if ($_POST['objectexplanation1']) { //object info $content .= CMS_poly_module_structure::viewObjectRowInfos($moduleCodename, $cms_language, $_POST['objectexplanation1']); } $content .= ' </fieldset> </td> </tr>
if (!$pluginDefinition->setValue("query", $_POST["searchedObjects"])) { $cms_message .= "\n" . $cms_language->getMessage(MESSAGE_FORM_ERROR_MALFORMED_FIELD, array($cms_language->getMessage(MESSAGE_PAGE_FIELD_OBJECT_PARAMETERS, false, MOD_POLYMOD_CODENAME))); } if (!$cms_message && $_POST["cms_action"] == "validate") { //save the data $pluginDefinition->writeToPersistence(); header("Location: modules_admin.php?moduleCodename=" . $moduleCodename . "&object=" . $object->getID() . "&cms_message_id=" . MESSAGE_ACTION_OPERATION_DONE . "&" . session_name() . "=" . session_id()); exit; } elseif ($_POST["cms_action"] != "validate") { $cms_message = ''; } break; } $dialog = new CMS_dialog(); $content = ''; $dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE_APPLICATIONS) . " :: " . $cms_language->getMessage(MESSAGE_PAGE_TITLE, array($object->getLabel($cms_languege)), MOD_POLYMOD_CODENAME), 'picto_modules.gif'); $dialog->setBacklink("modules_admin.php?moduleCodename=" . $moduleCodename . "&object=" . $object->getID()); if (method_exists($dialog, 'addStopTab')) { $dialog->addStopTab(); $stopTab = ' onkeydown="return catchTab(this,event)"'; } if ($cms_message) { $dialog->setActionMessage($cms_message); } $searchParameters = $object->getHTMLSubFieldsParametersSearch($cms_language, '', $pluginDefinition->getValue("query")); //Definition $definition = $_POST["definition"] ? $_POST["definition"] : $polymod->convertDefinitionString($pluginDefinition->getValue("definition"), true); $content = ' <table width="80%" border="0" cellpadding="3" cellspacing="2"> <form name="frm" action="' . $_SERVER["SCRIPT_NAME"] . '" method="post"> <input type="hidden" id="cms_action" name="cms_action" value="validate" />