[pLog-svn] r6016 - in plugins/branches/lifetype-1.2/moblog: . class/action class/log class/moblog class/view locale templates
reto at devel.lifetype.net
reto at devel.lifetype.net
Sun Oct 28 18:34:02 EDT 2007
Author: reto
Date: 2007-10-28 18:34:02 -0400 (Sun, 28 Oct 2007)
New Revision: 6016
Modified:
plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginsettingsaction.class.php
plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginupdatesettingsaction.class.php
plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogpluginupdatesettingsaction.class.php
plugins/branches/lifetype-1.2/moblog/class/log/mobloglogger.class.php
plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php
plugins/branches/lifetype-1.2/moblog/class/view/adminmoblogbatchpluginsettingsview.class.php
plugins/branches/lifetype-1.2/moblog/locale/locale_en_UK.php
plugins/branches/lifetype-1.2/moblog/pluginmoblog.class.php
plugins/branches/lifetype-1.2/moblog/templates/moblogbatchsettings.template
plugins/branches/lifetype-1.2/moblog/templates/pluginsettings.template
Log:
Improving usability and code of the moblog plugin, at least moblogbatch functionality.
Most of the help messages where wrong or not really helpfull (smtp vs. pop etc.)
Modified: plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginsettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginsettingsaction.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginsettingsaction.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -12,7 +12,7 @@
{
$this->AdminAction( $actionInfo, $request );
- $this->requireAdminPermission( "manage_admin_plugins" );
+ $this->requireAdminPermission( "manage_moblogbatch" );
}
function perform()
@@ -23,4 +23,4 @@
return true;
}
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginupdatesettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginupdatesettingsaction.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogbatchpluginupdatesettingsaction.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -13,7 +13,7 @@
{
$this->AdminAction( $actionInfo, $request );
- $this->requireAdminPermission( "manage_admin_plugins" );
+ $this->requireAdminPermission( "manage_moblogbatch" );
}
function validate()
@@ -49,7 +49,7 @@
$this->saveSession();
$this->_view = new AdminMoblogBatchPluginSettingsView( $this->_blogInfo );
- $this->_view->setSuccessMessage( $this->_locale->tr("moblog_settings_saved_ok"));
+ $this->_view->setSuccessMessage( $this->_locale->tr("moblogbatch_settings_saved_ok"));
$this->setCommonData();
// clear the cache
@@ -58,4 +58,4 @@
return true;
}
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogpluginupdatesettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogpluginupdatesettingsaction.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/class/action/adminmoblogpluginupdatesettingsaction.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -47,10 +47,10 @@
// show an informative message
$this->_view = new AdminMoblogPluginSettingsView( $this->_blogInfo, $this->_userInfo );
- $this->_view->setSuccessMessage( $this->_locale->tr("atom_plugin_settings_saved_ok"));
+ $this->_view->setSuccessMessage( $this->_locale->tr("moblog_plugin_settings_saved_ok"));
$this->setCommonData();
return true;
}
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/class/log/mobloglogger.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/log/mobloglogger.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/class/log/mobloglogger.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -1,8 +1,5 @@
<?php
-
- lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
-
/**
* simple class that logs a message to the standard log file, but only if enabled
*
@@ -15,12 +12,12 @@
*/
function Log( $message )
{
- $config =& Config::getConfig();
- if( $config->getValue( "moblog_logging_enabled" )) {
+
+ if( MOBLOG_DEBUG ) {
lt_include( PLOG_CLASS_PATH."class/logger/loggermanager.class.php" );
$logger =& LoggerManager::getLogger();
$logger->debug( $message );
}
}
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -6,14 +6,6 @@
lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
/**
- * the following strings will be filtered out from moblogged messages. At least in case
- * of Finnish Elisa operator, every message is sent including this annoying notice
- */
- $_moblog_filter_out = Array(
- "This is a HTML message, sorry"
- );
-
- /**
* contains all the parameters that came in the user's email.
*/
class MoblogRequest
@@ -32,10 +24,21 @@
var $_host;
var $_attachments;
var $_help;
- var $_inputEncoding;
+ var $_inputEncoding;
+ var $_moblog_filter_out = array();
+
function MoblogRequest( $request )
{
+
+ /**
+ * the following strings will be filtered out from moblogged messages. At least in case
+ * of Finnish Elisa operator, every message is sent including this annoying notice
+ */
+ $this->_moblog_filter_out = Array(
+ "This is a HTML message, sorry"
+ );
+
isset( $request["message"] ) ? $this->_message = $request["message"] : $this->_message = 0;
// it is possible to specify a default user id in the POSTed email message via
// curl, so that the amount of stuff that we need to type in the email is reduced
@@ -70,7 +73,10 @@
$this->_inputEncoding = strtoupper( $structure->ctype_parameters['charset'] );
MoblogLogger::log( "There are ".count($structure->parts)." MIME parts available to parse" );
- $this->parseMimeParts( $structure->parts );
+
+ if(count($structure->parts) > 0) {
+ $this->parseMimeParts( $structure->parts );
+ }
// if there was no subject specified, then let's see if there was something in the
// 'subject' line...
@@ -140,9 +146,8 @@
// strip off a standard .sig. Properly formed .sigs start with '-- ' on a new line.
list($body, $sig) = explode("\n-- ", $body);
-
- global $_moblog_filter_out;
- foreach( $_moblog_filter_out as $str ) {
+
+ foreach( $this->_moblog_filter_out as $str ) {
$body = str_replace( $str, '', $body );
}
@@ -312,4 +317,4 @@
return $this->_attachments;
}
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/class/view/adminmoblogbatchpluginsettingsview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/view/adminmoblogbatchpluginsettingsview.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/class/view/adminmoblogbatchpluginsettingsview.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -25,7 +25,7 @@
$password = $config->getValue( "plugin_moblog_password" );
$pseudoBatch = $config->getValue( "plugin_moblog_pseudobatch" );
if ($pseudoBatch == "") $pseudoBatch = "Off";
- $lastUpdate = $config->getValue( "plugin_moblog_lastupdate" );
+ $lastUpdate = date("Y-m-d H:m:s", $config->getValue( "plugin_moblog_lastupdate" ) );
// create a view and export the settings to the template
$this->setValue( "mailServer", $mailServer );
@@ -38,4 +38,4 @@
parent::render();
}
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/locale/locale_en_UK.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/locale/locale_en_UK.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -1,22 +1,44 @@
<?php
+//
+// Moblog Strings
+//
+
$messages["moblogSettings"] = "Moblog Settings";
$messages["enable_plugin"] = "Enable plugin";
-$messages["enable_moblog_plugin_help"] = "Enable the moblog plugin";
-$messages["moblog_articles_help"] = "In which category would you like articles posted via Atom to be categorized?";
+$messages["enable_moblog_plugin_help"] = "Enable the moblog plugin.";
+$messages["moblog_plugin_settings_saved_ok"] = "Moblog settings saved successfully!";
+$messages["moblog_articles_help"] = "In which category would you like articles posted to be categorized?";
$messages["moblog_resources_help"] = "Uploading resources such as images and videos is also supported by this implementation. In which album would you like files to be classified?";
-$messages["moblog_image_preview_type_help"] = "When embedding images in moblogged posts, how should the image be embedded?'";
-
-$messages["moblogbatch_mailserver_help"] = "SMTP server that contains the messages that should be posted to the blog";
-$messages["moblogbatch_port_help"] = "Port where the SMTP server is running";
-$messages["moblogbatch_username_help"] = "Username that should be used to authenticate against the SMTP server";
-$messages["moblogbatch_password_help"] = "Password that should be used to authenticate against the SMTP server";
-$messages["moblogbatch_pseudobatch_help"] = "How often should messages be checked, in minutes";
-$messages["moblogbatch_lastupdate_help"] = "tbd";
-
$messages["small_preview"] = "Small preview";
$messages["medium_preview"] = "Medium preview";
$messages["full_size"] = "Full size picture";
+$messages["moblog_image_preview_type_help"] = "When embedding images in moblogged posts, how should the image be embedded?'";
-$messages["moblogBatchSettings"] = "Moblog Batch";
-?>
\ No newline at end of file
+//
+// Moblog Batch Strings
+//
+
+$messages["moblogbatchSettings"] = "Moblog Batch Settings";
+$messages['manage_moblogbatch_desc'] = 'Manage batch settings of the Moblog Plugin';
+$messages["moblogbatch_mailserver"] = "Mailserver";
+$messages["moblogbatch_mailserver_help"] = "POP3 server that contains the messages that should be posted to the blog.";
+$messages["moblogbatch_port"] = "Port";
+$messages["moblogbatch_port_help"] = "Port where the POP3 server is running [ Default = 110 ]";
+$messages["moblogbatch_username_help"] = "Username that should be used to authenticate against the POP3 server.";
+$messages["moblogbatch_password_help"] = "Password that should be used to authenticate against the POP3 server.";
+$messages["moblogbatch_pseudobatch"] = "Pseudobatch";
+$messages["moblogbatch_pseudobatch_help"] = "How often should messages be checked, in minutes. Set the pseudobatch to 'diabled' if you are using a server-side cron job to check for new moblogs.";
+$messages["moblogbatch_lastupdate"] = "Last Update";
+$messages["moblogbatch_lastupdate_help"] = "Last time Moblog Batch was checking for new moblogs.";
+$messages["moblogbatch_off"] = "disabled";
+$messages["moblogbatch_settings_saved_ok"] = "Moblog Batch settings saved successfully!";
+
+//
+// Moblog Mail Messages
+//
+
+$messages["moblog_mailsubject"] = "LifeType Moblog Plugin: Message sent successfully";
+$messages["moblog_attachments"] = "The following attachments have been added:\n\n";
+$messages["moblog_body"] = "Post was successfully added to the database with topic %s.\n\n"
+?>
Modified: plugins/branches/lifetype-1.2/moblog/pluginmoblog.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/pluginmoblog.class.php 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/pluginmoblog.class.php 2007-10-28 22:34:02 UTC (rev 6016)
@@ -14,7 +14,7 @@
$this->id = "moblog";
$this->author = "The Lifetype Project";
$this->locales = Array();
- $this->version = "20070622";
+ $this->version = "20071028";
$this->desc = "
Send a message with the following format ('start' and 'end' messages not included!):<br/>
<br/>
@@ -22,11 +22,13 @@
<br/>
USER: your-lifetype-username<br/>
PASS: your-lifetype-password<br/>
-BLOG: your-lifetype-blog-name<br/>
+BLOG: your-lifetype-blog-name or BLOGID: id-of-your-blog<br/>
+TOPIC: your-subject (optional)
<br/>
--- end of moblog message format ---<br/>
<br/>
-The must be sent as plain text, and it can include as many attachment as needed.";
+The subject of the mail will be used as the subject for the article as long as there is no TOPIC set.<br/>
+The message must be sent as plain text, and it can include as many attachment as needed.";
$this->init();
}
@@ -50,13 +52,35 @@
// register menu entries
- $this->addMenuEntry( "/menu/controlCenter/manageSettings", // menu path
- "moblogSettings", // menu id
- "admin.php?op=moblogSettings", // url
- "Moblog" // text to show
- );
- $this->addMenuEntry( "/menu/adminSettings/GlobalSettings", "moblogbatchSettings", "admin.php?op=moblogbatchSettings", "" );
+ $this->addMenuEntry( "/menu/controlCenter/manageSettings", // menu path
+ "moblogSettings", // menu id
+ "admin.php?op=moblogSettings", // url
+ "moblogSettings" // text to show
+ );
+ $this->addMenuEntry( "/menu/adminSettings/GlobalSettings", // menu path
+ "moblogbatchSettings", // menu id
+ "admin.php?op=moblogbatchSettings", // url
+ "moblogbatchSettings" // text to show
+ );
}
- }
+ }
+
+
+ /**
+ * register the plugin
+ * @private
+ */
+ function register()
+ {
+ // register our permissions
+ // add our new permission if it doesn't exist yet
+ lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+ $perms = new Permissions();
+ if( !$perms->getPermissionByName( "manage_moblogbatch" )) {
+ $perm = new Permission( "manage_moblogbatch", "manage_moblogbatch_desc" );
+ $perm->setAdminOnlyPermission( true );
+ $perms->addPermission( $perm );
+ }
+ }
}
-?>
\ No newline at end of file
+?>
Modified: plugins/branches/lifetype-1.2/moblog/templates/moblogbatchsettings.template
===================================================================
--- plugins/branches/lifetype-1.2/moblog/templates/moblogbatchsettings.template 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/templates/moblogbatchsettings.template 2007-10-28 22:34:02 UTC (rev 6016)
@@ -1,19 +1,19 @@
{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=moblogbatchSettings title=$locale->tr("mobologbatch_plugin")}
+{include file="$admintemplatepath/navigation.template" showOpt=moblogbatchSettings title=$locale->tr("moblogbatchSettings")}
<form name="moblogbatchPluginConfig" method="post">
<fieldset class="inputField">
<legend>{$locale->tr("label_configuration")}</legend>
{include file="$admintemplatepath/successmessage.template"}
{include file="$admintemplatepath/errormessage.template"}
<div class="field">
- <label for="mailServer">{$locale->tr("mailserver")}</label>
+ <label for="mailServer">{$locale->tr("moblogbatch_mailserver")}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("moblogbatch_mailserver_help")}</div>
<input class="text" type="text" name="mailServer" id="mailServer" value="{$mailServer}" width="30" />
</div>
<div class="field">
- <label for="port">{$locale->tr("port")}</label>
+ <label for="port">{$locale->tr("moblogbatch_port")}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("moblogbatch_port_help")}</div>
<input class="text" type="text" name="port" id="port" value="{$port}" width="10" />
@@ -30,11 +30,11 @@
<label for="password">{$locale->tr("password")}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("moblogbatch_password_help")}</div>
- <input class="text" type="text" name="password" id="password" value="{$password}" width="30" />
+ <input class="text" type="password" name="password" id="password" value="{$password}" width="30" />
</div>
<div class="field">
- <label for="pseudoBatch">{$locale->tr("pseudobatch")}</label>
+ <label for="pseudoBatch">{$locale->tr("moblogbatch_pseudobatch")}</label>
<span class="required"></span>
<div class="formHelp">{$locale->tr("moblogbatch_pseudobatch_help")}</div>
<select name="pseudoBatch" id="pseudoBatch">
@@ -51,10 +51,9 @@
</div>
<div class="field">
- <label for="lastUpdate">{$locale->tr("lastupdate")}</label>
- <span class="required">*</span>
+ <label for="lastUpdate">{$locale->tr("moblogbatch_lastupdate")}</label>
<div class="formHelp">{$locale->tr("moblogbatch_lastupdate_help")}</div>
- <input class="text" type="text" name="lastUpdate" id="lastUpdate" value="{$lastUpdate}" width="10" />
+ {$lastUpdate}
</div>
</fieldset>
@@ -66,4 +65,4 @@
</div>
</form>
{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
+{include file="$admintemplatepath/footer.template"}
Modified: plugins/branches/lifetype-1.2/moblog/templates/pluginsettings.template
===================================================================
--- plugins/branches/lifetype-1.2/moblog/templates/pluginsettings.template 2007-10-28 21:47:03 UTC (rev 6015)
+++ plugins/branches/lifetype-1.2/moblog/templates/pluginsettings.template 2007-10-28 22:34:02 UTC (rev 6016)
@@ -1,6 +1,6 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=moblogSettings title=$locale->tr("moblogSettings")}
-<form name="pluginAtomSettings" method="post" action="admin.php">
+<form id="pluginMoblogSettings" method="post" action="admin.php">
<fieldset class="inputField">
<legend>{$locale->tr("moblogSettings")}</legend>
{include file="$admintemplatepath/successmessage.template"}
@@ -50,4 +50,4 @@
</div>
</form>
{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
+{include file="$admintemplatepath/footer.template"}
More information about the pLog-svn
mailing list