[pLog-svn] r518 - in plog/trunk: class/action/admin templates/admin
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri Dec 17 13:38:25 GMT 2004
Author: oscar
Date: 2004-12-17 13:38:24 +0000 (Fri, 17 Dec 2004)
New Revision: 518
Modified:
plog/trunk/class/action/admin/adminaddpostaction.class.php
plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php
plog/trunk/templates/admin/sendtrackbacks.template
Log:
now the "send trackbacks" page should work and look better
Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php 2004-12-17 12:54:06 UTC (rev 517)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php 2004-12-17 13:38:24 UTC (rev 518)
@@ -137,6 +137,7 @@
// we only have to send trackback pings if the article was published
// otherwise there is no need to...
+ $article->setId( $artId );
if( $article->getStatus() == POST_STATUS_PUBLISHED) {
// get the output from the xmlrpc pings but only if the user decided to do so!
if( $this->_sendPings ) {
Modified: plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php 2004-12-17 12:54:06 UTC (rev 517)
+++ plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php 2004-12-17 13:38:24 UTC (rev 518)
@@ -6,12 +6,11 @@
include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/trackbackclient.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/article.class.php" );
/**
* Action that shows a form to change the settings of the current blog.
@@ -30,40 +29,23 @@
function AdminSendTrackbacksAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
- }
- function validate()
- {
- $this->_trackbacks = $this->_request->getValue( "postLink" );
-
- // if there are no trackbacks, there is nothing to do here :)
- if( count($this->_trackbacks) == 0 ) {
- $this->_view = new AdminMessageView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("trackbacks_no_urls_selected"));
- $this->setCommonData();
-
- return false;
- }
-
- // get the post identifier and check that it is correct
- $this->_postId = $this->_request->getValue( "postId" );
- $validator = new IntegerValidator();
- if( !$validator->validate( $this->_postId )) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("error_incorrect_article_id"));
- $this->setCommonData();
-
- return false;
- }
-
- return true;
+ $this->registerFieldValidator( "postId", new IntegerValidator());
+ $this->registerFieldValidator( "postLink", new ArrayValidator());
+ $view = new AdminPostsListView( $this->_blogInfo );
+ $view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
+ $this->setValidationErrorView( $view );
}
- /**
+ /*
* Carries out the specified action
*/
function perform()
{
+ // fetch the validated data
+ $this->_trackbacks = $this->_request->getValue( "postLink" );
+ $this->_postId = $this->_request->getValue( "postId" );
+
// we need to have the post
$articles = new Articles();
$post = $articles->getBlogArticle( $this->_postId, $this->_blogInfo->getId());
@@ -73,7 +55,7 @@
// now check the results and give the user the possiblity to retry again with the
// ones that had some problem.
$errors = false;
- //print("results:");print_r($results);
+
$trackbackLinks = Array();
foreach( $results as $result ) {
if( $result["status"] == TRACKBACK_FAILED) {
@@ -105,8 +87,8 @@
if( $message != "" )
$message .= "<br/>";
$message .= $this->_locale->tr("trackbacks_received_all_hosts");
- $this->_view = new AdminMessageView( $this->_blogInfo );
- $this->_view->setMessage( $message );
+ $this->_view = new AdminPostsListView( $this->_blogInfo );
+ $this->_view->setSuccessMessage( $message );
$this->setCommonData();
}
}
Modified: plog/trunk/templates/admin/sendtrackbacks.template
===================================================================
--- plog/trunk/templates/admin/sendtrackbacks.template 2004-12-17 12:54:06 UTC (rev 517)
+++ plog/trunk/templates/admin/sendtrackbacks.template 2004-12-17 13:38:24 UTC (rev 518)
@@ -1,20 +1,25 @@
-{include file="admin/header.template"}
-
-<h3>{$locale->tr("send_trackback_pings")}</h3>
-{if $message != ""}
- <p>{$message}</p>
-{/if}
-<p>
-{$locale->tr("links_found")}<br/>
-<form name="pingThese" action="admin.php" method="post">
- {foreach from=$postlinks item=postlink}
- <input class="checkbox" type="checkbox" name="postLink[{counter}]" value="{$postlink}"/><a href="{$postlink}">{$postlink}</a><br/>
- {/foreach}
- <br/>
- <input type="submit" value="{$locale->tr("ping_selected")}" name="PingSelected"/>
- <input type="hidden" name="op" value="sendTrackbacks"/>
- <input type="hidden" name="postId" value="{$post->getId()}"/>
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=newPost title=$locale->tr("send_trackback_pings")}
+ {if $viewIsSuccess}
+ {include file="$admintemplatepath/successmessage.template" message=$viewSuccessMessage}<br/>
+ {/if}
+ {if $viewIsError}
+ {include file="$admintemplatepath/errormessage.template" message=$viewErrorMessage}<br/>
+ {/if}
+<form name="pingThese" method="post">
+ <fieldset class="inputField">
+ <label for="postLink">{$locale->tr("trackback_links")}</label>
+ <div class="formHelp">{$locale->tr("trackback_links_help")}</div>
+ {foreach from=$postlinks item=postlink}
+ <input class="checkbox" type="checkbox" name="postLink[{counter}]" value="{$postlink}" />
+ <a href="{$postlink}">{$postlink}</a><br/>
+ {/foreach}
+ </fieldset>
+ <div class="buttons">
+ <input type="submit" value="{$locale->tr("ping_selected")}" name="PingSelected"/>
+ <input type="hidden" name="op" value="sendTrackbacks"/>
+ <input type="hidden" name="postId" value="{$post->getId()}"/>
+ </div>
</form>
-</p>
-
-{include file="admin/footer.template"}
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
More information about the pLog-svn
mailing list