0
@@ -43,6 +43,8 @@ $smarty->assign('action', 'editcontent.php');
0
$content_id = coalesce_key($_REQUEST, 'content_id', '-1');
0
$page_type = coalesce_key($_REQUEST, 'page_type', 'content');
0
$orig_page_type = coalesce_key($_POST, 'orig_page_type', 'content');
0
+$current_language = coalesce_key($_POST, 'current_language', 'en_US');
0
+$orig_current_language = coalesce_key($_POST, 'orig_current_language', 'en_US');
0
$preview = array_key_exists('previewbutton', $_POST);
0
$submit = array_key_exists('submitbutton', $_POST);
0
$apply = array_key_exists('applybutton', $_POST);
0
@@ -98,7 +100,7 @@ function copycontentobj(&$page_object, $page_type)
0
$page_object = $tmpobj;
0
-function &get_page_object(&$page_type, &$orig_page_type, $userid, $content_id, $params
)
0
+function &get_page_object(&$page_type, &$orig_page_type, $userid, $content_id, $params
, $lang = 'en_US')
0
@@ -107,7 +109,7 @@ function &get_page_object(&$page_type, &$orig_page_type, $userid, $content_id, $
0
if (isset($params["serialized_content"]))
0
$page_object = unserialize_object($params["serialized_content"]);
0
- $page_object->update_parameters($params['content']
);
0
+ $page_object->update_parameters($params['content']
, $lang);
0
if (strtolower(get_class($page_object)) != $page_type)
0
copycontentobj($page_object, $page_type);
0
@@ -151,12 +153,13 @@ function change_block_type($params, $block_id, $new_block_type)
0
$content_id = coalesce_key($params, 'content_id', '-1');
0
$page_type = coalesce_key($params, 'page_type', 'content');
0
$orig_page_type = coalesce_key($params, 'orig_page_type', 'content');
0
+ $orig_current_language = coalesce_key($params, 'orig_current_language', 'en_US');
0
$userid = get_userid();
0
$config = cms_config();
0
$smarty = cms_smarty();
0
- $page_object = get_page_object($page_type, $orig_page_type, $userid, $content_id, $params
);
0
+ $page_object = get_page_object($page_type, $orig_page_type, $userid, $content_id, $params
, $orig_current_language);
0
$type_param = $block_id . '-block-type';
0
$div_id = 'content-form-' . $block_id;
0
$page_object->$type_param = $new_block_type;
0
@@ -180,11 +183,12 @@ function ajaxpreview($params)
0
$content_id = coalesce_key($params, 'content_id', '-1');
0
$page_type = coalesce_key($params, 'page_type', 'content');
0
$orig_page_type = coalesce_key($params, 'orig_page_type', 'content');
0
+ $orig_current_language = coalesce_key($params, 'orig_current_language', 'en_US');
0
$userid = get_userid();
0
$config =& cmsms()->GetConfig();
0
- $page_object = get_page_object($page_type, $orig_page_type, $userid, $content_id, $params
);
0
+ $page_object = get_page_object($page_type, $orig_page_type, $userid, $content_id, $params
, $orig_current_language);
0
$tmpfname = create_preview($page_object);
0
$url = $config["root_url"] . '/index.php?tmpfile=' . urlencode(basename($tmpfname));
0
@@ -203,7 +207,7 @@ function ajaxpreview($params)
0
//Get a working page object
0
-$page_object = get_page_object($page_type, $orig_page_type, $userid, $content_id, $_REQUEST
);
0
+$page_object = get_page_object($page_type, $orig_page_type, $userid, $content_id, $_REQUEST
, $orig_current_language);
0
$smarty->assign('showpreview', false);
0
@@ -223,8 +227,8 @@ else if ($access)
0
- $page_object->set_property_value('name', $_REQUEST['name'], 'en_US');
0
- $page_object->set_property_value('menu_text', $_REQUEST['menu_text'], 'en_US');
0
+ $page_object->set_property_value('name', $_REQUEST['name'], $orig_current_language);
0
+ $page_object->set_property_value('menu_text', $_REQUEST['menu_text'], $orig_current_language);
0
if ($page_object->save())
0
$contentops->SetAllHierarchyPositions();
0
@@ -273,6 +277,11 @@ $smarty->assign_by_ref('page_object', $page_object);
0
$smarty->assign('serialized_object', serialize_object($page_object));
0
$smarty->assign('orig_page_type', $orig_page_type);
0
+//Language related stuff
0
+$smarty->assign('languages', CmsLanguage::get_language_list(true));
0
+$smarty->assign('current_language', $current_language);
0
+$smarty->assign('orig_current_language', $current_language); //orig_current_language should match current_language now that saves and stuff are done
0
$smarty->assign('can_preview', $page_object->preview);
0
@@ -291,8 +300,8 @@ $smarty->assign('parent_dropdown', $contentops->CreateHierarchyDropdown($page_ob
0
$smarty->assign('template_names', $templateops->TemplateDropdown('content[template_id]', $page_object->template_id, 'onchange="document.contentform.submit()"'));
0
//Name and menu text are multilang, use the parameters
0
-$smarty->assign('name', $page_object->get_property_value('name'), 'en_US');
0
-$smarty->assign('menu_text', $page_object->get_property_value('menu_text'), 'en_US');
0
+$smarty->assign('name', $page_object->get_property_value('name', $current_language));
0
+$smarty->assign('menu_text', $page_object->get_property_value('menu_text', $current_language));
0
$userops =& $gCms->GetUserOperations();
0
@@ -300,7 +309,7 @@ $smarty->assign('show_owner_dropdown', false);
0
$smarty->assign('owner_dropdown', $userops->GenerateDropdown($page_object->owner_id, 'content[owner_id]'));
0
//Any included smarty templates for this page type?
0
-$smarty->assign('include_templates', $page_object->edit_template($smarty
));
0
+$smarty->assign('include_templates', $page_object->edit_template($smarty
, $current_language));
0
//Other fields that aren't easily done with smarty
0
$smarty->assign('metadata_box', create_textarea(false, $page_object->metadata, 'content[metadata]', 'pagesmalltextarea', 'content_metadata', '', '', '80', '6'));
Comments
No one has commented yet.