[pLog-svn] r6045 - in plog/trunk: class/action/admin class/controller class/dao class/view/admin js/ui/pages locale/admin templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Thu Nov 15 21:50:31 EST 2007
Author: mark
Date: 2007-11-15 21:50:30 -0500 (Thu, 15 Nov 2007)
New Revision: 6045
Added:
plog/trunk/class/action/admin/adminnewsendtrackbacksaction.class.php
plog/trunk/class/view/admin/adminnewsendtrackbacksview.class.php
plog/trunk/templates/admin/sendtrackbacks_form.template
Modified:
plog/trunk/class/action/admin/adminaddpostaction.class.php
plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php
plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php
plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php
plog/trunk/class/action/admin/adminupdatepostaction.class.php
plog/trunk/class/controller/admincontrollermap.properties.php
plog/trunk/class/dao/trackbackclient.class.php
plog/trunk/js/ui/pages/posts.js
plog/trunk/locale/admin/locale_zh_TW.php
plog/trunk/templates/admin/newpost.template
plog/trunk/templates/admin/sendtrackbacks.template
Log:
Addpost, savedraft, sendping, sendtrackback works!!
But, updatepost, and sendping, sendtrackback after updatepost still not works.
Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,5 +1,4 @@
<?php
-
lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
/**
@@ -11,7 +10,7 @@
class AdminAddPostAction extends AdminPostManagementCommonAction
{
var $_article;
-
+
/**
* Constructor. If nothing else, it also has to call the constructor of the parent
* class, BlogAction with the same parameters
@@ -19,7 +18,7 @@
function AdminAddPostAction( $actionInfo, $request )
{
$this->AdminPostManagementCommonAction( $actionInfo, $request );
-
+
// for data validation purposes, posts must have at least a topic, an intro text, and a category
$this->registerFieldValidator( "postText", new StringValidator(), false, $this->_locale->tr("error_missing_post_text" ));
$this->registerFieldValidator( "postTopic", new StringValidator(), false, $this->_locale->tr("error_missing_post_topic" ));
@@ -28,10 +27,11 @@
$this->registerFieldValidator( "postUser", new IntegerValidator(), false, $this->_locale->tr("error_invalid_user" ));
$this->registerFieldValidator( "postStatus", new IntegerValidator(), false, $this->_locale->tr( "error_incorrect_value" ));
$this->registerFieldValidator( "locationId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_value" ));
+
$view = new AdminNewPostView( $this->_blogInfo );
$view->setErrorMessage( $this->_locale->tr("error_adding_post"));
$this->setValidationErrorView( $view );
-
+
// these fields do not need to be validated but should be there when we show the view once again
$this->registerField( "postSlug" );
$this->registerField( "sendNotification" );
@@ -41,12 +41,11 @@
$this->registerField( "commentsEnabled" );
$this->registerField( "customField" );
$this->registerField( "postDateTime" );
- $this->registerField( "trackbackUrls" );
// security checks
$this->requirePermission( "add_post" );
}
-
+
/**
* @private
*
@@ -57,7 +56,7 @@
$validateOk = parent::validate();
if( !$validateOk )
$this->clearAutoSaveCookie();
-
+
return $validateOk;
}
@@ -68,26 +67,24 @@
*/
function _savePostData( $article )
{
-
-
$status = $this->_postStatus;
-
+
$articles = new Articles();
- $article->setFields( $this->_getArticleCustomFields());
+ $article->setFields( $this->_getArticleCustomFields());
//print_r($article->_customFields);
-
+
// notifiy about this event
$this->notifyEvent( EVENT_PRE_POST_ADD, Array( "article" => &$article ));
-
+
// location data, if necessary
$article->setLocationId( $this->getLocationFromRequest());
-
+
// in case the post is already in the db
if( $this->_postId != "" ) {
$article->setId( $this->_postId );
$artId = $this->_postId;
$postSavedOk = $articles->updateArticle( $article );
-
+
if( $postSavedOk )
$artId = $this->_postId;
else
@@ -96,19 +93,15 @@
else {
$artId = $articles->addArticle( $article );
}
-
+
return $artId;
}
-
+
function saveArticle()
{
-
-
-
$this->_fetchCommonData();
- $this->_postId = $this->_request->getValue( "postId" );
-
+ $this->_postId = $this->_request->getValue( "postId" );
$this->_previewPost = $this->_request->getValue( "previewPost" );
$this->_addPost = $this->_request->getValue( "addPost" );
$this->_saveDraft = $this->_request->getValue( "isDraft" );
@@ -117,14 +110,14 @@
// the post to the database
$postText = Textfilter::xhtmlize($this->_postText);
- $article = new Article( $this->_postTopic,
- $postText,
+ $article = new Article( $this->_postTopic,
+ $postText,
$this->_postCategories,
- $this->_posterId,
- $this->_blogInfo->getId(),
- $this->_postStatus,
- 0,
- Array(),
+ $this->_posterId,
+ $this->_blogInfo->getId(),
+ $this->_postStatus,
+ 0,
+ Array(),
$this->_postSlug );
// set also the date before it's too late
$article->setDateObject( $this->_postTimestamp );
@@ -133,34 +126,29 @@
// save the article to the db
$artId = $this->_savePostData( $article );
-
+
$message = "";
-
+
if( $artId ) {
// train the filter, but only if enabled
if( $this->_config->getValue( "bayesian_filter_enabled" ) == true ) {
-
BayesianFilterCore::trainWithArticle( $article );
}
-
+
// add the article notification if requested to do so
if( $this->_sendNotification ) {
-
-
$artNotifications = new ArticleNotifications();
$artNotifications->addNotification( $artId, $this->_blogInfo->getId(), $this->_userInfo->getId());
$message .= " ".$this->_locale->tr("send_notifications_ok");
}
- $this->notifyEvent( EVENT_POST_POST_ADD, Array( "article" => &$article ));
-
- // empty the cache used by this blog
-
+ $this->notifyEvent( EVENT_POST_POST_ADD, Array( "article" => &$article ));
- CacheControl::resetBlogCache( $this->_blogInfo->getId());
+ // empty the cache used by this blog
+ CacheControl::resetBlogCache( $this->_blogInfo->getId());
}
-
- return( $article );
+
+ return( $article );
}
/**
@@ -169,13 +157,13 @@
function perform()
{
$article = $this->saveArticle();
-
+
// depending on the permission that the user has, we'll show one view or another
if( !$this->userHasPermission( "view_posts" ))
$view = "AdminNewPostView";
else
- $view = "AdminPostsListView";
-
+ $view = "AdminPostsListView";
+
// once we have built the object, we can add it to the database
$message = "";
if( $article ) {
@@ -185,7 +173,7 @@
$this->_view = new $view( $this->_blogInfo );
//$article->setId( $artId );
$message = $this->_locale->tr("post_added_ok");
-
+
// we only have to send trackback pings if the article was published
// otherwise there is no need to...
//$article->setId( $artId );
@@ -203,37 +191,26 @@
// and now check what to do with the trackbacks
if( $this->_sendTrackbacks ) {
-
-
// get the links from the text of the post
$postLinks = StringUtils::getLinks( $article->getText());
- // get the real trackback links from trackbackUrls
- $trackbackLinks = Array();
- foreach(explode( "\r\n", $this->_trackbackUrls ) as $host ) {
- trim($host);
- if( $host != "" && $host != "\r\n" && $host != "\r" && $host != "\n" )
- array_push( $trackbackLinks, $host );
- }
-
// if no links, there is nothing to do
- if( count($postLinks) == 0 && count($trackbackLinks) == 0 ) {
+ if( count($postLinks) == 0 ) {
$this->_view = new $view( $this->_blogInfo );
$this->_view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
}
else {
- $this->_view = new AdminTemplatedView( $this->_blogInfo, "sendtrackbacks" );
- $this->_view->setValue( "post", $article );
- $this->_view->setValue( "postLinks", $postLinks );
- $this->_view->setValue( "trackbackLinks", $trackbackLinks );
+ $this->_view = new AdminNewSendTrackbacksView( $this->_blogInfo );
+ $this->_view->setValue( "post", $article);
+ $this->_view->setValue( "postLinks", $postLinks );
}
}
- $this->_view->setSuccessMessage( $message );
+ $this->_view->setSuccessMessage( $message );
}
else {
$this->_view = new $view( $this->_blogInfo );
$this->_view->setSuccessMessage( $this->_locale->tr("post_added_not_published") );
-
+
$this->notifyEvent( EVENT_POST_POST_ADD, Array( "article" => &$article ));
}
}
@@ -243,11 +220,11 @@
}
$this->setCommonData();
-
+
// better to return true if everything fine
return true;
}
-
+
function clearAutoSaveCookie()
{
$rg = $this->_blogInfo->getBlogRequestGenerator();
@@ -262,12 +239,19 @@
function performAjax()
{
-
$this->_view = new AdminAjaxView( $this->_blogInfo );
-
+
if(( $article = $this->saveArticle())) {
if( $article->getStatus() == POST_STATUS_PUBLISHED ) {
$message = $this->_locale->tr( "post_added_ok" );
+ if( $this->_sendPings) {
+ $t = new Timestamp();
+ $today = $t->getTimestamp();
+ if($today > $article->getDate()){
+ $pingsOutput = $this->sendXmlRpcPings();
+ $message .= "<br/><br/>".$pingsOutput;
+ }
+ }
}
else {
$message = $this->_locale->tr( "post_added_not_published" );
@@ -278,9 +262,9 @@
else {
$this->_view->setErrorMessage( $this->_locale->tr("error_adding_post" ));
}
-
+
$this->clearAutoSaveCookie();
-
+
return( true );
}
}
Added: plog/trunk/class/action/admin/adminnewsendtrackbacksaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewsendtrackbacksaction.class.php (rev 0)
+++ plog/trunk/class/action/admin/adminnewsendtrackbacksaction.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -0,0 +1,72 @@
+<?php
+ /**
+ * \ingroup Action
+ * @private
+ *
+ * Action that shows a form to change the settings of the current blog.
+ */
+ class AdminNewSendTrackbacksAction extends AdminAction
+ {
+ var $_postId;
+ var $_trackbackUrls;
+
+ /**
+ * Constructor. If nothing else, it also has to call the constructor of the parent
+ * class, BlogAction with the same parameters
+ */
+ function AdminNewSendTrackbacksAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ $this->registerFieldValidator( "postId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_article_id" ) );
+ $this->registerField( "trackbackUrls" );
+
+ $this->requirePermission( "add_post" );
+ }
+ /*
+ * Carries out the specified action
+ */
+ function perform()
+ {
+ $this->_postId = $this->_request->getValue( "postId" );
+ $this->_trackbackUrls = $this->_request->getValue( "trackbackUrls" );
+
+ // we need to have the post
+ $articles = new Articles();
+ $post = $articles->getBlogArticle( $this->_postId, $this->_blogInfo->getId());
+
+ if( !$post )
+ {
+ if( $this->_request->isXHR())
+ $this->_view = new AdminErrorDialogView( $this->_blogInfo );
+ else
+ {
+ if( $this->userHasPermission( "view_posts" ))
+ $this->_view = new AdminPostsListView( $this->_blogInfo );
+ else
+ $this->_view = new AdminNewPostView( $this->_blogInfo );
+ }
+
+ $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_article" ) );
+ $this->setCommonData();
+
+ return false;
+ }
+
+ // get the links from the text of the post
+ $postLinks = StringUtils::getLinks( $post->getText());
+
+ $this->_view = new AdminNewSendTrackbacksView( $this->_blogInfo );
+ $this->_view->setValue( "post", $post);
+ $this->_view->setValue( "postLinks", $postLinks );
+ $this->_view->setValue( "trackbackUrls", $trackbackUrls );
+ $this->setCommonData();
+
+ return true;
+ }
+
+ function performAjax()
+ {
+ return( $this->perform());
+ }
+ }
+?>
Modified: plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,13 +1,13 @@
<?php
-
-
-
-
-
-
-
+
+
+
+
+
+
+
/**
* \ingroup Action
* @private
@@ -29,7 +29,6 @@
var $_addPost;
var $_commentsEnabled;
var $_globalCategoryId;
- var $_trackbackUrls;
var $_posterId;
// stuff about the date
var $_postYear;
@@ -41,14 +40,14 @@
// custom fields
var $_customFields;
var $_postSlug;
- var $_postId;
-
-
- function AdminPostManagementCommonAction( $actionInfo, $request )
+ var $_postId;
+
+
+ function AdminPostManagementCommonAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
}
-
+
function _fetchPostDateInformation()
{
@@ -64,7 +63,7 @@
$this->_postYear = $dateParts[2];
$this->_postHour = $timeParts[0];
$this->_postMinutes = $timeParts[1];
-
+
$this->_postTimestamp->setMinutes( $this->_postMinutes );
$this->_postTimestamp->setHour( $this->_postHour );
$this->_postTimestamp->setDay( $this->_postDay );
@@ -72,7 +71,7 @@
$this->_postTimestamp->setYear( $this->_postYear );
}
}
-
+
/**
* @private
*/
@@ -90,7 +89,7 @@
"09", "10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "20", "21", "22", "23" );
}
-
+
/**
* sends xmlrpc pings
*/
@@ -101,14 +100,14 @@
if( !$this->_config->getValue( "xmlrpc_ping_enabled", false ))
return "";
-
+
$notifications = new ArticleNotifications();
$resultArray = $notifications->updateNotify( $this->_blogInfo );
-
+
// check to prevent throwing an error if the list is empty
if( $resultArray == "" || empty( $resultArray ))
return "";
-
+
$message = "";
foreach( $resultArray as $host => $result ) {
if( $result == "OK" )
@@ -122,16 +121,16 @@
return $message;
}
-
+
function _fetchCommonData()
{
$this->_postText = $this->_request->getValue( "postText" );
-
+
// check if javascript code is allowed in posts
$config =& Config::getConfig();
if( !$config->getValue( "allow_javascript_blocks_in_posts", false )) {
$this->_postText = Textfilter::filterJavaScript( $this->_postText );
- }
+ }
$this->_postText = trim(Textfilter::xhtmlize( $this->_postText ));
$this->_postTopic = trim(Textfilter::xhtmlize(Textfilter::filterAllHTML($this->_request->getValue( "postTopic" ))));
$this->_posterId = $this->_request->getValue( "posterId" );
@@ -140,35 +139,34 @@
$this->_postStatus = $this->_request->getValue( "postStatus" );
$this->_sendNotification = $this->_request->getValue( "sendNotification" );
$this->_sendTrackbacks = $this->_request->getValue( "sendTrackbacks" );
- $this->_sendPings = $this->_request->getValue( "sendPings" );
+ $this->_sendPings = $this->_request->getValue( "sendPings" );
$this->_postId = $this->_request->getValue( "postId" );
$this->_commentsEnabled = $this->_request->getValue( "commentsEnabled" );
$this->_globalArticleCategoryId = $this->_request->getValue( "globalArticleCategoryId" );
- $this->_trackbackUrls = $this->_request->getValue( "trackbackUrls" );
-
+
// fetch the custom fields
- $this->_customFields = $this->_request->getValue( "customField" );
-
+ $this->_customFields = $this->_request->getValue( "customField" );
+
// fetch the timestamp that the post will have
$this->_fetchPostDateInformation();
// information about the poster but only if the user is supposed to be able to change it
- if( $this->_userInfo->hasPermissionByName( "update_all_user_articles", $this->_blogInfo->getId()) ||
- $this->_userInfo->isSiteAdmin() ||
- $this->_blogInfo->getOwnerId() == $this->_userInfo->getId()) {
+ if( $this->_userInfo->hasPermissionByName( "update_all_user_articles", $this->_blogInfo->getId()) ||
+ $this->_userInfo->isSiteAdmin() ||
+ $this->_blogInfo->getOwnerId() == $this->_userInfo->getId()) {
$this->_posterId = $this->_request->getValue( "postUser" );
}
else {
$this->_posterId = $this->_userInfo->getId();
- }
+ }
}
-
+
/**
* @private
*/
function _getArticleCustomFields()
{
- // prepare the custom fields
+ // prepare the custom fields
$fields = Array();
if( is_array($this->_customFields)) {
foreach( $this->_customFields as $fieldId => $fieldValue ) {
@@ -181,14 +179,14 @@
"field_description" => "", // don't know
"article_id" => -1, // we don't know yet!
"blog_id" => $this->_blogInfo->getId(),
- "id" => -1 );
+ "id" => -1 );
// let's get the right value
$customField = CustomFieldValueFactory::getCustomFieldValueByFieldId( $fieldId, $row );
$fieldName = $customField->getName();
$fields["$fieldName"] = $customField;
}
- }
-
+ }
+
return $fields;
}
}
Modified: plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,6 +1,6 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
/**
* \ingroup Action
@@ -8,7 +8,7 @@
*/
class AdminSaveDraftArticleAjaxAction extends AdminAjaxAction
{
-
+
var $_postText;
var $_postTopic;
@@ -79,7 +79,7 @@
$status = POST_STATUS_DRAFT;
$articles = new Articles();
$postText = Textfilter::xhtmlize($this->_postText);
-
+
$article = new Article( $this->_postTopic, $postText, $this->_postCategories, $this->_userInfo->getId(),
$this->_blogInfo->getId(), $status, 0, Array(), $this->_postSlug );
// set also the date before it's too late
@@ -88,7 +88,7 @@
// prepare the custom fields
$fields = Array();
if( is_array($this->_customFields)) {
-
+
foreach( $this->_customFields as $fieldId => $fieldValue ) {
// 3 of those parameters are not really need when creating a new object... it's enough that
// we know the field definition id.
@@ -126,5 +126,10 @@
return true;
}
+
+ function performAjax()
+ {
+ return( $this->perform() );
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,26 +1,19 @@
<?php
-
-
-
-
-
-
-
-
/**
* \ingroup Action
* @private
*
* Action that shows a form to change the settings of the current blog.
*/
- class AdminSendTrackbacksAction extends AdminAction
+ class AdminSendTrackbacksAction extends AdminAction
{
var $_postLinks;
+ var $_trackbackUrls;
var $_trackbackLinks;
+ var $_message;
var $_postId;
- var $_locale;
/**
* Constructor. If nothing else, it also has to call the constructor of the parent
@@ -30,112 +23,100 @@
{
$this->AdminAction( $actionInfo, $request );
+ $this->registerFieldValidator( "postLinks", new ArrayValidator( new StringValidator()), true, $this->_locale->tr("error_no_post_links_select") );
+ $this->registerFieldValidator( "trackbackUrls", new StringValidator(), true, $this->_locale->tr("error_no_trackback_urls") );
+ $this->registerFieldValidator( "postId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_article_id") );
+
+ $view = new AdminPostsListView( $this->_blogInfo );
+ $view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
+ $this->setValidationErrorView( $view );
+
$this->requirePermission( "add_post" );
}
- function validate()
- {
- // fetch the validated data
- $this->_postLinks = $this->_request->getValue( "postLink" );
- $this->_trackbackLinks = $this->_request->getValue( "trackbackLink" );
- $this->_postId = $this->_request->getValue( "postId" );
-
- $intval = new IntegerValidator();
- if( !$intval->validate( $this->_postId ) ) {
- $this->_view = new AdminPostsListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id"));
- $this->setCommonData();
-
- return false;
- }
-
- $arrryval = new ArrayValidator();
- if( !$arrryval->validate( $this->_postLinks ) && !$arrryval->validate( $this->_trackbackLinks ) ) {
- $this->_view = new AdminPostsListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
- $this->setCommonData();
-
- return false;
- }
-
- return true;
- }
-
- /*
- * Carries out the specified action
- */
- function perform()
+ function sendTrackbacks()
{
+ // fetch the parameters that we need
+ $this->_postId = $this->_request->getValue( "postId" );
+ $this->_postLinks = $this->_request->getValue( "postLinks" );
+ $this->_trackbackUrls = $this->_request->getValue( "trackbackUrls" );
+
// we need to have the post
$articles = new Articles();
- $post = $articles->getBlogArticle( $this->_postId, $this->_blogInfo->getId());
-
+ $this->_post = $articles->getBlogArticle( $this->_postId, $this->_blogInfo->getId());
+
// now check the results and give the user the possiblity to retry again with the
// ones that had some problem.
$errors = false;
// and now start sending the trackback pings
$tbClient = new TrackbackClient();
- $postLinks = Array();
- $trackbackLinks = Array();
- $message = "";
-
+ $this->_message = "";
+
if ( $this->_postLinks && count($this->_postLinks) != 0 ) {
- $autoDiscoverResults = $tbClient->sendTrackbacks( $this->_postLinks, $post, $this->_blogInfo);
+ $autoDiscoverResults = $tbClient->sendTrackbacks( $this->_postLinks, $this->_post, $this->_blogInfo);
foreach( $autoDiscoverResults as $result ) {
if( $result["status"] == TRACKBACK_FAILED) {
- // add them again to the list of hosts
- $errors = true;
- array_push( $postLinks, $result["url"] );
+ $this->_message .= $this->_locale->tr("trackbacks_sent_failed")."<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
}
else if( $result["status"] == TRACKBACK_SUCCESS ) {
- if( $message == "" ) $message = $this->_locale->tr("trackbacks_sent_ok")."<br/><br/>";
- $message .= "<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
+ $this->_message .= $this->_locale->tr("trackbacks_sent_ok")."<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
}
else if( $result["status"] == TRACKBACK_UNAVAILABLE ) {
- $message .= $this->_locale->tr("trackbacks_no_trackback")."<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
+ $this->_message .= $this->_locale->tr("trackbacks_no_trackback")."<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
}
}
}
+ // get the real trackback links from trackbackUrls
+ $this->_trackbackLinks = Array();
+ foreach(explode( "\r\n", $this->_trackbackUrls ) as $host ) {
+ trim($host);
+ if( $host != "" && $host != "\r\n" && $host != "\r" && $host != "\n" )
+ array_push( $this->_trackbackLinks, $host );
+ }
+
if ( $this->_trackbackLinks && count($this->_trackbackLinks) != 0 ) {
- $directPingResults = $tbClient->sendDirectTrackbacks( $this->_trackbackLinks, $post, $this->_blogInfo);
-
+ $directPingResults = $tbClient->sendDirectTrackbacks( $this->_trackbackLinks, $this->_post, $this->_blogInfo);
+
foreach( $directPingResults as $result ) {
if( $result["status"] == TRACKBACK_FAILED) {
- // add them again to the list of hosts
- $errors = true;
- array_push( $trackbackLinks, $result["url"] );
+ $this->_message .= $this->_locale->tr("trackbacks_sent_failed")."<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
}
else if( $result["status"] == TRACKBACK_SUCCESS ) {
- if( $message == "" ) $message = $this->_locale->tr("trackbacks_sent_ok")."<br/><br/>";
- $message .= "<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
+ $this->_message .= $this->_locale->tr("trackbacks_sent_ok")."<a href=\"".$result["url"]."\">".$result["url"]."</a><br/>";
}
}
}
+ }
- // if there were errors, we let the user try again
- if( $errors ) {
- if( $message != "" )
- $message .= "<br/>";
- $message .= $this->_locale->tr("error_sending_trackbacks");
- $this->_view = new AdminTemplatedView( $this->_blogInfo, "sendtrackbacks" );
- $this->_view->setErrorMessage( $message );
- $this->_view->setValue( "post", $post);
- $this->_view->setValue( "postLinks", $postLinks );
- $this->_view->setValue( "trackbackLinks", $trackbackLinks );
- $this->setCommonData();
- }
- else {
- if( $this->userHasPermission( "view_posts" ))
- $this->_view = new AdminPostsListView( $this->_blogInfo );
- else
- $this->_view = new AdminNewPostView( $this->_blogInfo );
-
- $this->_view->setSuccessMessage( $message );
- $this->setCommonData();
- }
+ /*
+ * Carries out the specified action
+ */
+ function perform()
+ {
+ $this->sendTrackbacks();
+
+ if( $this->userHasPermission( "view_posts" ))
+ $this->_view = new AdminPostsListView( $this->_blogInfo );
+ else
+ $this->_view = new AdminNewPostView( $this->_blogInfo );
+
+ $this->_view->setSuccessMessage( $this->_message );
+ $this->setCommonData();
}
+
+ function performAjax()
+ {
+ $this->sendTrackbacks();
+
+ $this->_view = new AdminAjaxView( $this->_blogInfo );
+ $this->_view->setSuccess( true );
+ $this->_view->setResult( $this->_post );
+ $this->_view->setMessage( $this->_message );
+
+ return( true );
+ }
}
-?>
+?>
\ No newline at end of file
Modified: plog/trunk/class/action/admin/adminupdatepostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatepostaction.class.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/action/admin/adminupdatepostaction.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,7 +1,7 @@
<?php
lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
-
+
/**
* \ingroup Action
* @private
@@ -20,7 +20,7 @@
function AdminUpdatePostAction( $actionInfo, $request )
{
$this->AdminPostManagementCommonAction( $actionInfo, $request );
-
+
// for data validation purposes, posts must have at least a topic, an intro text, and a category
$this->registerFieldValidator( "postText", new StringValidator(), false, $this->_locale->tr("error_missing_post_text" ));
$this->registerFieldValidator( "postTopic", new StringValidator(), false, $this->_locale->tr("error_missing_post_topic" ));
@@ -42,7 +42,7 @@
$view->setErrorMessage( $this->_locale->tr("error_updating_post"));
$this->setValidationErrorView( $view );
-
+
// these fields do not need to be validated but should be there when we show the view once again
$this->registerField( "postExtendedText" );
$this->registerField( "postSlug" );
@@ -52,21 +52,20 @@
$this->registerField( "postId" );
$this->registerField( "commentsEnabled" );
$this->registerField( "customField" );
- $this->registerField( "postDateTime" );
- $this->registerField( "trackbackUrls" );
+ $this->registerField( "postDateTime" );
$this->requirePermission( "update_post" );
}
-
+
/**
* Carries out the specified action
*/
function perform()
- {
+ {
// fetch the data
- $this->_fetchCommonData();
+ $this->_fetchCommonData();
$this->_postId = $this->_request->getValue( "postId" );
-
+
// fetch the old post
$articles = new Articles();
$post = $articles->getBlogArticle( $this->_postId, $this->_blogInfo->getId());
@@ -88,7 +87,7 @@
$this->_view->setErrorMessage( $this->_locale->tr("error_can_only_update_own_articles" ));
$this->setCommonData();
- return false;
+ return false;
}
}
@@ -100,13 +99,13 @@
$post->setDateObject( $this->_postTimestamp );
$post->setCommentsEnabled( $this->_commentsEnabled );
$post->setPostSlug( $this->_postSlug );
- $post->setGlobalCategoryId( $this->_globalArticleCategoryId );
+ $post->setGlobalCategoryId( $this->_globalArticleCategoryId );
$post->setUser( $this->_posterId );
-
+
// set the modification date
$blogSettings = $this->_blogInfo->getSettings();
$modifDate = Timestamp::getDateWithOffset( new Timestamp(), $blogSettings->getValue( "time_offset", 0 ));
- $post->setModificationDate( $modifDate );
+ $post->setModificationDate( $modifDate );
// prepare the custom fields
$fields = Array();
@@ -119,13 +118,13 @@
}
$post->setFields( $fields );
}
-
+
// location data, if necessary
- $post->setLocationId( $this->getLocationFromRequest());
-
+ $post->setLocationId( $this->getLocationFromRequest());
+
// fire the pre event
$this->notifyEvent( EVENT_PRE_POST_UPDATE, Array( "article" => &$post ));
-
+
// and finally save the post to the database
if( !$articles->updateArticle( $post )) {
$this->_view = new AdminPostsListView( $this->_blogInfo );
@@ -135,9 +134,9 @@
return false;
}
-
+
// clean up the cache
- CacheControl::resetBlogCache( $this->_blogInfo->getId());
+ CacheControl::resetBlogCache( $this->_blogInfo->getId());
// create the definitive view
$this->_view = new AdminPostsListView( $this->_blogInfo );
@@ -163,7 +162,7 @@
$message .= " ".$this->_locale->tr("notification_removed");
}
}
-
+
// only send trackbacks and xmlrpc pings
// when a post is "published"
if( $post->getStatus() == POST_STATUS_PUBLISHED ) {
@@ -180,7 +179,7 @@
array_push( $trackbackLinks, $host );
}
}
-
+
// if the "send xmlrpc pings" checkbox was enabled,
// do something about it...
if( $this->_sendPings ) {
@@ -189,7 +188,7 @@
if($today > $post->getDate()){
$message .= "<br/><br/>".$this->sendXmlRpcPings();
}
- }
+ }
// and now check what to do with the trackbacks
if( $this->_sendTrackbacks ) {
// if no links, there is nothing to do
@@ -216,7 +215,7 @@
// show the message
$this->_view->setSuccessMessage( $message );
-
+
// and fire the post event
$this->notifyEvent( EVENT_POST_POST_UPDATE, Array( "article" => &$post ));
@@ -227,7 +226,7 @@
function performAjax()
{
-
+
}
}
?>
\ No newline at end of file
Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/controller/admincontrollermap.properties.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -101,6 +101,7 @@
// show statistics about a post
$actions["postStats"] = "AdminPostStatsAction";
// sends trackbacks
+ $actions["newSendTrackbacks"] = "AdminNewSendTrackbacksAction";
$actions["sendTrackbacks"] = "AdminSendTrackbacksAction";
// plugin center
$actions["pluginCenter"] = "AdminPluginCenterAction";
@@ -357,23 +358,23 @@
$actions["deleteOutboxPrivateMessage"] = "AdminDeleteOutboxPrivateMessageAction";
// template editor
$actions["editTemplate"] = "AdminEditTemplateAction";
- $actions["editTemplateFile"] = "AdminEditTemplateFileAction";
+ $actions["editTemplateFile"] = "AdminEditTemplateFileAction";
$actions["updateTemplateFile"] = "AdminUpdateTemplateFileAction";
$actions["deleteTemplateFile"] = "AdminDeleteTemplateFileAction";
- $actions["addTemplateFolder"] = "AdminAddTemplateFolderAction";
+ $actions["addTemplateFolder"] = "AdminAddTemplateFolderAction";
$actions["copyTemplateFile"] = "AdminCopyTemplateFileAction";
$actions["copyTemplateSet"] = "AdminCopyTemplateSetAction";
- $actions["newTemplateFile"] = "AdminNewTemplateFileAction";
- $actions["uploadTemplateFile"] = "AdminUploadTemplateFileAction";
+ $actions["newTemplateFile"] = "AdminNewTemplateFileAction";
+ $actions["uploadTemplateFile"] = "AdminUploadTemplateFileAction";
// template editor for blog-specific templates
$actions["editBlogTemplate"] = "AdminEditBlogTemplateAction";
- $actions["editBlogTemplateFile"] = "AdminEditBlogTemplateFileAction";
+ $actions["editBlogTemplateFile"] = "AdminEditBlogTemplateFileAction";
$actions["updateBlogTemplateFile"] = "AdminUpdateBlogTemplateFileAction";
$actions["deleteBlogTemplateFile"] = "AdminDeleteBlogTemplateFileAction";
- $actions["addBlogTemplateFolder"] = "AdminAddBlogTemplateFolderAction";
+ $actions["addBlogTemplateFolder"] = "AdminAddBlogTemplateFolderAction";
$actions["copyBlogTemplateFile"] = "AdminCopyBlogTemplateFileAction";
- $actions["copyBlogTemplateSet"] = "AdminCopyBlogTemplateSetAction";
- $actions["newBlogTemplateFile"] = "AdminNewBlogTemplateFileAction";
+ $actions["copyBlogTemplateSet"] = "AdminCopyBlogTemplateSetAction";
+ $actions["newBlogTemplateFile"] = "AdminNewBlogTemplateFileAction";
$actions["uploadBlogTemplateFile"] = "AdminUploadBlogTemplateFileAction";
// returns some javascript code containing the locale strings needed by the javascript classes
$actions["js"] = "AdminJsAction";
Modified: plog/trunk/class/dao/trackbackclient.class.php
===================================================================
--- plog/trunk/class/dao/trackbackclient.class.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/class/dao/trackbackclient.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,11 +1,11 @@
<?php
-
-
-
-
-
+
+
+
+
+
define( "TRACKBACK_SUCCESS", 0 );
define( "TRACKBACK_FAILED", 1 );
define( "TRACKBACK_UNAVAILABLE", 2 );
@@ -18,7 +18,7 @@
*
* \ingroup DAO
*/
- class TrackbackClient
+ class TrackbackClient
{
/**
@@ -26,7 +26,7 @@
*/
function TrackbackClient()
{
-
+
}
/**
@@ -228,12 +228,12 @@
{
$results = Array();
-
+
// to avoid annoying errors with the foreach() loop in case somebody's passing
// something which is not an array
if( !is_array( $trackbacks ))
$trackbacks = Array();
-
+
foreach( $trackbacks as $trackback )
{
// try and send a trackback
Added: plog/trunk/class/view/admin/adminnewsendtrackbacksview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminnewsendtrackbacksview.class.php (rev 0)
+++ plog/trunk/class/view/admin/adminnewsendtrackbacksview.class.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -0,0 +1,31 @@
+<?php
+
+ /**
+ * \ingroup View
+ * @private
+ *
+ * shows the view to add a new send trackbacks
+ */
+ class AdminNewSendTrackbacksView extends AdminTemplatedView
+ {
+ /**
+ * Constructor. If nothing else, it also has to call the constructor of the parent
+ * class, BlogAction with the same parameters
+ */
+ function AdminNewSendTrackbacksView( $blogInfo, $params = Array())
+ {
+ if( Request::isXHR())
+ $this->AdminTemplatedView( $blogInfo, "sendtrackbacks_form" );
+ else
+ $this->AdminTemplatedView( $blogInfo, "sendtrackbacks" );
+ }
+
+ /**
+ * Carries out the specified action
+ */
+ function render()
+ {
+ parent::render();
+ }
+ }
+?>
\ No newline at end of file
Modified: plog/trunk/js/ui/pages/posts.js
===================================================================
--- plog/trunk/js/ui/pages/posts.js 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/js/ui/pages/posts.js 2007-11-16 02:50:30 UTC (rev 6045)
@@ -9,7 +9,7 @@
Lifetype.UI.Pages.Posts.submitPostsList = function(op)
{
var oldOp = document.getElementById("postsList").op.value;
-
+
if ( op == 'changePostsStatus' ) {
if ( document.getElementById("postsList").postStatus.value == -1 )
window.alert(tr('error_post_status'));
@@ -32,7 +32,7 @@
// same thing here with the form submit
Lifetype.Forms.performRequest(Lifetype.Dom.$( 'postsList' ));
- }
+ }
}
else if( op == 'changePostsCategory' ) {
//if ( document.getElementById("postsList").postLocation.value == -1 ) {
@@ -44,21 +44,21 @@
// same thing here with the form submit
Lifetype.Forms.performRequest(Lifetype.Dom.$( 'postsList' ));
- }
+ }
}
-
+
document.getElementById("postsList").op.value = oldOp;
-
+
return( false );
}
Lifetype.UI.Pages.Posts.selectOperation = function( form, mode )
{
- if( Lifetype.UI.Pages.Posts.preview ) {
+ if( Lifetype.UI.Pages.Posts.preview ) {
document.postEdit.op.value = "previewPost";
document.postEdit.target = "admin";
window.open("", form.target, "scrollbars=yes,resizable=yes,toolbar=no" );
-
+
return true;
}
else {
@@ -83,17 +83,17 @@
/**
* The following functions are called when clicking the "add category" button
*/
-Lifetype.UI.Pages.Posts.addArticleCategoryAjax = function()
+Lifetype.UI.Pages.Posts.addArticleCategoryAjax = function()
{
var categoryName = Lifetype.Dom.$F('newArticleCategory');
if (categoryName != '') {
var params = 'op=addArticleCategory' + '&categoryName=' + encodeURIComponent(categoryName) + "&output=json";
-
+
// build the full URL
var url = Lifetype.Config.getValue( 'admin_base_url' ) + "?" + params;
-
- var transaction = YAHOO.util.Connect.asyncRequest( 'GET', url, { success:Lifetype.UI.Pages.Posts.addArticleCategoryOption, failure:Lifetype.UI.Pages.Posts.addArticleCategoryOption } );
-
+
+ var transaction = YAHOO.util.Connect.asyncRequest( 'GET', url, { success:Lifetype.UI.Pages.Posts.addArticleCategoryOption, failure:Lifetype.UI.Pages.Posts.addArticleCategoryOption } );
+
// show the "loading" message
Lifetype.Dom.$( 'newArticleCategory' ).value = tr('saving_message');
Lifetype.Dom.$( 'addArticleCategory' ).disabled = 1;
@@ -109,8 +109,8 @@
// we have no category selected!
window.alert(tr( 'msgErrorNoCategorySelected' ));
return false;
- }
-
+ }
+
return true;
}
@@ -153,7 +153,7 @@
Lifetype.UI.Pages.Posts.saveDraftArticleAjax = function()
{
// if there is no category selected, then we won't save a draft!
- form = document.getElementById( "newPost" );
+ form = document.getElementById( "postEdit" );
if( form.postTopic.value == '' ) {
window.alert( tr('error_missing_post_topic'));
@@ -173,14 +173,14 @@
}
if( !Lifetype.UI.Pages.Posts.submitNewPost( form ))
- return false;
+ return false;
- var formData = Lifetype.UI.Pages.Posts.getPostEditFormElements( "newPost" );
+ var formData = Lifetype.UI.Pages.Posts.getPostEditFormElements( "postEdit" );
var params = 'op=saveDraftArticleAjax&'+formData;
var url = Lifetype.Config.getValue( 'admin_base_url' ) + "?" + params;
-
- var transaction = YAHOO.util.Connect.asyncRequest( 'GET', url, { success:Lifetype.UI.Pages.Posts.saveDraftArticleResponse });
+
+ var transaction = YAHOO.util.Connect.asyncRequest( 'GET', url, { success:Lifetype.UI.Pages.Posts.saveDraftArticleResponse });
}
/**
@@ -190,8 +190,8 @@
{
// fetcth the json response
var msg = Lifetype.JSon.decode( originalRequest.responseText );
-
- var id = msg.result._id;
+
+ var id = msg.result.id;
var message = msg.message;
Lifetype.Dom.$( 'postId' ).value = id;
window.alert(message);
@@ -203,13 +203,13 @@
Lifetype.UI.Pages.Posts.getPostEditFormElements = function( formId )
{
var formData = '';
-
+
form = document.getElementById( formId );
-
+
for(i = 0; i < form.elements.length; i++ ) {
itemName = form.elements[i].name;
itemValue = form.elements[i].value;
-
+
if( itemName != "op" ) {
// we don't want to send more than one "op" parameter... do we?
if( itemName == "postCategories[]" ) {
@@ -217,7 +217,7 @@
// allows multiple selection... only using the "value" attribute will
// return one of the items and we would like to have them all
for (var j = 0; j < form.elements[i].options.length; j++) {
- if (form.elements[i].options[j].selected)
+ if (form.elements[i].options[j].selected)
formData = formData + itemName + "=" + form.elements[i].options[j].value + "&";
}
}
@@ -232,7 +232,37 @@
formData = formData + itemName + "=" + encodeURIComponent(itemValue) + "&";
}
}
- }
-
+ }
+
return formData;
-}
\ No newline at end of file
+}
+
+Lifetype.UI.Pages.Posts.newSendTrackback = function( type, args )
+{
+ var o = args[0];
+ var response = Lifetype.JSon.decode( o.responseText );
+ var success = response.success;
+ var result = response.result;
+ var sendTrackbacks = Lifetype.Config.getValue( 'send_trackbacks' );
+ var fromHandler = Lifetype.Config.getValue( 'form_handler' );
+ // we only show the send trackbacks dialog from addPost form handler
+ // if the form handler is from 'sendTrackbacks', we don't need to create
+ // the send trackbacks again.
+ if( success && sendTrackbacks && fromHandler == 'addPost' )
+ {
+ var admin_base_url = Lifetype.Config.getValue( 'admin_base_url' );
+ Lifetype.UI.ContentOverlay.createAndShow( admin_base_url + "?op=newSendTrackbacks&postId=" + result.id );
+ }
+}
+
+Lifetype.Config.setValue( 'form_handler', 'addPost' );
+
+Lifetype.UI.Pages.Posts.sendTrackbackSubmitHook = function( form )
+{
+ Lifetype.Config.setValue( 'form_handler', 'sendTrackbacks' );
+ Lifetype.Forms.AjaxFormProcessor( form.id,'?output=json', {resetAfterSuccess:true} );
+}
+
+YAHOO.util.Event.addListener( window, "load", function() {
+ Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.Pages.Posts.newSendTrackback );
+});
\ No newline at end of file
Modified: plog/trunk/locale/admin/locale_zh_TW.php
===================================================================
--- plog/trunk/locale/admin/locale_zh_TW.php 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/locale/admin/locale_zh_TW.php 2007-11-16 02:50:30 UTC (rev 6045)
@@ -888,7 +888,7 @@
$messages['error_comment_spam_keep'] = '反垃圾過濾系統已經將你的迴響放到佇列裡等待網誌擁有者的審核。';
$messages['blog_categories'] = '網誌分類';
-$messages['global_article_categories'] = '全站文章分類';
+$messages['global_article_categories'] = '全站文章分類';
$messages['help_force_posturl_unique'] = '強迫網誌裡所有文章的網址都是唯一的。這只有當你更改網址並且將日期部份從網址中移除時才需要。[預設值 = 否]';
@@ -897,27 +897,27 @@
$messages['enable_pull_down_menu'] = '下拉式選單';
$messages['enable_pull_down_menu_help'] = '啟用或關閉下拉式選單。';
-$messages['change_album'] = '修改檔案夾';
+$messages['change_album'] = '修改檔案夾';
$messages['warning_autosave_message'] = '<img src="imgs/admin/icon_warning-16.png" alt="Error" class="InfoIcon"/><p class="ErrorText">你好像有之前尚未存檔的文章。如果你還想繼續編輯,你可以 <a href="#" onclick="restoreAutoSave();">取回未存檔文章繼續編輯</a> 或是 <a href="#" onclick="eraseAutoSave();">把他刪除</a> 。</p>';
$messages['check_username'] = '檢查使用者名稱';
$messages['check_username_ok'] = '恭喜!這個使用者名稱還沒有任何人使用。';
-$messages['error_username_exist'] = '抱歉!這個使用者名稱已經被別人用了,試試其他的吧!';
+$messages['error_username_exist'] = '抱歉!這個使用者名稱已經被別人用了,試試其他的吧!';
$messages['error_rule_email_dns_server_temp_fail'] = '發生暫時性的錯誤,請稍後再試!';
$messages['error_rule_email_dns_server_unreachable'] = '電子郵件主機無法連線';
-$messages['error_rule_email_dns_not_permitted'] = '不被允許的電子郵件地址';
+$messages['error_rule_email_dns_not_permitted'] = '不被允許的電子郵件地址';
-$messages['blog_users_help'] = '可以存取這個網誌的使用者。請從左邊選取使用者將他移到右邊提供該使用者存取網誌的權限。';
+$messages['blog_users_help'] = '可以存取這個網誌的使用者。請從左邊選取使用者將他移到右邊提供該使用者存取網誌的權限。';
-$messages['summary_welcome_paragraph'] = '請將此處修改為你希望你的使用者看到的歡迎訊息,或將這部份刪除並重新安排整個頁面。這個頁面的模版在 templates/summary 裡面,你可以自由地依你的喜好修改他。';
+$messages['summary_welcome_paragraph'] = '請將此處修改為你希望你的使用者看到的歡迎訊息,或將這部份刪除並重新安排整個頁面。這個頁面的模版在 templates/summary 裡面,你可以自由地依你的喜好修改他。';
$messages['first_day_of_week'] = 1;
$messages['first_day_of_week_label'] = '每一週的開始';
-$messages['first_day_of_week_help'] = '在首頁月曆中的顯示方式。';
+$messages['first_day_of_week_help'] = '在首頁月曆中的顯示方式。';
-$messages['help_subdomains_base_url'] = '當次網域設定啟用時,這個網址將用來替代系統網址。使用 {blogname}來取得網誌名稱及{username}取得網誌使用者名稱以及{blogdomain},用來產生連結到網誌的網址。';
+$messages['help_subdomains_base_url'] = '當次網域設定啟用時,這個網址將用來替代系統網址。使用 {blogname}來取得網誌名稱及{username}取得網誌使用者名稱以及{blogdomain},用來產生連結到網誌的網址。';
$messages['registration_default_subject'] = 'LifeType 註冊確認';
@@ -1203,8 +1203,8 @@
/// new strings in LT 1.3 ///
// friend management
$messages['friendManagement'] = '好友管理';
-$messages['friend'] = '好友';
-$messages['friends'] = '好友';
+$messages['friend'] = '好友';
+$messages['friends'] = '好友';
$messages['manageFriends'] = '好友管理';
$messages['newFriendGroup'] = '新增好友群組';
$messages['editFriendGroups'] = '好友群組列表';
@@ -1215,7 +1215,7 @@
$messages['group_description_help'] = '關於這個好友群組的描述。';
$messages['show_group_help'] = '取消勾選,這個好友群組將不會出現在網誌好友列表中。';
$messages['error_adding_friend_group'] = '新增好友群組時發生錯誤。';
-$messages['friend_group_added_ok'] = '好友群組「%s」已順利新增';
+$messages['friend_group_added_ok'] = '好友群組「%s」已順利新增';
// edit friend relationship
$messages['error_updating_friend_group'] = '更新好友群組時發生錯誤。請檢查輸入資料後,再試一次。';
@@ -1229,7 +1229,7 @@
$messages['friend_group_deleted_ok'] = '好友群組「%s」已順利刪除。';
$messages['friend_groups_deleted_ok'] = '好友群組「%s」已順利刪除。';
$messages['error_removing_friend_group2'] = '刪除好友群組時發生錯誤 (id = %s)';
-
+
$messages['error_removing_last_friend_group'] = '無法刪除「%s」這個好友群組,因為至少要有一個好友群組。';
// new friend
@@ -1240,7 +1240,7 @@
$messages['friend_description_help'] = '請輸入你對這個好友的簡短描述。';
$messages['invitation_text'] = '邀請函';
$messages['invitation_text_help'] = '請輸入你要寄給好友的邀請函內容。';
-$messages['default_invitation_text'] = '你好。請問我可以把你加入我的好友列表裡面嗎?';
+$messages['default_invitation_text'] = '你好。請問我可以把你加入我的好友列表裡面嗎?';
$messages['error_adding_friend'] = '在新增好友時發生錯誤。請檢查輸入的資料再試一次。';
$messages['friend_added_ok'] = '新的好友「%s」已成功加入,正在等待審核。';
@@ -1258,7 +1258,7 @@
$messages['friend_authorization_waiting'] = '等待';
$messages['friend_authorization_reject'] = '拒絕';
$messages['friend_group'] = '好友群組';
-
+
$messages['error_fetching_friend'] = '找不到你指定的好友。';
$messages['friend_updated_ok'] = '好友「%s」已順利更新';
$messages['error_updating_friend'] = '更新好友時發生錯誤,請檢查輸入資料後,再試一次。';
@@ -1310,4 +1310,8 @@
$messages['reply_text'] = '回覆內容';
$messages['reply_text_help'] = '要回覆的簡訊內容,不可為空白。';
$messages['error_empty_reply_text']= '你必須輸入回覆簡訊的內容。';
+
+// new send trakback
+$messages['auto_discovery_trackbacks'] = '自動搜尋引用網址';
+$messages['auto_discovery_help'] = '請勾選你要引用的文章網址,如果你引用的文章網誌支援『引用網址自動搜尋』機制,系統會直接搜尋文章內的引用網址,並將引用訊息送到他的網誌中。';
?>
Modified: plog/trunk/templates/admin/newpost.template
===================================================================
--- plog/trunk/templates/admin/newpost.template 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/templates/admin/newpost.template 2007-11-16 02:50:30 UTC (rev 6045)
@@ -19,17 +19,17 @@
{else}
<script type="text/javascript" src="js/editor/lifetypeeditor.js"></script>
{/if}
- <script type="text/javascript">
+ <script type="text/javascript">
// this needs to be pre-initialized
Lifetype.UI.Pages.Posts.preview = false;
</script>
-
- <form name="postEdit" id="postEdit" action="admin.php" method="post" onSubmit="this.target='admin';return Lifetype.UI.Pages.Posts.selectOperation(this, 'addPost');">
+
+ <form name="postEdit" id="postEdit" action="admin.php" method="post" onSubmit="this.target='admin';Lifetype.Config.setValue( 'send_trackbacks', Lifetype.Dom.$('sendTrackbacks').checked ); return Lifetype.UI.Pages.Posts.selectOperation(this, 'addPost');">
<fieldset class="inputField">
<legend>{$locale->tr("newPost")}</legend>
<div id="mainPanel" style="float:left; width: 73%; border-right: 1px solid #DEDEDE;">
<div id="autoSaveMessage" style="display: none;"></div>
- {include file="$admintemplatepath/formvalidateajax.template"}
+ {include file="$admintemplatepath/formvalidateajax.template"}
<div class="field">
<label for="postTopic">{$locale->tr("topic")}</label>
<span class="required">*</span>
@@ -37,10 +37,10 @@
<input type="text" name="postTopic" style="width:100%" id="postTopic" value="{$postTopic|escape:"html"}" />
{include file="$admintemplatepath/validateajax.template" field=postTopic}
</div>
-
+
<!-- text field custom fields -->
- {include file="$admintemplatepath/newpost_customfields.template" type=1 fields=$customfields}
-
+ {include file="$admintemplatepath/newpost_customfields.template" type=1 fields=$customfields}
+
<div class="field">
<label for="postText">{$locale->tr("text")}</label>
<span class="required">*</span>
@@ -49,15 +49,9 @@
<textarea {if $htmlarea==1}rows="20"{else}rows="15"{/if} id="postText" name="postText" style="width:100%">{$postText}</textarea>
<a href="{if $htmlarea}javascript:tinyMCE.execInstanceCommand('mce_editor_0','mceinsertresource',true);{else}javascript:ed1.execute('postText','7_but_res',''){/if}">{$locale->tr("insert_media")}</a> |
<a href="{if $htmlarea}javascript:tinyMCE.execInstanceCommand('mce_editor_0','mcemoremore');{else}javascript:ed1.execute('postText','8_but_more',''){/if}">{$locale->tr("insert_more")}</a>
- {include file="$admintemplatepath/validateajax.template" field=postText}
+ {include file="$admintemplatepath/validateajax.template" field=postText}
</div>
- <div class="field">
- <label for="trackbackUrls">{$locale->tr("trackback_urls")}</label>
- <div class="formHelp">{$locale->tr("trackback_urls_help")}</div>
- <textarea rows="5" id="trackbackUrls" name="trackbackUrls" style="width:100%">{$trackbackUrls}</textarea>
- </div>
-
<!-- text area custom fields -->
{include file="$admintemplatepath/newpost_customfields.template" type=2 fields=$customfields}
</div>
@@ -93,13 +87,13 @@
});
{/literal}
</script>
-
+
<!-- date custom fields -->
{include file="$admintemplatepath/newpost_customfields.template" type=4 fields=$customfields}
-
+
<div class="field">
<label for="postStatus">{$locale->tr("status")}</label>
- <span class="required">*</span>
+ <span class="required">*</span>
<div class="formHelp">{$locale->tr("post_status_help")}</div>
<select name="postStatus" id="postStatus">
{foreach from=$poststatus key=name item=status}
@@ -108,7 +102,7 @@
selected="selected"{/if}>{$locale->tr($name)}</option>
{/if}
{/foreach}
- </select>
+ </select>
</div>
{if $location_data_enabled}
@@ -119,23 +113,23 @@
<div class="formHelp">{$locale->tr("article_location_help")}</div>
{location_chooser blogId=$blog->getId() showAddNewLink=1 showDisplayLink=1}
</div>
- {/if}
-
+ {/if}
+
<!-- user field -->
{check_perms perm=update_all_user_articles}
<div class="field">
{if empty($postUser)}{assign var=postUser value=$user->getId()}{/if}
<label for="postUser">{$locale->tr("posted_by")}</label>
- <span class="required">*</span>
+ <span class="required">*</span>
<div class="formHelp">{$locale->tr("posted_by_help")}</div>
<select name="postUser" id="postUser">
{foreach from=$blog->getUsersInfo() item=bloguser}
<option value="{$bloguser->getId()}" {if $postUser==$bloguser->getId()}selected="selected"{/if}>{$bloguser->getUserName()}</option>
{/foreach}
- </select>
+ </select>
</div>
{/check_perms}
-
+
<div class="field">
<label for="postCategories[]">{$locale->tr("categories")}</label>
<span class="required">*</span>
@@ -147,9 +141,9 @@
</select>
<input type="text" name="newArticleCategory" id="newArticleCategory" style="width:100px; margin-top:3px;" size="16" value="" />
<input type="button" name="addArticleCategory" id="addArticleCategory" style="width:35px; margin-top:3px;" value="{$locale->tr("add")}" onclick="Lifetype.UI.Pages.Posts.addArticleCategoryAjax()" />
- {include file="$admintemplatepath/validateajax.template" field=postCategories}
+ {include file="$admintemplatepath/validateajax.template" field=postCategories}
</div>
-
+
<div class="field">
<label for="globalArticleCategoryId">{$locale->tr("global_category")}</label>
<span class="required">*</span>
@@ -166,28 +160,28 @@
{/foreach}
{/if}
</select>
- {include file="$admintemplatepath/validateajax.template" field=globalArticleCategoryId}
- </div>
+ {include file="$admintemplatepath/validateajax.template" field=globalArticleCategoryId}
+ </div>
<!-- list custom fields -->
{include file="$admintemplatepath/newpost_customfields.template" type=5 fields=$customfields}
-
+
<div class="field_checkbox">
<input class="checkbox" type="checkbox" id="commentsEnabled" name="commentsEnabled" value="1" {if $commentsEnabled} checked="checked" {/if}/>
<label for="commentsEnabled">{$locale->tr("post_comments_enabled_help")}</label>
</div>
-
+
<div class="field_checkbox">
<input class="checkbox" type="checkbox" name="sendNotification" id="sendNotification" value="1" {if $sendNotification} checked="checked" {/if}/>
<label for="sendNotification">{$locale->tr("send_notification_help")}</label>
</div>
<div class="field_checkbox">
- <input class="checkbox" type="checkbox" name="sendTrackbacks" id="sendTrackbacks" value="1" {if $sendTrackbacks} checked="checked" {/if}/>
+ <input class="checkbox" type="checkbox" name="sendTrackbacks" id="sendTrackbacks" value="1" {if $sendTrackbacks} checked="checked" {/if}/>
<label for="sendTrackbacks">{$locale->tr("send_trackback_pings_help")}</label>
</div>
-
- <div class="field_checkbox">
+
+ <div class="field_checkbox">
{if $xmlRpcPingEnabled}
<input class="checkbox" type="checkbox" name="sendPings" id="sendPings" value="1" {if $sendPings} checked="checked" {/if}/>
<label for="sendPings">{$locale->tr("send_xmlrpc_pings_help")}</label>
@@ -200,9 +194,9 @@
<div class="field">
<br /><label for="bookmarklet">{$locale->tr("bookmarklet")}</label>
<div class="formHelp">{$locale->tr("bookmarklet_help")}</div>
- <a href="javascript:bm=document.selection?document.selection.createRange().text:document.getSelection();void(ltbm=window.open('{$url->getAdminUrl()}?op=newPost&sendTrackbacks=1&postText='+encodeURIComponent('<p>'+bm+' ... '+'<a href="'+window.location.href+'">'+'{$locale->tr("original_post")}'+'</a></p>'),'ltbm','toolbar=1,status=1,location=1,scrollbars=1,menubar=1,resizable=1'))" onclick="window.alert('{$locale->tr("bookmarklet_help")}');">{$locale->tr("blogit_to_lifetype")}</a>
+ <a href="javascript:bm=document.selection?document.selection.createRange().text:document.getSelection();void(ltbm=window.open('{$url->getAdminUrl()}?op=newPost&sendTrackbacks=1&postText='+encodeURIComponent('<p>'+bm+' ... '+'<a href="'+window.location.href+'">'+'{$locale->tr("original_post")}'+'</a></p>'),'ltbm','toolbar=1,status=1,location=1,scrollbars=1,menubar=1,resizable=1'))" onclick="window.alert('{$locale->tr("bookmarklet_help")}');">{$locale->tr("blogit_to_lifetype")}</a>
</div>
-
+
</div>
</fieldset>
<div class="buttons">
Modified: plog/trunk/templates/admin/sendtrackbacks.template
===================================================================
--- plog/trunk/templates/admin/sendtrackbacks.template 2007-11-15 15:21:33 UTC (rev 6044)
+++ plog/trunk/templates/admin/sendtrackbacks.template 2007-11-16 02:50:30 UTC (rev 6045)
@@ -1,32 +1,7 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=newPost title=$locale->tr("send_trackbacks")}
-<form name="pingThese" method="post" action="admin.php">
- <fieldset class="inputField">
- <legend>{$locale->tr("send_trackbacks")}</legend>
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
-
- <label for="postLink">{$locale->tr("send_trackbacks")}</label>
- <div class="formHelp">{$locale->tr("send_trackbacks_help")}</div>
- {if count($postLinks) != 0}
- {foreach from=$postLinks item=postLink}
- <input class="checkbox" type="checkbox" id="postLink[{counter}]" name="postLink[{counter}]" value="{$postLink}" />
- <a href="{$postLink}">{$postLink}</a><br/>
- {/foreach}
- {/if}
- {if count($trackbackLinks) != 0}
- {foreach from=$trackbackLinks item=trackbackLink}
- <input class="checkbox" type="checkbox" id="trackbackLink[{counter}]" name="trackbackLink[{counter}]" value="{$trackbackLink}" checked />
- <a href="{$trackbackLink}">{$trackbackLink}</a><br/>
- {/foreach}
- {/if}
-
- </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>
+
+{include file="$admintemplatepath/sendtrackbacks_form.template"}
+
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Added: plog/trunk/templates/admin/sendtrackbacks_form.template
===================================================================
--- plog/trunk/templates/admin/sendtrackbacks_form.template (rev 0)
+++ plog/trunk/templates/admin/sendtrackbacks_form.template 2007-11-16 02:50:30 UTC (rev 6045)
@@ -0,0 +1,29 @@
+<form id="pingThese" name="pingThese" method="post" action="admin.php" onSubmit="Lifetype.UI.Pages.Posts.sendTrackbackSubmitHook(this);return(false);">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("send_trackbacks")}</legend>
+ {include file="$admintemplatepath/formvalidateajax.template"}
+
+ {if count($postLinks) != 0}
+ <div class="field">
+ <label for="postLinks">{$locale->tr("auto_discovery_trackbacks")}</label>
+ <div class="formHelp">{$locale->tr("auto_discovery_help")}</div>
+ {foreach from=$postLinks item=postLink}
+ <input class="checkbox" type="checkbox" id="postLinks[{counter}]" name="postLinks[{counter}]" value="{$postLink}" />
+ <a href="{$postLink}">{$postLink}</a><br/>
+ {/foreach}
+ </div>
+ {/if}
+
+ <div class="field">
+ <label for="trackbackUrls">{$locale->tr("trackback_urls")}</label>
+ <div class="formHelp">{$locale->tr("trackback_urls_help")}</div>
+ <textarea rows="5" id="trackbackUrls" name="trackbackUrls" style="width:100%">{$trackbackUrls}</textarea>
+ </div>
+
+ </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>
\ No newline at end of file
More information about the pLog-svn
mailing list