diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php
index 8eb6a8724..5033927a5 100644
--- a/e107_admin/cpage.php
+++ b/e107_admin/cpage.php
@@ -9,8 +9,8 @@
* Custom Menus/Pages Administration
*
* $Source: /cvs_backup/e107_0.8/e107_admin/cpage.php,v $
- * $Revision: 1.26 $
- * $Date: 2009-11-18 01:04:25 $
+ * $Revision: 1.27 $
+ * $Date: 2009-11-19 12:35:33 $
* $Author: e107coders $
*
*/
@@ -69,9 +69,18 @@ if(isset($_POST['updatePage']))
$page->submitPage($_POST['pe_id']);
}
-if(isset($_POST['delete']))
+if(isset($_POST['delete']) || varset($_POST['etrigger_delete']))
{
- foreach(array_keys($_POST['delete']) as $pid)
+ if($_POST['etrigger_delete'])
+ {
+ $delArray = array_keys($_POST['etrigger_delete']);
+ }
+ else
+ {
+ $delArray = array_keys($_POST['delete']);
+ }
+
+ foreach($delArray as $pid)
{
$page->delete_page($pid);
}
@@ -94,6 +103,13 @@ if(!e_QUERY)
}
}
+elseif($_GET['action']=='edit')
+{
+ $action = 'create';
+ $sub_action = 'edit';
+ $id = ($_GET['id']);
+ $page->createPage();
+}
else
{
$function = $action."Page";
@@ -119,19 +135,20 @@ class page
$this->fieldpref = (varset($user_pref['admin_cpage_columns'])) ? $user_pref['admin_cpage_columns'] : array("page_id","page_title","page_theme"); ;
$this->fields = array(
- 'page_id' => array('title'=> ID, 'width'=>'5%', 'forced'=> TRUE),
- 'page_title' => array('title'=> CUSLAN_1, 'width'=>'auto'),
- 'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto'),
- 'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
- 'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'text', 'width' => 'auto'), // User name
- 'page_class' => array('title'=> LAN_USERCLASS, 'type' => 'text', 'width' => 'auto'), // Photo
- 'page_rating_flag' => array('title'=> LAN_RATING, 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
- 'page_comment_flag' => array('title'=> ADLAN_114, 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // No real vetting
- // 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
+ 'page_id' => array('title'=> ID, 'width'=>'5%', 'forced'=> TRUE),
+ 'page_title' => array('title'=> CUSLAN_1, 'type' => 'text', 'width'=>'auto'),
+ 'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
+ 'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'),
+ 'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
+ 'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'width' => 'auto'),
+ 'page_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'width' => 'auto'),
+ '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_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
- 'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last')
+ 'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
// $this->fieldpref = array("page_id","page_title","page_author","page_class");
@@ -189,29 +206,11 @@ class page
foreach($pages as $pge)
{
- //title='".LAN_DELETE."'
- $title_text = $pge['page_title'] ? $pge['page_title'] : ($pge['page_theme'] ? CUSLAN_43.$pge['page_theme'] : CUSLAN_44);
- $author = get_user_data($pge['page_author']);
+ $pge['page_title'] = $pge['page_title'] ? $pge['page_title'] : ($pge['page_theme'] ? CUSLAN_43.$pge['page_theme'] : CUSLAN_44);
+ $authorData = get_user_data($pge['page_author']);
+ $pge['page_author'] = $authorData['user_name'];
-
- $text .= "
-
- {$pge['page_id']} | ";
-
- $text .= (in_array("page_title",$this->fieldpref)) ? "{$title_text} | " : "";
- $text .= (in_array("page_theme",$this->fieldpref)) ? "".($pge['page_theme'] ? "menu" : "page")." | " : "";
- $text .= (in_array("page_author",$this->fieldpref)) ? "".($author['user_name'])." | " : "";
- $text .= (in_array("page_datestamp",$this->fieldpref)) ? "".strftime($pref['shortdate'],$pge['page_datestamp'])." | " : "";
- $text .= (in_array("page_class",$this->fieldpref)) ? "".(r_userclass_name($pge['page_class']))." | " : "";
- $text .= (in_array("page_rating_flag",$this->fieldpref)) ? "".($pge['page_rating_flag'] ? ADMIN_TRUE_ICON : " ")." | " : "";
- $text .= (in_array("page_comment_flag",$this->fieldpref)) ? "".($pge['page_comment_flag'] ? ADMIN_TRUE_ICON : " ")." | " : "";
-
- $text .= "
- ".ADMIN_EDIT_ICON."
-
- |
-
- ";
+ $text .= $frm->renderTableRow($this->fields,$this->fieldpref,$pge,'page_id');
}
}
@@ -245,7 +244,12 @@ class page
{
/* mode: FALSE == page, mode: TRUE == menu */
- global $sql, $tp, $e107, $sub_action, $id, $frm, $e_userclass, $e_event;
+ global $e107, $sub_action, $id, $e_userclass, $e_event;
+
+ $frm = e107::getForm();
+ $sql = e107::getDb();
+ $tp = e107::getParser();
+
$edit = ($sub_action == 'edit');
$caption =(!$mode ? ($edit ? CUSLAN_23 : CUSLAN_24) : ($edit ? CUSLAN_25 : CUSLAN_26));
@@ -288,34 +292,62 @@ class page
{
$text .= "
- ".CUSLAN_7." |
-
+ | ".CUSLAN_7." |
+
".$frm->text('menu_name', $menu_name, 50)."
|
";
}
-
+ else
+ {
+
+ $templates = array();
+ $tmp = e107::getTemplate('page', 'page');
+ foreach($tmp as $key=>$val)
+ {
+ $templates[$key] = $key; //TODO add LANS?
+ }
+
+
+ $text .= "
+
+ Template |
+
+ ". $frm->selectbox('page_template',$templates,$row['page_template']) ."
+ |
+
+ ";
+ }
$text .= "
- ".CUSLAN_8." |
-
+ | ".CUSLAN_8." |
+
".$frm->text('page_title', $page_title, 250)."
|
- ".CUSLAN_9." |
-
+ | ".CUSLAN_9." |
+
";
- require_once(e_HANDLER."ren_help.php");
- $insertjs = (!e_WYSIWYG)? " rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' style='width:95%'": "rows='25' style='width:100%' ";
+ // require_once(e_HANDLER."ren_help.php");
+
+ // $insertjs = (!e_WYSIWYG)? " rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' style='width:95%'": "rows='25' style='width:100%' ";
+
$data = $tp->toForm($data,FALSE,TRUE); // Make sure we convert HTML tags to entities
- $text .= "";
-
- $text .= "
- ".display_help('cpage-help', 'cpage')."
- |
+
+ $textareaValue = (strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data));
+ // $text .= $frm->textarea('data', $textareaValue);
+ $text .= $frm->bbarea('data', $textareaValue, 'data', 'cpage-help');
+
+
+
+ // $text .= "";
+ //
".display_help('cpage-help', 'cpage')."
+
+
+ $text .= "
".LAN_UPLOAD_IMAGES." |
@@ -440,13 +472,14 @@ class page
$page_title = $tp->toDB($_POST['page_title']);
$page_text = $tp->toDB($_POST['data']);
- $pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0);
+ // $pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0); // this check should be done in the front-end.
+ $pauthor = USERID;
if($mode)
{ // Saving existing page/menu after edit
// Don't think $_POST['page_ip_restrict'] is ever set.
$menuname = ($type ? ", page_theme = '".$tp -> toDB($_POST['menu_name'])."'" : "");
- $update = $sql -> db_Update("page", "page_title='{$page_title}', 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'],'')."'{$menuname} WHERE page_id='{$mode}'");
+ $update = $sql -> db_Update("page", "page_title='{$page_title}', 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}'");
$admin_log->log_event('CPAGE_02',$mode.'[!br!]'.$page_title.'[!br!]'.$pauthor,E_LOG_INFORMATIVE,'');
$e107cache->clear("page_{$mode}");
$e107cache->clear("page-t_{$mode}");
@@ -495,7 +528,7 @@ class page
{ // New page/menu
$menuname = ($type ? $tp->toDB($_POST['menu_name']) : "");
- $pid = admin_update($sql->db_Insert("page", "0, '{$page_title}', '{$page_text}', '{$pauthor}', '".time()."', '".intval($_POST['page_rating_flag'])."', '".intval($_POST['page_comment_flag'])."', '".$_POST['page_password']."', '".$_POST['page_class']."', '', '".$menuname."'"), 'insert', CUSLAN_27, LAN_CREATED_FAILED, false);
+ $pid = admin_update($sql->db_Insert("page", "0, '{$page_title}', '{$page_text}', '{$pauthor}', '".time()."', '".intval($_POST['page_rating_flag'])."', '".intval($_POST['page_comment_flag'])."', '".$_POST['page_password']."', '".$_POST['page_class']."', '', '".$menuname."', '".$_POST['page_template']."'"), 'insert', CUSLAN_27, LAN_CREATED_FAILED, false);
$admin_log->log_event('CPAGE_01',$menuname.'[!br!]'.$page_title.'[!br!]'.$pauthor,E_LOG_INFORMATIVE,'');
if($type)
diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php
index c4d155f06..afbca0eff 100644
--- a/e107_admin/sql/core_sql.php
+++ b/e107_admin/sql/core_sql.php
@@ -9,8 +9,8 @@
* Core SQL
*
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
- * $Revision: 1.39 $
- * $Date: 2009-11-18 10:05:53 $
+ * $Revision: 1.40 $
+ * $Date: 2009-11-19 12:35:33 $
* $Author: e107coders $
*/
@@ -370,6 +370,7 @@ CREATE TABLE page (
page_class varchar(250) NOT NULL default '',
page_ip_restrict text NOT NULL,
page_theme varchar(50) NOT NULL default '',
+ page_template varchar(50) NOT NULL default '',
PRIMARY KEY (page_id)
) TYPE=MyISAM;
# --------------------------------------------------------
diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php
index 6c06ba941..e0cc9edff 100644
--- a/e107_admin/update_routines.php
+++ b/e107_admin/update_routines.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
-| $Revision: 1.61 $
-| $Date: 2009-11-19 10:07:29 $
+| $Revision: 1.62 $
+| $Date: 2009-11-19 12:35:33 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -263,7 +263,7 @@ function update_706_to_800($type='')
// List of changed DB tables (defined in core_sql.php)
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
$changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist', 'menus',
- 'plugin', 'news', 'news_category','online');
+ 'plugin', 'news', 'news_category','online', 'page');
// List of changed DB tables from core plugins (defined in pluginname_sql.php file)
diff --git a/e107_plugins/page/plugin.xml b/e107_plugins/page/plugin.xml
new file mode 100644
index 000000000..454646ee2
--- /dev/null
+++ b/e107_plugins/page/plugin.xml
@@ -0,0 +1,5 @@
+
+
+
+ menu
+
\ No newline at end of file
diff --git a/e107_plugins/page/templates/page_template.php b/e107_plugins/page/templates/page_template.php
new file mode 100644
index 000000000..5eff0b732
--- /dev/null
+++ b/e107_plugins/page/templates/page_template.php
@@ -0,0 +1,25 @@
+";
+
+ $PAGE_TEMPLATE['other1'] = "";
+
+ $PAGE_TEMPLATE['other2'] = "";
+
+?>
\ No newline at end of file