From 2f2137fca405bba4977e8523776b46c3cfe64f7c Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Thu, 12 May 2011 12:11:47 +0100 Subject: [PATCH] MDL-27171 messages: admin settings reordering This includes: * most email settings go from general admin setings to email plugin settings * digestmailtime goes to mod/forum/settings.php * supportname, supportemail and supportpage go to Support contact page * all jabber settings go from general admin setings to jabber plugin settings AMOS BEGIN MOV [jabberhost,admin],[jabberhost,message_jabber] MOV [configjabberhost,admin],[configjabberhost,message_jabber] MOV [jabberserver,admin],[jabberserver,message_jabber] MOV [configjabberserver,admin],[configjabberserver,message_jabber] MOV [jabberusername,admin],[jabberusername,message_jabber] MOV [configjabberusername,admin],[configjabberusername,message_jabber] MOV [jabberpassword,admin],[jabberpassword,message_jabber] MOV [configjabberpassword,admin],[configjabberpassword,message_jabber] MOV [jabberport,admin],[jabberport,message_jabber] MOV [configjabberport,admin],[configjabberport,message_jabber] MOV [digestmailtime,admin],[digestmailtime,forum] MOV [configdigestmailtime,admin],[configdigestmailtime,forum] MOV [allowusermailcharset,admin],[allowusermailcharset,message_email] MOV [configallowusermailcharset,admin],[configallowusermailcharset,message_email] MOV [mailnewline,admin],[mailnewline,message_email] MOV [configmailnewline,admin],[configmailnewline,message_email] MOV [noreplyaddress,admin],[noreplyaddress,message_email] MOV [confignoreplyaddress,admin],[confignoreplyaddress,message_email] MOV [sitemailcharset,admin],[sitemailcharset,message_email] MOV [configsitemailcharset,admin],[configsitemailcharset,message_email] MOV [smtphosts,admin],[smtphosts,message_email] MOV [configsmtphosts,admin],[configsmtphosts,message_email] MOV [smtpmaxbulk,admin],[smtpmaxbulk,message_email] MOV [configsmtpmaxbulk,admin],[configsmtpmaxbulk,message_email] MOV [smtpuser,admin],[smtpuser,message_email] MOV [configsmtpuser,admin],[configsmtpuser,message_email] MOV [smtppass,admin],[smtppass,message_email] AMOS END Signed-off-by: Ruslan Kabalin --- admin/message.php | 14 +++++ admin/settings/plugins.php | 17 +++++- admin/settings/server.php | 53 +------------------ lang/en/admin.php | 30 +---------- lib/adminlib.php | 15 +++--- .../output/email/lang/en/message_email.php | 17 +++++- message/output/email/settings.php | 44 +++++++++++++++ .../output/jabber/lang/en/message_jabber.php | 12 ++++- message/output/jabber/settings.php | 34 ++++++++++++ message/renderer.php | 27 +++++++--- mod/forum/lang/en/forum.php | 2 + mod/forum/settings.php | 4 ++ 12 files changed, 173 insertions(+), 96 deletions(-) create mode 100644 message/output/email/settings.php create mode 100644 message/output/jabber/settings.php diff --git a/admin/message.php b/admin/message.php index 4eccb33d917..bde17d2364b 100644 --- a/admin/message.php +++ b/admin/message.php @@ -1,4 +1,18 @@ . /** * Message outputs configuration page diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 525d45f4ab8..d68b6771875 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -49,7 +49,22 @@ if ($hassiteconfig) { // message outputs $ADMIN->add('modules', new admin_category('messageoutputs', get_string('messageoutputs', 'message'))); $ADMIN->add('messageoutputs', new admin_page_managemessageoutputs()); - + require_once($CFG->dirroot.'/message/lib.php'); + $processors = get_message_processors(); + foreach ($processors as $processor) { + $processorname = $processor->name; + if (!$processor->available) { + continue; + } + $strprocessorname = get_string('pluginname', 'message_'.$processorname); + if (file_exists($CFG->dirroot.'/message/output/'.$processor->name.'/settings.php')) { + $settings = new admin_settingpage('messagesetting'.$processorname, $strprocessorname, 'moodle/site:config', !$processor->enabled); + include($CFG->dirroot.'/message/output/'.$processor->name.'/settings.php'); + if ($settings) { + $ADMIN->add('messageoutputs', $settings); + } + } + } // authentication plugins $ADMIN->add('modules', new admin_category('authsettings', get_string('authentication', 'admin'))); diff --git a/admin/settings/server.php b/admin/settings/server.php index 7334fec0529..049663df3e0 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -17,46 +17,8 @@ $ADMIN->add('server', $temp); -// "email" settingpage -$temp = new admin_settingpage('mail', get_string('mail','admin')); -$temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_RAW)); -$temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '')); -$temp->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'admin'), get_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT)); -$temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_NOTAGS)); -$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00', - '01' => '01', - '02' => '02', - '03' => '03', - '04' => '04', - '05' => '05', - '06' => '06', - '07' => '07', - '08' => '08', - '09' => '09', - '10' => '10', - '11' => '11', - '12' => '12', - '13' => '13', - '14' => '14', - '15' => '15', - '16' => '16', - '17' => '17', - '18' => '18', - '19' => '19', - '20' => '20', - '21' => '21', - '22' => '22', - '23' => '23'))); -$charsets = get_list_of_charsets(); -unset($charsets['UTF-8']); // not needed here -$options = array(); -$options['0'] = 'UTF-8'; -$options = array_merge($options, $charsets); -$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '0', $options)); -$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0)); -$options = array('LF'=>'LF', 'CRLF'=>'CRLF'); -$temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options)); +// "supportcontact" settingpage +$temp = new admin_settingpage('supportcontact', get_string('supportcontact','admin')); if (isloggedin()) { global $USER; $primaryadminemail = $USER->email; @@ -73,17 +35,6 @@ $temp->add(new admin_setting_configtext('supportpage', get_string('supportpage', $ADMIN->add('server', $temp); -// Jabber settingpage -$temp = new admin_settingpage('jabber', get_string('jabber', 'admin')); -$temp->add(new admin_setting_configtext('jabberhost', get_string('jabberhost', 'admin'), get_string('configjabberhost', 'admin'), '', PARAM_RAW)); -$temp->add(new admin_setting_configtext('jabberserver', get_string('jabberserver', 'admin'), get_string('configjabberserver', 'admin'), '', PARAM_RAW)); -$temp->add(new admin_setting_configtext('jabberusername', get_string('jabberusername', 'admin'), get_string('configjabberusername', 'admin'), '', PARAM_RAW)); -$temp->add(new admin_setting_configpasswordunmask('jabberpassword', get_string('jabberpassword', 'admin'), get_string('configjabberpassword', 'admin'), '')); -$temp->add(new admin_setting_configtext('jabberport', get_string('jabberport', 'admin'), get_string('configjabberport', 'admin'), 5222, PARAM_INT)); -$ADMIN->add('server', $temp); - - - // "sessionhandling" settingpage $temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin')); $temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 1)); diff --git a/lang/en/admin.php b/lang/en/admin.php index 09817efec35..420f04f2f4a 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -51,7 +51,6 @@ $string['allowobjectembed'] = 'Allow EMBED and OBJECT tags'; $string['allowrenames'] = 'Allow renames'; $string['allowthemechangeonurl'] = 'Allow theme changes in the URL'; $string['allowuserblockhiding'] = 'Allow users to hide blocks'; -$string['allowusermailcharset'] = 'Allow user to select character set'; $string['allowuserswitchrolestheycantassign'] = 'Allow users without the assign roles capability to switch roles'; $string['allowuserthemes'] = 'Allow user themes'; $string['antivirus'] = 'Anti-Virus'; @@ -133,7 +132,6 @@ $string['configallowoverride2'] = 'Select which role(s) can be overridden by eac $string['configallowswitch'] = 'Select which roles a user may switch to, based on which roles they already have. In addition to an entry in this table, a user must also have the moodle/role:switchroles capability to be able to switch.
Note that it is only possible to switch to roles that have the moodle/course:view capability, and that do not have the moodle/site:doanything capability, so some columns in this table are disabled.'; $string['configallowthemechangeonurl'] = 'If enabled, the theme can be changed by adding theme={themename} to any Moodle URL.'; $string['configallowuserblockhiding'] = 'Do you want to allow users to hide/show side blocks throughout this site? This feature uses Javascript and cookies to remember the state of each collapsible block, and only affects the user\'s own view.'; -$string['configallowusermailcharset'] = 'Enabling this, every user in the site will be able to specify his own charset for email.'; $string['configallowuserswitchrolestheycantassign'] = 'By default, moodle/role:assign is required for users to switch roles. Enabling this setting removes this requirement, and results in the roles available in the "Switch role to" dropdown menu being determined by settings in the "Allow role assignments" table only. It is recommended that the settings in the "Allow role assignments" table do not allow users to switch to a role with more capabilities than their existing role.'; $string['configallowuserthemes'] = 'If you enable this, then users will be allowed to set their own themes. User themes override site themes (but not course themes)'; @@ -187,7 +185,6 @@ $string['configdefaultuserroleid'] = 'All logged in users will be given the capa $string['configdeleteincompleteusers'] = 'After this period, old not fully setup accounts are deleted.'; $string['configdeleteunconfirmed'] = 'If you are using email authentication, this is the period within which a response will be accepted from users. After this period, old unconfirmed accounts are deleted.'; $string['configdenyemailaddresses'] = 'To deny email addresses from particular domains list them here in the same way. All other domains will be accepted. To deny subdomains add the domain with a preceding \'.\'. eg hotmail.com yahoo.co.uk .live.com'; -$string['configdigestmailtime'] = 'People who choose to have emails sent to them in digest form will be emailed the digest daily. This setting controls which time of day the daily mail will be sent (the next cron that runs after this hour will send it).'; $string['configdisableuserimages'] = 'Disable the ability for users to change user profile images.'; $string['configdisplayloginfailures'] = 'This will display information to selected users about previous failed logins.'; $string['configdocroot'] = 'Defines the path to the Moodle Docs. You can change this if you wish to have your own custom online documentation. However, if you do that make sure that the paths in your documentation follow the same format as http://docs.moodle.org.'; @@ -239,11 +236,6 @@ $string['configintroadmin'] = 'On this page you should configure your main admin $string['configintrosite'] = 'This page allows you to configure the front page and name of this new site. You can come back here later to change these settings any time using the Administration menus.'; $string['configintrotimezones'] = 'This page will search for new information about world timezones (including daylight savings time rules) and update your local database with this information. These locations will be checked, in order: {$a} This procedure is generally very safe and can not break normal installations. Do you wish to update your timezones now?'; $string['configiplookup'] = 'When you click on an IP address (such as 34.12.222.93), such as in the logs, you are shown a map with a best guess of where that IP is located. There are different plugins for this that you can choose from, each has benefits and disadvantages.'; -$string['configjabberhost'] = 'The server to connect to to send jabber message notifications'; -$string['configjabberserver'] = 'XMPP host ID (can be left empty if the same as Jabber host)'; -$string['configjabberusername'] = 'The user name to use when connecting to the Jabber server'; -$string['configjabberpassword'] = 'The password to use when connecting to the Jabber server'; -$string['configjabberport'] = 'The port to use when connecting to the Jabber server'; $string['configkeeptagnamecase'] = 'Check this if you want tag names to keep the original casing as entered by users who created them'; $string['configlang'] = 'Choose a default language for the whole site. Users can override this setting using the language menu or the setting in their personal profile.'; $string['configlangstringcache'] = 'Caches all the language strings into compiled files in the data directory. If you are translating Moodle or changing strings in the Moodle source code then you may want to switch this off. Otherwise leave it on to see performance benefits.'; @@ -255,7 +247,6 @@ $string['configlocale'] = 'Choose a sitewide locale - this will override the for $string['configloginhttps'] = 'Turning this on will make Moodle use a secure https connection just for the login page (providing a secure login), and then afterwards revert back to the normal http URL for general speed. CAUTION: this setting REQUIRES https to be specifically enabled on the web server - if it is not then YOU COULD LOCK YOURSELF OUT OF YOUR SITE.'; $string['configloglifetime'] = 'This specifies the length of time you want to keep logs about user activity. Logs that are older than this age are automatically deleted. It is best to keep logs as long as possible, in case you need them, but if you have a very busy server and are experiencing performance problems, then you may want to lower the log lifetime. Values lower than 30 are not recommended because statistics may not work properly.'; $string['configlookahead'] = 'Days to look ahead'; -$string['configmailnewline'] = 'Newline characters used in mail messages. CRLF is required according to RFC 822bis, some mail servers do automatic conversion from LF to CRLF, other mail servers do incorrect conversion from CRLF to CRCRLF, yet others reject mails with bare LF (qmail for example). Try changing this setting if you are having problems with undelivered emails or double newlines.'; $string['configmaxbytes'] = 'This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP settings post_max_size and upload_max_filesize, as well as the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level. If \'Server Limit\' is chosen, the server maximum allowed by the server will be used.'; $string['configmaxconsecutiveidentchars'] = 'Passwords must not have more than this number of consecutive identical characters. Use 0 to disable this check.'; $string['configmaxeditingtime'] = 'This specifies the amount of time people have to re-edit forum postings, glossary comments etc. Usually 30 minutes is a good value.'; @@ -276,7 +267,6 @@ $string['configmypagelocked'] = 'This setting prevents the default page from bei $string['confignavcourselimit'] = 'Limits the number of courses shown to the user when they are either not logged in or are not enrolled in any courses.'; $string['confignavshowallcourses'] = 'Setting this ensures that all courses on the site are shown in the navigation at all times.'; $string['confignavshowcategories'] = 'Show course categories in the navigation bar and navigation blocks. This does not occur with courses the user is currently enrolled in, they will still be listed under mycourses without categories.'; -$string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the "From" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).'; $string['confignotifyloginfailures'] = 'If login failures have been recorded, email notifications can be sent out. Who should see these notifications?'; $string['confignotifyloginthreshold'] = 'If notifications about failed logins are active, how many failed login attempts by one user or one IP address is it worth notifying about?'; $string['confignotloggedinroleid'] = 'Users who are not logged in to the site will be treated as if they have this role granted to them at the site context. Guest is almost always what you want here, but you might want to create roles that are less or more restrictive. Things like creating posts still require the user to log in properly.'; @@ -329,14 +319,10 @@ $string['configshowcommentscount'] = 'Show comments count, it will cost one more $string['configshowsiteparticipantslist'] = 'All of these site students and site teachers will be listed on the site participants list. Who shall be allowed to see this site participants list?'; $string['configsitedefaultlicense'] = 'Default site licence'; $string['configsitedefaultlicensehelp'] = 'The default licence for publishing content on this site'; -$string['configsitemailcharset'] = 'All the emails generated by your site will be sent in the charset specified here. Anyway, every individual user will be able to adjust it if the next setting is enabled.'; $string['configsitemaxcategorydepth'] = 'Maximum category depth'; $string['configsitemaxcategorydepthhelp'] = 'This specifies the maximum depth of child categories shown'; $string['configslasharguments'] = 'Files (images, uploads etc) are provided via a script using \'slash arguments\'. This method allows files to be more easily cached in web browsers, proxy servers etc. Unfortunately, some PHP servers don\'t allow this method, so if you have trouble viewing uploaded files or images (eg user pictures), disable this setting.'; $string['configsmartpix'] = 'With this on, icons are served through a PHP script that searches the current theme, then all parent themes, then the Moodle /pix folder. This reduces the need to duplicate image files within themes, but has a slight performance cost.'; -$string['configsmtphosts'] = 'Give the full name of one or more local SMTP servers that Moodle should use to send mail (eg \'mail.a.com\' or \'mail.a.com;mail.b.com\'). To specify a non-default port (i.e other than port 25), you can use the [server]:[port] syntax (eg \'mail.a.com:587\'. If you leave it blank, Moodle will use the PHP default method of sending mail.'; -$string['configsmtpmaxbulk'] = 'Maximum number of messages sent per SMTP session. Grouping messages may speed up the sending of emails. Values lower than 2 force creation of new SMTP session for each email.'; -$string['configsmtpuser'] = 'If you have specified an SMTP server above, and the server requires authentication, then enter the username and password here.'; $string['configstartwday'] = 'Start of week'; $string['configstatsfirstrun'] = 'This specifies how far back the logs should be processed the first time the cronjob wants to process statistics. If you have a lot of traffic and are on shared hosting, it\'s probably not a good idea to go too far back, as it could take a long time to run and be quite resource intensive. (Note that for this setting, 1 month = 28 days. In the graphs and reports generated, 1 month = 1 calendar month.)'; $string['configstatsmaxruntime'] = 'Stats processing can be quite intensive, so use a combination of this field and the next one to specify when it will run and how long for.'; @@ -450,7 +436,6 @@ $string['deletingqtype'] = 'Deleting question type \'{$a}\''; $string['density'] = 'Density'; $string['denyemailaddresses'] = 'Denied email domains'; $string['development'] = 'Development'; -$string['digestmailtime'] = 'Hour to send digest emails'; $string['disableuserimages'] = 'Disable user profile images'; $string['displayerrorswarning'] = 'Enabling the PHP setting display_errors is not recommended on production sites because some error messages may reveal sensitive information about your server.'; $string['displayloginfailures'] = 'Display login failures to'; @@ -623,12 +608,6 @@ It is recommended to install local copy of free GeoLite City database from MaxMi IP address location is displayed on simple map or using Google Maps. Please note that you need to have a Google account and apply for free Google Maps API key to enable interactive maps.'; $string['iplookupmaxmindnote'] = 'This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.'; $string['iplookupnetgeonote'] = 'The NetGeo server is currently being used to look up geographical information. For more accurate results we recommend installing a local copy of the MaxMind GeoLite database.'; -$string['jabber'] = 'Jabber'; -$string['jabberhost'] = 'Jabber host'; -$string['jabberserver'] = 'Jabber server'; -$string['jabberusername'] = 'Jabber user name'; -$string['jabberpassword'] = 'Jabber password'; -$string['jabberport'] = 'Jabber port'; $string['keeptagnamecase'] = 'Keep tag name casing'; $string['lang'] = 'Default language'; $string['langcache'] = 'Cache language menu'; @@ -674,8 +653,6 @@ $string['logguests_help'] = 'This setting enables logging of actions by guest ac $string['loginhttps'] = 'Use HTTPS for logins'; $string['loglifetime'] = 'Keep logs for'; $string['longtimewarning'] = 'Please note that this process can take a long time.'; -$string['mail'] = 'Email'; -$string['mailnewline'] = 'Newline characters in mail'; $string['maintenancemode'] = 'In maintenance mode'; $string['maintfileopenerror'] = 'Error opening maintenance files!'; $string['maintinprogress'] = 'Maintenance is in progress...'; @@ -756,7 +733,6 @@ $string['nolangupdateneeded'] = 'All your language packs are up to date, no upda $string['nomissingstrings'] = 'No missing strings'; $string['nonewsettings'] = 'No new settings were added during this upgrade.'; $string['nonexistentbookmark'] = 'The bookmark you requested does not exist.'; -$string['noreplyaddress'] = 'No-reply address'; $string['noresults'] = 'No results found.'; $string['noroles'] = 'No roles'; $string['notifications'] = 'Notifications'; @@ -948,7 +924,6 @@ $string['showdetails'] = 'Show details'; $string['simpletest'] = 'Unit tests'; $string['simplexmlrequired'] = 'The SimpleXML PHP extension is now required by Moodle.'; $string['sitelangchanged'] = 'Site language setting changed successfully'; -$string['sitemailcharset'] = 'Character set'; $string['sitemaintenance'] = 'The site is undergoing maintenance and is currently not available'; $string['sitemaintenancemode'] = 'Maintenance mode'; $string['sitemaintenanceoff'] = 'Maintenance mode has been disabled and the site is running normally again'; @@ -963,10 +938,6 @@ $string['sitepolicyguest_help'] = 'If you have a site policy that all guests mus $string['sitesectionhelp'] = 'If selected, a topic section will be displayed on the site\'s front page.'; $string['slasharguments'] = 'Use slash arguments'; $string['smartpix'] = 'Smart pix search'; -$string['smtphosts'] = 'SMTP hosts'; -$string['smtpmaxbulk'] = 'SMTP session limit'; -$string['smtppass'] = 'SMTP password'; -$string['smtpuser'] = 'SMTP username'; $string['soaprecommended'] = 'Installing the optional soap extension is useful for web services and some contrib modules.'; $string['spellengine'] = 'Spell engine'; $string['splrequired'] = 'The SPL PHP extension is now required by Moodle.'; @@ -982,6 +953,7 @@ $string['stickyblocksduplicatenotice'] = 'If any block you add here is already p $string['stickyblocksmymoodle'] = 'My Moodle'; $string['stickyblockspagetype'] = 'Page type to configure'; $string['stripalltitletags'] = 'Remove HTML tags from all activity names'; +$string['supportcontact'] = 'Support contact'; $string['supportemail'] = 'Support email'; $string['supportname'] = 'Support name'; $string['supportpage'] = 'Support page'; diff --git a/lib/adminlib.php b/lib/adminlib.php index c4b888df914..62a91ebbb20 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -4924,7 +4924,7 @@ class admin_page_managemessageoutputs extends admin_externalpage { } /** - * Search for a specific block + * Search for a specific message processor * * @param string $query The string to search for * @return array @@ -4936,18 +4936,19 @@ class admin_page_managemessageoutputs extends admin_externalpage { } $found = false; - if ($blocks = $DB->get_records('block')) { + require_once($CFG->dirroot.'/message/lib.php'); + if ($processors = get_message_processors()) { $textlib = textlib_get_instance(); - foreach ($blocks as $block) { - if (!file_exists("$CFG->dirroot/blocks/$block->name/")) { + foreach ($processors as $processor) { + if (!$processor->available) { continue; } - if (strpos($block->name, $query) !== false) { + if (strpos($processor->name, $query) !== false) { $found = true; break; } - $strblockname = get_string('pluginname', 'block_'.$block->name); - if (strpos($textlib->strtolower($strblockname), $query) !== false) { + $strprocessorname = get_string('pluginname', 'message_'.$processor->name); + if (strpos($textlib->strtolower($strprocessorname), $query) !== false) { $found = true; break; } diff --git a/message/output/email/lang/en/message_email.php b/message/output/email/lang/en/message_email.php index 2cb8fe295fa..ae06d11d976 100644 --- a/message/output/email/lang/en/message_email.php +++ b/message/output/email/lang/en/message_email.php @@ -23,5 +23,20 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['pluginname'] = 'Email'; +$string['allowusermailcharset'] = 'Allow user to select character set'; +$string['configallowusermailcharset'] = 'Enabling this, every user in the site will be able to specify his own charset for email.'; +$string['configmailnewline'] = 'Newline characters used in mail messages. CRLF is required according to RFC 822bis, some mail servers do automatic conversion from LF to CRLF, other mail servers do incorrect conversion from CRLF to CRCRLF, yet others reject mails with bare LF (qmail for example). Try changing this setting if you are having problems with undelivered emails or double newlines.'; +$string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the "From" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).'; +$string['configsitemailcharset'] = 'All the emails generated by your site will be sent in the charset specified here. Anyway, every individual user will be able to adjust it if the next setting is enabled.'; +$string['configsmtphosts'] = 'Give the full name of one or more local SMTP servers that Moodle should use to send mail (eg \'mail.a.com\' or \'mail.a.com;mail.b.com\'). To specify a non-default port (i.e other than port 25), you can use the [server]:[port] syntax (eg \'mail.a.com:587\'. If you leave it blank, Moodle will use the PHP default method of sending mail.'; +$string['configsmtpmaxbulk'] = 'Maximum number of messages sent per SMTP session. Grouping messages may speed up the sending of emails. Values lower than 2 force creation of new SMTP session for each email.'; +$string['configsmtpuser'] = 'If you have specified an SMTP server above, and the server requires authentication, then enter the username and password here.'; $string['email'] = 'Send email notifications to'; +$string['mailnewline'] = 'Newline characters in mail'; +$string['noreplyaddress'] = 'No-reply address'; +$string['pluginname'] = 'Email'; +$string['sitemailcharset'] = 'Character set'; +$string['smtphosts'] = 'SMTP hosts'; +$string['smtpmaxbulk'] = 'SMTP session limit'; +$string['smtppass'] = 'SMTP password'; +$string['smtpuser'] = 'SMTP username'; diff --git a/message/output/email/settings.php b/message/output/email/settings.php new file mode 100644 index 00000000000..7b7e7230769 --- /dev/null +++ b/message/output/email/settings.php @@ -0,0 +1,44 @@ +. + +/** + * Email configuration page + * + * @package message + * @subpackage email + * @copyright 2011 Lancaster University Network Services Limited + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die; + +if ($ADMIN->fulltree) { + $settings->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'message_email'), get_string('configsmtphosts', 'message_email'), '', PARAM_RAW)); + $settings->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'message_email'), get_string('configsmtpuser', 'message_email'), '', PARAM_NOTAGS)); + $settings->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'message_email'), get_string('configsmtpuser', 'message_email'), '')); + $settings->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'message_email'), get_string('configsmtpmaxbulk', 'message_email'), 1, PARAM_INT)); + $settings->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'message_email'), get_string('confignoreplyaddress', 'message_email'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_NOTAGS)); + + $charsets = get_list_of_charsets(); + unset($charsets['UTF-8']); // not needed here + $options = array(); + $options['0'] = 'UTF-8'; + $options = array_merge($options, $charsets); + $settings->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'message_email'), get_string('configsitemailcharset','message_email'), '0', $options)); + $settings->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'message_email'), get_string('configallowusermailcharset', 'message_email'), 0)); + $options = array('LF'=>'LF', 'CRLF'=>'CRLF'); + $settings->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'message_email'), get_string('configmailnewline','message_email'), 'LF', $options)); +} \ No newline at end of file diff --git a/message/output/jabber/lang/en/message_jabber.php b/message/output/jabber/lang/en/message_jabber.php index fee28ef13e4..e38f6999e66 100644 --- a/message/output/jabber/lang/en/message_jabber.php +++ b/message/output/jabber/lang/en/message_jabber.php @@ -23,6 +23,16 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['pluginname'] = 'Jabber message'; +$string['configjabberhost'] = 'The server to connect to to send jabber message notifications'; +$string['configjabberserver'] = 'XMPP host ID (can be left empty if the same as Jabber host)'; +$string['configjabberusername'] = 'The user name to use when connecting to the Jabber server'; +$string['configjabberpassword'] = 'The password to use when connecting to the Jabber server'; +$string['configjabberport'] = 'The port to use when connecting to the Jabber server'; +$string['jabberhost'] = 'Jabber host'; $string['jabberid'] = 'Jabber ID'; +$string['jabberserver'] = 'Jabber server'; +$string['jabberusername'] = 'Jabber user name'; +$string['jabberpassword'] = 'Jabber password'; +$string['jabberport'] = 'Jabber port'; $string['notconfigured'] = 'The Jabber server hasn\'t been configured so Jabber messages cannot be sent'; +$string['pluginname'] = 'Jabber message'; diff --git a/message/output/jabber/settings.php b/message/output/jabber/settings.php new file mode 100644 index 00000000000..3f7428f786f --- /dev/null +++ b/message/output/jabber/settings.php @@ -0,0 +1,34 @@ +. + +/** + * Jabber configuration page + * + * @package message + * @subpackage jabber + * @copyright 2011 Lancaster University Network Services Limited + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die; + +if ($ADMIN->fulltree) { + $settings->add(new admin_setting_configtext('jabberhost', get_string('jabberhost', 'message_jabber'), get_string('configjabberhost', 'message_jabber'), '', PARAM_RAW)); + $settings->add(new admin_setting_configtext('jabberserver', get_string('jabberserver', 'message_jabber'), get_string('configjabberserver', 'message_jabber'), '', PARAM_RAW)); + $settings->add(new admin_setting_configtext('jabberusername', get_string('jabberusername', 'message_jabber'), get_string('configjabberusername', 'message_jabber'), '', PARAM_RAW)); + $settings->add(new admin_setting_configpasswordunmask('jabberpassword', get_string('jabberpassword', 'message_jabber'), get_string('configjabberpassword', 'message_jabber'), '')); + $settings->add(new admin_setting_configtext('jabberport', get_string('jabberport', 'message_jabber'), get_string('configjabberport', 'message_jabber'), 5222, PARAM_INT)); +} \ No newline at end of file diff --git a/message/renderer.php b/message/renderer.php index 4fcf586965a..532f25ef898 100644 --- a/message/renderer.php +++ b/message/renderer.php @@ -1,4 +1,18 @@ . /** * Messaging libraries @@ -28,6 +42,7 @@ class core_message_renderer extends plugin_renderer_base { * @return string The text to render */ public function manage_messageoutputs($processors) { + global $CFG; // Display the current workflows $table = new html_table(); $table->attributes['class'] = 'generaltable'; @@ -45,19 +60,19 @@ class core_message_renderer extends plugin_renderer_base { foreach ( $processors as $processor ){ $row = new html_table_row(); - $row->attributes['class'] = 'workflow'; + $row->attributes['class'] = 'messageoutputs'; // Name $name = new html_table_cell($processor->name); // Enable $enable = new html_table_cell(); + $enable->attributes['class'] = 'mdl-align'; if (!$processor->available) { $enable->text = html_writer::nonempty_tag('span', get_string('outputnotavailable', 'message'), array('class' => 'error')); } else if (!$processor->configured) { $enable->text = html_writer::nonempty_tag('span', get_string('outputnotconfigured', 'message'), array('class' => 'error')); } else if ($processor->enabled) { - $row->attributes['class'] .= 'enabled'; $url = new moodle_url('/admin/message.php', array('disable' => $processor->id, 'sesskey' => sesskey())); $enable->text = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/hide'), @@ -67,7 +82,7 @@ class core_message_renderer extends plugin_renderer_base { ) )); } else { - $row->attributes['class'] .= 'disabled'; + $name->attributes['class'] = 'dimmed_text'; $url = new moodle_url('/admin/message.php', array('enable' => $processor->id, 'sesskey' => sesskey())); $enable->text = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/show'), @@ -77,10 +92,10 @@ class core_message_renderer extends plugin_renderer_base { ) )); } - + // Settings $settings = new html_table_cell(); - if ($processor->available) { - $settingsurl = new moodle_url('/message/output/'.$processor->name.'/settings.php'); + if ($processor->available && file_exists($CFG->dirroot.'/message/output/'.$processor->name.'/settings.php')) { + $settingsurl = new moodle_url('settings.php', array('section' => 'messagesetting'.$processor->name)); $settings->text = html_writer::link($settingsurl, get_string('settings', 'message')); } diff --git a/mod/forum/lang/en/forum.php b/mod/forum/lang/en/forum.php index ad6051adde3..17d8ffb238b 100644 --- a/mod/forum/lang/en/forum.php +++ b/mod/forum/lang/en/forum.php @@ -84,6 +84,7 @@ $string['completionreplies'] = 'Student must post replies:'; $string['completionrepliesgroup'] = 'Require replies'; $string['completionreplieshelp'] = 'requiring replies to complete'; $string['configcleanreadtime'] = 'The hour of the day to clean old posts from the \'read\' table.'; +$string['configdigestmailtime'] = 'People who choose to have emails sent to them in digest form will be emailed the digest daily. This setting controls which time of day the daily mail will be sent (the next cron that runs after this hour will send it).'; $string['configdisplaymode'] = 'The default display mode for discussions if one isn\'t set.'; $string['configenablerssfeeds'] = 'This switch will enable the possibility of RSS feeds for all forums. You will still need to turn feeds on manually in the settings for each forum.'; $string['configenabletimedposts'] = 'Set to \'yes\' if you want to allow setting of display periods when posting a new forum discussion (Experimental as not yet fully tested)'; @@ -110,6 +111,7 @@ $string['deletesureplural'] = 'Are you sure you want to delete this post and all $string['digestmailheader'] = 'This is your daily digest of new posts from the {$a->sitename} forums. To change your forum email preferences, go to {$a->userprefs}.'; $string['digestmailprefs'] = 'your user profile'; $string['digestmailsubject'] = '{$a}: forum digest'; +$string['digestmailtime'] = 'Hour to send digest emails'; $string['digestsentusers'] = 'Email digests successfully sent to {$a} users.'; $string['disallowsubscribe'] = 'Subscriptions not allowed'; $string['disallowsubscribeteacher'] = 'Subscriptions not allowed (except for teachers)'; diff --git a/mod/forum/settings.php b/mod/forum/settings.php index d2d343eb5cd..a5cc4e9b0a4 100644 --- a/mod/forum/settings.php +++ b/mod/forum/settings.php @@ -73,6 +73,10 @@ if ($ADMIN->fulltree) { $settings->add(new admin_setting_configselect('forum_cleanreadtime', get_string('cleanreadtime', 'forum'), get_string('configcleanreadtime', 'forum'), 2, $options)); + for ($i = 0; $i < 23; $i++) { + $options[$i] = sprintf("%02d",$i); + } + $settings->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'forum'), get_string('configdigestmailtime', 'forum'), 17, $options)); if (empty($CFG->enablerssfeeds)) { $options = array(0 => get_string('rssglobaldisabled', 'admin'));