/**
* Face recognition class
*
- * $Horde: ansel/lib/Faces.php,v 1.29 2009/07/14 00:25:28 mrubinsk Exp $
- *
* @author Duck <duck@obala.net>
* @package Ansel
*/
/**
* Create instance
*/
- function Ansel_Faces_opencv($params)
+ public function __construct($params)
{
$this->_defs = $params['defs'];
}
*
* @param string $file Picture filename
*/
- function _getFaces($file)
+ protected function _getFaces($file)
{
$result = Horde_Util::loadExtension('opencv');
if (!$result) {
- $err = PEAR::raiseError(_("You do not have the opencv extension enabled in PHP"));
- Horde::logMessage($err, __FILE__, __LINE__, PEAR_LOG_ERR);
- return $err;
+ throw new Horde_Exception('You do not have the opencv extension enabled in PHP');
}
$im = cv_image_load($file);
$haar = cv_object_load($this->_defs);
*
* @param int Face ID containg passed face
*/
- function _isInFace($face, $faces)
+ protected function _isInFace($face, $faces)
{
foreach ($faces as $id => $rect) {
if ($face['x'] > $rect['x'] && $face['x'] + $face['width'] < $face['x'] + $rect['width']
return false;
}
- function _getParamsArray($face_id, $image, $rect)
+ protected function _getParamsArray($face_id, $image, $rect)
{
$params = array($face_id,
$image->id,
return $params;
}
- function _createView($face_id, $image, $rect)
+ protected function _createView($face_id, $image, $rect)
{
return $this->createView($face_id,
$image,
{
echo '<div class="anselWidgets">';
foreach ($this->_widgets as $widget) {
- if ($widget->_render == 'auto') {
+ if ($widget->autoRender) {
echo $widget->html();
echo '<br />';
}
* Ansel_Widget:: class wraps the display of widgets to be displayed in various
* Ansel_Views.
*
- * $Horde: ansel/lib/Widget.php,v 1.10 2009/06/19 22:32:18 mrubinsk Exp $
- *
* Copyright 2008-2009 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget {
-
- /**
- * Any parameters this widget will need..
- *
- * @var array
- */
- var $_params = array();
-
- /**
- * Reference to the Ansel_View we are attaching to
- *
- * @var Ansel_View
- */
- var $_view;
-
- /**
- * Holds the style definition for the gallery this view is for
- * (or the image's parent gallery if this is for an image view).
- *
- * @var array
- */
- var $_style;
-
- /**
- * Title for this widget.
- *
- * @var string
- */
- var $_title;
-
- /**
- * Determine if this widget will be automatically rendered, or if it is
- * the calling code's responsibility to render it.
- *
- * @var string
- */
- var $_render = 'auto';
-
+class Ansel_Widget
+{
/**
* Factory method for creating Ansel_Widgets
*
- * @param string $type The type of widget to create.
- * @param array $params Any parameters the widget needs.
+ * @param string $driver The type of widget to create.
+ * @param array $params Any parameters the widget needs.
*
* @return mixed Ansel_Widget object | PEAR_Error
*/
- function factory($type, $params = array())
+ static function factory($driver, $params = array())
{
- $type = basename($type);
- $class = 'Ansel_Widget_' . $type;
- if (!class_exists($class)) {
- include dirname(__FILE__) . '/Widget/' . $type . '.php';
- }
+ $driver = basename($driver);
+ $class = 'Ansel_Widget_' . $driver;
if (class_exists($class)) {
- $widget = new $class($params);
- return $widget;
- }
-
- return PEAR::raiseError(sprintf(_("Unable to load the definition of %s."), $class));
- }
-
- /**
- * Constructor
- *
- * @param array $params
- * @return Ansel_Widget
- */
- function Ansel_Widget($params)
- {
- $this->_params = array_merge($params, $this->_params);
- if (!empty($params['render'])) {
- $this->_render = $params['render'];
+ return new $class($params);
}
- }
- /**
- * Attach this widget to the passed in view. Normally called
- * by the Ansel_View once this widget is added.
- *
- * @param Ansel_View $view The view to attach to
- */
- function attach($view)
- {
- $this->_view = $view;
-
- if (!empty($this->_params['style'])) {
- $this->_style = Ansel::getStyleDefinition($this->_params['style']);
- } else {
- $this->_style = $view->gallery->getStyle();
- }
-
- return true;
- }
-
- /**
- * Get the HTML for this widget
- *
- * @abstract
- */
- function html()
- {
- }
-
- /**
- * Default HTML for the beginning of the widget.
- *
- * @return string
- */
- function _htmlBegin()
- {
- $html = '<div class="anselWidget" style="background-color:' . $this->_style['background'] . ';">';
- $html .= '<h2 class="header tagTitle">' . $this->_title . '</h2>';
- return $html;
- }
-
- /**
- * Default HTML for the end of the widget.
- *
- * @return string
- */
- function _htmlEnd()
- {
- return '</div>';
- }
-
-
- /**
- * Determine if a particular view (Image, Gallery etc..) is supported
- * by this widget.
- *
- * @TODO
- * @param string $view The view to check
- *
- * @return boolean
- */
- function isSupported($view)
- {
- return true;
+ throw new Horde_Exception('Class definition of ' . $class . ' not found.');
}
}
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget_Actions extends Ansel_Widget {
+class Ansel_Widget_Actions extends Ansel_Widget_Base
+{
+ protected $_supported_views = array('Gallery');
- var $_supported_views = array('Gallery');
-
- function Ansel_Widget_Actions($params)
+ public function __construct($params)
{
- parent::Ansel_Widget($params);
$this->_title = _("Gallery Actions");
+ parent::__construct($params);
}
- function html()
+ /**
+ * TODO
+ *
+ * @see ansel/lib/Widget/Ansel_Widget_Base#html()
+ */
+ public function html()
{
- global $registry;
$html = $this->_htmlBegin();
$id = $this->_view->gallery->id;
- $galleryurl = Horde_Util::addParameter(Horde::applicationUrl('gallery.php'),
- 'gallery', $id);
+ $galleryurl = Horde_Util::addParameter(Horde::applicationUrl('gallery.php'), 'gallery', $id);
if ($this->_view->gallery->hasFeature('upload')) {
- $uploadurl = Horde_Util::addParameter(Horde::applicationUrl('img/upload.php'),
- array('gallery' => $id,
- 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0));
+ $uploadurl = Horde_Util::addParameter(
+ Horde::applicationUrl('img/upload.php'),
+ array('gallery' => $id,
+ 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0)
+ );
}
$html .= '<ul style="list-style-type:none;">';
/* Subgalleries */
if ($this->_view->gallery->hasFeature('subgalleries')) {
- $html .= '<li>' . Horde::link(Horde_Util::addParameter($galleryurl, 'actionID', 'addchild'), '', 'widget') . Horde::img('add.png') . ' ' . _("Create a subgallery") . '</a></li>';
+ $html .= '<li>' . Horde::link(Horde_Util::addParameter($galleryurl, 'actionID', 'addchild'), '', 'widget') . Horde::img('add.png', '[icon]') . ' ' . _("Create a subgallery") . '</a></li>';
}
}
$html .= '</ul>';
*
* @return string The HTML
*/
- function _getGalleryActions()
+ protected function _getGalleryActions()
{
- global $registry, $prefs, $conf;
+ global $registry, $conf;
$id = $this->_view->gallery->id;
$galleryurl = Horde_Util::addParameter(Horde::applicationUrl('gallery.php'),
- 'gallery', $id);
+ 'gallery', $id);
$selfurl = Horde::selfUrl(true, false, true);
$count = $this->_view->gallery->countImages();
$date = $this->_view->gallery->getDate();
- $html = '<div style="display:' . (($prefs->getValue('show_actions')) ? 'block' : 'none') . ';" id="gallery-actions">';
+ $html = '<div style="display:' . (($GLOBALS['prefs']->getValue('show_actions')) ? 'block' : 'none') . ';" id="gallery-actions">';
/* Attach the ajax action */
ob_start();
'url' => Ansel::getUrlFor('view', $view_params, true),
'title' => $this->_view->gallery->get('name'));
- $url = $registry->call('bookmarks/getAddUrl', array($api_params));
- if (!is_a($url, 'PEAR_Error')) {
- $html .= '<li>' . Horde::link($url, '', 'widget') . Horde::img('trean.png', '', '', $registry->getImageDir('trean')) . ' ' . _("Add to bookmarks") . '</a></li>';
- }
+ try {
+ $url = $registry->bookmarks->getAddUrl(array($api_params));
+ } catch (Horde_Exception $e) {}
+
+ $html .= '<li>' . Horde::link($url, '', 'widget') . Horde::img('trean.png', '', '', $registry->getImageDir('trean')) . ' ' . _("Add to bookmarks") . '</a></li>';
}
/* Download as ZIP link */
$conf['report_content']['allow'] == 'all')) {
$reporturl = Horde_Util::addParameter(Horde::applicationUrl('report.php'),
- 'gallery', $id);
+ 'gallery', $id);
$html .= '<li>' . Horde::link($reporturl, '', 'widget') . ' ' . _("Report") . "</a></li>\n";
}
<?php
+/**
+ * Ansel_Widget:: class wraps the display of widgets to be displayed in various
+ * Ansel_Views.
+ *
+ * $Horde: ansel/lib/Widget.php,v 1.10 2009/06/19 22:32:18 mrubinsk Exp $
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+abstract class Ansel_Widget_Base
+{
+ /**
+ * Any parameters this widget will need..
+ *
+ * @var array
+ */
+ protected $_params = array();
+
+ /**
+ * Reference to the Ansel_View we are attaching to
+ *
+ * @var Ansel_View
+ */
+ protected $_view;
+
+ /**
+ * Holds the style definition for the gallery this view is for
+ * (or the image's parent gallery if this is for an image view).
+ *
+ * @var array
+ */
+ protected $_style;
+
+ /**
+ * Title for this widget.
+ *
+ * @var string
+ */
+ protected $_title;
+
+ /**
+ * Determine if this widget will be automatically rendered, or if it is
+ * the calling code's responsibility to render it.
+ *
+ * @var string
+ */
+ protected $_autoRender = true;
+
+ /**
+ * Constructor
+ * render
+ * style
+ * @param array $params
+ * @return Ansel_Widget
+ */
+ public function __construct($params)
+ {
+ $this->_params = $params;
+ if (!empty($params['render'])) {
+ $this->_autoRender = ($params['render'] == 'auto');
+ }
+ }
+
+ /**
+ * Attach this widget to the passed in view. Normally called
+ * by the Ansel_View once this widget is added.
+ *
+ * @param Ansel_View $view The view to attach to
+ */
+ public function attach($view)
+ {
+ $this->_view = $view;
+ if (!empty($this->_params['style'])) {
+ $this->_style = Ansel::getStyleDefinition($this->_params['style']);
+ } else {
+ $this->_style = $view->gallery->getStyle();
+ }
+
+ return true;
+ }
+
+ public function __get($property)
+ {
+ switch ($property) {
+ case 'autoRender':
+ return $this->_autoRender;
+ }
+ }
+
+ /**
+ * Get the HTML for this widget
+ */
+ abstract public function html();
+
+ /**
+ * Default HTML for the beginning of the widget.
+ *
+ * @return string
+ */
+ protected function _htmlBegin()
+ {
+ $html = '<div class="anselWidget" style="background-color:' . $this->_style['background'] . ';">';
+ $html .= '<h2 class="header tagTitle">' . $this->_title . '</h2>';
+ return $html;
+ }
+
+ /**
+ * Default HTML for the end of the widget.
+ *
+ * @return string
+ */
+ protected function _htmlEnd()
+ {
+ return '</div>';
+ }
+
+
+ /**
+ * Determine if a particular view (Image, Gallery etc..) is supported
+ * by this widget.
+ *
+ * @TODO
+ * @param string $view The view to check
+ *
+ * @return boolean
+ */
+ protected function isSupported($view)
+ {
+ return true;
+ }
+
+}
* Horde_Widget_GalleryFaces:: class to display a widget containing mini
* thumbnails of faces in the gallery.
*
- * $Horde: ansel/lib/Widget/GalleryFaces.php,v 1.6 2009/07/08 18:28:46 slusarz Exp $
- *
* Copyright 2008-2009 The Horde Project (http://www.horde.org/)
*
* @author Duck <duck@obala.net>
*
* @package Ansel
*/
-class Ansel_Widget_GalleryFaces extends Ansel_Widget {
-
+class Ansel_Widget_GalleryFaces extends Ansel_Widget_Base
+{
/**
* @TODO
*
* @var unknown_type
*/
- var $_supported_views = array('Gallery');
+ protected $_supported_views = array('Gallery');
/**
* Constructor
* @param array $params Any parameters for this widget
* @return Ansel_Widget_ImageFaces
*/
- function Ansel_Widget_GalleryFaces($params)
+ public function __construct($params)
{
- parent::Ansel_Widget($params);
+ parent::__construct($params);
$this->_title = _("People in this gallery");
}
*
* @return string The HTML for this widget.
*/
- function html()
- { if ($GLOBALS['conf']['faces']['driver']) {
+ public function html()
+ {
+ if ($GLOBALS['conf']['faces']['driver']) {
$html = $this->_getFaceNames();
return $this->_htmlBegin() . $html . $this->_htmlEnd();
} else {
*
* @return string The HTML
*/
- function _getFaceNames()
+ protected function _getFaceNames()
{
if ($this->_view->resource->get('faces')) {
return '<div id="faces_widget_content">'
. '<br /><em>' . _("No faces found") . '</em></div>';
}
- require_once ANSEL_BASE . '/lib/Faces.php';
$faces = Ansel_Faces::factory();
- if (is_a($faces, 'PEAR_Error')) {
- return $faces->getMessage();
- }
// Check for existing faces for this gallery.
$html = '<div style="display: block'
. ';width:100%;max-height:300px;overflow:auto;" id="faces_widget_content" >';
$images = $faces->getGalleryFaces($this->_view->resource->id);
- if (is_a($images, 'PEAR_Error')) {
- return $images->getMessage();
- }
+
if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
$link_text = (empty($images) ? _("Find faces") : _("Edit faces"));
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
+ * @TODO: Refactor the JS out to a seperate file, output needed values in the
+ * GLOBAL Ansel javascript object.
+ *
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget_Geodata extends Ansel_Widget {
-
- var $_supported_views = array('Image', 'Gallery');
- var $_params = array('default_zoom' => 15,
- 'max_auto_zoom' => 15);
+class Ansel_Widget_Geodata extends Ansel_Widget_Base
+{
+ protected $_supported_views = array('Image', 'Gallery');
+ protected $_params = array('default_zoom' => 15,
+ 'max_auto_zoom' => 15);
- function Ansel_Widget_Geodata($params)
+ public function __construct($params)
{
- parent::Ansel_Widget($params);
+ parent::__construct($params);
$this->_title = _("Location");
}
- function attach($view)
+ public function attach($view)
{
// Don't even try if we don't have an api key
if (empty($GLOBALS['conf']['api']['googlemaps'])) {
return true;
}
- function html()
+ public function html()
{
global $ansel_storage;
}
// Bring in googlemap.js now that we know we need it.
-// $sfiles = &Ansel_Script_Files::singleton();
-// $sfiles->addExternalScript('http://maps.google.com/maps?file=api&v=2&sensor=false&key=' . $GLOBALS['conf']['api']['googlemaps']);
-// $sfiles->addExternalScript('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/1.1/src/markermanager.js');
Horde::addExternalScriptFile('http://maps.google.com/maps?file=api&v=2&sensor=false&key=' . $GLOBALS['conf']['api']['googlemaps'], 'ansel');
Horde::addExternalScriptFile('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/1.1/src/markermanager.js', 'ansel');
Horde::addScriptFile('googlemap.js');
return $html;
}
- function _getGalleryImagesWithGeodata()
+ protected function _getGalleryImagesWithGeodata()
{
return $GLOBALS['ansel_storage']->getImagesGeodata(array(), $this->_view->gallery->id);
}
- function _point2Deg($value, $lat = false)
+ protected function _point2Deg($value, $lat = false)
{
$letter = $lat ? ($value > 0 ? "N" : "S") : ($value > 0 ? "E" : "W");
$value = abs($value);
* Horde_Widget_ImageFaces:: class to display a widget containing mini
* thumbnails of faces in the image.
*
- * $Horde: ansel/lib/Widget/ImageFaces.php,v 1.29 2009/07/30 13:15:10 mrubinsk Exp $
- *
* Copyright 2008-2009 The Horde Project (http://www.horde.org/)
*
* @author Duck <duck@obala.net>
*
* @package Ansel
*/
-class Ansel_Widget_ImageFaces extends Ansel_Widget {
-
+class Ansel_Widget_ImageFaces extends Ansel_Widget_Base
+{
/**
* @TODO
*
* @var unknown_type
*/
- var $_supported_views = array('Image');
+ private $_supported_views = array('Image');
/**
* Constructor
* @param array $params Any parameters for this widget
* @return Ansel_Widget_ImageFaces
*/
- function Ansel_Widget_ImageFaces($params)
+ public function __construct($params)
{
parent::Ansel_Widget($params);
$this->_title = _("People in this photo");
*
* @return string The HTML for this widget.
*/
- function html()
+ public function html()
{
-
if ($GLOBALS['conf']['faces']['driver']) {
$html = $this->_getFaceNames();
return $this->_htmlBegin() . $html . $this->_htmlEnd();
*
* @return string The HTML
*/
- function _getFaceNames()
+ protected function _getFaceNames()
{
- require_once ANSEL_BASE . '/lib/Faces.php';
$faces = Ansel_Faces::factory();
- if (is_a($faces, 'PEAR_Error')) {
- return $faces->getMessage();
- }
// Check for existing faces for this image.
$html = '';
$images = $faces->getImageFacesData($this->_view->resource->id, true);
- if (is_a($images, 'PEAR_Error')) {
- return $images->getMessage();
- }
// Generate the top ajax action links and attach the edit actions. Falls
// back on going to the find all faces in gallery page if no js...
/**
* Ansel_Widget_links:: class to wrap the display of various feed links etc...
*
- * $Horde: ansel/lib/Widget/Links.php,v 1.16 2009/07/30 18:02:15 mrubinsk Exp $
- *
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget_Links extends Ansel_Widget {
-
- var $_supported_views = array('Gallery', 'Image');
+class Ansel_Widget_Links extends Ansel_Widget_Base
+{
+ protected $_supported_views = array('Gallery', 'Image');
- function Ansel_Widget_Links($params)
+ public function __construct($params)
{
- parent::Ansel_Widget($params);
+ parent::__construct($params);
$this->_title = _("Links");
}
- function html()
+ public function html()
{
global $registry;
$html .= '<br />' . Horde::link(Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $slug))) . ' ' . Horde::img('feed.png', '', '', $registry->getImageDir('horde')) . ' ' . sprintf(_("Recent photos in %s"), htmlspecialchars($this->_view->gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset())) . '</a>';
/* Embed html */
-
if (empty($this->_view->_params['image_id'])) {
/* Gallery view */
$params = array('count' => 10);
}
$embed = htmlentities(Ansel::embedCode($params));
-
- $html .= '<div class="embedInput">' . _("Embed: ") . '<br /><input type="text" readonly="readonly" value="' . $embed
- . '" /></div>';
-
+ $html .= '<div class="embedInput">' . _("Embed: ") . '<br /><input type="text" readonly="readonly" value="' . $embed . '" /></div>';
$html .= $this->_htmlEnd();
+
return $html;
}
}
-?>
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget_OtherGalleries extends Ansel_Widget {
-
+class Ansel_Widget_OtherGalleries extends Ansel_Widget_Base
+{
/**
* Override the parent class' attach method and set the owner in the
* title string.
*
* @param Ansel_View $view The view we are attaching to
*/
- function attach($view)
+ public function attach($view)
{
parent::attach($view);
*
* @return string The HTML representing this widget.
*/
- function html()
+ public function html()
{
if ($GLOBALS['conf']['ansel_cache']['usecache'] &&
($widget = $GLOBALS['cache']->get('Ansel_OtherGalleries' . $this->_view->gallery->get('owner'))) !== false) {
*
* @return string The HTML
*/
- function _getOtherGalleries()
+ protected function _getOtherGalleries()
{
- require_once 'Horde/Tree.php';
-
- global $prefs;
-
$owner = $this->_view->gallery->get('owner');
/* Set up the tree */
'name', 0);
$html = '<div style="display:'
- . (($prefs->getValue('show_othergalleries')) ? 'block' : 'none')
+ . (($GLOBALS['prefs']->getValue('show_othergalleries')) ? 'block' : 'none')
. ';background:' . $this->_style['background']
. ';width:100%;max-height:300px;overflow:auto;" id="othergalleries" >';
+ //@TODO - for now, Horde_Share will still return PEAR_Error,
+ // this will be fixed when Ansel_Gallery is refactored.
foreach($gals as $gal) {
if (is_a($gal, 'PEAR_Error')) {
Horde::logMessage($gal, __FILE__, __LINE__, PEAR_LOG_ERR);
* @author Duck <duck@obala.net>
* @package Ansel
*/
-class Ansel_Widget_OwnerFaces extends Ansel_Widget {
-
- var $_faces;
- var $_count;
- var $_owner;
+class Ansel_Widget_OwnerFaces extends Ansel_Widget_Base
+{
+ protected $_faces;
+ protected $_count;
+ protected $_owner;
/**
* Constructor
* @param array $params Any parameters for this widget
* @return Ansel_Widget_ImageFaces
*/
- function Ansel_Widget_OwnerFaces($params)
+ function __construct($params)
{
- parent::Ansel_Widget($params);
-
- require_once ANSEL_BASE . '/lib/Faces.php';
+ parent::__construct($params);
$this->_faces = Ansel_Faces::factory();
}
*
* @return string The HTML for this widget.
*/
- function html()
+ public function html()
{
if (!$GLOBALS['conf']['faces']['driver']) {
return '';
}
$this->_owner = $this->_view->gallery->get('owner');
- $this->_count = $this->_faces->countOwnerFaces($this->_owner);
+ //@TODO: Remove the PEAR_Error check when Faces is refactored.
+ try {
+ $this->_count = $this->_faces->countOwnerFaces($this->_owner);
+ } catch (Horde_Exception $e) {}
if (is_a($this->_count, 'PEAR_error')) {
$this->_count = 0;
}
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget_SimilarPhotos extends Ansel_Widget {
-
+class Ansel_Widget_SimilarPhotos extends Ansel_Widget_Base
+{
/**
* @TODO
*
* @var unknown_type
*/
- var $_supported_views = array('Image');
+ protected $_supported_views = array('Image');
/**
* Constructor
* @param array $params Any parameters for this widget
* @return Ansel_Widget_SimilarPhotos
*/
- function Ansel_Widget_SimilarPhotos($params)
+ public function __construct($params)
{
- parent::Ansel_Widget($params);
+ parent::__construct($params);
$this->_title = _("Similar Photos");
}
*
* @return string The HTML for this widget.
*/
- function html()
+ public function html()
{
$html = $this->_htmlBegin();
$html .= '<div id="similar">' . $this->_getRelatedImages() . '</div>';
$html .= $this->_htmlEnd();
+
return $html;
}
*
* @return string The HTML
*/
- function _getRelatedImages()
+ public function _getRelatedImages()
{
- require_once ANSEL_BASE . '/lib/Tags.php';
global $ansel_storage;
$html = '';
}
}
}
+
return $html;
}
}
<?php
-require_once ANSEL_BASE . '/lib/Tags.php';
-
/**
* Ansel_Widget_Tags:: class to display a tags widget in the image and gallery
* views.
*
- * $Horde: ansel/lib/Widget/Tags.php,v 1.15 2009/07/28 15:15:04 mrubinsk Exp $
- *
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
-class Ansel_Widget_Tags extends Ansel_Widget {
+class Ansel_Widget_Tags extends Ansel_Widget_Base
+{
+ protected $_resourceType;
- var $_resourceType;
-
- function Ansel_Widget_Tags($params)
+ public function __construct($params)
{
- parent::Ansel_Widget($params);
+ parent::__construct($params);
$this->_resourceType = $params['view'];
$this->_title = _("Tags");
}
*
* @return string The HTML representing this widget.
*/
- function html()
+ public function html()
{
if ($this->_resourceType == 'image') {
$image_id = $this->_view->resource->id;
$html .= '<div id="tags">' . $this->_getTagHTML() . '</div>';
if ($this->_view->gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
ob_start();
-
/* Attach the Ajax action */
$imple = Horde_Ajax_Imple::factory(array('ansel', 'TagActions'),
array('bindTo' => array('add' => 'tagbutton'),
$imple->attach();
$html .= ob_get_clean();
- // JS fallback is getting refactoring into xrequest.php
$actionUrl = Horde_Util::addParameter('image.php',
array('image' => $this->_view->resource->id,
'gallery' => $this->_view->gallery->id));
*
* @return string The HTML representing the tag list.
*/
- function _getTagHTML()
+ protected function _getTagHTML()
{
global $registry;
- /* Clear the tag cache? */
+ /* Clear the tag cache? */
if (Horde_Util::getFormData('havesearch', 0) == 0) {
Ansel_Tags::clearSearch();
}
- // TODO - Degrade the delete links to work without js
$hasEdit = $this->_view->gallery->hasPermission(Horde_Auth::getAuth(),
PERMS_EDIT);
$owner = $this->_view->gallery->get('owner');