[pLog-svn] r1975 - in plugins/trunk: . gallery
gallery/classgallery/class/action gallery/class/gallery
gallery/class/viewgallery/locale gallery/templates
Mark Wu
markplace at gmail.com
Tue May 10 01:39:27 GMT 2005
Wow... I love this plugin :D
I really want to use it on my personal site . Amazing ...:P
Mark
> -----Original Message-----
> From: plog-svn-bounces at devel.plogworld.net
> [mailto:plog-svn-bounces at devel.plogworld.net] On Behalf Of
> oscar at devel.plogworld.net
> Sent: Tuesday, May 10, 2005 3:26 AM
> To: plog-svn at devel.plogworld.net
> Subject: [pLog-svn] r1975 - in plugins/trunk: . gallery
> gallery/classgallery/class/action gallery/class/gallery
> gallery/class/viewgallery/locale gallery/templates
>
> Author: oscar
> Date: 2005-05-09 19:25:50 +0000 (Mon, 09 May 2005) New Revision: 1975
>
> Added:
> plugins/trunk/gallery/
> plugins/trunk/gallery/README
> plugins/trunk/gallery/class/
> plugins/trunk/gallery/class/action/
>
> plugins/trunk/gallery/class/action/plugingalleryconfigaction.class.php
>
> plugins/trunk/gallery/class/action/plugingalleryshowaction.class.php
>
> plugins/trunk/gallery/class/action/plugingalleryupdateconfigac
> tion.class.php
> plugins/trunk/gallery/class/gallery/
> plugins/trunk/gallery/class/gallery/galleryhelper.class.php
> plugins/trunk/gallery/class/view/
> plugins/trunk/gallery/class/view/plugingalleryconfigview.class.php
> plugins/trunk/gallery/class/view/plugingalleryshowview.class.php
> plugins/trunk/gallery/locale/
> plugins/trunk/gallery/locale/locale_en_UK.php
> plugins/trunk/gallery/plugingallery.class.php
> plugins/trunk/gallery/templates/
> plugins/trunk/gallery/templates/galleryAdmin.template
> plugins/trunk/gallery/templates/galleryShow.template
> Log:
> added a new plugin to integrate Gallery2 with plog's own
> public side. Quite cool if you ask me :)
>
> Added: plugins/trunk/gallery/README
> ===================================================================
> --- plugins/trunk/gallery/README 2005-05-09 07:31:58 UTC
> (rev 1974)
> +++ plugins/trunk/gallery/README 2005-05-09 19:25:50 UTC
> (rev 1975)
> @@ -0,0 +1,23 @@
> +PLUGIN: Embbeded Gallery
> +AUTHOR: Laurent Vauthrin
> +
> +1. Download Gallery2 from http://gallery.menalto.com/ and install it.
> +2. Copy this plugin to the plugins directory and configure it.
> +3. Add the following to your template so that it adds the link.
> + {if $gallery->isEnabled()}
> + <a title="My Photos" href="index.php?op=gallery">
> + {$locale->tr("gallery")}
> + </a>
> + {/if}
> +4. Optionally add the following for image blocks
> + {if $gallery->isEnabled()}{$gallery->getImageBlock()}{/if}
> +
> +Once it is all done, you may want to change the template
> that is used
> +to display the gallery. The template file
> (galleryShow.template) is located in the plugin's templates folder.
> +More information is available in that file. You should also modify
> +your template's css (if you don't plan on using the one
> returned by gallery) so that the albums look better.
> +
> +There is room for improvement. For example, no user/session
> +information is passed between Gallery and pLog even though
> the capability is there.
> +
> +Gallery2 is in beta so there are likely to be changes.
>
> Added:
> plugins/trunk/gallery/class/action/plugingalleryconfigaction.class.php
> ===================================================================
> ---
> plugins/trunk/gallery/class/action/plugingalleryconfigaction.c
> lass.php 2005-05-09 07:31:58 UTC (rev 1974)
> +++
> plugins/trunk/gallery/class/action/plugingalleryconfigaction.c
> lass.php 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,39 @@
> +<?php
> +include_once(
> +PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
> +include_once(
> +PLOG_CLASS_PATH."plugins/gallery/class/view/plugingalleryconf
> igview.cla
> +ss.php" );
> +
> +/**
> + * This class is responsible for processing the gallery
> plugin config action.
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class PluginGalleryConfigAction extends AdminAction {
> + /**
> + * Constructor.
> + *
> + * @param $actionInfo The action information.
> + * @param $request The HTTP request information.
> + * @return Returns the value passed back by AdminAction.
> + */
> + function PluginGalleryConfigAction( $actionInfo, $request )
> + {
> + $this->AdminAction( $actionInfo, $request );
> + }
> +
> + /**
> + * This function performs the action.
> + *
> + * @param None.
> + * @return Returns true
> + */
> + function perform()
> + {
> + $this->_view = new PluginGalleryConfigView(
> $this->_blogInfo );
> + $this->setCommonData();
> +
> + return true;
> + }
> +}
> +?>
>
> Added:
> plugins/trunk/gallery/class/action/plugingalleryshowaction.class.php
> ===================================================================
> ---
> plugins/trunk/gallery/class/action/plugingalleryshowaction.cl
> ass.php 2005-05-09 07:31:58 UTC (rev 1974)
> +++
> plugins/trunk/gallery/class/action/plugingalleryshowaction.cl
> ass.php 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,39 @@
> +<?php
> +include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
> +include_once(
> +PLOG_CLASS_PATH."plugins/gallery/class/view/plugingalleryshow
> view.class
> +.php" );
> +
> +/**
> + * This class is responsible for performing the show gallery action.
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class PluginGalleryShowAction extends BlogAction {
> + /**
> + * Constructor.
> + *
> + * @param $actionInfo The action information.
> + * @param $request The HTTP request information.
> + * @return Returns the value passed back by AdminAction.
> + */
> + function PluginGalleryShowAction( $actionInfo, $request )
> + {
> + return $this->BlogAction( $actionInfo, $request );
> + }
> +
> + /**
> + * This function performs the action.
> + *
> + * @param None.
> + * @return Returns true.
> + */
> + function perform()
> + {
> + $this->_view = new PluginGalleryShowView( $this->_blogInfo );
> + $this->setCommonData();
> +
> + return true;
> + }
> +}
> +?>
>
> Added:
> plugins/trunk/gallery/class/action/plugingalleryupdateconfigac
> tion.class.php
> ===================================================================
> ---
> plugins/trunk/gallery/class/action/plugingalleryupdateconfigac
> tion.class.php 2005-05-09 07:31:58 UTC (rev 1974)
> +++
> plugins/trunk/gallery/class/action/plugingalleryupdateconfigac
> tion.class.php 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,159 @@
> +<?php
> +include_once(
> +PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
> +include_once(
> +PLOG_CLASS_PATH."plugins/gallery/class/view/plugingalleryconf
> igview.cla
> +ss.php" );
> +
> +/**
> + * This class is responsible for updating the gallery plugin
> settings.
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class PluginGalleryUpdateConfigAction extends AdminAction {
> + /**
> + * @private
> + */
> + var $_pluginEnabled;
> + var $_sidebarEnabled;
> + var $_sidebarGreetingEnabled;
> + var $_pathbarEnabled;
> + var $_absolutePath;
> + var $_embedUri;
> + var $_embedPath;
> + var $_relativPath;
> + var $_blocks;
> + var $_show;
> + var $_itemid;
> +
> + /**
> + * Constructor.
> + *
> + * @param $actionInfo The action information.
> + * @param $request The HTTP request information.
> + * @return Returns the value passed back by AdminAction.
> + */
> + function PluginGalleryUpdateConfigAction( $actionInfo,
> $request )
> + {
> + $this->AdminAction( $actionInfo, $request );
> + }
> +
> + /**
> + * This function validates the form inputs.
> + *
> + * @param None.
> + * @return Returns true.
> + */
> + function validate()
> + {
> + $this->_pluginEnabled = $this->_request->getValue(
> "pluginEnabled" );
> + $this->_pluginEnabled = ( $this->_pluginEnabled != "" );
> +
> + $this->_sidebarEnabled = $this->_request->getValue(
> "sidebarEnabled" );
> + $this->_sidebarEnabled = ( $this->_sidebarEnabled != "" );
> +
> + $this->_sidebarGreetingEnabled =
> $this->_request->getValue( "sidebarGreetingEnabled" );
> + $this->_sidebarGreetingEnabled = (
> + $this->_sidebarGreetingEnabled != "" );
> +
> + $this->_pathbarEnabled = $this->_request->getValue(
> "pathbarEnabled" );
> + $this->_pathbarEnabled = ( $this->_pathbarEnabled != "" );
> +
> + $this->_absolutePath = $this->_request->getValue(
> "absolutePath" );
> + $this->_embedUri = $this->_request->getValue( "embedUri" );
> + $this->_embedPath = $this->_request->getValue( "embedPath" );
> + $this->_relativePath = $this->_request->getValue(
> "relativePath" );
> +
> + $this->_blocks = $this->_request->getValue( "blocks" );
> + $this->_show = $this->_request->getValue( "show" );
> + $this->_itemid = $this->_request->getValue( "itemid" );
> +
> + if ( $this->_embedUri == "" || $this->_absolutePath
> == "" ||
> + $this->_embedPath == "" || $this->_relativePath == "" ) {
> +
> + $this->_view = new PluginGalleryConfigView(
> $this->_blogInfo );
> + $this->_view->setErrorMessage(
> $this->_locale->tr( "error_required_missing" ) );
> + $this->setCommonData();
> +
> + return false;
> + }
> +
> + // TODO: run checks to make sure that blocks and show
> have valid
> +values
> +
> + if ( $this->_blocks == "specificItem" &&
> $this->_itemid == "" ) {
> + $this->_view = new PluginGalleryConfigView(
> $this->_blogInfo );
> + $this->_view->setErrorMessage( $this->_locale->tr(
> "error_itemid" ) );
> + $this->setCommonData();
> +
> + return false;
> + }
> +
> + if ( $this->_blocks != "specificItem" ) {
> + $this->_itemid = "";
> + }
> +
> + if ( !file_exists( $this->_absolutePath ) ) {
> +
> + $this->_view = new PluginGalleryConfigView(
> $this->_blogInfo );
> + $this->_view->setErrorMessage(
> $this->_locale->tr( "error_absolute_path" ) );
> + $this->setCommonData();
> +
> + return false;
> + }
> +
> + return true;
> + }
> +
> + /**
> + * This function performs the action.
> + *
> + * @param None.
> + * @return Returns true if the update was successful;
> otherwise returns false.
> + */
> + function perform()
> + {
> + // Get the blog settings
> + $blogSettings = $this->_blogInfo->getSettings();
> +
> + // Update the relevant values with the form inputs
> + $blogSettings->setValue( "plugin_gallery_enabled",
> $this->_pluginEnabled );
> + $blogSettings->setValue( "gallery_sidebar_enabled",
> $this->_sidebarEnabled );
> + $blogSettings->setValue( "gallery_sidebarGreeting_enabled",
> + $this->_sidebarGreetingEnabled );
> + $blogSettings->setValue( "gallery_pathbar_enabled",
> $this->_pathbarEnabled );
> + $blogSettings->setValue( "gallery_absolute_path",
> $this->_absolutePath );
> + $blogSettings->setValue( "gallery_embed_uri",
> $this->_embedUri );
> + $blogSettings->setValue( "gallery_embed_path",
> $this->_embedPath );
> + $blogSettings->setValue( "gallery_relative_path",
> $this->_relativePath );
> + $blogSettings->setValue( "gallery_blocks", $this->_blocks );
> + $blogSettings->setValue( "gallery_show", $this->_show );
> + $blogSettings->setValue( "gallery_itemid", $this->_itemid );
> +
> + // Set and save the new blog settings
> + $this->_blogInfo->setSettings( $blogSettings );
> + $blogs = new Blogs();
> +
> + // Display an error message if there was a problem with
> the update
> + if( !$blogs->updateBlog( $this->_blogInfo->getId(),
> $this->_blogInfo ) ) {
> + $this->_view = new PluginGalleryConfigView(
> $this->_blogInfo );
> + $this->_view->setErrorMessage(
> $this->_locale->tr( "error_updating_settings" ) );
> + $this->setCommonData();
> +
> + return false;
> + }
> +
> + // If things went well, save the session...
> + $this->_blogInfo->setSettings( $blogSettings );
> + $this->_session->setValue( "blogInfo", $this->_blogInfo );
> + $this->saveSession();
> +
> + // and show the success message
> + $this->_view = new PluginGalleryConfigView(
> $this->_blogInfo );
> + $this->_view->setSuccessMessage( $this->_locale->tr(
> "gallery_settings_saved_ok" ) );
> + $this->setCommonData();
> +
> + // clear the cache
> + CacheControl::resetBlogCache( $this->_blogInfo->getId() );
> +
> + return true;
> + }
> +}
> +?>
>
> Added: plugins/trunk/gallery/class/gallery/galleryhelper.class.php
> ===================================================================
> ---
> plugins/trunk/gallery/class/gallery/galleryhelper.class.php
> 2005-05-09 07:31:58 UTC (rev 1974)
> +++
> plugins/trunk/gallery/class/gallery/galleryhelper.class.php
> 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,212 @@
> +<?php
> +include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
> +
> +/**
> + * This class calls the gallery embedding functions.
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class GalleryHelper extends Object
> +{
> + /**
> + * @private
> + */
> + var $_absolutePath;
> + var $_embedUri;
> + var $_embedPath;
> + var $_relativePath;
> + var $_title;
> + var $_css;
> + var $_javascript;
> + var $_body;
> + var $_error;
> +
> + /**
> + * Constructor used to make a request to Gallery
> + *
> + * @param $absolutePath Path to the gallery application
> + * @param $embedUri File to plog main file
> + * @param $embedPath Path to document root from pLog
> + * @param $relativePath Path to gallery from pLog
> + * @return None.
> + */
> + function GalleryHelper( $absolutePath,
> + $embedUri,
> + $embedPath,
> + $relativePath )
> + {
> +
> + $this->_absolutePath = $absolutePath;
> + $this->_embedUri = $embedUri;
> + $this->_embedPath = $embedPath;
> + $this->_relativePath = $relativePath;
> + }
> +
> + /**
> + * Function which retrieves your galleries
> + *
> + * @param $sidebarEnabled Boolean used to show/hide the side bar
> + * @param $sidebarGreetingEnabled Boolean used to
> show/hide the side greeting
> + * @param $pathbarEnabled Boolean used to show/hide the path bar
> + * @return Error object or Gallery HTML.
> + */
> + function getGallery( $sidebarEnabled,
> + $sidebarGreetingEnabled,
> + $pathbarEnabled )
> + {
> + require_once( $this->_absolutePath );
> +
> + // Set up the gallery call
> + $ret = GalleryEmbed::init( array( 'embedUri' =>
> $this->_embedUri,
> + 'embedPath' =>
> $this->_embedPath,
> + 'relativeG2Path'
> => $this->_relativePath,
> + 'activeUserId' => '' ) );
> +
> + // Return error details if there is a problem
> + if ($ret->isError()) {
> + $this->_error = $ret->getAsHtml();
> + return;
> + }
> +
> + // Set gallery options
> + GalleryCapabilities::set( 'showSidebar', $sidebarEnabled );
> + GalleryCapabilities::set( 'showSidebarGreeting',
> $sidebarGreetingEnabled );
> + GalleryCapabilities::set( 'showPathbar', $pathbarEnabled );
> +
> + // Process the request
> + $g2data = GalleryEmbed::handleRequest();
> +
> + // Gallery has already sent output (redirect or binary data)
> + if ( $g2data['isDone'] ) {
> + return;
> + }
> +
> + // Retrieve the html head
> + if ( isset( $g2data['headHtml'] ) ) {
> + list( $title, $css, $javascript ) =
> GalleryEmbed::parseHead( $g2data['headHtml'] );
> + $this->_title = $title;
> + $this->_css = $css;
> + $this->_javascript = $javascript;
> + }
> +
> + // Tell gallery that you are done
> + $ret = GalleryEmbed::done();
> +
> + // Check for errors
> + if ($ret->isError()) {
> + return $ret->getAsHtml();
> + }
> +
> + // Retrieve the html body
> + $this->_body = $g2data['bodyHtml'];
> + }
> +
> + /**
> + * Function which retrieve's Gallery's image block
> + *
> + * @param $blocks Identifies what image you want to see.
> + * @param $show Identifies what to display with the image.
> + * @param $itemid The Itemd ID of the image to be shown
> (must specify in blocks).
> + * @return Error object or image block HTML.
> + */
> + function getImageBlock( $blocks,
> + $show,
> + $itemid)
> +
> + {
> + require_once($this->_absolutePath);
> +
> + // Set up the gallery call
> +
> + $ret = GalleryEmbed::init( array( 'embedUri' =>
> $this->_embedUri,
> + 'embedPath' =>
> $this->_embedPath,
> + 'relativeG2Path' =>
> $this->_relativePath,
> + 'activeUserId' => '' ) );
> +
> + // Check for errors
> + if ($ret->isError()) {
> + return $ret->getAsHtml();
> + }
> +
> + // Get the image block
> + if ( $itemid != "" ) {
> + list($ret, $g2data) = GalleryEmbed::getImageBlock(
> array( 'blocks' => $blocks,
> +
> 'show' => $show,
> +
> 'itemId' => $itemid) );
> + } else {
> + list($ret, $g2data) = GalleryEmbed::getImageBlock(
> array( 'blocks' => $blocks,
> +
> 'show' => $show ) );
> + }
> +
> + // Check for errors
> + if ($ret->isError()) {
> + return $ret->getAsHtml();
> + }
> +
> + // Tell gallery that you are done
> + $ret = GalleryEmbed::done();
> +
> + // Check for errors
> + if ($ret->isError()) {
> + return $ret->getAsHtml();
> + }
> +
> + return $g2data;
> + }
> +
> + /**
> + * Accessor function used to retrieve the gallery title
> + *
> + * @param None.
> + * @return Gallery title.
> + */
> + function getTitle()
> + {
> + return $this->_title;
> + }
> +
> + /**
> + * Accessor function used to retrieve the gallery style sheet
> + *
> + * @param None.
> + * @return Gallery style sheet.
> + */
> + function getCSS()
> + {
> + return $this->_css;
> + }
> +
> + /**
> + * Accessor function used to retrieve the gallery javascript
> + *
> + * @param None.
> + * @return Gallery javascript.
> + */
> + function getJavascript()
> + {
> + return $this->_javascript;
> + }
> +
> + /**
> + * Accessor function used to retrieve the actual gallery
> + *
> + * @param None.
> + * @return Gallery body.
> + */
> + function getBody()
> + {
> + return $this->_body;
> + }
> +
> + /**
> + * Accessor function used to retrieve error messages
> + *
> + * @param None.
> + * @return Gallery error message.
> + */
> + function getError()
> + {
> + return $this->_error;
> + }
> +}
>
> Added:
> plugins/trunk/gallery/class/view/plugingalleryconfigview.class.php
> ===================================================================
> ---
> plugins/trunk/gallery/class/view/plugingalleryconfigview.cl
> ass.php 2005-05-09 07:31:58 UTC (rev 1974)
> +++
> plugins/trunk/gallery/class/view/plugingalleryconfigview.cl
> ass.php 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,63 @@
> +<?php
> +
> +include_once(
> +PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.cl
> ass.php"
> +);
> +
> +/**
> + * Implements the config view for the gallery plugin
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class PluginGalleryConfigView extends AdminPluginTemplatedView {
> +
> + /**
> + * Constructor
> + *
> + * @param $blogInfo Blog specific information.
> + * @return None.
> + */
> + function PluginGalleryConfigView( $blogInfo ) {
> + $this->AdminPluginTemplatedView( $blogInfo, "gallery",
> "galleryAdmin" );
> + }
> +
> + /**
> + * This function renders the admin view
> + *
> + * @param None.
> + * @return Returns true.
> + */
> + function render() {
> +
> + // Get the current gallery plugin settings
> + $blogSettings = $this->_blogInfo->getSettings();
> + $pluginEnabled = $blogSettings->getValue(
> "plugin_gallery_enabled" );
> + $sidebarEnabled = $blogSettings->getValue(
> "gallery_sidebar_enabled" );
> + $sidebarGreetingEnabled = $blogSettings->getValue(
> "gallery_sidebarGreeting_enabled" );
> + $pathbarEnabled = $blogSettings->getValue(
> "gallery_pathbar_enabled" );
> + $absolutePath = $blogSettings->getValue(
> "gallery_absolute_path" );
> + $embedUri = $blogSettings->getValue( "gallery_embed_uri" );
> + $embedPath = $blogSettings->getValue( "gallery_embed_path" );
> + $relativePath = $blogSettings->getValue(
> "gallery_relative_path" );
> + $blocks = $blogSettings->getValue( "gallery_blocks" );
> + $show = $blogSettings->getValue( "gallery_show" );
> + $itemid = $blogSettings->getValue( "gallery_itemid" );
> +
> + // Export the settings to the template
> + $this->setValue( "pluginEnabled", $pluginEnabled );
> + $this->setValue( "sidebarEnabled", $sidebarEnabled );
> + $this->setValue( "sidebarGreetingEnabled",
> $sidebarGreetingEnabled );
> + $this->setValue( "pathbarEnabled", $pathbarEnabled );
> + $this->setValue( "absolutePath", $absolutePath );
> + $this->setValue( "embedUri", $embedUri );
> + $this->setValue( "embedPath", $embedPath );
> + $this->setValue( "relativePath", $relativePath );
> + $this->setValue( "blocks", $blocks );
> + $this->setValue( "show", $show );
> + $this->setValue( "itemid", $itemid );
> +
> + parent::render();
> +
> + return true;
> + }
> +}
> +?>
>
> Added:
> plugins/trunk/gallery/class/view/plugingalleryshowview.class.php
> ===================================================================
> ---
> plugins/trunk/gallery/class/view/plugingalleryshowview.cl
> ass.php 2005-05-09 07:31:58 UTC (rev 1974)
> +++
> plugins/trunk/gallery/class/view/plugingalleryshowview.cl
> ass.php 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,70 @@
> +<?php
> +include_once(
> +PLOG_CLASS_PATH."class/view/plugintemplatedview.class.php" );
> +include_once(
> +PLOG_CLASS_PATH."plugins/gallery/class/gallery/galleryhelper.
> class.php"
> +);
> +
> +/**
> + * This class creates the view for the embedded gallery.
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class PluginGalleryShowView extends PluginTemplatedView {
> +
> + /**
> + * Constructor to create a non-cached view
> + *
> + * @param $blogInfo Blog specific information.
> + * @return None.
> + */
> + function PluginGalleryShowView( $blogInfo )
> + {
> + $this->PluginTemplatedView( $blogInfo,
> + "gallery",
> + "galleryShow",
> + SMARTY_VIEW_CACHE_DISABLED );
> + }
> +
> + /**
> + * This function renders the gallery view
> + *
> + * @param None.
> + * @return Returns true.
> + */
> + function render()
> + {
> + // Get the current gallery settings
> + $blogSettings = $this->_blogInfo->getSettings();
> + $pluginEnabled = $blogSettings->getValue(
> "plugin_gallery_enabled" );
> + $sidebarEnabled = $blogSettings->getValue(
> "gallery_sidebar_enabled" );
> + $sidebarGreetingEnabled = $blogSettings->getValue(
> "gallery_sidebarGreeting_enabled" );
> + $pathbarEnabled = $blogSettings->getValue(
> "gallery_pathbar_enabled" );
> + $absolutePath = $blogSettings->getValue(
> "gallery_absolute_path" );
> + $embedUri = $blogSettings->getValue( "gallery_embed_uri" );
> + $embedPath = $blogSettings->getValue( "gallery_embed_path" );
> + $relativePath = $blogSettings->getValue(
> "gallery_relative_path" );
> +
> + // Create a gallery helper object to interact with gallery
> + $gallery = new GalleryHelper( $absolutePath,
> + $embedUri,
> + $embedPath,
> + $relativePath);
> +
> + $gallery->getGallery($sidebarEnabled,
> + $sidebarGreetingEnabled,
> + $pathbarEnabled);
> +
> + // Export values to the template
> + $this->setValue( "pluginEnabled", $pluginEnabled );
> + $this->setValue( "galleryTitle", $gallery->getTitle() );
> + $this->setValue( "galleryCSS", $gallery->getCSS() );
> + $this->setValue( "galleryJavascript",
> $gallery->getJavascript() );
> + $this->setValue( "galleryBody", $gallery->getBody() );
> + $this->setValue( "galleryError", $gallery->getError() );
> +
> + parent::render();
> +
> + return true;
> + }
> +}
> +?>
>
> Added: plugins/trunk/gallery/locale/locale_en_UK.php
> ===================================================================
> --- plugins/trunk/gallery/locale/locale_en_UK.php
> 2005-05-09 07:31:58 UTC (rev 1974)
> +++ plugins/trunk/gallery/locale/locale_en_UK.php
> 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,52 @@
> +<?php
> +$messages["embeddedApps"] = "Embedded Applications";
> +$messages["Gallery"] = "Gallery"; $messages["gallery_plugin"] =
> +"Gallery Plugin";
> +
> +$messages["gallery_sidebar_enabled"] = "Show sidebar";
> +$messages["gallery_sidebarGreeting_enabled"] = "Show sidebar
> greeting";
> +$messages["gallery_pathbar_enabled"] = "Show pathbar";
> +
> +$messages["error_gallery_not_enabled"] = "Please enable
> Gallery plugin
> +first."; $messages["error_required_missing"] = "Please fill in all
> +required values."; $messages["error_absolute_path"] = "Absolute path
> +doesn't seem to be correct."; $messages["error_itemid"] = "You must
> +fill in Item Id if you choose 'specificItem' in blocks";
> +$messages["gallery_settings_saved_ok"] = "Gallery settings saved
> +successfully!";
> +
> +$messages["label_configuration"] = "Configuration";
> +$messages["label_enable"] = "Enable this plugin";
> +$messages["label_default"] = "Default"; $messages["label_sidebar"] =
> +"Enable side bar"; $messages["label_sidebar_greeting"] =
> "Enable side
> +bar greeting"; $messages["label_sidepath"] = "Enable side path";
> +$messages["label_absolute_path"] = "Absolute path";
> +$messages["label_embed_uri"] = "Embed uri";
> +$messages["label_embed_path"] = "Embed path";
> +$messages["label_relative_path"] = "Relative path";
> +$messages["label_example"] = "Example:"; $messages["label_blocks"] =
> +"Blocks"; $messages["label_show"] = "Show";
> $messages["label_itemid"] =
> +"Item ID";
> +
> +$messages["help_enable"] = "Enables the gallery plugin";
> +$messages["help_sidebar"] = "Enable the Gallery side bar.
> This allows
> +for extended functionality."; $messages["help_sidebar_greeting"] =
> +"Displays a welcome message to the user.";
> $messages["help_sidepath"] =
> +"Displays a navigation path to the user.";
> +$messages["help_absolute_path"] = "Path to Gallery's embed.php file
> +(ex. /var/www/gallery2/embed.php)."; $messages["help_embed_uri"] =
> +"Filename (and query parameters, but no path) of pLog.";
> $messages["help_embed_path"] = "URL path from document root
> to pLog directory."; $messages["help_relative_path"] = "Path
> from pLog directory to Gallery base directory.";
> +$messages["help_example"] = "<pre> __ access point
> __ __ G2 base dir __<br/>".
> +" a) plog/index.php plog/gallery2<br/>".
> +" b) index.php?page=gallery albums<br/>".
> +"For the above examples these settings are:<br/>".
> +" __ embedURI __ __ embedPath __ __
> relativeG2Path __<br/>".
> +" a) index.php /plog
> gallery2<br/>".
> +" d) index.php?page=gallery /
> albums</pre>";
> +$messages["help_blocks"] = "A pipe (|) separated list, of
> one or more possible blocks which are:<br/>".
> +" *
> randomImage|recentImage|viewedImage|randomAlbum|recentAlbum|vi
> ewedAlbum|specificItem<br/>".
> +" *
> +dailyImage|weeklyImage|monthlyImage|dailyAlbum|weeklyAlbum|mo
> nthlyAlbum
> +"; $messages["help_show"] = "A pipe (|) separated list of
> one or more
> +possible choices which are:<br/>".
> +" * title|date|views|owner|heading|fullSize or just 'none'";
> +$messages["help_itemid"] = "If you choose 'blocks' = 'specificItem',
> +you have to specify this field."; ?>
> \ No newline at end of file
>
> Added: plugins/trunk/gallery/plugingallery.class.php
> ===================================================================
> --- plugins/trunk/gallery/plugingallery.class.php
> 2005-05-09 07:31:58 UTC (rev 1974)
> +++ plugins/trunk/gallery/plugingallery.class.php
> 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,113 @@
> +<?php
> +include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
> +include_once(
> +PLOG_CLASS_PATH."plugins/gallery/class/gallery/galleryhelper.
> class.php"
> +);
> +
> +/**
> + * This class is responsible for initializing the gallery
> plugin. The
> +gallery plugin
> + * creates one blog action (to display the photo gallery)
> and two admin
> +actions to change
> + * the plugin's settings. This class also sets up an menu
> option in the control center.
> + *
> + * @version 0.1
> + * @author Laurent Vauthrin
> + */
> +class PluginGallery extends PluginBase {
> + /**
> + * @private
> + */
> + var $_pluginEnabled;
> +
> + /**
> + * Constructor.
> + *
> + * @param None.
> + * @return None.
> + */
> + function Plugingallery()
> + {
> + $this->PluginBase();
> +
> + // Setup the plugin information
> + $this->id = "gallery";
> + $this->author = "Laurent Vauthrin";
> + $this->desc = "Integrates gallery into plog.";
> +
> + // Setup the locale
> + $this->locales = Array( "en_UK" );
> +
> + // Register the actions
> + $this->registerBlogAction( "gallery",
> "PluginGalleryShowAction" );
> + $this->registerAdminAction( "gallery",
> "PluginGalleryConfigAction" );
> + $this->registerAdminAction( "updateGalleryConfig",
> + "PluginGalleryUpdateConfigAction" );
> +
> + // Set up the Admin menu options
> + $menu =& Menu::getMenu();
> + if( !$menu->entryExists(
> "/menu/controlCenter/embeddedApps" ) ) {
> + $this->addMenuEntry( "/menu/controlCenter",
> "embeddedApps", "", "", true, false );
> + }
> + $this->addMenuEntry(
> "/menu/controlCenter/embeddedApps", "Gallery", "?op=gallery", "" );
> + }
> +
> + /**
> + * This function initialites the plugin's default values
> + *
> + * @param None.
> + * @return Returns true.
> + */
> + function register()
> + {
> + $blogSettings = $this->blogInfo->getSettings();
> + $this->_pluginEnabled = $blogSettings->getValue(
> +"plugin_gallery_enabled" );
> +
> + return true;
> + }
> +
> + /**
> + * This function gets Gallery's image block
> + *
> + * @param
> + * @return Returns error or image block.
> + */
> + function getImageBlock()
> + {
> + // Get the necessary blog settings
> + $blogSettings = $this->blogInfo->getSettings();
> + $absolutePath = $blogSettings->getValue(
> "gallery_absolute_path" );
> + $embedUri = $blogSettings->getValue( "gallery_embed_uri" );
> + $embedPath = $blogSettings->getValue( "gallery_embed_path" );
> + $relativePath = $blogSettings->getValue(
> "gallery_relative_path" );
> + $blocks = $blogSettings->getValue( "gallery_blocks" );
> + $show = $blogSettings->getValue( "gallery_show" );
> + $itemid = $blogSettings->getValue( "gallery_itemid" );
> +
> + // Create a gallery helper object to interact with gallery
> + $gallery = new GalleryHelper( $absolutePath,
> + $embedUri,
> + $embedPath,
> + $relativePath);
> +
> + if ( $blocks == "" ) {
> + $blocks = "randomImage";
> + }
> + if ( $show == "" ) {
> + $show = "none";
> + }
> +
> + // Get the image block
> + return $gallery->getImageBlock($blocks,
> + $show,
> + $itemid);
> + }
> +
> + /**
> + * Accessor function used to determine if the plugin is enabled.
> + *
> + * @param None.
> + * @return A boolean value that tells whether the plugin
> is enabled or disabled.
> + */
> + function isEnabled()
> + {
> + return $this->_pluginEnabled;
> + }
> +}
> +?>
>
> Added: plugins/trunk/gallery/templates/galleryAdmin.template
> ===================================================================
> --- plugins/trunk/gallery/templates/galleryAdmin.template
> 2005-05-09 07:31:58 UTC (rev 1974)
> +++ plugins/trunk/gallery/templates/galleryAdmin.template
> 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,104 @@
> +{include file="$admintemplatepath/header.template"}
> +{include file="$admintemplatepath/navigation.template"
> showOpt=Gallery
> +title=$locale->tr("gallery_plugin")}
> +<form name="galleryPluginConfig" method="post"> <fieldset
> +class="inputField">
> +<legend>{$locale->tr("label_configuration")}</legend>
> + {include file="$admintemplatepath/successmessage.template"}
> + {include file="$admintemplatepath/errormessage.template"}
> + <div class="field">
> + <span class="required"></span>
> + <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
> + <div class="formHelp">
> + <input class="checkbox" type="checkbox"
> name="pluginEnabled" id="pluginEnabled"
> + {if $pluginEnabled} checked="checked" {/if}
> value="1"/>{$locale->tr("help_enable")}
> + </div>
> + </div>
> +
> + <div class="field">
> + <label
> for="absolutePath">{$locale->tr("label_absolute_path")}</label>
> + <span class="required">*</span>
> + <div class="formHelp">{$locale->tr("help_absolute_path")}
> + <input class="text" type="text" name="absolutePath"
> id="absolutePath" value="{$absolutePath}"/>
> + </div>
> + </div>
> + <div class="field">
> + <label for="embedUri">{$locale->tr("label_embed_uri")}</label>
> + <span class="required">*</span>
> + <div class="formHelp">{$locale->tr("help_embed_uri")}
> + <input class="text" type="text" name="embedUri"
> id="embedUri" value="{$embedUri}"/>
> + </div>
> + </div>
> + <div class="field">
> + <label for="embedPath">{$locale->tr("label_embed_path")}</label>
> + <span class="required">*</span>
> + <div class="formHelp">{$locale->tr("help_embed_path")}
> + <input class="text" type="text" name="embedPath"
> id="embedPath" value="{$embedPath}"/>
> + </div>
> + </div>
> + <div class="field">
> + <label
> for="relativePath">{$locale->tr("label_relative_path")}</label>
> + <span class="required">*</span>
> + <div class="formHelp">{$locale->tr("help_relative_path")}
> + <input class="text" type="text" name="relativePath"
> id="relativePath" value="{$relativePath}"/>
> + </div>
> + </div>
> + <div class="field">
> + <label>{$locale->tr("label_example")}</label>
> + <div class="formHelp">{$locale->tr("help_example")}</div>
> + </div>
> +
> + <div class="field">
> + <label for="blocks">{$locale->tr("label_blocks")}</label>
> + <span class="required"></span>
> + <div class="formHelp">{$locale->tr("help_blocks")}
> + <input class="text" type="text" name="blocks"
> id="blocks" value="{$blocks}"/>
> + </div>
> + </div>
> + <div class="field">
> + <label for="show">{$locale->tr("label_show")}</label>
> + <span class="required"></span>
> + <div class="formHelp">{$locale->tr("help_show")}
> + <input class="text" type="text" name="show" id="show"
> value="{$show}"/>
> + </div>
> + </div>
> + <div class="field">
> + <label for="itemid">{$locale->tr("label_itemid")}</label>
> + <span class="required"></span>
> + <div class="formHelp">{$locale->tr("help_itemid")}
> + <input class="text" type="text" name="itemid"
> id="itemid" value="{$itemid}"/>
> + </div>
> + </div>
> +
> + <div class="field">
> + <span class="required"></span>
> + <label
> for="pluginEnabled">{$locale->tr("label_sidebar")}</label><br/>
> + <div class="formHelp">
> + <input class="checkbox" type="checkbox"
> name="sidebarEnabled" id="sidebarEnabled"
> + {if $sidebarEnabled} checked="checked" {/if} value="1"
> />{$locale->tr("help_sidebar")}
> + </div>
> + </div>
> + <div class="field">
> + <span class="required"></span>
> + <label
> for="pluginEnabled">{$locale->tr("label_sidebar_greeting")}</label>
> + <div class="formHelp">
> + <input class="checkbox" type="checkbox"
> name="sidebarGreetingEnabled" id="sidebarGreetingEnabled"
> + {if $sidebarGreetingEnabled} checked="checked" {/if}
> value="1" />{$locale->tr("help_sidebar_greeting")}
> + </div>
> + </div>
> + <div class="field">
> + <span class="required"></span>
> + <label for="pluginEnabled">{$locale->tr("label_sidepath")}</label>
> + <div class="formHelp">
> + <input class="checkbox" type="checkbox"
> name="pathbarEnabled" id="pathbarEnabled"
> + {if $pathbarEnabled} checked="checked" {/if} value="1"
> />{$locale->tr("help_sidepath")}
> + </div>
> + </div>
> + </fieldset>
> + <div class="buttons">
> + <input type="hidden" name="op" value="updateGalleryConfig" />
> + <input type="reset" name="{$locale->tr("reset")}" />
> + <input type="submit" name="{$locale->tr("update_settings")}"
> +value="{$locale->tr("update")}" /> </div> </form> {include
> +file="$admintemplatepath/footernavigation.template"}
> +{include file="$admintemplatepath/footer.template"}
>
> Added: plugins/trunk/gallery/templates/galleryShow.template
> ===================================================================
> --- plugins/trunk/gallery/templates/galleryShow.template
> 2005-05-09 07:31:58 UTC (rev 1974)
> +++ plugins/trunk/gallery/templates/galleryShow.template
> 2005-05-09 19:25:50 UTC (rev 1975)
> @@ -0,0 +1,26 @@
> +{include file="$blogtemplate/header.template"}
> +
> +<!--
> +You should modify this template to suit your needs.
> +The variables exported to Smarty are:
> +
> +"pluginEnabled" - Tells you if the plugin is enabled or not.
> +"galleryTitle" - The title of the gallery page.
> +"galleryCSS" - The CSS for the gallery page (array).
> +"galleryJavascript" - The javascript for the gallery page (array).
> +"galleryBody" - The actual content of the gallery page.
> +"galleryError" - Error message sent back from gallery.
> +-->
> +
> +{if $galleryError}
> + {$galleryError}
> +{else}
> +<!-- -->
> + {section name=cssSection loop=$galleryCSS}
> + {$galleryCSS[cssSection]}
> + {/section}
> +
> + {$galleryBody}
> +{/if}
> +
> +{include file="$blogtemplate/footer.template"}
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.plogworld.net
> http://devel.plogworld.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list