$articleTypeName = Input::Get('f_article_type'); $articleTypeFieldName = Input::Get('f_field_name'); $articleField = new ArticleTypeField($articleTypeName, $articleTypeFieldName); $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/"); $crumbs[] = array($articleTypeName, ''); $crumbs[] = array(getGS("Article type fields"), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName)); $crumbs[] = array(getGS("Reassign a field type"), ""); echo camp_html_breadcrumbs($crumbs); include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php"; $lang = camp_session_get('LoginLanguageId', 1); $languageObj = new Language($lang); // Verify the merge rules $options = array(); $convertibleFromTypes = $articleField->getConvertibleToTypes(); foreach ($convertibleFromTypes as $type) { $options[$type] = ArticleTypeField::VerboseTypeName($type, $languageObj->getLanguageId()); } ?> <script> function UpdateArticleFieldContext() { var my_form = document.forms["add_field_form"] var field_type = my_form.elements["f_article_field_type"].value var is_topic = my_form.elements["is_topic"].value if ((is_topic == "false" && field_type == "topic") || (is_topic == "true" && field_type != "topic")) { ToggleRowVisibility('topic_list') ToggleBoolValue('is_topic') } }
// Check permissions if (!$g_user->hasPermission('ManageArticleTypes')) { camp_html_display_error($translator->trans("You do not have the right to reassign article type fields.", array(), 'article_type_fields')); exit; } $articleTypeName = Input::Get('f_article_type'); $fieldName = trim(Input::Get('f_field_name')); $fieldType = trim(Input::Get('f_article_field_type')); $field = new ArticleTypeField($articleTypeName, $fieldName); $correct = true; $errorMsgs = array(); if (!$field->exists()) { $errorMsgs[] = $translator->trans('The field $1 does not exist.', array('$1' => '<B>' . urlencode($fieldName) . '</B>'), 'article_type_fields'); $correct = false; } if (array_search($fieldType, $field->getConvertibleToTypes()) === false) { $errorMsgs[] = $translator->trans('Can not convert the field $1 from $2 to type $3.', array('$1' => $fieldName, '$2' => $field->getType(), '$3' => $fieldType), 'article_type_fields'); $correct = false; } if ($correct) { $field->setType($fieldType); $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache'); $cacheService->clearNamespace('article_type'); camp_html_goto_page("/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName)); } $crumbs = array(); $crumbs[] = array($translator->trans('Configure'), ""); $crumbs[] = array($translator->trans('Article Types'), "/{$ADMIN}/article_types/"); $crumbs[] = array($articleTypeName, ''); $crumbs[] = array($translator->trans("Article type fields", array(), 'article_type_fields'), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName)); $crumbs[] = array($translator->trans("Adding new field", array(), 'article_type_fields'), "");