[pLog-svn] r6057 - in plog/trunk: class/action/admin js/ui/pages templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Mon Nov 19 08:48:09 EST 2007
Author: mark
Date: 2007-11-19 08:48:09 -0500 (Mon, 19 Nov 2007)
New Revision: 6057
Added:
plog/trunk/js/ui/pages/referers.js
Modified:
plog/trunk/class/action/admin/admindeletereferreraction.class.php
plog/trunk/class/action/admin/adminstatisticsaction.class.php
plog/trunk/templates/admin/statistics.template
Log:
Fixed the post stats view. Now we delete the referer use the ajax way.
Modified: plog/trunk/class/action/admin/admindeletereferreraction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletereferreraction.class.php 2007-11-19 11:23:34 UTC (rev 6056)
+++ plog/trunk/class/action/admin/admindeletereferreraction.class.php 2007-11-19 13:48:09 UTC (rev 6057)
@@ -1,19 +1,11 @@
<?php
-
-
-
-
-
-
-
-
/**
* \ingroup Action
* @private
*
* Allows to remove referrers
*/
- class AdminDeleteReferrerAction extends AdminAction
+ class AdminDeleteReferrerAction extends AdminAction
{
var $_articleId;
@@ -28,7 +20,7 @@
function AdminDeleteReferrerAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
-
+
// data validation
$this->_mode = $actionInfo->getActionParamValue();
if( $this->_mode == "deleteReferrer" )
@@ -38,14 +30,14 @@
$view = new AdminReferrersView( $this->_blogInfo );
$view->setErrorMessage( $this->_locale->tr("error_no_items_selected" ));
$this->setValidationErrorView( $view );
-
+
$this->requirePermission( "update_blog_stats" );
}
-
+
function perform()
{
$results = $this->_deleteReferrers();
-
+
$this->_view = new AdminReferrersView( $this->_blogInfo );
if( $results["errorMessage"] != "" ) $this->_view->setErrorMessage( $results["errorMessage"] );
if( $results["successMessage"] != "" ) $this->_view->setSuccessMessage( $results["successMessage"] );
@@ -53,7 +45,7 @@
// better to return true if everything fine
return true;
- }
+ }
/**
* Carries out the specified action
@@ -67,20 +59,20 @@
$this->_referrerIds[] = $this->_referrerId;
}
else
- $this->_referrerIds = $this->_request->getValue( "referrerIds" );
-
+ $this->_referrerIds = $this->_request->getValue( "referrerIds" );
+
$referrers = new Referers();
$errorMessage = "";
$successMessage = "";
$totalOk = 0;
-
+
foreach( $this->_referrerIds as $referrerId ) {
// fetch the referrer
$referrer = $referrers->getBlogReferer( $referrerId, $this->_blogInfo->getId());
-
+
// fire the pre-event
$this->notifyEvent( EVENT_PRE_REFERRER_DELETE, Array( "referrer" => &$referrer ));
-
+
if( !$referrer ) {
$errorMessage .= $this->_locale->pr("error_deleting_referrer2", $referrerId )."<br/>";
}
@@ -95,12 +87,12 @@
$successMessage = $this->_locale->pr("referrers_deleted_ok", $totalOk );
// fire the post-event
$this->notifyEvent( EVENT_POST_REFERRER_DELETE, Array( "referrer" => &$referrer ));
-
+
$clearCache = true;
}
- }
+ }
}
-
+
if( $clearCache ) {
// clear the cache if needed
CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
@@ -112,11 +104,11 @@
function performAjax()
{
$results = $this->_deleteReferrers();
-
-
+
+
$this->_view = new AdminAjaxView( $this->_blogInfo );
$this->_view->setMessage( $results );
- $this->_view->setSuccess( true );
+ $this->_view->setSuccess( true );
}
}
?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/adminstatisticsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminstatisticsaction.class.php 2007-11-19 11:23:34 UTC (rev 6056)
+++ plog/trunk/class/action/admin/adminstatisticsaction.class.php 2007-11-19 13:48:09 UTC (rev 6057)
@@ -1,18 +1,13 @@
<?php
-
-
-
-
-
/**
* \ingroup Action
* @private
*
* Action that shows statistics
*/
- class AdminStatisticsAction extends AdminAction
+ class AdminStatisticsAction extends AdminAction
{
-
+
var $_page;
/**
@@ -25,7 +20,7 @@
$this->requirePermission( "view_blog_stats" );
}
-
+
/**
* Carries out the specified action
*/
@@ -38,5 +33,10 @@
// better to return true if everything fine
return true;
}
+
+ function performAjax()
+ {
+ return( $this->perform() );
+ }
}
?>
\ No newline at end of file
Added: plog/trunk/js/ui/pages/referers.js
===================================================================
--- plog/trunk/js/ui/pages/referers.js (rev 0)
+++ plog/trunk/js/ui/pages/referers.js 2007-11-19 13:48:09 UTC (rev 6057)
@@ -0,0 +1,11 @@
+Lifetype.UI.Pages.Referers = function() {}
+
+YAHOO.util.Event.addListener( window, "load", function() {
+ var t = new Lifetype.Effects.Table( "list" );
+ t.stripe();
+ t.highlightRows();
+
+ // reload the list when successfully deleting an item and processing one of the forms
+ 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/templates/admin/statistics.template
===================================================================
--- plog/trunk/templates/admin/statistics.template 2007-11-19 11:23:34 UTC (rev 6056)
+++ plog/trunk/templates/admin/statistics.template 2007-11-19 13:48:09 UTC (rev 6057)
@@ -1,20 +1,21 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=Stats title=$locale->tr("Stats")}
+{js src="js/ui/pages/referers.js"}
<script type="text/javascript">
{literal}
YAHOO.util.Event.addListener( window, "load", function() {
var t = new Lifetype.Effects.Table( "list" );
t.stripe();
t.highlightRows();
-
+
// reload the list when successfully deleting an item and processing one of the forms
Lifetype.Forms.Events.performRequestSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
- Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+ Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
});
{/literal}
</script>
<form id="postStats" action="admin.php" method="post" onSubmit="Lifetype.Forms.performRequest(this);return(false);">
-{include file="$admintemplatepath/viewvalidateajax.template"}
+{include file="$admintemplatepath/viewvalidateajax.template"}
<div id="list">
{include file="$admintemplatepath/statistics_table.template"}
</div>
@@ -22,8 +23,8 @@
{check_perms perm=update_blog_stats}
<input type="submit" name="delete" value="{$locale->tr("delete")}" class="submit" />
<input type="hidden" name="op" value="deleteReferrers" />
- {/check_perms}
- </div>
+ {/check_perms}
+ </div>
</form>
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
More information about the pLog-svn
mailing list