mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
News administration - done (without 'submitted news' page); ajax added on various places
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* News Administration
|
* News Administration
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||||
* $Revision: 1.23 $
|
* $Revision: 1.24 $
|
||||||
* $Date: 2009-01-17 01:30:35 $
|
* $Date: 2009-01-17 22:48:14 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
@@ -31,6 +31,10 @@ $pst->id = "admin_newspost";
|
|||||||
// ------------------------------
|
// ------------------------------
|
||||||
|
|
||||||
$newspost = new admin_newspost(e_QUERY, $pst);
|
$newspost = new admin_newspost(e_QUERY, $pst);
|
||||||
|
|
||||||
|
//Handle Ajax Calls
|
||||||
|
if($newspost->ajax_observer()) exit;
|
||||||
|
|
||||||
function headerjs()
|
function headerjs()
|
||||||
{
|
{
|
||||||
global $newspost;
|
global $newspost;
|
||||||
@@ -62,6 +66,41 @@ function headerjs()
|
|||||||
</script>
|
</script>
|
||||||
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
if($newspost->getAction() == 'cat')
|
||||||
|
{
|
||||||
|
$ret .= "
|
||||||
|
<script type='text/javascript'>
|
||||||
|
//Click observer
|
||||||
|
document.observe('dom:loaded', function(){
|
||||||
|
\$\$('a.action[id^=core-news-catedit-]').each(function(element) {
|
||||||
|
element.observe('click', function(event) {
|
||||||
|
event.stop();
|
||||||
|
var el = event.findElement('a');
|
||||||
|
$('core-newspost-cat-create-form').fillForm(\$\$('body')[0], { handler: el.readAttribute('href') });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
elseif ($newspost->getAction() == 'pref')
|
||||||
|
{
|
||||||
|
$ret .= "
|
||||||
|
<script type='text/javascript'>
|
||||||
|
document.observe('dom:loaded', function(){
|
||||||
|
\$('newsposts').observe('change', function(event) { console.log(event.element().readAttribute('tabindex'));
|
||||||
|
new e107Ajax.Updater(
|
||||||
|
'newsposts-archive-cont',
|
||||||
|
'".e_SELF."?pref_archnum.' + (event.element().selectedIndex + 1) + '.' + event.element().readAttribute('tabindex'),
|
||||||
|
{ overlayElement: 'newsposts-archive-cont' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
";
|
||||||
|
}
|
||||||
$ret .= $newspost->_cal->load_files();
|
$ret .= $newspost->_cal->load_files();
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
@@ -163,6 +202,17 @@ class admin_newspost
|
|||||||
$e107->ecache->clear("othernews");
|
$e107->ecache->clear("othernews");
|
||||||
$e107->ecache->clear("othernews2");
|
$e107->ecache->clear("othernews2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ajax_observer()
|
||||||
|
{
|
||||||
|
$method = 'ajax_exec_'.$this->getAction();
|
||||||
|
if(e_AJAX_REQUEST && method_exists($this, $method))
|
||||||
|
{
|
||||||
|
$this->$method();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function observer()
|
function observer()
|
||||||
{
|
{
|
||||||
@@ -387,9 +437,9 @@ class admin_newspost
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_POST['category_button'] = $tp->toDB($_POST['category_button']);
|
$_POST['category_button'] = $e107->tp->toDB($_POST['category_button']);
|
||||||
}
|
}
|
||||||
$_POST['category_name'] = $tp->toDB($_POST['category_name']);
|
$_POST['category_name'] = $e107->tp->toDB($_POST['category_name']);
|
||||||
$e107->sql->db_Insert('news_category', "'0', '{$_POST['category_name']}', '{$_POST['category_button']}'");
|
$e107->sql->db_Insert('news_category', "'0', '{$_POST['category_name']}', '{$_POST['category_button']}'");
|
||||||
$admin_log->log_event('NEWS_04',$_POST['category_name'].', '.$_POST['category_button'],E_LOG_INFORMATIVE,'');
|
$admin_log->log_event('NEWS_04',$_POST['category_name'].', '.$_POST['category_button'],E_LOG_INFORMATIVE,'');
|
||||||
$this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS);
|
$this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS);
|
||||||
@@ -414,17 +464,20 @@ class admin_newspost
|
|||||||
function _observe_save_prefs()
|
function _observe_save_prefs()
|
||||||
{
|
{
|
||||||
global $pref, $admin_log;
|
global $pref, $admin_log;
|
||||||
|
|
||||||
|
$e107 = e107::getInstance();
|
||||||
|
|
||||||
$temp = array();
|
$temp = array();
|
||||||
$temp['newsposts'] = intval($_POST['newsposts']);
|
$temp['newsposts'] = intval($_POST['newsposts']);
|
||||||
$temp['newsposts_archive'] = intval($_POST['newsposts_archive']);
|
$temp['newsposts_archive'] = intval($_POST['newsposts_archive']);
|
||||||
$temp['newsposts_archive_title'] = $tp->toDB($_POST['newsposts_archive_title']);
|
$temp['newsposts_archive_title'] = $e107->tp->toDB($_POST['newsposts_archive_title']);
|
||||||
$temp['news_cats'] = intval($_POST['news_cats']);
|
$temp['news_cats'] = intval($_POST['news_cats']);
|
||||||
$temp['nbr_cols'] = intval($_POST['nbr_cols']);
|
$temp['nbr_cols'] = intval($_POST['nbr_cols']);
|
||||||
$temp['subnews_attach'] = intval($_POST['subnews_attach']);
|
$temp['subnews_attach'] = intval($_POST['subnews_attach']);
|
||||||
$temp['subnews_resize'] = intval($_POST['subnews_resize']);
|
$temp['subnews_resize'] = intval($_POST['subnews_resize']);
|
||||||
$temp['subnews_class'] = intval($_POST['subnews_class']);
|
$temp['subnews_class'] = intval($_POST['subnews_class']);
|
||||||
$temp['subnews_htmlarea'] = intval($_POST['subnews_htmlarea']);
|
$temp['subnews_htmlarea'] = intval($_POST['subnews_htmlarea']);
|
||||||
$temp['news_subheader'] = $tp->toDB($_POST['news_subheader']);
|
$temp['news_subheader'] = $e107->tp->toDB($_POST['news_subheader']);
|
||||||
$temp['news_newdateheader'] = intval($_POST['news_newdateheader']);
|
$temp['news_newdateheader'] = intval($_POST['news_newdateheader']);
|
||||||
$temp['news_unstemplate'] = intval($_POST['news_unstemplate']);
|
$temp['news_unstemplate'] = intval($_POST['news_unstemplate']);
|
||||||
$temp['news_editauthor'] = intval($_POST['news_editauthor']);
|
$temp['news_editauthor'] = intval($_POST['news_editauthor']);
|
||||||
@@ -1183,27 +1236,49 @@ class admin_newspost
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_message($message, $type = E_MESSAGE_INFO, $session = false)
|
function ajax_exec_cat()
|
||||||
{
|
{
|
||||||
// ##### Display comfort ---------------------------------------------------------------------------------------------------------
|
require_once (e_HANDLER.'js_helper.php');
|
||||||
//global $ns;
|
$e107 = &e107::getInstance();
|
||||||
//$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
|
||||||
$emessage = &eMessage::getInstance();
|
$category = array();
|
||||||
$emessage->add($message, $type, $session);
|
if ($e107->sql->db_Select("news_category", "*", "category_id=".$this->getId()))
|
||||||
|
{
|
||||||
|
$category = $e107->sql->db_Fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($category))
|
||||||
|
{
|
||||||
|
e_jshelper::sendAjaxError(404, 'Page not found!', 'Requested news category was not found in the DB.', true);
|
||||||
|
}
|
||||||
|
$jshelper = new e_jshelper();
|
||||||
|
|
||||||
|
//show cancel and update, hide create buttons; disable create button (just in case)
|
||||||
|
$jshelper->addResponseAction('element-invoke-by-id', array(
|
||||||
|
'show' => 'category-clear,update-category',
|
||||||
|
'disabled,1' => 'create-category',
|
||||||
|
'hide' => 'create-category'
|
||||||
|
));
|
||||||
|
|
||||||
|
//category icon alias
|
||||||
|
$category['category-button'] = $category['category_icon'];
|
||||||
|
//Send the prefered response type
|
||||||
|
echo $jshelper->sendXMLResponse('fill-form', $category);
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_categories()
|
function show_categories()
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER."userclass_class.php");
|
|
||||||
require_once(e_HANDLER."form_handler.php");
|
require_once(e_HANDLER."form_handler.php");
|
||||||
$frm = new e_form(true); //enable inner tabindex counter
|
$frm = new e_form(true); //enable inner tabindex counter
|
||||||
|
|
||||||
$e107 = &e107::getInstance();
|
$e107 = &e107::getInstance();
|
||||||
|
|
||||||
$category = array();
|
$category = array();
|
||||||
if ($this->getSubAction() == "edit") {
|
if ($this->getSubAction() == "edit")
|
||||||
if ($e107->sql->db_Select("news_category", "*", "category_id=".$this->getId())) {
|
{
|
||||||
|
if ($e107->sql->db_Select("news_category", "*", "category_id=".$this->getId()))
|
||||||
|
{
|
||||||
$category = $e107->sql->db_Fetch();
|
$category = $e107->sql->db_Fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1246,6 +1321,9 @@ class admin_newspost
|
|||||||
{
|
{
|
||||||
$text .= "
|
$text .= "
|
||||||
".$frm->admin_button('create_category', NWSLAN_56, 'create')."
|
".$frm->admin_button('create_category', NWSLAN_56, 'create')."
|
||||||
|
".$frm->admin_button('update_category', NWSLAN_55, 'update', '', 'other=style="display:none"')."
|
||||||
|
".$frm->admin_button('category_clear', LAN_CANCEL, 'cancel', '', 'other=style="display:none"')."
|
||||||
|
".$frm->hidden("category_id", 0)."
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1257,7 +1335,7 @@ class admin_newspost
|
|||||||
|
|
||||||
//XXX LAN - Icon
|
//XXX LAN - Icon
|
||||||
$text .= "
|
$text .= "
|
||||||
<form action='".e_SELF."?cat' id='newscatform' method='post'>
|
<form action='".e_SELF."?cat' id='core-newspost-cat-list-form' method='post'>
|
||||||
<fieldset id='core-newspost-cat-list'>
|
<fieldset id='core-newspost-cat-list'>
|
||||||
<legend>".NWSLAN_51."</legend>
|
<legend>".NWSLAN_51."</legend>
|
||||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||||
@@ -1270,7 +1348,7 @@ class admin_newspost
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class='center'>".LAN_NEWS_45."</th>
|
<th class='center'>".LAN_NEWS_45."</th>
|
||||||
<th class='center'>Icon</th>
|
<th class='center'>".NWSLAN_122."</th>
|
||||||
<th>".NWSLAN_6."</th>
|
<th>".NWSLAN_6."</th>
|
||||||
<th class='center last'>".LAN_OPTIONS."</th>
|
<th class='center last'>".LAN_OPTIONS."</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -1286,11 +1364,11 @@ class admin_newspost
|
|||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='center'>{$category['category_id']}</td>
|
<td class='center middle'>{$category['category_id']}</td>
|
||||||
<td class='center'><img class='icon action' src='{$icon}' alt='' /></td>
|
<td class='center middle'><img class='icon action' src='{$icon}' alt='' /></td>
|
||||||
<td>{$category['category_name']}</td>
|
<td class='middle'>{$category['category_name']}</td>
|
||||||
<td class='center'>
|
<td class='center middle'>
|
||||||
<a href='".e_SELF."?cat.edit.{$category['category_id']}'>".ADMIN_EDIT_ICON."</a>
|
<a class='action' id='core-news-catedit-{$category['category_id']}' href='".e_SELF."?cat.edit.{$category['category_id']}' tabindex='".$frm->getNext()."'>".ADMIN_EDIT_ICON."</a>
|
||||||
".$frm->submit_image("delete[category_{$category['category_id']}]", $category['category_id'], 'delete', $e107->tp->toJS(NWSLAN_37." [ID: {$category['category_id']} ]"))."
|
".$frm->submit_image("delete[category_{$category['category_id']}]", $category['category_id'], 'delete', $e107->tp->toJS(NWSLAN_37." [ID: {$category['category_id']} ]"))."
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
@@ -1311,14 +1389,36 @@ class admin_newspost
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
$e107->ns->tablerender(NWSLAN_46, $text);
|
$e107->ns->tablerender(NWSLAN_46a, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _optrange($num , $zero = true)
|
||||||
|
{
|
||||||
|
$tmp = range(0, $num < 0 ? 0 : $num);
|
||||||
|
if(!$zero) unset($tmp[0]);
|
||||||
|
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajax_exec_pref_archnum()
|
||||||
|
{
|
||||||
|
global $pref;
|
||||||
|
|
||||||
|
require_once(e_HANDLER."form_handler.php");
|
||||||
|
$frm = new e_form();
|
||||||
|
|
||||||
|
echo $frm->selectbox('newsposts_archive', $this->_optrange(intval($this->getSubAction()) - 1), intval($pref['newsposts_archive']), 'class=tbox&tabindex='.intval($this->getId()));
|
||||||
|
}
|
||||||
|
|
||||||
function show_news_prefs()
|
function show_news_prefs()
|
||||||
{
|
{
|
||||||
global $sql, $rs, $ns, $pref, $frm;
|
global $pref, $e_userclass;
|
||||||
|
|
||||||
|
require_once(e_HANDLER."form_handler.php");
|
||||||
|
$frm = new e_form(true); //enable inner tabindex counter
|
||||||
|
|
||||||
|
$e107 = &e107::getInstance();
|
||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
<form method='post' action='".e_SELF."?pref' id='core-newspost-settings-form'>
|
<form method='post' action='".e_SELF."?pref' id='core-newspost-settings-form'>
|
||||||
<fieldset id='core-newspost-settings'>
|
<fieldset id='core-newspost-settings'>
|
||||||
@@ -1332,26 +1432,19 @@ class admin_newspost
|
|||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_86."</td>
|
<td class='label'>".NWSLAN_86."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->checkbox('news_cats', '1', ($pref['news_cats'] == 1))."
|
".$frm->checkbox_switch('news_cats', 1, $pref['news_cats'])."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_87."</td>
|
<td class='label'>".NWSLAN_87."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
<select class='tbox' name='nbr_cols'>
|
".$frm->selectbox('nbr_cols', $this->_optrange(6, false), $pref['nbr_cols'], 'class=tbox')."
|
||||||
<option value='1' ".($pref['nbr_cols'] == 1 ? "selected='selected'>" : "").">1</option>
|
|
||||||
<option value='2' ".($pref['nbr_cols'] == 2 ? "selected='selected'>" : "").">2</option>
|
|
||||||
<option value='3' ".($pref['nbr_cols'] == 3 ? "selected='selected'>" : "").">3</option>
|
|
||||||
<option value='4' ".($pref['nbr_cols'] == 4 ? "selected='selected'>" : "").">4</option>
|
|
||||||
<option value='5' ".($pref['nbr_cols'] == 5 ? "selected='selected'>" : "").">5</option>
|
|
||||||
<option value='6' ".($pref['nbr_cols'] == 6 ? "selected='selected'>" : "").">6</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_88."</td>
|
<td class='label'>".NWSLAN_88."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->text('newsposts', $pref['newsposts'])."
|
".$frm->selectbox('newsposts', $this->_optrange(50, false), $pref['newsposts'], 'class=tbox')."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
@@ -1360,17 +1453,12 @@ class admin_newspost
|
|||||||
// ##### ADDED FOR NEWS ARCHIVE --------------------------------------------------------------------
|
// ##### ADDED FOR NEWS ARCHIVE --------------------------------------------------------------------
|
||||||
// the possible archive values are from "0" to "< $pref['newsposts']"
|
// the possible archive values are from "0" to "< $pref['newsposts']"
|
||||||
// this should really be made as an onchange event on the selectbox for $pref['newsposts'] ...
|
// this should really be made as an onchange event on the selectbox for $pref['newsposts'] ...
|
||||||
|
//SecretR - Done
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_115."</td>
|
<td class='label'>".NWSLAN_115."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
<select class='tbox' name='newsposts_archive'>
|
<div id='newsposts-archive-cont'>".$frm->selectbox('newsposts_archive', $this->_optrange(intval($pref['newsposts']) - 1), intval($pref['newsposts_archive']), 'class=tbox')."</div>
|
||||||
";
|
|
||||||
for($i = 0; $i < $pref['newsposts']; $i++) {
|
|
||||||
$text .= ($i == $pref['newsposts_archive'] ? "<option value='".$i."' selected='selected'>".$i."</option>" : " <option value='".$i."'>".$i."</option>");
|
|
||||||
}
|
|
||||||
$text .= "
|
|
||||||
</select>
|
|
||||||
<div class='field-help'>".NWSLAN_116."</div>
|
<div class='field-help'>".NWSLAN_116."</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -1383,59 +1471,60 @@ class admin_newspost
|
|||||||
";
|
";
|
||||||
// ##### END --------------------------------------------------------------------------------------
|
// ##### END --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
require_once(e_HANDLER."userclass_class.php");
|
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".LAN_NEWS_51."</td>
|
<td class='label'>".LAN_NEWS_51."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".r_userclass("news_editauthor", $pref['news_editauthor'],"off","nobody,mainadmin,admin,classes")."
|
".$e107->user_class->uc_dropdown('news_editauthor', $pref['news_editauthor'], 'nobody,main,admin,classes', "tabindex='".$frm->getNext()."'")."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_106."</td>
|
<td class='label'>".NWSLAN_106."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".r_userclass("subnews_class", $pref['subnews_class'],"off","nobody,public,guest,member,admin,classes")."
|
".$e107->user_class->uc_dropdown('subnews_class', $pref['subnews_class'], 'nobody,public,guest,member,admin,classes', "tabindex='".$frm->getNext()."'")."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_107."</td>
|
<td class='label'>".NWSLAN_107."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->checkbox('subnews_htmlarea', '1', $pref['subnews_htmlarea'])."
|
".$frm->checkbox_switch('subnews_htmlarea', '1', $pref['subnews_htmlarea'])."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_100."</td>
|
<td class='label'>".NWSLAN_100."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->checkbox('subnews_attach', '1', $pref['subnews_attach'])."
|
".$frm->checkbox_switch('subnews_attach', '1', $pref['subnews_attach'])."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_101."</td>
|
<td class='label'>".NWSLAN_101."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
<input class='tbox' type='text' style='width:50px' name='subnews_resize' value='".$pref['subnews_resize']."' />
|
".$frm->text('subnews_resize', $pref['subnews_resize'], 5, 'size=6&class=tbox')."
|
||||||
".NWSLAN_102."
|
<div class='field-help'>".NWSLAN_102."</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_111."</td>
|
<td class='label'>".NWSLAN_111."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->checkbox('news_newdateheader', '1', ($pref['news_newdateheader'] == 1))."
|
<div class='auto-toggle-area autocheck'>
|
||||||
<div class='field-help'>".NWSLAN_112."</div>
|
".$frm->checkbox_switch('news_newdateheader', '1', $pref['news_newdateheader'])."
|
||||||
|
<div class='field-help'>".NWSLAN_112."</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_113."</td>
|
<td class='label'>".NWSLAN_113."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
".$frm->checkbox('news_unstemplate', '1', ($pref['news_unstemplate'] == 1))."
|
<div class='auto-toggle-area autocheck'>
|
||||||
<div class='field-help'>".NWSLAN_114."</div>
|
".$frm->checkbox_switch('news_unstemplate', '1', $pref['news_unstemplate'])."
|
||||||
|
<div class='field-help'>".NWSLAN_114."</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='label'>".NWSLAN_120."</td>
|
<td class='label'>".NWSLAN_120."</td>
|
||||||
<td class='control'>
|
<td class='control'>
|
||||||
<textarea name='news_subheader' style='width:95%;' rows='6' cols='80' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' class='tbox'>".stripcslashes($pref['news_subheader'])." </textarea><br />" . display_help('helpb', 2) . "
|
".$frm->bbarea('news_subheader', stripcslashes($pref['news_subheader']), 2, 'helpb')."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -1447,7 +1536,7 @@ class admin_newspost
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
$ns->tablerender(NWSLAN_90, $text);
|
$e107->ns->tablerender(NWSLAN_90, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1524,6 +1613,14 @@ class admin_newspost
|
|||||||
|
|
||||||
$ns->tablerender(NWSLAN_47, $text);
|
$ns->tablerender(NWSLAN_47, $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function show_message($message, $type = E_MESSAGE_INFO, $session = false)
|
||||||
|
{
|
||||||
|
// ##### Display comfort ---------
|
||||||
|
$emessage = &eMessage::getInstance();
|
||||||
|
$emessage->add($message, $type, $session);
|
||||||
|
}
|
||||||
|
|
||||||
function show_options()
|
function show_options()
|
||||||
{
|
{
|
||||||
@@ -1558,6 +1655,4 @@ function newspost_adminmenu()
|
|||||||
global $newspost;
|
global $newspost;
|
||||||
$newspost->show_options();
|
$newspost->show_options();
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
?>
|
|
@@ -8,8 +8,8 @@
|
|||||||
* e107 Admin Helper
|
* e107 Admin Helper
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/admin.js,v $
|
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/admin.js,v $
|
||||||
* $Revision: 1.14 $
|
* $Revision: 1.15 $
|
||||||
* $Date: 2009-01-12 12:05:55 $
|
* $Date: 2009-01-17 22:48:14 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -92,7 +92,16 @@ e107Admin.Helper = {
|
|||||||
toggleChecked: function(event) {
|
toggleChecked: function(event) {
|
||||||
//do nothing if checkbox/form element or link is clicked
|
//do nothing if checkbox/form element or link is clicked
|
||||||
var tmp = event.element().nodeName.toLowerCase();
|
var tmp = event.element().nodeName.toLowerCase();
|
||||||
if(tmp == 'input' || tmp == 'a' || tmp == 'select' || tmp == 'textarea' || tmp == 'radio') return;
|
switch (tmp) {
|
||||||
|
case 'input':
|
||||||
|
case 'a':
|
||||||
|
case 'select':
|
||||||
|
case 'textarea':
|
||||||
|
case 'radio':
|
||||||
|
case 'label':
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//checkbox container element
|
//checkbox container element
|
||||||
var element = event.findElement('.autocheck'), check = null;
|
var element = event.findElement('.autocheck'), check = null;
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
* e107 Javascript API
|
* e107 Javascript API
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $
|
||||||
* $Revision: 1.23 $
|
* $Revision: 1.24 $
|
||||||
* $Date: 2009-01-16 17:57:57 $
|
* $Date: 2009-01-17 22:48:14 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -1486,7 +1486,7 @@ e107Event.register('ajax_loading_element_start', function(event) {
|
|||||||
if(element) element.startLoading();
|
if(element) element.startLoading();
|
||||||
});
|
});
|
||||||
|
|
||||||
e107Event.register('ajax_loading_element_end', function(event) {
|
e107Event.register('ajax_loading_element_end', function(event) {
|
||||||
var element = $(event.memo.overlayElement);
|
var element = $(event.memo.overlayElement);
|
||||||
if(element) window.setTimeout( function(){ element.stopLoading() }.bind(element), 50);
|
if(element) window.setTimeout( function(){ element.stopLoading() }.bind(element), 50);
|
||||||
});
|
});
|
||||||
@@ -2234,8 +2234,14 @@ var e107AjaxAbstract = Class.create ({
|
|||||||
if(field.getAttribute('name')) {
|
if(field.getAttribute('name')) {
|
||||||
var type = field.getAttribute('type'), //not used yet
|
var type = field.getAttribute('type'), //not used yet
|
||||||
name = field.getAttribute('name'),
|
name = field.getAttribute('name'),
|
||||||
eldata = field.firstChild;
|
eldata = field.firstChild
|
||||||
parsed[action][name] = eldata ? eldata.data : '';
|
val = eldata ? eldata.data : '';
|
||||||
|
if(parsed[action][name] && Object.isArray(parsed[action][name]))
|
||||||
|
parsed[action][name].push(val);
|
||||||
|
else if(parsed[action][name] && Object.isString(parsed[action][name]))
|
||||||
|
parsed[action][name] = [parsed[action][name], val];
|
||||||
|
else
|
||||||
|
parsed[action][name]= val;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2291,6 +2297,8 @@ var e107AjaxAbstract = Class.create ({
|
|||||||
* Examples:
|
* Examples:
|
||||||
* {'show': 'id1,id2,id3'} -> show elements with id id1,id2 and id3
|
* {'show': 'id1,id2,id3'} -> show elements with id id1,id2 and id3
|
||||||
* {'writeAttribute,rel,external': 'id1,id2,id3'} -> invoke writeAttribute('rel', 'external') on elements with id id1,id2 and id3
|
* {'writeAttribute,rel,external': 'id1,id2,id3'} -> invoke writeAttribute('rel', 'external') on elements with id id1,id2 and id3
|
||||||
|
* {'disabled,1': 'button-el,other-button-el'} -> set disabled property of elements with id button-el,other-button-el to true
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
_processResponseElementInvokeById: function(response) {
|
_processResponseElementInvokeById: function(response) {
|
||||||
//response.key is comma separated list representing method -> args to be invoked on every element
|
//response.key is comma separated list representing method -> args to be invoked on every element
|
||||||
@@ -2298,11 +2306,16 @@ var e107AjaxAbstract = Class.create ({
|
|||||||
var tmp = $A(key.split(',')),
|
var tmp = $A(key.split(',')),
|
||||||
method = tmp[0],
|
method = tmp[0],
|
||||||
args = tmp.slice(1);
|
args = tmp.slice(1);
|
||||||
//response.value is comma separated element id list
|
//response.value is comma separated element id list or array of element ids
|
||||||
$A(response[key].split(',')).each( function(el) {
|
var els = Object.isArray(response[key]) ? response[key] : response[key].split(',');
|
||||||
|
$A(els).each( function(el) {
|
||||||
el = $(el.strip());
|
el = $(el.strip());
|
||||||
if(el)
|
if(el) {
|
||||||
el[method].apply(el, args)
|
if(Object.isFunction(el[method]))
|
||||||
|
el[method].apply(el, args);
|
||||||
|
else
|
||||||
|
el[method] = (args[0] ? true : false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -2426,7 +2439,7 @@ e107Ajax.Updater = Class.create({
|
|||||||
// Set current version value for container
|
// Set current version value for container
|
||||||
e107History.set(id, version);
|
e107History.set(id, version);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return new Ajax.Updater(container, url, this.options);
|
return new Ajax.Updater(container, url, this.options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Form Handler
|
* Form Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||||
* $Revision: 1.16 $
|
* $Revision: 1.17 $
|
||||||
* $Date: 2009-01-16 17:57:56 $
|
* $Date: 2009-01-17 22:48:14 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -147,6 +147,11 @@ class e_form
|
|||||||
return "<input type='checkbox' name='{$name}' value='{$value}'".$this->get_attributes($options, $name, $value)." />";
|
return "<input type='checkbox' name='{$name}' value='{$value}'".$this->get_attributes($options, $name, $value)." />";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkbox_switch($name, $value, $checked = false, $label = '')
|
||||||
|
{
|
||||||
|
return $this->checkbox($name, $value, $checked).$this->label($label ? $label : LAN_ENABLED, $name, $value);
|
||||||
|
}
|
||||||
|
|
||||||
function checkbox_toggle($name, $selector = 'multitoggle')
|
function checkbox_toggle($name, $selector = 'multitoggle')
|
||||||
{
|
{
|
||||||
@@ -196,6 +201,11 @@ class e_form
|
|||||||
$options = $this->format_options('select', $name, $options);
|
$options = $this->format_options('select', $name, $options);
|
||||||
return "<select name='{$name}'".$this->get_attributes($options, $name).">";
|
return "<select name='{$name}'".$this->get_attributes($options, $name).">";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectbox($name, $option_array, $selected = false, $options = array())
|
||||||
|
{
|
||||||
|
return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close();
|
||||||
|
}
|
||||||
|
|
||||||
function optgroup_open($label, $disabled)
|
function optgroup_open($label, $disabled)
|
||||||
{
|
{
|
||||||
@@ -209,6 +219,19 @@ class e_form
|
|||||||
$options = $this->format_options('option', '', $options);
|
$options = $this->format_options('option', '', $options);
|
||||||
return "<option value='{$value}'".$this->get_attributes($options).">{$option_name}</option>";
|
return "<option value='{$value}'".$this->get_attributes($options).">{$option_name}</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function option_multi($option_array, $selected = false, $options = array())
|
||||||
|
{
|
||||||
|
if(is_string($option_array)) parse_str($option_array, $option_array);
|
||||||
|
|
||||||
|
$text = '';
|
||||||
|
foreach ($option_array as $value => $label)
|
||||||
|
{
|
||||||
|
$text .= $this->option($label, $value, $selected == $value, $options)."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
function optgroup_close()
|
function optgroup_close()
|
||||||
{
|
{
|
||||||
@@ -272,9 +295,15 @@ class e_form
|
|||||||
return $this->_tabindex_counter;
|
return $this->_tabindex_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetTabindex()
|
function getCurrent()
|
||||||
{
|
{
|
||||||
$this->_tabindex_counter = 0;
|
if(!$this->_tabindex_enabled) return 0;
|
||||||
|
return $this->_tabindex_counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetTabindex($reset = 0)
|
||||||
|
{
|
||||||
|
$this->_tabindex_counter = $reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_attributes($options, $name = '', $value = '')
|
function get_attributes($options, $name = '', $value = '')
|
||||||
@@ -302,9 +331,13 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'tabindex':
|
case 'tabindex':
|
||||||
if(false === $optval || !$this->_tabindex_enabled) break;
|
if($optval) $ret .= " tabindex='{$optval}'";
|
||||||
$this->_tabindex_counter += 1;
|
elseif(false === $optval || !$this->_tabindex_enabled) break;
|
||||||
$ret .= " tabindex='".($optval ? $optval : $this->_tabindex_counter)."'";
|
else
|
||||||
|
{
|
||||||
|
$this->_tabindex_counter += 1;
|
||||||
|
$ret .= " tabindex='".$this->_tabindex_counter."'";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'readonly':
|
case 'readonly':
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Javascript Helper
|
* Javascript Helper
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_helper.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_helper.php,v $
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
* $Date: 2008-12-10 16:59:19 $
|
* $Date: 2009-01-17 22:48:14 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +43,6 @@ class e_jshelper
|
|||||||
|
|
||||||
function addResponseAction($action, $data_array)
|
function addResponseAction($action, $data_array)
|
||||||
{
|
{
|
||||||
if(!$action) $action = 'auto';
|
|
||||||
if(!isset($this->_response_actions[$action]))
|
if(!isset($this->_response_actions[$action]))
|
||||||
{
|
{
|
||||||
$this->_response_actions[$action] = array();
|
$this->_response_actions[$action] = array();
|
||||||
@@ -52,6 +51,30 @@ class e_jshelper
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addResponseItem($action, $subaction, $data)
|
||||||
|
{
|
||||||
|
if(!isset($this->_response_actions[$action]))
|
||||||
|
{
|
||||||
|
$this->_response_actions[$action] = array();
|
||||||
|
}
|
||||||
|
if(!isset($this->_response_actions[$action][$subaction]))
|
||||||
|
{
|
||||||
|
$this->_response_actions[$action][$subaction] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_array($data))
|
||||||
|
{
|
||||||
|
$this->_response_actions[$action][$subaction] = array_merge($this->_response_actions[$action][$subaction], $data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->_response_actions[$action][$subaction][] = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response array getter
|
* Response array getter
|
||||||
@@ -89,11 +112,27 @@ class e_jshelper
|
|||||||
//associative arrays only - no numeric keys!
|
//associative arrays only - no numeric keys!
|
||||||
//to speed this up use $sql->db_Fetch(MYSQL_ASSOC);
|
//to speed this up use $sql->db_Fetch(MYSQL_ASSOC);
|
||||||
//when passing large data from the DB
|
//when passing large data from the DB
|
||||||
if (is_numeric($field))
|
if (is_numeric($field) || empty($field)) continue;
|
||||||
continue;
|
|
||||||
$transport_value = $value;
|
switch (gettype($value)) {
|
||||||
if(!is_numeric($value) && !is_bool($value)) { $transport_value = "<![CDATA[{$value}]]>"; }
|
case 'array':
|
||||||
$ret .= "\t\t<item type='".gettype($value)."' name='{$field}'>{$transport_value}</item>\n";
|
foreach ($value as $v)
|
||||||
|
{
|
||||||
|
if(is_string($v)) { $v = "<![CDATA[{$v}]]>"; }
|
||||||
|
$ret .= "\t\t<item type='".gettype($v)."' name='{$field}'>{$v}</item>\n";;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'string':
|
||||||
|
$value = "<![CDATA[{$value}]]>";
|
||||||
|
$ret .= "\t\t<item type='".gettype($value)."' name='{$field}'>{$value}</item>\n";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'boolean':
|
||||||
|
case 'numeric':
|
||||||
|
$ret .= "\t\t<item type='".gettype($value)."' name='{$field}'>{$value}</item>\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$ret .= "\t</e107action>\n";
|
$ret .= "\t</e107action>\n";
|
||||||
}
|
}
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
| e107 website system - Language File.
|
| e107 website system - Language File.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_newspost.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_newspost.php,v $
|
||||||
| $Revision: 1.7 $
|
| $Revision: 1.8 $
|
||||||
| $Date: 2009-01-17 01:30:35 $
|
| $Date: 2009-01-17 22:48:14 $
|
||||||
| $Author: secretr $
|
| $Author: secretr $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +55,7 @@ define("NWSLAN_43", "No news items");
|
|||||||
define("NWSLAN_44", "News Front Page");
|
define("NWSLAN_44", "News Front Page");
|
||||||
define("NWSLAN_45", "Create News Item");
|
define("NWSLAN_45", "Create News Item");
|
||||||
define("NWSLAN_46", "Categories");
|
define("NWSLAN_46", "Categories");
|
||||||
|
define("NWSLAN_46a", "News - Categories");
|
||||||
define("NWSLAN_47", "Submitted News");
|
define("NWSLAN_47", "Submitted News");
|
||||||
define("NWSLAN_48", "News Options");
|
define("NWSLAN_48", "News Options");
|
||||||
define("NWSLAN_49", "Submitted by");
|
define("NWSLAN_49", "Submitted by");
|
||||||
@@ -99,7 +100,7 @@ define("NWSLAN_89", "Save News Preferences");
|
|||||||
define("NWSLAN_90", "News Preferences");
|
define("NWSLAN_90", "News Preferences");
|
||||||
define("NWSLAN_100", "Enable Image uploading on Submit News page");
|
define("NWSLAN_100", "Enable Image uploading on Submit News page");
|
||||||
define("NWSLAN_101", "Automatic resizing of submitted image");
|
define("NWSLAN_101", "Automatic resizing of submitted image");
|
||||||
define("NWSLAN_102", "width in pixels<br /> or leave blank to disable.");
|
define("NWSLAN_102", "width in pixels or leave blank to disable.");
|
||||||
define("NWSLAN_103", "re-post");
|
define("NWSLAN_103", "re-post");
|
||||||
define("NWSLAN_104", "by");
|
define("NWSLAN_104", "by");
|
||||||
define("NWSLAN_105", "Check box to update date stamp of news item to current time");
|
define("NWSLAN_105", "Check box to update date stamp of news item to current time");
|
||||||
@@ -115,11 +116,12 @@ define("NWSLAN_114", "if the theme you're using has a news layout template, use
|
|||||||
|
|
||||||
define("NWSLAN_115", "News posts to display in archive ?");
|
define("NWSLAN_115", "News posts to display in archive ?");
|
||||||
define("NWSLAN_116", "First update the preferences with the changed display per page setting, then update again after setting the news archive preference. (0 is un-activated)");
|
define("NWSLAN_116", "First update the preferences with the changed display per page setting, then update again after setting the news archive preference. (0 is un-activated)");
|
||||||
define("NWSLAN_117", "set the title for the news archive");
|
define("NWSLAN_117", "Set the title for the news archive");
|
||||||
// define("NWSLAN_118", "View Images"); already defined above.
|
// define("NWSLAN_118", "View Images"); already defined above.
|
||||||
define("NWSLAN_119", "Settings Saved");
|
define("NWSLAN_119", "Settings Saved");
|
||||||
define("NWSLAN_120", "Text to show at the top of Submit News");
|
define("NWSLAN_120", "Text to show at the top of Submit News");
|
||||||
define("NWSLAN_121", "Nothing found for %s");
|
define("NWSLAN_121", "Nothing found for %s");
|
||||||
|
define("NWSLAN_122", "Icon");
|
||||||
|
|
||||||
define("LAN_NEWS_5", "Error! - Was unable to update news item into database!");
|
define("LAN_NEWS_5", "Error! - Was unable to update news item into database!");
|
||||||
define("LAN_NEWS_6", "News entered into database.");
|
define("LAN_NEWS_6", "News entered into database.");
|
||||||
|
Reference in New Issue
Block a user