1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-16 04:24:42 +01:00

Merge pull request #1064 from e107bg/master

Multi-language for Custom Pages
This commit is contained in:
Cameron 2015-06-19 10:50:10 -07:00
commit e8892454da
4 changed files with 74 additions and 40 deletions

View File

@ -61,8 +61,8 @@ class page_admin extends e_admin_dispatcher
'menu/list' => array('caption'=> CUSLAN_49, 'perm' => 'J', 'tab' => 2),
'page/create' => array('caption'=> CUSLAN_12, 'perm' => '5'),
'other' => array('divider'=> true),
'cat/list' => array('caption'=> "List Books/Chapters", 'perm' => '5'), // Create Category.
'cat/create' => array('caption'=> "Add Book/Chapter", 'perm' => '5'), // Category List
'cat/list' => array('caption'=> CUSLAN_50, 'perm' => '5'), // Create Category.
'cat/create' => array('caption'=> CUSLAN_51, 'perm' => '5'), // Category List
'other2' => array('divider'=> true),
// 'menu/create' => array('caption'=> CUSLAN_31, 'perm' => 'J', 'tab' => 2),
@ -154,14 +154,14 @@ class page_chapters_ui extends e_admin_ui
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'chapter_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
'chapter_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'writeParms'=> 'glyphs=1', 'readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
'chapter_parent' => array('title'=> "Book", 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'filter'=>true),
'chapter_name' => array('title'=> "Book or Chapter Title", 'type' => 'method', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'writeParms'=>'size=xxlarge'),
'chapter_parent' => array('title'=> CUSLAN_52, 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'filter'=>true),
'chapter_name' => array('title'=> CUSLAN_53, 'type' => 'method', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'writeParms'=>'size=xxlarge'),
'chapter_template' => array('title'=> LAN_TEMPLATE, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'chapter_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE),
'chapter_meta_keywords' => array('title'=> "Meta Keywords", 'type' => 'tags', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE, 'inline'=>true, 'writeParms'=>'size=xxlarge&inline-empty=1'), // Display name
'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
'chapter_meta_keywords' => array('title'=> CUSLAN_54, 'type' => 'tags', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
'chapter_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE, 'inline'=>true, 'writeParms'=>'size=xxlarge&inline-empty=1'), // Display name
'chapter_manager' => array('title'=> CUSLAN_55, 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
'chapter_visibility' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
@ -178,7 +178,7 @@ class page_chapters_ui extends e_admin_ui
if($this->getAction() == 'list')
{
$this->fields['chapter_parent']['title'] = 'Parent';
$this->fields['chapter_parent']['title'] = CUSLAN_56;
}
$sql = e107::getDb();
@ -226,7 +226,7 @@ class page_chapters_ui extends e_admin_ui
if(e107::getDb()->count('page_chapters', '(*)', "chapter_sef='{$sef}'"))
{
e107::getMessage()->addError('Please choose unique SEF URL string for this entry.');
e107::getMessage()->addError(CUSLAN_57);
return false;
}
@ -301,7 +301,7 @@ class page_chapters_form_ui extends e_admin_form_ui
if($parent != 0)
{
$link = e_SELF."?searchquery=&filter_options=page_chapter__".$id."&mode=page&action=list";
$text .= "<a href='".$link."' class='btn' title='View Pages in this chapter'>".E_32_CUST."</a>";
$text .= "<a href='".$link."' class='btn' title='".CUSLAN_58."'>".E_32_CUST."</a>";
}
return $text;
@ -450,7 +450,7 @@ class page_admin_ui extends e_admin_ui
protected $orderStep = 10;
//protected $url = array('profile'=>'page/view', 'name' => 'page_title', 'description' => '', 'link'=>'{e_BASE}page.php?id=[id]'); // 'link' only needed if profile not provided.
protected $url = array('route'=>'page/view/index', 'vars' => array('id' => 'page_id', 'name' => 'page_sef', 'other' => 'page_sef', 'chapter' => 'chapter_sef', 'book' => 'book_sef'), 'name' => 'page_title', 'description' => ''); // 'link' only needed if profile not provided.
protected $tabs = array("Page","Page Options","Menu", "Menu Options");
protected $tabs = array(CUSLAN_59,CUSLAN_60,CUSLAN_61,CUSLAN_62);
protected $featurebox = array('name'=>'page_title', 'description'=>'page_text', 'image' => 'menu_image', 'visibility' => 'page_class', 'url' => true);
/*
@ -472,7 +472,7 @@ class page_admin_ui extends e_admin_ui
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'3%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> LAN_ID, 'type' => 'text', 'tab' => 0, 'width'=>'5%', 'forced'=> TRUE, 'readParms'=>'link=sef&target=dialog'),
'page_title' => array('title'=> LAN_TITLE, 'tab' => 0, 'type' => 'text', 'inline'=>true, 'width'=>'25%', 'writeParms'=>'size=block-level'),
'page_chapter' => array('title'=> 'Book/Chapter', 'tab' => 0, 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true, 'inline'=>true),
'page_chapter' => array('title'=> CUSLAN_63, 'tab' => 0, 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true, 'inline'=>true),
'page_template' => array('title'=> LAN_TEMPLATE, 'tab' => 0, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
@ -493,18 +493,18 @@ class page_admin_ui extends e_admin_ui
'page_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'width' => 'auto', 'inline'=>true),
// Menu Tab XXX 'menu_name' is 'menu_name' - not caption.
'menu_name' => array('title'=> "Menu Name", 'tab' => 2, 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name or may be called using {CMENU=name} in your theme. Must use ASCII characters only."),
'menu_title' => array('title'=> "Menu Title", 'nolist'=>true, 'tab' => 2, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Caption displayed on the menu item.", 'writeParms'=>'size=xxlarge'),
'menu_text' => array('title'=> "Menu Body", 'nolist'=>true, 'tab' => 2, 'type' => 'bbarea', 'data'=>'str', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page' ),
'menu_template' => array('title'=> "Menu Template", 'nolist'=>true, 'tab' => 2, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_name' => array('title'=> CUSLAN_64, 'tab' => 2, 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name or may be called using {CMENU=name} in your theme. Must use ASCII characters only."),
'menu_title' => array('title'=> CUSLAN_65, 'nolist'=>true, 'tab' => 2, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Caption displayed on the menu item.", 'writeParms'=>'size=xxlarge'),
'menu_text' => array('title'=> CUSLAN_66, 'nolist'=>true, 'tab' => 2, 'type' => 'bbarea', 'data'=>'str', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page' ),
'menu_template' => array('title'=> CUSLAN_66, 'nolist'=>true, 'tab' => 2, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_class' => array('title'=> LAN_VISIBILITY, 'tab' => 3, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'menu_button_text' => array('title'=> "Custom Button Text", 'nolist'=>true, 'tab' => 3, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Leave blank to use the default"),
'menu_button_text' => array('title'=> CUSLAN_68, 'nolist'=>true, 'tab' => 3, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Leave blank to use the default"),
'menu_button_url' => array('title'=> "Custom Button URL", 'nolist'=>true, 'tab' => 3, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Leave blank to use the corresponding page", 'writeParms'=>'size=xxlarge'),
'menu_button_url' => array('title'=> CUSLAN_69, 'nolist'=>true, 'tab' => 3, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Leave blank to use the corresponding page", 'writeParms'=>'size=xxlarge'),
'menu_icon' => array('title' =>"Menu Icon/Glyph", 'nolist'=>true, 'tab' => 2, 'type' => 'icon', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&glyphs=1', 'readonly'=>false),
'menu_icon' => array('title' =>CUSLAN_70, 'nolist'=>true, 'tab' => 2, 'type' => 'icon', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&glyphs=1', 'readonly'=>false),
'menu_image' => array('title' =>"Menu Image/Video", 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&video=1', 'readonly'=>false),
'menu_image' => array('title' =>CUSLAN_71, 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&video=1', 'readonly'=>false),
@ -517,13 +517,13 @@ class page_admin_ui extends e_admin_ui
protected $prefs = array(
'listPages' => array('title'=> CUSLAN_29, 'type'=>'boolean'),
'listBooks' => array('title'=> 'List Books/Chapters', 'type'=>'boolean'),
'listBooksTemplate' => array('title'=> 'List Books/Chapters Template', 'type'=>'dropdown'),
'listBooks' => array('title'=> CUSLAN_50, 'type'=>'boolean'),
'listBooksTemplate' => array('title'=> CUSLAN_72, 'type'=>'dropdown'),
'pageCookieExpire' => array('title'=> CUSLAN_30, 'type'=>'number') //TODO Set default value to 84600
);
protected $books = array();
protected $cats = array(0 => 'None');
protected $cats = array(0 => LAN_NONE);
protected $templates = array();
function init()
@ -552,24 +552,24 @@ class page_admin_ui extends e_admin_ui
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'3%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> 'ID', 'type'=>'text', 'tab' => 0, 'width'=>'5%', 'readParms'=>'','forced'=> TRUE),
'menu_image' => array('title' =>"Menu Image/Video", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=140&thumb_urlraw=0&thumb_aw=140', 'readonly'=>false),
'menu_image' => array('title' =>CUSLAN_71, 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=140&thumb_urlraw=0&thumb_aw=140', 'readonly'=>false),
'menu_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '80px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=80&thumb_urlraw=0&thumb_aw=80', 'readonly'=>false),
'menu_title' => array('title'=> "Menu Title", 'forced'=> TRUE, 'type' => 'text', 'inline'=>true, 'width'=>'20%'),
'menu_title' => array('title'=> CUSLAN_65, 'forced'=> TRUE, 'type' => 'text', 'inline'=>true, 'width'=>'20%'),
'menu_name' => array('title'=> "Menu Name", 'type' => 'text', 'inline'=>true, 'width' => '10%','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name. Must use ASCII characters only."),
'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => '15%', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'menu_name' => array('title'=> CUSLAN_64, 'type' => 'text', 'inline'=>true, 'width' => '10%','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name. Must use ASCII characters only."),
'menu_template' => array('title'=> CUSLAN_67, 'type' => 'dropdown', 'width' => '15%', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
// 'page_author' => array('title'=> LAN_AUTHOR, 'tab' => 0, 'type' => 'user', 'data'=>'int','width' => 'auto', 'thclass' => 'left'),
'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&readonly=1'),
'page_chapter' => array('title'=> 'Book/Chapter', 'tab' => 0, 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true, 'inline'=>true),
'page_chapter' => array('title'=> CUSLAN_63, 'tab' => 0, 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true, 'inline'=>true),
'menu_text' => array('title'=> "Menu Body", 'type' => 'bbarea', 'data'=>'str', 'width' => 'auto', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page'),
'menu_text' => array('title'=> CUSLAN_66, 'type' => 'bbarea', 'data'=>'str', 'width' => 'auto', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page'),
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'noselector' => true, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'delete=0&deleteClass='.e_UC_NOBODY)
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'noselector' => true, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'delete=0&deleteClass='.e_UC_NOBODY)
);
$this->fieldpref = array("page_id","menu_name", "menu_title", 'menu_image', 'menu_template', 'menu_icon', 'page_chapter', 'menu_class');
@ -665,7 +665,7 @@ class page_admin_ui extends e_admin_ui
if($sql->insert('menus', $insert) !== false)
{
$mes->addDebug("Menu Created");
$mes->addDebug(CUSLAN_73);
return true;
}
}
@ -699,7 +699,7 @@ class page_admin_ui extends e_admin_ui
if(e107::getDb()->count('page', '(*)', "page_sef='{$sef}'"))
{
e107::getMessage()->addError('Please choose unique SEF URL string for this entry.');
e107::getMessage()->addError(CUSLAN_57);
return false;
}
@ -727,13 +727,13 @@ class page_admin_ui extends e_admin_ui
{
if($sql->update('menus', "menu_name='{$menu_name}' WHERE menu_path=".$id." ") !== false)
{
$mes->addDebug("Menu Updated");
$mes->addDebug(CUSLAN_74);
return true;
}
}
else // missing menu record so create it.
{
$mes->addDebug("Missing Menu-id detected: ".$id);
$mes->addDebug(CUSLAN_75." ".$id);
return $this->afterCreate($newdata,$olddata,$id);
}
@ -748,12 +748,12 @@ class page_admin_ui extends e_admin_ui
{
if($sql->delete('menus', " menu_path=".intval($id)." ") !== false)
{
e107::getMessage()->addDebug("Menu with path #".$id." deleted.");
e107::getMessage()->addDebug(CUSLAN_76."".$id." ".CUSLAN_77);
return true;
}
else
{
e107::getMessage()->addDebug("Couldn't delete menu with path #".$id.".");
e107::getMessage()->addDebug(CUSLAN_78."".$id.".");
}
}

View File

@ -14,6 +14,35 @@ define("CUSLAN_30", "Expiry time for cookie (in seconds)");
define("CUSLAN_31", "Create menu");
define("CUSLAN_48", "Page List");
define("CUSLAN_49", "Menu List");
define("CUSLAN_50", "List Books/Chapters");
define("CUSLAN_51", "Add Book/Chapter");
define("CUSLAN_52", "Book");
define("CUSLAN_53", "Book or Chapter Title");
define("CUSLAN_54", "Meta Keywords");
define("CUSLAN_55", "Can be edited by");
define("CUSLAN_56", "Parent");
define("CUSLAN_57", 'Please choose unique SEF URL string for this entry.');
define("CUSLAN_58", 'View Pages in this chapter');
define("CUSLAN_59", "Page");
define("CUSLAN_60", "Page Options");
define("CUSLAN_61", "Menu");
define("CUSLAN_62", "Menu Options");
define("CUSLAN_63", 'Book/Chapter');
define("CUSLAN_64", "Menu Name");
define("CUSLAN_65", "Menu Title");
define("CUSLAN_66", "Menu Body");
define("CUSLAN_67", "Menu Template");
define("CUSLAN_68", "Custom Button Text");
define("CUSLAN_69", "Custom Button URL");
define("CUSLAN_70", "Menu Icon/Glyph");
define("CUSLAN_71", "Menu Image/Video");
define("CUSLAN_72", 'List Books/Chapters Template');
define("CUSLAN_73", "Menu Created");
define("CUSLAN_74", "Menu Updated");
define("CUSLAN_75", "Missing Menu-id detected:");
define("CUSLAN_76", "Menu with path #");
define("CUSLAN_77", "deleted");
define("CUSLAN_78", "Couldn't delete menu with path ");
// define("CUSLAN_1", "Title");
// define("CUSLAN_2", "Type");

View File

@ -24,4 +24,9 @@ define("LAN_PAGE_11", "Page List");
define("LAN_PAGE_12", "Invalid page");
define("LAN_PAGE_13", "Page");
define("LAN_PAGE_14", "Other Articles");
define("LAN_PAGE_15", "Articles");
define("LAN_PAGE_16", "There are no chapters in this book");
?>

View File

@ -263,14 +263,14 @@ class pageClass
if(e107::getPref('listPages',false))
{
$text .= "<h3>Other Articles</h3>"; // Book Title.
$text .= "<h3>".LAN_PAGE_14."</h3>"; // Book Title.
$tmp = $this->listPages(0);
$text .= $tmp['text']; // Pages unassigned to Book/Chapters.
} //
if($text)
{
$caption = varset($template['caption'], "Articles");
$caption = varset($template['caption'], LAN_PAGE_15);
$this->pageOutput = array('caption'=>$caption, 'text'=>$text);
//e107::getRender()->tablerender($caption, $text, "cpage_list");
}
@ -376,7 +376,7 @@ class pageClass
}
else
{
$text = e107::getMessage()->addInfo("There are no chapters in this book")->render();
$text = e107::getMessage()->addInfo(LAN_PAGE_16)->render();
}
#return array('caption'=>$caption, 'text'=>$text);