[pLog-svn] r5796 - in plog/trunk: class/action/admin class/dao class/dao/misc class/view/admin js/ui js/ui/pages locale/admin templates/admin
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Sun Aug 5 14:54:53 EDT 2007
Author: oscar
Date: 2007-08-05 14:54:53 -0400 (Sun, 05 Aug 2007)
New Revision: 5796
Added:
plog/trunk/class/dao/misc/
plog/trunk/class/dao/misc/init.class.php
plog/trunk/js/ui/pages/blogs.js
plog/trunk/templates/admin/siteblogs_table.template
Modified:
plog/trunk/class/action/admin/adminaddblogaction.class.php
plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php
plog/trunk/class/action/admin/admindeleteblogaction.class.php
plog/trunk/class/action/admin/adminresendconfirmationaction.class.php
plog/trunk/class/view/admin/adminsiteblogslistview.class.php
plog/trunk/js/ui/plogui.js
plog/trunk/locale/admin/locale_en_UK.php
plog/trunk/templates/admin/createblog.template
plog/trunk/templates/admin/siteblogs.template
Log:
Totally ajaxified the "Blogs" page.
Modified: plog/trunk/class/action/admin/adminaddblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogaction.class.php 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/class/action/admin/adminaddblogaction.class.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -7,9 +7,11 @@
lt_include( PLOG_CLASS_PATH."class/data/validator/blognamevalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/domainvalidator.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/misc/init.class.php" );
/**
* \ingroup Action
@@ -23,17 +25,19 @@
var $_blogName;
var $_ownerId;
var $_blogProperties;
+ var $_mainDomain;
+ var $_subDomain;
function AdminAddBlogAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
// data validation
- $this->registerFieldValidator( "blogName", new BlogNameValidator());
- $this->registerFieldValidator( "userId", new IntegerValidator());
+ $this->registerFieldValidator( "blogName", new BlogNameValidator(), false, $this->_locale->tr("error_invalid_blog_name"));
+ $this->registerFieldValidator( "userId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_user"));
if( Subdomains::getSubdomainsEnabled()) {
- $this->registerFieldValidator( "blogSubDomain", new DomainValidator());
- $this->registerFieldValidator( "blogMainDomain", new DomainValidator());
+ $this->registerFieldValidator( "blogSubDomain", new DomainValidator(), false, $this->_locale->tr("error_invalid_subdomain"));
+ $this->registerFieldValidator( "blogMainDomain", new DomainValidator(), false, $this->_locale->tr("error_invalid_domain"));
}
$this->registerField( "userName" );
@@ -44,59 +48,64 @@
$this->requireAdminPermission( "add_site_blog" );
}
- function perform()
- {
- // fetch the validated data
- $this->_blogName = Textfilter::filterAllHTML($this->_request->getValue( "blogName" ));
- $this->_ownerId = $this->_request->getValue( "userId" );
- $this->_blogProperties = $this->_request->getValue( "properties" );
-
+ function validate()
+ {
+ if( !parent::validate())
+ return( false );
+
+ $this->_ownerId = $this->_request->getValue( "userId" );
// check that the user really exists
$users = new Users();
$userInfo = $users->getUserInfoFromId( $this->_ownerId );
if( !$userInfo ) {
- $this->_view = new AdminCreateBlogView( $this->_blogInfo );
- $this->_form->setFieldValidationStatus( "blogOwner", false );
- $this->setCommonData( true );
- return false;
- }
-
- // now that we have validated the data, we can proceed to create the user, making
- // sure that it doesn't already exists
- $blogs = new Blogs();
- $blog = new BlogInfo( $this->_blogName, $this->_ownerId, "", "" );
- $blog->setProperties( $this->_blogProperties );
-
- // check to see whether we are going to save subdomain information
+ $this->_form->setFieldValidationStatus( "userId", false );
+ $this->validationErrorProcessing();
+ return( false );
+ }
+
if( Subdomains::getSubdomainsEnabled()) {
-
// Translate a few characters to valid names, and remove the rest
- $mainDomain = Textfilter::domainize($this->_request->getValue( "blogMainDomain" ));
- if(!$mainDomain)
- $mainDomain = "?";
- $subDomain = Textfilter::domainize($this->_request->getValue( "blogSubDomain" ));
+ $this->_mainDomain = Textfilter::domainize($this->_request->getValue( "blogMainDomain" ));
+ if(!$this->_mainDomain) $this->_mainDomain = "?";
+ $this->_subDomain = Textfilter::domainize($this->_request->getValue( "blogSubDomain" ));
- if( !Subdomains::isDomainAvailable( $mainDomain )) {
- $this->_view = new AdminCreateBlogView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_updating_blog_subdomain"));
+ if( !Subdomains::isDomainAvailable( $this->_mainDomain )) {
+ //$this->_view->setErrorMessage( $this->_locale->tr("error_updating_blog_subdomain"));
$this->_form->setFieldValidationStatus( "blogMainDomain", false );
- $this->setCommonData();
+ $this->validationErrorProcessing();
return false;
}
- if( !Subdomains::isValidDomainName( $subDomain )) {
- $this->_view = new AdminCreateBlogView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_updating_blog_subdomain"));
+ if( !Subdomains::isValidDomainName( $this->_subDomain )) {
+ //$this->_view->setErrorMessage( $this->_locale->tr("error_updating_blog_subdomain"));
$this->_form->setFieldValidationStatus( "blogSubDomain", false );
- $this->setCommonData();
+ $this->validationErrorProcessing();
return false;
}
+ }
- if($mainDomain == "?"){
- $blog_domain = $subDomain;
+ return( true );
+ }
+
+ private function addBlog()
+ {
+ // fetch the validated data
+ $this->_blogName = $this->_request->getFilteredValue( "blogName", new HtmlFilter());
+ $this->_blogProperties = $this->_request->getValue( "properties" );
+
+ // now that we have validated the data, we can proceed to create the user, making
+ // sure that it doesn't already exists
+ $blogs = new Blogs();
+ $blog = new BlogInfo( $this->_blogName, $this->_ownerId, "", "" );
+ $blog->setProperties( $this->_blogProperties );
+
+ // check to see whether we are going to save subdomain information
+ if( Subdomains::getSubdomainsEnabled()) {
+ if($this->_mainDomain == "?") {
+ $blog_domain = $this->_subDomain;
}
else{
- $blog_domain = $subDomain . "." . $mainDomain;
+ $blog_domain = $this->_subDomain . "." . $this->_mainDomain;
}
$blog->setCustomDomain( $blog_domain );
@@ -106,83 +115,49 @@
$this->notifyEvent( EVENT_PRE_BLOG_ADD, Array( "blog" => &$blog ));
$newBlogId = $blogs->addBlog( $blog );
if( !$newBlogId) {
- $this->_view = new AdminCreateBlogView( $this->_blogInfo );
- $this->_form->setFieldValidationStatus( "blogName", false );
- $this->setCommonData();
-
return false;
}
- // get the default global article category id
- lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
- $globalArticleCategories = new GlobalArticleCategories();
- $globalArticleCategoryId = $this->_config->getValue("default_global_article_category_id");
- if( !empty( $globalArticleCategoryId ) ) {
- $globalArticleCategory = $globalArticleCategories->getGlobalArticleCategory( $globalArticleCategoryId );
- if( empty( $globalArticleCategory ) )
- $globalArticleCategoryId = 0;
- }
- else {
- $globalArticleCategoryId = 0;
- }
-
- // Get the defaul locale object
- $config =& Config::getConfig();
- $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+ // initialize the blog with some basic data
+ Init::initBlog( $blog );
- // add a default category and a default post
- $articleCategories = new ArticleCategories();
- $articleCategory = new ArticleCategory( $locale->tr( "register_default_category" ), "", $newBlogId, true );
- $catId = $articleCategories->addArticleCategory( $articleCategory );
- $articleTopic = $locale->tr( "register_default_article_topic" );
- $articleText = $locale->tr( "register_default_article_text" );
- $article = new Article( $articleTopic,
- $articleText,
- Array( $catId ),
- $this->_ownerId,
- $newBlogId,
- POST_STATUS_PUBLISHED,
- 0,
- Array(),
- "welcome" );
- $article->setGlobalCategoryId( $globalArticleCategoryId ); // set the default ArticleGlobalCategory id to article
- $t = new Timestamp();
- $article->setDateObject( $t );
- $article->setInSummary( false );
- $articles = new Articles();
- $articles->addArticle( $article );
-
- // add a new first album so that users can start uploading stuff right away
- lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
- lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbum.class.php" );
- $album = new GalleryAlbum( $newBlogId, // blog id
- $locale->tr( "register_default_album_name" ), // album name
- $locale->tr( "register_default_album_description" ), // album description
- GALLERY_RESOURCE_PREVIEW_AVAILABLE, // flags
- 0, // no parent id
- $t->getTimestamp(), // current date
- Array(), // no properties
- true ); // show the album in the interface
- $albums = new GalleryAlbums();
- $albums->addAlbum( $album );
-
- // add a new default mylinkscategory
- lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
- $linksCategory = new MyLinksCategory( $locale->tr("register_default_category" ), $newBlogId );
- $linksCategories = new MyLinksCategories();
- $linksCategories->addMyLinksCategory( $linksCategory );
-
// and inform everyone that everything went ok
$this->notifyEvent( EVENT_POST_BLOG_ADD, Array( "blog" => &$blog ));
+
+ return( $blog );
+ }
+
+ function perform()
+ {
+ $blog = $this->addBlog();
+
if( $this->userHasPermission( "view_site_blogs", ADMIN_PERMISSION ))
$this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
else
$this->_view = new AdminCreateBlogView( $this->_blogInfo );
- $this->_view->setSuccessMessage($this->_locale->pr("blog_added_ok", $blog->getBlog()));
+ if( $blog )
+ $this->_view->setSuccessMessage($this->_locale->pr("blog_added_ok", $blog->getBlog()));
+ else
+ $this->_view->setErrorMessage( $this->_locale->tr( "error_adding_blog" ));
+
$this->setCommonData();
return true;
}
+
+ function performAjax()
+ {
+ $blog = $this->addBlog();
+
+ lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ if( $blog )
+ $this->_view->setSuccessMessage($this->_locale->pr("blog_added_ok", $blog->getBlog()));
+ else
+ $this->_view->setErrorMessage( $this->_locale->tr( "error_adding_blog" ));
+
+ return true;
+ }
}
-?>
+?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -46,6 +46,11 @@
$successMessage = "";
$totalOk = 0;
+ // prepare the parameters.. If there's only one category id, then add it to
+ // an array.
+ $this->_blogIds = $this->_request->getValue( "blogIds" );
+ $this->_blogStatus = $this->_request->getValue( "blogStatus" );
+
foreach( $this->_blogIds as $blogId ) {
// get the post
$blog = $blogs->getBlogInfo( $blogId );
@@ -77,27 +82,36 @@
}
// clean up the cache
- CacheControl::resetBlogCache( $this->_blogInfo->getId());
+ if( $totalOk > 0 )
+ CacheControl::resetBlogCache( $this->_blogInfo->getId());
+ return( Array( "errorMessage" => $errorMessage, "successMessage" => $successMessage ));
+ }
+
+ function perform()
+ {
+ $results = $this->_changeBlogsStatus();
+
$this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
- if( $errorMessage != "" )
- $this->_view->setErrorMessage( $errorMessage );
- if( $successMessage != "" )
- $this->_view->setSuccessMessage( $successMessage );
+ if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
+ if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
$this->setCommonData();
- return true;
- }
+ return( true );
+ }
- function perform()
+ function performAjax()
{
- // prepare the parameters.. If there's only one category id, then add it to
- // an array.
- $this->_blogIds = $this->_request->getValue( "blogIds" );
- $this->_blogStatus = $this->_request->getValue( "blogStatus" );
-
- $this->_changeBlogsStatus();
- }
+ $results = $this->_changeBlogsStatus();
+
+ lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setMessage( $results );
+ $this->_view->setSuccess( true );
+
+ // better to return true if everything fine
+ return true;
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/admindeleteblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteblogaction.class.php 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/class/action/admin/admindeleteblogaction.class.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -36,6 +36,34 @@
function perform()
{
+ $results = $this->_disableBlogs();
+
+ $this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
+ if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
+ if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
+ $this->setCommonData();
+
+ return( true );
+ }
+
+ function performAjax()
+ {
+ $results = $this->_disableBlogs();
+
+ lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setMessage( $results );
+ $this->_view->setSuccess( true );
+
+ // better to return true if everything fine
+ return true;
+ }
+
+ /**
+ * @private
+ */
+ private function _disableBlogs()
+ {
if( $this->_op == "deleteBlog" ) {
$this->_blogIds = Array();
$blogId = $this->_request->getValue( "blogId" );
@@ -44,16 +72,6 @@
else
$this->_blogIds = $this->_request->getValue( "blogIds" );
- $this->_disableBlogs();
- }
-
-// function disableBlog( $blogIn
-
- /**
- * @private
- */
- function _disableBlogs()
- {
// get the default blog id
$config =& Config::getConfig();
$defaultBlogId = $config->getValue( "default_blog_id" );
@@ -93,12 +111,7 @@
}
}
- $this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
- if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
- if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
- $this->setCommonData();
-
- return true;
- }
+ return( Array( "errorMessage" => $errorMessage, "successMessage" => $successMessage ));
+ }
}
-?>
+?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/adminresendconfirmationaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminresendconfirmationaction.class.php 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/class/action/admin/adminresendconfirmationaction.class.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -32,20 +32,14 @@
$this->setValidationErrorView( $view );
}
- /**
- * Carries out the specified action
- */
- function perform()
- {
+ private function sendConfirmation()
+ {
// get the blog and its settings
$this->_editBlogId = $this->_request->getValue( "blogId" );
$blogs = new Blogs();
$blogInfo = $blogs->getBlogInfo( $this->_editBlogId);
if( !$blogInfo ) {
- $this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_incorrect_blog_id" ));
- $this->setCommonData();
return false;
}
@@ -58,13 +52,38 @@
$blogOwner = $blogInfo->getOwnerInfo();
// generate and send the right link
SummaryMailer::sendConfirmationEmail( $blogOwner->getUsername());
+
+ return( true );
+ }
+
+ /**
+ * Carries out the specified action
+ */
+ function perform()
+ {
// print a confirmation message
$this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
- $this->_view->setSuccessMessage( $this->_locale->tr( "confirmation_message_resent_ok" ));
+
+ if( $this->sendConfirmation())
+ $this->_view->setSuccessMessage( $this->_locale->tr( "confirmation_message_resent_ok" ));
+ else
+ $this->_view->setErrorMessage( $this->_locale->tr( "error_sending_confirmation_message" ));
$this->setCommonData();
// better to return true if everything fine
return true;
}
+
+ function performAjax()
+ {
+ lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ if( $this->sendConfirmation())
+ $this->_view->setSuccessMessage( $this->_locale->tr( "confirmation_message_resent_ok" ));
+ else
+ $this->_view->setErrorMessage( $this->_locale->tr( "error_sending_confirmation_message" ));
+
+ return( true );
+ }
}
-?>
+?>
\ No newline at end of file
Added: plog/trunk/class/dao/misc/init.class.php
===================================================================
--- plog/trunk/class/dao/misc/init.class.php (rev 0)
+++ plog/trunk/class/dao/misc/init.class.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -0,0 +1,82 @@
+<?php
+
+ class Init
+ {
+ /**
+ * Initializes a blog by creating a default category, default welcome post, default
+ * album, etc.
+ *
+ * This method should be called *after* adding the blog to the database with
+ * Blogs::addBlog()
+ *
+ * @param blog
+ */
+ static function initBlog( $blog )
+ {
+ lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbum.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+
+ $config =& Config::getConfig();
+
+ // get the default global article category id
+ $globalArticleCategories = new GlobalArticleCategories();
+ $globalArticleCategoryId = $config->getValue("default_global_article_category_id");
+ if( !empty( $globalArticleCategoryId ) ) {
+ $globalArticleCategory = $globalArticleCategories->getGlobalArticleCategory( $globalArticleCategoryId );
+ if( empty( $globalArticleCategory ))
+ $globalArticleCategoryId = 0;
+ }
+ else {
+ $globalArticleCategoryId = 0;
+ }
+
+ // Get the blog's Locale object
+ $locale = $blog->getLocale();
+
+ // add a default category and a default post
+ $articleCategories = new ArticleCategories();
+ $articleCategory = new ArticleCategory( $locale->tr( "register_default_category" ), "", $blog->getId(), true );
+ $catId = $articleCategories->addArticleCategory( $articleCategory );
+ $articleTopic = $locale->tr( "register_default_article_topic" );
+ $articleText = $locale->tr( "register_default_article_text" );
+ $article = new Article( $articleTopic,
+ $articleText,
+ Array( $catId ),
+ $blog->getOwnerId(),
+ $blog->getId(),
+ POST_STATUS_PUBLISHED,
+ 0,
+ Array(),
+ "welcome" );
+ $article->setGlobalCategoryId( $globalArticleCategoryId ); // set the default ArticleGlobalCategory id to article
+ $t = new Timestamp();
+ $article->setDateObject( $t );
+ $article->setInSummary( false );
+ $articles = new Articles();
+ $articles->addArticle( $article );
+
+ // add a new first album so that users can start uploading stuff right away
+
+ $album = new GalleryAlbum( $blog->getId(), // blog id
+ $locale->tr( "register_default_album_name" ), // album name
+ $locale->tr( "register_default_album_description" ), // album description
+ GALLERY_RESOURCE_PREVIEW_AVAILABLE, // flags
+ 0, // no parent id
+ $t->getTimestamp(), // current date
+ Array(), // no properties
+ true ); // show the album in the interface
+ $albums = new GalleryAlbums();
+ $albums->addAlbum( $album );
+
+ // add a new default mylinkscategory
+ $linksCategory = new MyLinksCategory( $locale->tr("register_default_category" ), $blog->getId());
+ $linksCategories = new MyLinksCategories();
+ $linksCategories->addMyLinksCategory( $linksCategory );
+
+ return( true );
+ }
+ }
+?>
\ No newline at end of file
Modified: plog/trunk/class/view/admin/adminsiteblogslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminsiteblogslistview.class.php 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/class/view/admin/adminsiteblogslistview.class.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -21,7 +21,12 @@
{
$this->_pagerUrl = "?op=editSiteBlogs";
if( $this->_templateName == "" )
- $this->_templateName = "siteblogs";
+ $r =& Request::getRequest();
+ if( $r->isTableOnly())
+ $this->_templateName = "siteblogs_table";
+ else
+ $this->_templateName = "siteblogs";
+
$this->AdminTemplatedView( $blogInfo, $this->_templateName );
$this->_page = $this->getCurrentPageFromRequest();
Added: plog/trunk/js/ui/pages/blogs.js
===================================================================
--- plog/trunk/js/ui/pages/blogs.js (rev 0)
+++ plog/trunk/js/ui/pages/blogs.js 2007-08-05 18:54:53 UTC (rev 5796)
@@ -0,0 +1,34 @@
+Lifetype.UI.Pages.Blogs = function() {}
+
+Lifetype.UI.Pages.Blogs.addSubmitHook = function( form )
+{
+ Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json', {resetAfterSuccess:true} );
+}
+
+Lifetype.UI.Pages.Blogs.updateSubmitHook = function( form )
+{
+ Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json' );
+}
+
+Lifetype.UI.Pages.Blogs.submitBlogList = function (op)
+{
+ if ( document.getElementById("blogStatus").value == -1 )
+ window.alert(tr('error_select_status'));
+ else {
+ var oldOp = Lifetype.Dom.$( "siteBlogs" ).op.value;
+ Lifetype.Dom.$( "siteBlogs" ).op.value = op;
+ Lifetype.Forms.performRequest( Lifetype.Dom.$( 'siteBlogs' ));
+
+ Lifetype.Dom.$( "siteBlogs" ).op.value = oldOp;
+ }
+}
+
+YAHOO.util.Event.addListener( window, "load", function() {
+
+ var t = new Lifetype.Effects.Table( "blogsList" );
+ t.stripe();
+ t.highlightRows();
+
+ Lifetype.Forms.Events.performRequestSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+ Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+});
\ No newline at end of file
Modified: plog/trunk/js/ui/plogui.js
===================================================================
--- plog/trunk/js/ui/plogui.js 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/js/ui/plogui.js 2007-08-05 18:54:53 UTC (rev 5796)
@@ -1,13 +1,3 @@
-function submitBlogsList(op)
-{
- if ( document.getElementById("blogStatus").value == -1 )
- window.alert(tr('error_select_status'));
- else {
- document.getElementById("editBlogs").op.value = op;
- document.getElementById("editBlogs").submit();
- }
-}
-
function showProgressBar( elementToHide )
{
button = document.getElementById( elementToHide );
Modified: plog/trunk/locale/admin/locale_en_UK.php
===================================================================
--- plog/trunk/locale/admin/locale_en_UK.php 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/locale/admin/locale_en_UK.php 2007-08-05 18:54:53 UTC (rev 5796)
@@ -1291,4 +1291,6 @@
$messages['newGlobalArticleCategory'] = 'New Global Category';
$messages['editGlobalArticleCategories'] = 'Global Categories';
$messages['editSiteUsers'] = 'Users';
+
+$messages['error_sending_confirmation_message'] = 'There was an error resending the confirmation message';
?>
\ No newline at end of file
Modified: plog/trunk/templates/admin/createblog.template
===================================================================
--- plog/trunk/templates/admin/createblog.template 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/templates/admin/createblog.template 2007-08-05 18:54:53 UTC (rev 5796)
@@ -1,13 +1,13 @@
- <form name="addBlog" action="admin.php" method="post">
+ <form id="addBlog" name="addBlog" action="admin.php" method="post" onSubmit="Lifetype.UI.Pages.Blogs.addSubmitHook(this);return(false);">
<fieldset class="inputField">
<legend>{$locale->tr("createBlog")}</legend>
- {include file="$admintemplatepath/formvalidate.template"}
+ {include file="$admintemplatepath/formvalidateajax.template"}
<div class="field">
<label for="blogName">{$locale->tr("name")}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("blog_name_help")}</div>
<input type="text" style="width:95%" name="blogName" id="blogName" value="{$blogName}"/>
- {include file="$admintemplatepath/validate.template" field=blogName message=$locale->tr("error_invalid_blog_name")}
+ {include file="$admintemplatepath/validateajax.template" field=blogName}
</div>
{if $blogDomainsEnabled}
@@ -28,12 +28,8 @@
</option>
{/foreach}
</select>
- {include file="$admintemplatepath/validate.template"
- field=blogSubDomain
- message=$locale->tr("error_invalid_subdomain")}
- {include file="$admintemplatepath/validate.template"
- field=blogMainDomain
- message=$locale->tr("error_invalid_domain")}
+ {include file="$admintemplatepath/validateajax.template" field=blogSubDomain}
+ {include file="$admintemplatepath/validateajax.template" field=blogMainDomain}
</div>
{/if}
@@ -46,7 +42,7 @@
<a href="#" onclick="window.open('?op=siteUsersChooser','UserChooser','scrollbars=yes,resizable=yes,toolbar=no,height=450,width=600');">
{$locale->tr("select")}
</a>
- {include file="$admintemplatepath/validate.template" field=userId message=$locale->tr("error_incorrect_user")}
+ {include file="$admintemplatepath/validateajax.template" field=userId}
</div>
</fieldset>
<div class="buttons">
Modified: plog/trunk/templates/admin/siteblogs.template
===================================================================
--- plog/trunk/templates/admin/siteblogs.template 2007-08-05 18:54:16 UTC (rev 5795)
+++ plog/trunk/templates/admin/siteblogs.template 2007-08-05 18:54:53 UTC (rev 5796)
@@ -1,6 +1,7 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editSiteBlogs title=$locale->tr("editSiteBlogs")}
{js src="js/ui/pages/global.js"}
+{js src="js/ui/pages/blogs.js"}
<div id="list_nav_bar">
<div id="list_nav_select">
<form id="viewBlogs" action="admin.php" method="post">
@@ -45,78 +46,13 @@
<a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="Lifetype.UI.Pages.Global.switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
</div>
{/check_perms}
-<br style="clear:both" />
- <form id="editBlogs" method="post" action="admin.php">
+ <form id="siteBlogs" method="post" action="admin.php" onSubmit="Lifetype.Forms.performRequest(this);return(false);">
+ {include file="$admintemplatepath/viewvalidateajax.template"}
<div id="list">
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
- <table id="list" class="info" summary="{$locale->tr("editSiteBlogs")}">
- <thead>
- <tr>
- <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('editBlogs');" /></th>
- <th style="width:35%;">{$locale->tr("blog")}</th>
- <th style="width:25%">{$locale->tr("owner")}</th>
- <th style="width:15%;">{$locale->tr("status")}</th>
- <th style="width:10%;">{$locale->tr("quota")}</th>
- <th style="width:25%;">{$locale->tr("actions")}</th>
- </tr>
- </thead>
- <tbody>
- {foreach from=$siteblogs item=siteblog}
- <tr>
- <td><input class="checkbox" type="checkbox" name="blogIds[{counter}]" value="{$siteblog->getId()}"/></td>
- <td class="col_highlighted">
- {check_perms adminperm=update_site_blog}<a href="?op=editBlog&blogId={$siteblog->getId()}">{/check_perms}{$siteblog->getBlog()}{check_perms adminperm=update_site_blog}</a>{/check_perms}
- </td>
- <td>
- {assign var=ownerInfo value=$siteblog->getOwnerInfo()}
- <a href="?op=editSiteUser&userId={$ownerInfo->getId()}">{$ownerInfo->getUsername()}</a>
- </td>
- <td>
- {foreach from=$blogstatus key=name item=status}
- {if $siteblog->getStatus() == $status}
- {if $status == 2}<span style="color:red">{$locale->tr($name)}</span>
- {else}{$locale->tr($name)}{/if}
- {/if}
- {/foreach}
- </td>
- <td>
- {$siteblog->getResourcesQuota()|round:$locale}
- </td>
- <td>
- <div class="list_action_button">
- {check_perms adminperm=update_site_blog}
- <a href="?op=deleteBlog&blogId={$siteblog->getId()}" title="{$locale->tr("delete")}">
- <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
- </a>
- <a href="?op=editBlog&blogId={$siteblog->getId()}" title="{$locale->tr("edit")}">
- <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
- </a>
- {assign var=blogUrl value=$siteblog->getBlogRequestGenerator()}
- {assign var=blogname value=$siteblog->getBlog()}
- <a href="{$blogUrl->blogLink()}" title="{$locale->pr("goto_blog_page",$blogname)}">
- <img src="imgs/admin/icon_goto-16.png" alt="{$locale->pr("goto_blog_page",$blogname)}" />
- </a>
- {if $siteblog->getStatus() == 3}
- <a href="?op=resendConfirmation&blogId={$siteblog->getId()}" title="{$locale->tr("resend_confirmation_blog")}">
- <img src="imgs/admin/icon_mail-16.png" alt="{$locale->tr("resend_confirmation_blog")}" />
- </a>
- {/if}
- {/check_perms}
- {check_perms adminperm=edit_blog_admin_mode}
- <a href="?op=adminBlogSelect&blogId={$siteblog->getId()}&action=controlCenter" title="{$locale->tr("administrate_user_blog")}">
- <img src="imgs/admin/icon_admin_mode-16.png" alt="{$locale->tr("administrate_user_blog")}" />
- </a>
- {/check_perms}
- </div>
- </tr>
- {/foreach}
- </tbody>
- </table>
+ {include file="$admintemplatepath/siteblogs_table.template"}
</div>
<a name="bulkEdit"></a>
<div id="list_action_bar">
- {adminpager style="list"}
{check_perms adminperm=update_site_blog}
<input type="hidden" name="op" value="deleteBlogs"/>
<input type="submit" name="{$locale->tr("delete")}" value="{$locale->tr("delete")}"/>
@@ -132,7 +68,7 @@
{if $status != -1}<option value="{$status}">{$locale->tr($name)}</option>{/if}
{/foreach}
</select>
- <input type="button" name="changeBlogStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitBlogsList('changeBlogStatus');" />
+ <input type="button" name="changeBlogStatus" value="{$locale->tr("change_status")}" class="submit" onClick="Lifetype.UI.Pages.Blogs.submitBlogList('changeBlogStatus');" />
</fieldset>
</div>
{/check_perms}
Added: plog/trunk/templates/admin/siteblogs_table.template
===================================================================
--- plog/trunk/templates/admin/siteblogs_table.template (rev 0)
+++ plog/trunk/templates/admin/siteblogs_table.template 2007-08-05 18:54:53 UTC (rev 5796)
@@ -0,0 +1,64 @@
+<table id="blogsList" class="info" summary="{$locale->tr("editSiteBlogs")}">
+ <thead>
+ <tr>
+ <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('editBlogs');" /></th>
+ <th style="width:35%;">{$locale->tr("blog")}</th>
+ <th style="width:25%">{$locale->tr("owner")}</th>
+ <th style="width:15%;">{$locale->tr("status")}</th>
+ <th style="width:10%;">{$locale->tr("quota")}</th>
+ <th style="width:25%;">{$locale->tr("actions")}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {foreach from=$siteblogs item=siteblog}
+ <tr>
+ <td><input class="checkbox" type="checkbox" name="blogIds[{counter}]" value="{$siteblog->getId()}"/></td>
+ <td class="col_highlighted">
+ {check_perms adminperm=update_site_blog}<a href="?op=editBlog&blogId={$siteblog->getId()}">{/check_perms}{$siteblog->getBlog()}{check_perms adminperm=update_site_blog}</a>{/check_perms}
+ </td>
+ <td>
+ {assign var=ownerInfo value=$siteblog->getOwnerInfo()}
+ <a href="?op=editSiteUser&userId={$ownerInfo->getId()}">{$ownerInfo->getUsername()}</a>
+ </td>
+ <td>
+ {foreach from=$blogstatus key=name item=status}
+ {if $siteblog->getStatus() == $status}
+ {if $status == 2}<span style="color:red">{$locale->tr($name)}</span>
+ {else}{$locale->tr($name)}{/if}
+ {/if}
+ {/foreach}
+ </td>
+ <td>
+ {$siteblog->getResourcesQuota()|round:$locale}
+ </td>
+ <td>
+ <div class="list_action_button">
+ {check_perms adminperm=update_site_blog}
+ <a href="?op=deleteBlog&blogId={$siteblog->getId()}" title="{$locale->tr("delete")}" onClick="Lifetype.Forms.performRequest(this);return(false);">
+ <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+ </a>
+ <a href="?op=editBlog&blogId={$siteblog->getId()}" title="{$locale->tr("edit")}" rel="overlay">
+ <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+ </a>
+ {assign var=blogUrl value=$siteblog->getBlogRequestGenerator()}
+ {assign var=blogname value=$siteblog->getBlog()}
+ <a href="{$blogUrl->blogLink()}" title="{$locale->pr("goto_blog_page",$blogname)}">
+ <img src="imgs/admin/icon_goto-16.png" alt="{$locale->pr("goto_blog_page",$blogname)}" />
+ </a>
+ {/check_perms}
+ {check_perms adminperm=edit_blog_admin_mode}
+ <a href="?op=adminBlogSelect&blogId={$siteblog->getId()}&action=controlCenter" title="{$locale->tr("administrate_user_blog")}">
+ <img src="imgs/admin/icon_admin_mode-16.png" alt="{$locale->tr("administrate_user_blog")}" />
+ </a>
+ {/check_perms}
+ {if $siteblog->getStatus() == 3}
+ <a href="?op=resendConfirmation&blogId={$siteblog->getId()}" title="{$locale->tr("resend_confirmation_blog")}" onClick="Lifetype.Forms.performRequest(this);return(false);">
+ <img src="imgs/admin/icon_mail-16.png" alt="{$locale->tr("resend_confirmation_blog")}" />
+ </a>
+ {/if}
+ </div>
+ </tr>
+ {/foreach}
+ </tbody>
+</table>
+{adminpagerajax style="list"}
\ No newline at end of file
More information about the pLog-svn
mailing list