From 734b8d969c88695990aefecf0cd43d6e0bc2606d Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 10 Dec 2012 16:01:44 -0800 Subject: [PATCH] Admin Preferences GUI Improvements and addition of basic mail prefs. --- e107_admin/prefs.php | 256 +++++++++++++++++++++++--- e107_handlers/form_handler.php | 5 +- e107_handlers/mailout_admin_class.php | 1 + e107_handlers/sitelinks_class.php | 14 ++ e107_themes/bootstrap/admin_style.css | 7 + 5 files changed, 259 insertions(+), 24 deletions(-) diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 2040c5415..908a8e6aa 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -29,6 +29,7 @@ if(! getperms("1")) include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); $e_sub_cat = 'prefs'; +e107::lan('core','mailout','admin'); //FIXME temporary fix - need universal solution. e107::js('inline'," @@ -52,11 +53,34 @@ $(document).ready(function() { $('#core-prefs-main').show(); } + + }); ","jquery"); +e107::js('inline'," + function disp(type) + { + if(type == 'smtp') + { + $('#smtp').show('slow'); + $('#sendmail').hide('slow'); + return; + } + + if(type =='sendmail') + { + $('#smtp').hide('slow'); + $('#sendmail').show('slow'); + return; + } + + $('#smtp').hide('slow'); + $('#sendmail').hide('slow'); + } +",'jquery'); require_once (e_ADMIN."auth.php"); @@ -85,6 +109,17 @@ if(isset($_POST['submit_resetdisplaynames'])) //echo '
';
 //var_dump($core_pref->getPref());
 //echo '
