[pLog-svn] r1962 - in plugins/trunk/atom: class/action class/view
class/xml/atom locale templates
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri May 6 22:37:10 GMT 2005
Author: oscar
Date: 2005-05-06 22:37:09 +0000 (Fri, 06 May 2005)
New Revision: 1962
Modified:
plugins/trunk/atom/class/action/adminatompluginupdatesettingsaction.class.php
plugins/trunk/atom/class/view/adminatompluginsettingsview.class.php
plugins/trunk/atom/class/xml/atom/atomconstants.properties.php
plugins/trunk/atom/class/xml/atom/postservice.class.php
plugins/trunk/atom/locale/locale_en_UK.php
plugins/trunk/atom/templates/pluginsettings.template
Log:
now it is possible to select how images should be embedded in posts sent via Atom (like when using Lifeblog), instead of using the small preview by default.
Modified: plugins/trunk/atom/class/action/adminatompluginupdatesettingsaction.class.php
===================================================================
--- plugins/trunk/atom/class/action/adminatompluginupdatesettingsaction.class.php 2005-05-06 22:08:04 UTC (rev 1961)
+++ plugins/trunk/atom/class/action/adminatompluginupdatesettingsaction.class.php 2005-05-06 22:37:09 UTC (rev 1962)
@@ -3,6 +3,7 @@
include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
include_once( PLOG_CLASS_PATH."plugins/atom/class/view/adminatompluginsettingsview.class.php" );
include_once( PLOG_CLASS_PATH."plugins/atom/class/dao/atompasswords.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/atom/class/xml/atom/atomconstants.properties.php" );
class AdminAtomPluginUpdateSettingsAction extends BlogOwnerAdminAction
{
@@ -11,6 +12,7 @@
var $_password;
var $_loggingEnabled;
var $_dontSetHeaders;
+ var $_previewType;
function AdminAtomPluginUpdateSettingsAction( $actionInfo, $request )
{
@@ -22,6 +24,11 @@
$this->_categoryId = $this->_request->getValue( "categoryId" );
$this->_albumId = $this->_request->getValue( "albumId" );
$this->_password = $this->_request->getValue( "password" );
+ // check how images should be embedded
+ $this->_previewType = $this->_request->getValue( "resourcePreviewType" );
+ if( $this->_previewType < ATOM_EMBED_SMALL_PREVIEW ||
+ $this->_previewType > ATOM_EMBED_FULL_SIZE )
+ $this->_previewType = ATOM_EMBED_SMALL_PREVIEW;
$this->_loggingEnabled = $this->_request->getValue( "loggingEnabled" );
$this->_dontSetHeaders = $this->_request->getValue( "dontSetHeaders" );
@@ -37,6 +44,7 @@
$blogSettings = $this->_blogInfo->getSettings();
$blogSettings->setValue( "plugin_atom_article_category_id", $this->_categoryId );
$blogSettings->setValue( "plugin_atom_gallery_resource_album_id", $this->_albumId );
+ $blogSettings->setValue( "plugin_atom_resource_preview_type", $this->_previewType );
$this->_blogInfo->setSettings( $blogSettings );
$blogs = new Blogs();
// update the settings in the database *and* in the session, otherwise we will
Modified: plugins/trunk/atom/class/view/adminatompluginsettingsview.class.php
===================================================================
--- plugins/trunk/atom/class/view/adminatompluginsettingsview.class.php 2005-05-06 22:08:04 UTC (rev 1961)
+++ plugins/trunk/atom/class/view/adminatompluginsettingsview.class.php 2005-05-06 22:37:09 UTC (rev 1962)
@@ -27,6 +27,7 @@
// fetch the current settings
$categoryId = $blogSettings->getValue( "plugin_atom_article_category_id" );
$albumId = $blogSettings->getValue( "plugin_atom_gallery_resource_album_id" );
+ $resourcePreviewType = $blogSettings->getValue( "plugin_atom_resource_preview_type" );
$passwords = new AtomPasswords();
$atomPassword = $passwords->getPassword( $this->_userInfo->getId());
@@ -53,6 +54,7 @@
$this->setValue( "password", $atomPassword );
$this->setValue( "loggingEnabled", $loggingEnabled );
$this->setValue( "dontSetHeaders", $dontSetHeaders );
+ $this->setValue( "resourcePreviewType", $resourcePreviewType );
parent::render();
Modified: plugins/trunk/atom/class/xml/atom/atomconstants.properties.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/atomconstants.properties.php 2005-05-06 22:08:04 UTC (rev 1961)
+++ plugins/trunk/atom/class/xml/atom/atomconstants.properties.php 2005-05-06 22:37:09 UTC (rev 1962)
@@ -55,4 +55,11 @@
define( "ATOM_NO_BLOG", 0 );
define( "ATOM_NO_ARTICLE", 0 );
+
+ /**
+ * how should images be embedded in posts
+ */
+ define( 'ATOM_EMBED_SMALL_PREVIEW', 1 );
+ define( 'ATOM_EMBED_MEDIUM_PREVIEW', 2 );
+ define( 'ATOM_EMBED_FULL_SIZE_VIEW', 3 );
?>
\ No newline at end of file
Modified: plugins/trunk/atom/class/xml/atom/postservice.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/postservice.class.php 2005-05-06 22:08:04 UTC (rev 1961)
+++ plugins/trunk/atom/class/xml/atom/postservice.class.php 2005-05-06 22:37:09 UTC (rev 1962)
@@ -216,9 +216,20 @@
$resource = $resources->getResource( $localResData["id"] );
if( $resource->isImage()) {
AtomLogger::Log( " It is an image!" );
- $url =& RequestGenerator::getRequestGenerator( $this->_blogInfo );
+ //$url =& RequestGenerator::getRequestGenerator( $this->_blogInfo );
+ $url = $this->_blogInfo->getBlogRequestGenerator();
+ // check which type of resource preview we should attach and generate the right link
+ $settings = $this->_blogInfo->getSettings();
+ $previewType = $settings->getValue( "plugin_atom_resource_preview_type" );
+ if( $previewType == ATOM_EMBED_MEDIUM_PREVIEW )
+ $link = $url->resourceMediumPreviewLink( $resource );
+ elseif( $previewType == ATOM_EMBED_FULL_SIZE_VIEW )
+ $link = $url->resourceDownloadLink( $resource );
+ else
+ $link = $url->resourcePreviewLink( $resource );
+
$result .= "<a href=\"".$url->resourceLink( $resource )."\">
- <img class=\"resource-image\" src=\"".$url->resourcePreviewLink( $resource )."\" alt=\"".$resource->getFileName()."\" />
+ <img class=\"resource-image\" src=\"$link\" alt=\"".$resource->getFileName()."\" />
</a><br />";
}
else {
Modified: plugins/trunk/atom/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/atom/locale/locale_en_UK.php 2005-05-06 22:08:04 UTC (rev 1961)
+++ plugins/trunk/atom/locale/locale_en_UK.php 2005-05-06 22:37:09 UTC (rev 1962)
@@ -8,4 +8,8 @@
$messages['atom_dont_set_headers'] = 'Do not set headers';
$messages['atom_dont_set_headers_help'] = 'Some servers will generate an "HTTP 500 Internal Server Error" message whenever the atom layer tries to change the headers to conform to the Atom specification. Please set the following to "Yes" if you are having problems with this.';
$messages['atom_plugin_settings_saved_ok'] = 'Atom plugin settings saved successfully';
+$messages['atom_image_preview_type_help'] = 'When embedding images in Atom posts, how should the image be embedded?';
+$messages['small_preview'] = 'Small preview';
+$messages['medium_preview'] = 'Medium preview';
+$messages['full_size'] = 'Full size view';
?>
\ No newline at end of file
Modified: plugins/trunk/atom/templates/pluginsettings.template
===================================================================
--- plugins/trunk/atom/templates/pluginsettings.template 2005-05-06 22:08:04 UTC (rev 1961)
+++ plugins/trunk/atom/templates/pluginsettings.template 2005-05-06 22:37:09 UTC (rev 1962)
@@ -25,8 +25,16 @@
<option value="{$album->getId()}" {if $albumId == $album->getId()}selected="selected"{/if}>{$album->getName()}</option>
{/foreach}
</select>
+ <br/>
+ <div class="formHelp">{$locale->tr("atom_image_preview_type_help")}</div>
+ <select name="resourcePreviewType">
+ <option value="1" {if $resourcePreviewType==1}selected="selected"{/if}>{$locale->tr("small_preview")}</option>
+ <option value="2" {if $resourcePreviewType==2}selected="selected"{/if}>{$locale->tr("medium_preview")}</option>
+ <option value="3" {if $resourcePreviewType==3}selected="selected"{/if}>{$locale->tr("full_size")}</option>
+ </select>
</div>
+
<!-- password -->
<div class="field">
<label for="password">{$locale->tr("password")}</label>
More information about the pLog-svn
mailing list