1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

Issue #90 - Welcome messages (also GUI styling and #6)

This commit is contained in:
Tijn Kuyper
2013-02-07 21:19:15 +01:00
parent cc8eefd5ff
commit 4fc76feb1a
2 changed files with 60 additions and 28 deletions

View File

@@ -25,14 +25,15 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'wmessage'; $e_sub_cat = 'wmessage';
require_once("auth.php"); require_once("auth.php");
require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'form_handler.php');
require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER.'userclass_class.php');
require_once(e_HANDLER."ren_help.php"); require_once(e_HANDLER."ren_help.php");
require_once(e_HANDLER.'message_handler.php');
$rs = new form; $rs = new form;
$frm = new e_form; $frm = e107::getForm();
$mes = e107::getMessage();
vartrue($action) == ''; vartrue($action) == '';
if (e_QUERY) if (e_QUERY)
@@ -55,7 +56,15 @@ if (isset($_POST['wm_update']))
$wm_title = $tp->toDB($_POST['wm_caption']); $wm_title = $tp->toDB($_POST['wm_caption']);
$wmId = intval($_POST['wm_id']); $wmId = intval($_POST['wm_id']);
welcome_adminlog('02', $wmId, $wm_title); welcome_adminlog('02', $wmId, $wm_title);
$message = ($sql->db_Update("generic", "gen_chardata ='{$data}',gen_ip ='{$wm_title}', gen_intdata='".$_POST['wm_active']."' WHERE gen_id=".$wmId." ")) ? LAN_UPDATED : LAN_UPDATED_FAILED; //$message = ($sql->db_Update("generic", "gen_chardata ='{$data}',gen_ip ='{$wm_title}', gen_intdata='".$_POST['wm_active']."' WHERE gen_id=".$wmId." ")) ? LAN_UPDATED : LAN_UPDATED_FAILED;
if ($sql->db_Update("generic", "gen_chardata ='{$data}',gen_ip ='{$wm_title}', gen_intdata='".$_POST['wm_active']."' WHERE gen_id=".$wmId." "))
{
$mes->addSuccess(LAN_UPDATED);
}
else
{
$mes->addError(LAN_UPDATED_FAILED); // TODO ? $sql show error?
}
} }
if (isset($_POST['wm_insert'])) if (isset($_POST['wm_insert']))
@@ -63,7 +72,15 @@ if (isset($_POST['wm_insert']))
$wmtext = $tp->toDB($_POST['data']); $wmtext = $tp->toDB($_POST['data']);
$wmtitle = $tp->toDB($_POST['wm_caption']); $wmtitle = $tp->toDB($_POST['wm_caption']);
welcome_adminlog('01', 0, $wmtitle); welcome_adminlog('01', 0, $wmtitle);
$message = ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) ? LAN_CREATED : LAN_CREATED_FAILED ; //$message = ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) ? LAN_CREATED : LAN_CREATED_FAILED ;
if ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' "))
{
$mes->addSuccess(LAN_CREATED);
}
else
{
$mes->addError(LAN_CREATED_FAILED); // TODO ? $sql show error?
}
} }
if (isset($_POST['updateoptions'])) if (isset($_POST['updateoptions']))
@@ -82,7 +99,10 @@ if (isset($_POST['updateoptions']))
{ {
save_prefs(); save_prefs();
welcome_adminlog('04', 0, $pref['wm_enclose'].', '.$pref['wmessage_sc']); welcome_adminlog('04', 0, $pref['wm_enclose'].', '.$pref['wmessage_sc']);
$message = LAN_SETSAVED; }
else
{
$mes->addInfo(LAN_NOCHANGE_NOTSAVED);
} }
} }
@@ -90,13 +110,25 @@ if (isset($_POST['main_delete']))
{ {
$del_id = array_keys($_POST['main_delete']); $del_id = array_keys($_POST['main_delete']);
welcome_adminlog('03', $wmId, ''); welcome_adminlog('03', $wmId, '');
$message = ($sql->db_Delete("generic", "gen_id='".$del_id[0]."' ")) ? LAN_DELETED : LAN_DELETED_FAILED ; //$message = ($sql->db_Delete("generic", "gen_id='".$del_id[0]."' ")) ? LAN_DELETED : LAN_DELETED_FAILED ;
if ($sql->db_Delete("generic", "gen_id='".$del_id[0]."' "))
{
$mes->addSuccess(LAN_DELETED);
}
else
{
$mes->addError(LAN_DELETED_FAILED); // TODO ? $sql show error?
}
} }
/*
if (isset($message)) if (isset($message))
{ {
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
} }
*/
$ns->tablerender($caption, $mes->render() . $text);
// Show Existing ------- // Show Existing -------
if ($action == "main" || $action == "") if ($action == "main" || $action == "")
@@ -105,19 +137,19 @@ if ($action == "main" || $action == "")
{ {
$wmList = $sql->db_getList(); $wmList = $sql->db_getList();
$text = $rs->form_open('post', e_SELF, 'myform_wmessage', '', ''); $text = $rs->form_open('post', e_SELF, 'myform_wmessage', '', '');
$text .= "<div style='text-align:center'> $text .= "
<table class='table adminlist'> <table class='table adminlist'>
<colgroup> <colgroup>
<col style='width:5%' /> <col style='width:5%' />
<col style='width:60%' /> <col style='width:70%' />
<col style='width:20%' /> <col style='width:10%' />
<col style='width:10%' /> <col style='width:10%' />
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th>ID</th> <th>".LAN_ID."</th>
<th>".WMLAN_02."</th> <th>".WMLAN_02."</th>
<th class='center'>".WMLAN_03."</th> <th class='center'>".LAN_VISIBILITY."</th>
<th class='center'>".LAN_OPTIONS."</th> <th class='center'>".LAN_OPTIONS."</th>
</tr> </tr>
</thead> </thead>
@@ -137,12 +169,13 @@ if ($action == "main" || $action == "")
</tr>"; </tr>";
} }
$text .= "</tbody></table></div>"; $text .= "</tbody></table>";
$text .= $rs->form_close(); $text .= $rs->form_close();
} else { } else {
$text .= "<div style='text-align:center'>".WMLAN_09."</div>"; //$text .= "<div style='text-align:center'>".WMLAN_09."</div>";
$mes->addInfo(WMLAN_09);
} }
$ns->tablerender(WMLAN_00, $text); $ns->tablerender(WMLAN_00, $mes->render() . $text);
} }
// Create and Edit // Create and Edit
@@ -156,7 +189,6 @@ if ($action == "create" || $action == "edit")
} }
$text = " $text = "
<div style='text-align:center'>
<form method='post' action='".e_SELF."' id='wmform'> <form method='post' action='".e_SELF."' id='wmform'>
<fieldset id='code-wmessage-create'> <fieldset id='code-wmessage-create'>
<table class='table adminform'> <table class='table adminform'>
@@ -186,7 +218,7 @@ if ($action == "create" || $action == "edit")
$text .= " $text .= "
</td> </td>
</tr> </tr>
<tr><td>".WMLAN_03."</td> <tr><td>".LAN_VISIBILITY."</td>
<td>".r_userclass("wm_active", vartrue($row['gen_intdata']), "off", "public,guest,nobody,member,admin,classes")."</td></tr> <td>".r_userclass("wm_active", vartrue($row['gen_intdata']), "off", "public,guest,nobody,member,admin,classes")."</td></tr>
</table>"; </table>";
@@ -199,21 +231,23 @@ if ($action == "create" || $action == "edit")
} }
else else
{ {
$text .= $frm->admin_button('wm_insert', LAN_CREATE); $text .= $frm->admin_button('wm_insert', LAN_CREATE, 'create');
} }
$text .= "<input type='hidden' name='wm_id' value='".$id."' />"; $text .= "<input type='hidden' name='wm_id' value='".$id."' />";
$text .= "</div> $text .= "</div>
</fieldset> </fieldset>
</form> </form>
</div>"; ";
$ns->tablerender(WMLAN_01, $text); $ns->tablerender(WMLAN_01, $mes->render() . $text);
} }
if ($action == "opt") { if ($action == "opt") {
global $pref, $ns; $pref = e107::getPref();
$text = "<div style='text-align:center'> $ns = e107::getRender();
$text = "
<form method='post' action='".e_SELF."?".e_QUERY."'>\n <form method='post' action='".e_SELF."?".e_QUERY."'>\n
<fieldset id='code-wmessage-options'> <fieldset id='code-wmessage-options'>
<table class='table adminform'> <table class='table adminform'>
@@ -240,16 +274,14 @@ if ($action == "opt") {
</tr> </tr>
</table> </table>
<div class='buttons-bar center'>"; <div class='buttons-bar center'>
".$text .= $frm->admin_button('updateoptions', LAN_SAVE)."
$text .= $frm->admin_button('updateoptions', LAN_SAVE);
$text .= "
</div> </div>
</fieldset> </fieldset>
</form> </form>
</div>"; ";
$ns->tablerender(WMLAN_00.": ".LAN_PREFS, $text); $ns->tablerender(WMLAN_00.": ".LAN_PREFS, $mes->render() . $text);
} }

View File

@@ -20,7 +20,7 @@
define("WMLAN_00","Welcome Messages"); define("WMLAN_00","Welcome Messages");
define("WMLAN_01","Create New Message"); define("WMLAN_01","Create New Message");
define("WMLAN_02","Message"); define("WMLAN_02","Message");
define("WMLAN_03","Visibility"); //define("WMLAN_03","Visibility");
define("WMLAN_04","Message Text"); define("WMLAN_04","Message Text");
define("WMLAN_05","Enclose"); define("WMLAN_05","Enclose");