diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php
index a0596a8ff..1103c42dc 100644
--- a/e107_admin/cpage.php
+++ b/e107_admin/cpage.php
@@ -124,6 +124,12 @@ class page_admin extends e_admin_dispatcher
'ui' => 'page_admin_form_ui',
'uipath' => null
),
+ 'cat' => array(
+ 'controller' => 'page_chapters_ui',
+ 'path' => null,
+ 'ui' => 'page_chapters_form_ui',
+ 'uipath' => null
+ ),
'menu' => array(
'controller' => 'page_admin_ui',
'path' => null,
@@ -140,8 +146,11 @@ class page_admin extends e_admin_dispatcher
protected $adminMenu = array(
'page/list' => array('caption'=> CUSLAN_48, 'perm' => '5'),
- 'menu/list' => array('caption'=> CUSLAN_49, 'perm' => 'J'),
'page/create' => array('caption'=> CUSLAN_12, 'perm' => '5'),
+ 'cat/list' => array('caption'=> "List Books/Chapters", 'perm' => '5'), // Create Category.
+ 'cat/create' => array('caption'=> "Add Book/Chapter", 'perm' => '5'), // Category List
+
+ 'menu/list' => array('caption'=> CUSLAN_49, 'perm' => 'J'),
'menu/create' => array('caption'=> CUSLAN_31, 'perm' => 'J'),
'page/options' => array('caption'=> LAN_OPTIONS, 'perm' => '0')
);
@@ -185,8 +194,74 @@ class page_admin_form_ui extends e_admin_form_ui
}
+//FIXME - needs a layout similar to the admin sitelinks page. ie. showing chapters as we would 'sublinks'.
+class page_chapters_ui extends e_admin_ui
+{
+ protected $pluginTitle = 'Page Chapters';
+ protected $pluginName = 'core';
+ protected $table = "page_chapters";
+ protected $pid = "chapter_id";
+ protected $perPage = 0; //no limit
+ protected $batchDelete = false;
+ protected $listOrder = 'chapter_parent,chapter_order asc';
+
+ protected $fields = array(
+ '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', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','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' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
+ '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' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
+ 'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE), // Display name
+ 'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
+ 'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
+ 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
+
+ );
+ protected $fieldpref = array('checkboxes', 'chapter_icon', 'chapter_id', 'chapter_name', 'chapter_description','chapter_manager', 'chapter_order', 'options');
+
+ protected $books = array();
+
+ function init()
+ {
+ $sql = e107::getDb();
+ $sql->db_Select_gen("SELECT chapter_id,chapter_name FROM #page_chapters WHERE chapter_parent =0");
+ $this->books[0] = "(New Book)";
+ while($row = $sql->db_Fetch())
+ {
+ $bk = $row['chapter_id'];
+ $this->books[$bk] = $row['chapter_name'];
+ }
+ asort($this->books);
+
+ $this->fields['chapter_parent']['writeParms'] = $this->books;
+ }
+
+ // function createPage()
+ // {
+ // $this->newspost->show_categories();
+ // }
+
+ public function beforeCreate($new_data)
+ {
+
+ }
+
+
+ public function beforeUpdate($new_data, $old_data, $id)
+ {
+
+ }
+
+}
+
+class page_chapters_form_ui extends e_admin_form_ui
+{
+
+}
class page_admin_ui extends e_admin_ui
@@ -199,35 +274,86 @@ class page_admin_ui extends e_admin_ui
//protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
protected $pid = "page_id";
- protected $listOrder = 'p.page_id desc';
+ protected $listOrder = 'p.page_order asc'; // desc would require changes to ajax sorting.
protected $perPage = 10;
protected $batchDelete = true;
protected $batchCopy = true;
+ // protected $listSorting = true;
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE),
- 'page_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width'=>'auto','readParms'=>'link={e_BASE}page.php?[id]&dialog=1'),
+ 'page_chapter' => array('title'=> 'Book/Chapter', 'type' => 'dropdown', 'width' => '10%', 'filter' => true, 'batch'=>true),
+ 'page_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width'=>'25%','readParms'=>'link={e_BASE}page.php?[id]&dialog=1'),
'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
- 'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'),
+
+ 'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto','filter' => true, 'batch'=>true),
'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'width' => 'auto', 'thclass' => 'left'),
'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'width' => 'auto'),
'page_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'width' => 'auto', 'filter' => true, 'batch' => true),
- 'page_rating_flag' => array('title'=> LAN_RATING, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ),
- 'page_comment_flag' => array('title'=> ADLAN_114, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ),
- // 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
-
+ 'page_rating_flag' => array('title'=> LAN_RATING, 'type' => 'boolean', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
+ 'page_comment_flag' => array('title'=> ADLAN_114, 'type' => 'boolean', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
+ // 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
+ 'page_order' => array('title'=> LAN_ORDER, 'type' => 'number', 'width' => 'auto', 'nolist'=>true),
// 'page_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
- 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
+ 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'sort=1')
);
protected $fieldpref = array("page_id","page_title","page_template","page_author","page_class");
+ protected $books = array();
+ protected $cats = array();
+
function init()
{
+ if(e_AJAX_REQUEST) // ajax sorting.
+ {
+ $sql = e107::getDb();
+ $c= ($_GET['from']) ? intval($_GET['from']) : 0;
+ if(isset($_POST['all']))
+ {
+ foreach($_POST['all'] as $row)
+ {
+ list($tmp,$id) = explode("-",$row);
+ $sql->db_Update("page","page_order = ".intval($c)." WHERE page_id = ".intval($id));
+ $c++;
+ }
+ }
+ // echo "";
+ exit;
+ }
+
+
+
+
+
+ $sql = e107::getDb();
+ $sql->db_Select_gen("SELECT chapter_id,chapter_name,chapter_parent FROM #page_chapters ORDER BY chapter_parent asc");
+ while($row = $sql->db_Fetch())
+ {
+ $cat = $row['chapter_id'];
+
+ if($row['chapter_parent'] == 0)
+ {
+ $this->books[$cat] = $row['chapter_name'];
+ }
+ else
+ {
+ $book = $row['chapter_parent'];
+ $this->cats[$cat] = $this->books[$book] . " : ".$row['chapter_name'];
+ }
+ }
+ asort($this->cats);
+
+ $this->fields['page_chapter']['writeParms'] = $this->cats;
+
+
+
+
+
if(varset($_GET['mode'])=='dialog' && varset($_GET['action'])=='dialog') // New Page bbcode in tabs.
{
$this->dialogPage();
@@ -393,8 +519,18 @@ class page_admin_ui extends e_admin_ui
}
else
{
+
+ $text .= "
+
+ Chapter |
+ ". $frm->selectbox('page_chapter',$this->cats, $row['page_chapter']) ." |
+
+ ";
+
+
// fixed - last parameter (allinfo) should be false as getLayout method is returning non-usable formatted array
$templates = e107::getLayouts('', 'page', 'front', '', false, false);
+ $templates['menu'] = "Sidebar"; // ie. a MENU item. //TODO
$text .= "
@@ -402,6 +538,8 @@ class page_admin_ui extends e_admin_ui
". $frm->selectbox('page_template',$templates,$row['page_template']) ." |
";
+
+
}
$text .= "
@@ -446,7 +584,8 @@ class page_admin_ui extends e_admin_ui
$textareaValue = (strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data));
- $text .= $this->bbareaMulti('data', $textareaValue, 'page','page','large');
+ // $text .= $this->bbareaMulti('data', $textareaValue, 'page','page','large');
+ $text .= $frm->bbarea('data', $textareaValue, 'page','page','large');
$text .= "";
// $text .= $frm->bbarea('data', $textareaValue, 'page','help','large');
@@ -589,7 +728,7 @@ class page_admin_ui extends e_admin_ui
if(!$textareaValue)
{
- $textareaValue = "[newpage] ";
+ // $textareaValue = "[newpage] ";
}
@@ -734,9 +873,9 @@ class page_admin_ui extends e_admin_ui
{
list($tm,$key) = explode("_",$k);
- if($mode === FALSE) // Pages only, not menus.
+ if($mode == FALSE) // Pages only, not menus.
{
- $newData .= "[newpage=".$_POST['page_subtitle'][$key]."]\n";
+ $newData[] = "[newpage=".$_POST['page_subtitle'][$key]."]\n";
}
$newData[] = $v;
}
@@ -744,9 +883,12 @@ class page_admin_ui extends e_admin_ui
// return;
}
- // echo nl2br($newData);
+
// return;
$newData = implode("\n\n", $newData);
+
+ // echo nl2br($newData);
+
$page_text = $tp->toDB($newData);
$pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0); // Ideally, this check should be done in the front-end.
$update = 0; // Make sure some updates happen
@@ -815,7 +957,7 @@ class page_admin_ui extends e_admin_ui
$menuname = ($type && vartrue($_POST['menu_name']) ? ", page_theme = '".$tp -> toDB($_POST['menu_name'])."'" : "");
- $status = $sql -> db_Update("page", "page_title='{$page_title}', page_sef='{$page_sef}', page_metakeys='{$page_metak}', page_metadscr='{$page_metad}', page_text='{$page_text}', page_datestamp='".time()."', page_author='{$pauthor}', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."', page_template='".$_POST['page_template']."' {$menuname} WHERE page_id='{$mode}'") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
+ $status = $sql -> db_Update("page", "page_title='{$page_title}', page_sef='{$page_sef}', page_chapter='".intval($_POST['page_chapter'])."', page_metakeys='{$page_metak}', page_metadscr='{$page_metad}', page_text='{$page_text}', page_datestamp='".time()."', page_author='{$pauthor}', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."', page_template='".$_POST['page_template']."' {$menuname} WHERE page_id='{$mode}'") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
if ($status == E_MESSAGE_SUCCESS) $update++;
@@ -892,6 +1034,7 @@ class page_admin_ui extends e_admin_ui
$info = array(
'page_title' => $page_title,
'page_sef' => $page_sef,
+ 'page_chapter' => varset($_POST['page_chapter'],0),
'page_metakeys' => $page_metak,
'page_metadscr' => $page_metad,
'page_text' => $page_text,
diff --git a/e107_admin/lancheck.php b/e107_admin/lancheck.php
index 4bd7b6ba8..8f226e431 100644
--- a/e107_admin/lancheck.php
+++ b/e107_admin/lancheck.php
@@ -474,8 +474,9 @@ class lancheck
foreach($lang_array as $f)
{
- if(preg_match($regexp,$f['path'].$f['fname']) && is_file($f['path'].$f['fname']))
+ if(preg_match($regexp,$f['path'].$f['fname']))
{
+
$data = file($f['path'].$f['fname']);
$relpath = str_replace($comp_dir,"",$f['path']);
if(substr($data[0],0,5) != "form = "core-newspost-create-form"; // form id of the form that will have it's values saved.
-$pst->page = "newspost.php?create"; // display preset options on which page(s).
-$pst->id = "admin_newspost";
// ------------------------------
// done in class2: require_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php"); // maybe this should be put in class2.php when 'admin' is detected.
$newspost = new admin_newspost(e_QUERY, $pst);
@@ -313,7 +307,7 @@ class news_admin_ui extends e_admin_ui
'news_end' => array('title' => "End", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_class' => array('title' => NWSLAN_22, 'type' => 'userclasses', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
- 'news_render_type' => array('title' => LAN_NEWS_49, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
+ 'news_render_type' => array('title' => LAN_TEMPLATE, 'type' => 'dropdown', 'data' => 'str', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false,'batch'=>true, 'filter'=>true,'readParms'=>'reverse=1','writeParms'=>'reverse=1'),
'news_comment_total' => array('title' => LAN_NEWS_60, 'type' => 'number', 'width' => '10%', 'thclass' => '', 'class' => null, 'nosort' => false),
@@ -338,7 +332,7 @@ class news_admin_ui extends e_admin_ui
}
asort($this->cats);
$this->fields['news_category']['writeParms'] = $this->cats;
- $this->fields['news_render_type']['writeParms'] = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2");
+ $this->fields['news_render_type']['writeParms'] = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2","Featurebox");
$this->newspost = new admin_newspost;
$this->newspost->observer();
@@ -782,7 +776,7 @@ class admin_newspost
$this->news_renderTypes[$key] = $value;
}*/
- $this->news_renderTypes = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2");
+ $this->news_renderTypes = array('0'=>NWSLAN_75,'1'=>NWSLAN_76,'2'=>NWSLAN_77,'3'=>NWSLAN_77." 2",'4'=>"Featurebox");
}
@@ -965,13 +959,6 @@ class admin_newspost
// print_a($POST);
switch ($this->getAction()) {
- case 'savepreset':
- case 'clr_preset':
- $this->_pst->save_preset('news_datestamp', false); // save and render result using unique name. Don't save item datestamp
- $_POST = array();
- $this->parseRequest('');
- $this->show_existing_items();
- break;
case 'create':
$this->_pst->read_preset('admin_newspost'); //only works here because $_POST is used.
$this->show_create_item();
@@ -1081,6 +1068,7 @@ class admin_newspost
return true;
}
+// In USE.
function _observe_submit_item($sub_action, $id)
{
// ##### Format and submit item to DB
@@ -1117,6 +1105,7 @@ class admin_newspost
$_POST['news_datestamp'] = time();
}
+
/*
$matches = array();
if(preg_match('#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#', $_POST['news_datestamp'], $matches))
@@ -1159,6 +1148,9 @@ class admin_newspost
$_POST['news_thumbnail'] = urldecode(basename($_POST['news_thumbnail']));
}*/
+ $_POST['news_render_type'] = implode(",",$_POST['news_render_type']);
+// print_a($_POST);
+// exit;
$tmp = explode(chr(35), $_POST['news_author']);
$_POST['news_author'] = $tmp[0];
@@ -1474,7 +1466,7 @@ class admin_newspost
}
}
-
+/*
function _observe_saveColumns()
{
global $user_pref,$admin_log;
@@ -1650,6 +1642,8 @@ class admin_newspost
e107::getRender()->tablerender(NWSLAN_4, e107::getMessage()->render().$text);
}
+
+
function show_batch_options()
{
$classes = e107::getUserClass()->uc_get_classlist();
@@ -1765,11 +1759,13 @@ class admin_newspost
}
}
+*/
-
-
+ // In Use.
function _pre_create()
{
+
+
if($this->getSubAction() == "edit" && !$_POST['preview'])
{
if(!isset($_POST['submit_news']))
@@ -2141,12 +2137,12 @@ class admin_newspost
- ".NWSLAN_73.": |
+ ".LAN_TEMPLATE.": |
";
-
- $text .= $frm->radio_multi('news_render_type', $this->news_renderTypes, $_POST['news_render_type'], true,array(NWSLAN_74))."
+ //TODO multiple-selections at once. (comma separated)
+ $text .= $frm->selectbox('news_render_type', $this->news_renderTypes, intval($_POST['news_render_type']), "multiple=1",array(NWSLAN_74))."
".NWSLAN_74."
diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php
index e642f7fdd..6f38ca66a 100644
--- a/e107_admin/sql/core_sql.php
+++ b/e107_admin/sql/core_sql.php
@@ -370,6 +370,7 @@ CREATE TABLE page (
page_id int(10) unsigned NOT NULL auto_increment,
page_title varchar(250) NOT NULL default '',
page_sef varchar (250) NOT NULL default '',
+ page_chapter int(10) unsigned NOT NULL default '0',
page_metakeys varchar (250) NOT NULL default '',
page_metadscr mediumtext NOT NULL,
page_text mediumtext NOT NULL,
@@ -382,10 +383,33 @@ CREATE TABLE page (
page_ip_restrict text NOT NULL,
page_theme varchar(50) NOT NULL default '',
page_template varchar(50) NOT NULL default '',
+ page_order int(4) unsigned NOT NULL default '9999',
PRIMARY KEY (page_id)
) ENGINE=MyISAM;
# --------------------------------------------------------
+
+#
+# Table structure for table `page_chapters`
+#
+
+CREATE TABLE page_chapters (
+ chapter_id tinyint(3) unsigned NOT NULL auto_increment,
+ chapter_parent int(4) unsigned NOT NULL default '0',
+ chapter_name varchar(200) NOT NULL default '',
+ chapter_sef varchar(200) NOT NULL default '',
+ chapter_meta_description text NOT NULL,
+ chapter_meta_keywords varchar(255) NOT NULL default '',
+ chapter_manager tinyint(3) unsigned NOT NULL default '254',
+ chapter_icon varchar(250) NOT NULL default '',
+ chapter_order tinyint(3) unsigned NOT NULL default '0',
+ PRIMARY KEY (chapter_id),
+ KEY chapter_order (chapter_order)
+) ENGINE=MyISAM;
+# --------------------------------------------------------
+
+
+
#
# Table structure for table `plugin`
#
diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php
index 178403eba..b6fa73db0 100644
--- a/e107_handlers/news_class.php
+++ b/e107_handlers/news_class.php
@@ -125,7 +125,7 @@ class news {
$data['_FIELD_TYPES']['news_class'] = 'todb';
$data['data']['news_render_type'] = $news['news_render_type'];
- $data['_FIELD_TYPES']['news_render_type'] = 'int';
+ $data['_FIELD_TYPES']['news_render_type'] = 'todb';
//news_comment_total
|