'; + +if (isset($_POST['testemail'])) +{ + sendTest(); +} + + + + + + /* UPDATE PREFERENCES */ if(isset($_POST['updateprefs'])) { @@ -200,6 +235,37 @@ if (plugInstalled('alt_auth')) } } + + +function sendTest() +{ + $log = e107::getAdminLog(); + $mes = e107::getMessage(); + + if(trim($_POST['testaddress']) == '') + { + $mes->add(LAN_MAILOUT_19, E_MESSAGE_ERROR); + $subAction = 'error'; + } + else + { + $mailheader_e107id = USERID; + require_once(e_HANDLER.'mail.php'); + $add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).")" : ' (PHP)'; + $sendto = trim($_POST['testaddress']); + if (!sendemail($sendto, LAN_MAILOUT_113." ".SITENAME.$add, LAN_MAILOUT_114,LAN_MAILOUT_189)) + { + $mes->add(($pref['mailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106, E_MESSAGE_ERROR); + } + else + { + $mes->add(LAN_MAILOUT_81. ' ('.$sendto.')', E_MESSAGE_SUCCESS); + $log->log_event('MAIL_01',$sendto,E_LOG_INFORMATIVE,''); + } + } + +} + /* if(isset($message)) { @@ -260,7 +326,7 @@ $text = " ".PRFLAN_4." "; - +/* $parms = "name=sitebutton"; $parms .= "&path=".e_THEME.$pref['sitetheme']."/images/|".e_IMAGE; $parms .= "&filter=0"; @@ -281,17 +347,16 @@ $text .= "
".$tp->parseTemplate("{IMAGESELECTOR={$parm $text .= "
".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."
"; $sLogo = siteinfo_shortcodes::sc_logo(); +*/ -//echo $sLogo; -// $frm->imagepicker('sitelogo',$pref['sitelogo'],'_common') - +$text .= $frm->imagepicker('sitebutton',$pref['sitebutton'],'_common','help=Used by Facebook and others. Should be a square image.'); $text .= " ".PRFLAN_214." - ".$frm->imagepicker('sitelogo',$pref['sitelogo'],'_common')." + ".$frm->imagepicker('sitelogo',$pref['sitelogo'],'_common','help=Used by some themes as the header image on some pages.')." ".PRFLAN_5." @@ -305,12 +370,36 @@ $text .= " ".$frm->textarea('sitedescription', $pref['sitedescription'], 6, 59)." + - ".PRFLAN_7." + ".PRFLAN_9." - ".$frm->text('siteadmin', SITEADMIN, 100)." + ".$frm->textarea('sitedisclaimer', str_replace(array('<', '>', '"'), array('<', '>', '"'), $pref['sitedisclaimer']), 6, 59)." + + + ".pref_submit('main')." + +"; + + +// Email and Contact Information -------------- + +$text .= "
+ ".PRFLAN_13." + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - +
".PRFLAN_7." + ".$frm->text('siteadmin', SITEADMIN, 100)." +
".PRFLAN_8." @@ -331,6 +420,128 @@ $text .= "
".PRFLAN_177."
".LAN_MAILOUT_110."
".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."  + +
".LAN_MAILOUT_115."
+ ".LAN_MAILOUT_116."
"; + + + + // SMTP. --------------> + $smtp_opts = explode(',',varset($pref['smtp_options'],'')); + $smtpdisp = ($pref['mailer'] != 'smtp') ? "style='display:none;'" : ''; + $text .= "
+ + + + + + "; + $text .= " + + + + + + + + + + + + + + + + + "; + + $text .= " + + "; + + $checked = (in_array('useVERP',$smtp_opts) ? "checked='checked'" : ""); + $text .= " + + +
".LAN_MAILOUT_87.":   + +
".LAN_MAILOUT_88.": (".LAN_OPTIONAL.")   + +
".LAN_MAILOUT_89.": (".LAN_OPTIONAL.")   + +
".LAN_MAILOUT_90." + ".LAN_MAILOUT_94."
".LAN_MAILOUT_57." + "; + $checked = (varsettrue($pref['smtp_keepalive']) ) ? "checked='checked'" : ''; + $text .= " +
".LAN_MAILOUT_95." + +
"; + + /* FIXME - posting SENDMAIL path triggers Mod-Security rules. + // Sendmail. --------------> + $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; + $text .= "
"; + $text .= " + + + + + +
".LAN_MAILOUT_20.":   + +
"; + */ + + $text .= "
+ Not available in this release +
"; + + + $text .="
".LAN_MAILOUT_222.""; + + $emFormat = array( + 'textonly' => LAN_MAILOUT_125, + 'texthtml' => LAN_MAILOUT_126, + 'texttheme' => LAN_MAILOUT_127 + ); + $text .= $frm->selectbox('mail_sendstyle', $emFormat,$pref['mail_sendstyle']); // $mailAdmin->sendStyleSelect(varset($pref['mail_sendstyle'], 'textonly'), 'mail_sendstyle'); + $text .= "".LAN_MAILOUT_223." +
".PRFLAN_162." @@ -355,17 +566,11 @@ $text .= "
".PRFLAN_165."
".PRFLAN_9." - ".$frm->textarea('sitedisclaimer', str_replace(array('<', '>', '"'), array('<', '>', '"'), $pref['sitedisclaimer']), 6, 59)." -
- ".pref_submit('main')." -
-"; + ".pref_submit('email')." + "; + $text .= "
@@ -1676,19 +1881,24 @@ function pref_submit($post_id = '') function prefs_adminmenu() { $var['core-prefs-main']['text'] = PRFLAN_1; - $var['core-prefs-display']['text'] = PRFLAN_13; - $var['core-prefs-admindisp']['text'] = PRFLAN_77; - $var['core-prefs-date']['text'] = PRFLAN_21; + $var['core-prefs-email']['text'] = "Email & Contact Info."; $var['core-prefs-registration']['text'] = PRFLAN_28; $var['core-prefs-signup']['text'] = PRFLAN_19; $var['core-prefs-sociallogin']['text'] = "Social Logins"; - $var['core-prefs-textpost']['text'] = PRFLAN_101; - $var['core-prefs-security']['text'] = PRFLAN_47; + $var['core-prefs-comments']['text'] = PRFLAN_210; $var['core-prefs-uploads']['text'] = "File Uploading"; // TODO LAN + + $var['core-prefs-header1']['header'] = "Advanced Options"; + + $var['core-prefs-display']['text'] = PRFLAN_13; + $var['core-prefs-admindisp']['text'] = PRFLAN_77; + $var['core-prefs-textpost']['text'] = PRFLAN_101; + $var['core-prefs-security']['text'] = PRFLAN_47; + $var['core-prefs-date']['text'] = PRFLAN_21; $var['core-prefs-javascript']['text'] = "Javascript Framework"; // TODO LAN $var['core-prefs-advanced']['text'] = PRFLAN_149; - e107::getNav()->admin(LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var); + e107::getNav()->admin("Basic ".LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var); } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index d2d42e1f2..d50cdeaee 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -477,7 +477,10 @@ class e_form } else { - $ret = "
"; + + $title = (vartrue($sc_parameters['help'])) ? "title='".$sc_parameters['help']."'" : ""; + + $ret = "
"; $att = 'aw=120&ah=100'; $thpath = isset($sc_parameters['nothumb']) || vartrue($hide) ? $default : $tp->thumbUrl($default_thumb, $att, true); $label = "{$default_url}"; diff --git a/e107_handlers/mailout_admin_class.php b/e107_handlers/mailout_admin_class.php index 90f682123..de0def970 100644 --- a/e107_handlers/mailout_admin_class.php +++ b/e107_handlers/mailout_admin_class.php @@ -728,6 +728,7 @@ class mailoutAdminClass extends e107MailManager * @param $name name of item * @return text for display */ + //FIXME use $frm->selectbox() instead. public function sendStyleSelect($curval = '', $name = 'send_style') { diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 7f12dabbe..69edad297 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -975,6 +975,20 @@ class e_navigation continue; } + if (isset($e107_vars[$act]['header'])) + { + $text .= ""; //TODO add to Template. + continue; + } + + if (isset($e107_vars[$act]['divider'])) + { + $text .= "
  • "; //TODO add to Template. + continue; + } + + + // check class so that e.g. e_UC_NOBODY will result no permissions granted (even for main admin) if (isset($e107_vars[$act]['userclass']) && !e107::getUser()->checkClass($e107_vars[$act]['userclass'], false)) // check userclass perms { diff --git a/e107_themes/bootstrap/admin_style.css b/e107_themes/bootstrap/admin_style.css index 4131a583f..635abe124 100644 --- a/e107_themes/bootstrap/admin_style.css +++ b/e107_themes/bootstrap/admin_style.css @@ -105,6 +105,13 @@ legend { display:none } .btn { vertical-align: top; } + +input::-webkit-input-placeholder { font-style:italic } + +input:-moz-placeholder { font-style:italic }​ + + + input[type='radio'] { vertical-align:top; } label { margin-left:5px; margin-right:10px; display: inline; vertical-align:bottom; }