[pLog-svn] r516 - in plog/trunk: . class/summary/action
class/summary/dao class/summary/view templates/admin
templates/summary
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri Dec 17 12:41:47 GMT 2004
Author: oscar
Date: 2004-12-17 12:41:47 +0000 (Fri, 17 Dec 2004)
New Revision: 516
Added:
plog/trunk/class/summary/view/summarymessageview.class.php
Removed:
plog/trunk/class/summary/dao/confirmemailmessage.class.php
plog/trunk/templates/summary/confirmresult.template
Modified:
plog/trunk/class/summary/action/activeaccountaction.class.php
plog/trunk/class/summary/action/dofinishregister.class.php
plog/trunk/class/summary/action/doreadagreement.class.php
plog/trunk/class/summary/action/dousercreation.class.php
plog/trunk/class/summary/action/summarysendresetemail.class.php
plog/trunk/templates/admin/globalsettings_summary.template
plog/trunk/templates/summary/blogprofile.template
plog/trunk/templates/summary/message.template
plog/trunk/templates/summary/registerstep0.template
plog/trunk/templates/summary/registerstep3.template
plog/trunk/templates/summary/registerstep4.template
plog/trunk/templates/summary/registerstep5.template
plog/trunk/templates/summary/resetpassword.template
plog/trunk/wizard.php
Log:
several improvements and fixes to the summary.php script:
- fixed the look of several templates, making them more integrated with the rest of the site. The look still needs to be improved, but we're on the right track :)
- added SummaryMessageView to make it easier to show messages, and integrated it in some of the classes that were using SummaryView("message")
- Added force_one_blog_per_email_account to control whether there can be only one blog per email address, summary_show_agreement to control whether some sort of end-user site usage agreement should be shown to users prior to starting the regsitration process and need_email_confirm_registration to control whether a confirmation email should be sent to the user before the user and the new blog can be activated. If no confirmation is needed, the blog will be activated right away.
- The wizard has also been updated to include all these new settings, as well as the admin interface.
Modified: plog/trunk/class/summary/action/activeaccountaction.class.php
===================================================================
--- plog/trunk/class/summary/action/activeaccountaction.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/action/activeaccountaction.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -4,7 +4,7 @@
include_once(PLOG_CLASS_PATH.'class/data/validator/stringvalidator.class.php');
include_once(PLOG_CLASS_PATH.'class/dao/users.class.php');
include_once(PLOG_CLASS_PATH.'class/dao/blogs.class.php');
-include_once(PLOG_CLASS_PATH.'class/summary/view/summaryview.class.php');
+include_once(PLOG_CLASS_PATH.'class/summary/view/summarymessageview.class.php');
include_once(PLOG_CLASS_PATH.'class/logger/LogUtil.php');
@@ -32,8 +32,7 @@
$userInfo = $users->getUserInfoFromUsername($this->username);
if(!$userInfo){
- $this->_view = new SummaryView("confirmresult");
- $this->_view->setValue("message",$this->_locale->tr("no_user_found"));
+ $this->_view = new SummaryMessageView( $this->_locale->tr("no_user_found"), $this->_locale->tr("error"));
return false;
}
@@ -43,8 +42,7 @@
if($activeCode != $this->activeCode){
$this->log->debug("active code in db is:".$activeCode);
$this->log->debug("active code from user is:".$this->activeCode);
- $this->_view = new SummaryView("confirmresult");
- $this->_view->setValue("message",$this->_locale->tr("wrong_active_code"));
+ $this->_view = new SummaryMessageView($this->_locale->tr("wrong_active_code"), $this->_locale->tr("error"));
return false;
}
@@ -60,8 +58,7 @@
$blog->setStatus(BLOG_STATUS_ACTIVE);
$blogs->updateBlog($blogId,$blog);
- $this->_view = new SummaryView("confirmresult");
- $this->_view->setValue("message",$this->_locale->tr("active_account_ok"));
+ $this->_view = new SummaryMessageView($this->_locale->tr("active_account_ok"));
$this->setCommonData();
return true;
}
Modified: plog/trunk/class/summary/action/dofinishregister.class.php
===================================================================
--- plog/trunk/class/summary/action/dofinishregister.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/action/dofinishregister.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -73,7 +73,7 @@
// if user registration need email confirm, that is
// user must active his account
- if($this->need_confirm == 1){
+ if($this->need_confirm == true){
$this->log->debug("set user status to unconfirmed");
$user->setStatus(USER_STATUS_UNCONFIRMED);
} else {
@@ -110,7 +110,7 @@
$blogInfo = new BlogInfo( $this->blogName, $userId, "", "" );
if($this->need_confirm == 1){
- $blogInfo->setStatus( BLOG_STATUS_DISABLED );
+ $blogInfo->setStatus( BLOG_STATUS_UNCONFIRMED );
$this->log->debug("set blog status to disabled.");
} else {
$blogInfo->setStatus( BLOG_STATUS_ACTIVE );
Modified: plog/trunk/class/summary/action/doreadagreement.class.php
===================================================================
--- plog/trunk/class/summary/action/doreadagreement.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/action/doreadagreement.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,6 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
/**
* shows a form so that users can register
@@ -9,7 +10,13 @@
{
function perform()
{
- $this->_view = new SummaryView( "registerstep0" );
+
+ $config =& Config::getConfig();
+ if( $config->getValue( "summary_show_agreement" ))
+ $this->_view = new SummaryView( "registerstep0" );
+ else
+ $this->_view = new SummaryView( "registerstep1" );
+
$this->setCommonData();
}
}
Modified: plog/trunk/class/summary/action/dousercreation.class.php
===================================================================
--- plog/trunk/class/summary/action/dousercreation.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/action/dousercreation.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -49,7 +49,10 @@
return false;
}
- // check if this email account has registered and quit if so
+ // check if this email account has registered and quit if so, but only if the configuration
+ // says that we should only allow one blog per email account
+ $config =& Config::getConfig();
+ if( $config->getValue( "force_one_blog_per_email_account" )) {
if( $users->emailExists($this->userEmail)) {
$this->log->debug("email address ".$this->userEmail." has used by someone.");
$this->_view = new SummaryView( "registerstep1" );
@@ -58,6 +61,7 @@
$this->setCommonData( true );
return false;
}
+ }
// check if the passwords match, and stop processing if so too
if( $this->userPassword != $this->confirmPassword ) {
Modified: plog/trunk/class/summary/action/summarysendresetemail.class.php
===================================================================
--- plog/trunk/class/summary/action/summarysendresetemail.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/action/summarysendresetemail.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,7 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
+ include_once( PLOG_CLASS_PATH."class/summary/view/summarymessageview.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
@@ -66,8 +66,7 @@
print($resetUrl);
- $this->_view = new SummaryView( "message" );
- $this->_view->setValue( "message", $this->_locale->tr( "password_reset_message_sent_ok" ));
+ $this->_view = new SummaryMessageView( $this->_locale->tr( "password_reset_message_sent_ok" ));
return true;
}
Deleted: plog/trunk/class/summary/dao/confirmemailmessage.class.php
===================================================================
--- plog/trunk/class/summary/dao/confirmemailmessage.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/dao/confirmemailmessage.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,58 +0,0 @@
-<?php
-
-include_once(PLOG_CLASS_PATH.'class/mail/emailmessage.class.php');
-include_once(PLOG_CLASS_PATH.'class/locale/locales.class.php');
-
-define(CONFIRM_MAIL_TEMPLATE,"email_confirm");
-
-/**
- * email message that represent confirm email message mailed to user
- * @package mail
- */
-class ConfirmEmailMessage extends EmailMessage{
-
- var $username;
- var $activeCode;
- var $activeLink;
-
- function ConfirmEmailMessage(){
- $this->EmailMessage();
- }
-
- function setUsername($username){
- $this->username = $username;
- }
-
- function setActiveCode($activeCode){
- $this->activeCode = $activeCode;
- }
-
- function setActiveLink($activeLink){
- $this->activeLink = $activeLink;
- }
-
- /**
- * create the message body
- */
- function createBody(){
- $body = $this->renderBodyTemplate(CONFIRM_MAIL_TEMPLATE,"misc");
- $this->setBody($body) ;
- }
-
- function renderBodyTemplate($templateid,$templateFolder){
- // create a new template service
- $ts = new TemplateService();
- $messageTemplate = $ts->Template( $templateid,$templateFolder );
- $messageTemplate->assign("username",$this->username);
- $messageTemplate->assign("activeCode",$this->activeCode);
- $messageTemplate->assign("activeLink",$this->activeLink);
-
- // FIXME: use which locale?
- $locale = &Locales::getLocale();
- $messageTemplate->assign("locale",$locale);
- // render and return the contents
- return $messageTemplate->fetch();
- }
-}
-
-?>
Added: plog/trunk/class/summary/view/summarymessageview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarymessageview.class.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/class/summary/view/summarymessageview.class.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -0,0 +1,35 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/summary/view/summaryview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+
+ /**
+ * shows a feedback (or error) message
+ */
+ class SummaryMessageView extends SummaryView
+ {
+
+ function SummaryMessageView( $messageBody, $messageTitle = "" )
+ {
+ $this->SummaryView( "message" );
+
+ // keep the message body
+ $this->_body = $messageBody;
+
+ // and the message title
+ if( $messageTitle == "" ) {
+ $locale =& Locales::getLocale();
+ $messageTitle = $locale->tr( "message" );
+ }
+ $this->_title = $messageTitle;
+ }
+
+ function render()
+ {
+ $this->_params->setValue( "message", $this->_body );
+ $this->_params->setValue( "title", $this->_title );
+
+ parent::render();
+ }
+ }
+?>
Modified: plog/trunk/templates/admin/globalsettings_summary.template
===================================================================
--- plog/trunk/templates/admin/globalsettings_summary.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/admin/globalsettings_summary.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -24,7 +24,6 @@
</td>
<td>{$locale->tr("help_summary_blogs_per_page")}</td>
</tr>
-
<!-- force_registration_confirmation -->
<tr>
<td>force_registration_confirmation</td>
@@ -41,4 +40,31 @@
<input style="width:100%" type="text" name="config[forbidden_usernames]" value="{$forbidden_usernames}"/>
</td>
<td>{$locale->tr("help_forbidden_usernames")}</td>
- </tr>
\ No newline at end of file
+ </tr>
+ <!-- force_one_blog_per_email_account -->
+ <tr>
+ <td>force_one_blog_per_email_account</td>
+ <td>
+ <input class="radio" type="radio" name="config[force_one_blog_per_email_account]" value="1" {if $force_one_blog_per_email_account == 1 } checked="checked" {/if}>{$locale->tr("yes")}</input>
+ <input class="radio" type="radio" name="config[force_one_blog_per_email_account]" value="0" {if $force_one_blog_per_email_account == 0 } checked="checked" {/if}>{$locale->tr("no")}</input>
+ </td>
+ <td>{$locale->tr("help_force_one_blog_per_email_account")}</td>
+ </tr>
+ <!-- summary_show_agreement -->
+ <tr>
+ <td>summary_show_agreement</td>
+ <td>
+ <input class="radio" type="radio" name="config[summary_show_agreement]" value="1" {if $summary_show_agreement == 1 } checked="checked" {/if}>{$locale->tr("yes")}</input>
+ <input class="radio" type="radio" name="config[summary_show_agreement]" value="0" {if $summary_show_agreement == 0 } checked="checked" {/if}>{$locale->tr("no")}</input>
+ </td>
+ <td>{$locale->tr("help_summary_show_agreement")}</td>
+ </tr>
+ <!-- need_email_confirm_registration -->
+ <tr>
+ <td>need_email_confirm_registration</td>
+ <td>
+ <input class="radio" type="radio" name="config[need_email_confirm_registration]" value="1" {if $need_email_confirm_registration == 1 } checked="checked" {/if}>{$locale->tr("yes")}</input>
+ <input class="radio" type="radio" name="config[need_email_confirm_registration]" value="0" {if $need_email_confirm_registration == 0 } checked="checked" {/if}>{$locale->tr("no")}</input>
+ </td>
+ <td>{$locale->tr("help_need_email_confirm_registration")}</td>
+ </tr>
\ No newline at end of file
Modified: plog/trunk/templates/summary/blogprofile.template
===================================================================
--- plog/trunk/templates/summary/blogprofile.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/blogprofile.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,4 +1,4 @@
-{include file="summary/header.template" selected="blogslist" columns=1}
+{include file="summary/header.template" selected="blogslist" columns=1 section=$locale->tr("blog_profile")}
<div id="onecolumn">
{assign var="url" value=$blog->getBlogRequestGenerator()}
Deleted: plog/trunk/templates/summary/confirmresult.template
===================================================================
--- plog/trunk/templates/summary/confirmresult.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/confirmresult.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,9 +0,0 @@
-{include file="summary/header.template" selected="register" columns=1}
-<div id="onecolumn">
-
- <h1>{$locale->tr("confirm_result")}</h1>
- <p>
- <span style="color: red">{$message}</span>
- </p>
-</div>
-{include file="summary/footer.template"}
Modified: plog/trunk/templates/summary/message.template
===================================================================
--- plog/trunk/templates/summary/message.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/message.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,4 +1,4 @@
-{include file="summary/header.template"}
+{include file="summary/header.template" section=$title}
<div id="onecolumn">
{$message}
</div>
Modified: plog/trunk/templates/summary/registerstep0.template
===================================================================
--- plog/trunk/templates/summary/registerstep0.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/registerstep0.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,15 +1,21 @@
{include file="summary/header.template" section=$locale->tr("register_new_blog_step0_title")}
-
-<!--user aggreement-->
-<textarea name="textarea" class="contract" width="100%">
+<form action="summary.php">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("service_use_agreement")}</legend>
+ <div class="field">
+ <!--user aggreement-->
+ <label for="contract">{$locale->tr("read_service_agreement")}</label>
+ <div class="formHelp"></div>
+ <textarea name="contract" class="contract" readonly="readonly" style="width:100%">
{include file="misc/agreement.template"}
-</textarea>
-<!--end user agreement-->
-
- <form action="summary.php">
- <input type="submit" value="{$locale->tr("accept")}" name="accept"/>
- <input type="button" value="{$locale->tr("decline")}" name="decline" onclick="window.location.href='summary.php'" />
- <input type="hidden" name="op" value="RegisterStep1"/>
- </form>
-
+ </textarea>
+ <!--end user agreement-->
+ </div>
+ </fieldset>
+ <div class="buttons">
+ <input type="button" value="{$locale->tr("decline")}" name="decline" onclick="window.location.href='summary.php'" />
+ <input type="submit" value="{$locale->tr("accept")}" name="accept"/>
+ <input type="hidden" name="op" value="RegisterStep1"/>
+ </div>
+ </form>
{include file="summary/footer.template"}
Modified: plog/trunk/templates/summary/registerstep3.template
===================================================================
--- plog/trunk/templates/summary/registerstep3.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/registerstep3.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -3,7 +3,6 @@
<fieldset class="inputField">
<legend>{$locale->tr("step3")}</legend>
<div class="field">
- {$form}
{**include file="summary/validate.template" field=templateId message=$locale->tr("error_must_choose_template")**}
{foreach from=$templates item=template}
{assign var=templateName value=$template->getName()}
Modified: plog/trunk/templates/summary/registerstep4.template
===================================================================
--- plog/trunk/templates/summary/registerstep4.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/registerstep4.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -5,18 +5,45 @@
<fieldset class="inputField">
<legend>{$locale->tr("step4")}</legend>
- <div class="field"><label for="username"> {$locale->tr("username")}:{$userName}</label></div>
- <div class="field"><label for="userFullName"> {$locale->tr("full_name")}:{$userFullName}</label> </div>
- <div class="field"><label for="password"> {$locale->tr("password")}:{$userPassword}</label> </div>
- <div class="field"><label for="userEmail"> {$locale->tr("email")}:{$userEmail}</label> </div>
- <div class="field"><label for="blogName"> {$locale->tr("register_step2_blog_name")}:{$blogName}</label> </div>
- <div class="field"><label for="locale"> {$locale->tr("locale")}:{$blogLocale}</label> </div>
- <div class="field"><label for="templateId"> {$locale->tr("templateId")}:{$templateId}</label> </div>
-
+ <div class="field">
+ <label for="username">{$locale->tr("username")}</label>
+ <div class="formHelp"></div>
+ {$userName}
+ </div>
+ <div class="field">
+ <label for="userFullName">{$locale->tr("full_name")}</label>
+ <div class="formHelp"></div>
+ {$userFullName}
+ </div>
+ <div class="field">
+ <label for="password">{$locale->tr("password")}</label>
+ <div class="formHelp"></div>
+ {$userPassword}
+ </div>
+ <div class="field">
+ <label for="userEmail">{$locale->tr("email")}</label>
+ <div class="formHelp"></div>
+ {$userEmail}
+ </div>
+ <div class="field">
+ <label for="blogName">{$locale->tr("blog_name")}</label>
+ <div class="formHelp"></div>
+ {$blogName}
+ </div>
+ <div class="field">
+ <label for="locale">{$locale->tr("locale")}</label>
+ <div class="formHelp"></div>
+ {$blogLocale}
+ </div>
+ <div class="field">
+ <label for="templateId">{$locale->tr("templateId")}</label>
+ <div class="formHelp"></div>
+ {$templateId}
+ </div>
</fieldset>
<div class="buttons">
- <input type="submit" name="done" value="{$locale->tr("done")}" />
+ <input type="submit" name="done" value="{$locale->tr("create")}" />
</div>
<input type="hidden" name="userName" value="{$userName}"/>
Modified: plog/trunk/templates/summary/registerstep5.template
===================================================================
--- plog/trunk/templates/summary/registerstep5.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/registerstep5.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,6 +1,6 @@
{include file="summary/header.template" section=$locale->tr("register_new_blog_step5_title")}
<div id="onecolumn">
- <form name="formDone">
+ <form name="formDone">
<fieldset class="inputField">
{$locale->tr("register_new_blog_step5_description")}
@@ -15,7 +15,8 @@
{/if}
</fieldset>
<div class="buttons">
- <input type="submit" name="done" value="{$locale->tr("register_finished")}" onClick='window.location.href="summary.php"'/>
+ <input type="hidden" name="op" value="Default" />
+ <input type="submit" name="finish" value="{$locale->tr("finish")}" />
</form>
</div>
{include file="summary/footer.template"}
Modified: plog/trunk/templates/summary/resetpassword.template
===================================================================
--- plog/trunk/templates/summary/resetpassword.template 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/templates/summary/resetpassword.template 2004-12-17 12:41:47 UTC (rev 516)
@@ -1,11 +1,10 @@
-{include file="summary/header.template"}
+{include file="summary/header.template" section=$locale->tr("reset_password")}
<div id="onecolumn">
- <h1>{$locale->tr("reset_password")}</h1>
<p>
{$locale->tr("reset_password_info")}
</p>
<form name="resetPasswordForm" method="post">
- <fieldset>
+ <fieldset class="inputField">
{include file="summary/formvalidate.template" message=$locale->tr("error_resetting_password")}
<div class="field">
<label for="userName">{$locale->tr("username")}</label><br/>
@@ -18,9 +17,9 @@
{include file="summary/validate.template" field=userName message=$locale->tr("error_incorrect_email_address")}
</div>
</fieldset>
- <br/>
- <input type="submit" name="resetPasswordButton" value="{$locale->tr("reset_password")}" />
- <input type="hidden" name="op" value="sendResetEmail" />
- </form>
+ <div class="buttons">
+ <input type="submit" name="resetPasswordButton" value="{$locale->tr("reset_password")}" />
+ <input type="hidden" name="op" value="sendResetEmail" />
+ </div>
</div>
{include file="summary/footer.template"}
\ No newline at end of file
Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php 2004-12-17 12:22:31 UTC (rev 515)
+++ plog/trunk/wizard.php 2004-12-17 12:41:47 UTC (rev 516)
@@ -536,10 +536,9 @@
$Inserts[99] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('autosave_new_drafts_time_millis', '300000', 3);";
$Inserts[100] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('save_drafts_via_xmlhttprequest_enabled', '1', 1);";
$Inserts[101] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('need_email_confirm_registration', '1', 1);";
+$Inserts[102] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('force_one_blog_per_email_account', '0', 1);";
+$Inserts[103] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('summary_show_agreement', '1', 1);";
-
-
-
/**
* Open a connection to the database
*/
@@ -1268,7 +1267,7 @@
// ---
// add the new configuration settings that were added for 1.0
// ---
- $newSettings = range( 71, 101 );
+ $newSettings = range( 71, 103 );
foreach( $newSettings as $settingId ) {
$setting = $Inserts[$settingId];
$query = str_replace( "{dbprefix}", $this->_dbPrefix, $setting );
More information about the pLog-svn
mailing list