Horde_Util::closeWindowJS('window.opener.location.href = window.opener.location.href; window.close();');
exit;
}
-} else {
- // TODO - right now we should *always* have a gallery_id. If we get here
- // from a results view, we may not, but that's not implemented yet.
}
/* Make sure we have at least one image */
if ($results instanceof PEAR_Error) {
Horde::logMessage($results, __FILE__, __LINE__, PEAR_LOG_ERR);
} else {
- // @TODO: This should be a config param?
$_SESSION['ansel']['ajax_locationac'] = (count($results) > 50);
}
}
* @param string $name Face name
*
* @return array Faces found
- * @throws Horde_Exception
+ * @throws Ansel_Exception, Horde_Exception_PermissionDenied
*/
public function saveCustomFace($face_id, $image, $x1, $y1, $x2, $y2, $name = '')
{
$image = &$GLOBALS['ansel_storage']->getImage($image);
$gallery = $GLOBALS['ansel_storage']->getGallery($image->gallery);
if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) {
- //TODO: Do we throw exceptions for access denied?
- throw new Horde_Exception('Access denied editing the photo.');
+ throw new Horde_Exception_PermissionDenied('Access denied editing the photo.');
}
if (empty($face_id)) {
$new = true;
$face_id = $GLOBALS['ansel_db']->nextId('ansel_faces');
if ($face_id instanceof PEAR_Error) {
- throw new Horde_Exception_Prior($face_id);
+ throw new Ansel_Exception($face_id);
}
}
*
* @return mixed true || PEAR_Error on failure.
*/
- function _save()
+ public function _save()
{
// Check for invalid characters in the slug.
if (!empty($this->data['attribute_slug']) &&
* 1 - descending
*
* @return array of Ansel_Gallery objects
- * @throws Horde_Exception
+ * @throws Ansel_Exception
*/
public function listGalleries($perm = Horde_Perms::SHOW,
$attributes = null,
'day' => date('j', $full_date->timestamp()));
}
- /* Get the currently displayed gallery view type */
- // @TODO: $view would only be needed if we are displaying this tile in a
- // search result view as well. (Not implemented yet)
- //$view = Horde_Util::getFormData('view', 'Gallery');
-
/* Check permissions on the gallery and get appropriate tile image */
if ($dgallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::READ)) {
if (is_null($style)) {
/**
* The current page we are viewing
- * //TODO: use __get() for these type of things...
+ *
* @var integer
*/
public $page = 0;
}
/**
- * TODO
- *
+ *
* @see ansel/lib/Widget/Ansel_Widget_Base#html()
*/
public function html()
* Determine if a particular view (Image, Gallery etc..) is supported
* by this widget.
*
- * @TODO
* @param string $view The view to check
*
* @return boolean
class Ansel_Widget_GalleryFaces extends Ansel_Widget_Base
{
/**
- * @TODO
+ * Supported views for this widget
*
- * @var unknown_type
+ * @var array
*/
protected $_supported_views = array('Gallery');
* 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.
+ * GLOBAL Ansel javascript object. Rewrite for Horde_Map js.
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
class Ansel_Widget_ImageFaces extends Ansel_Widget_Base
{
/**
- * @TODO
+ * The views this Widget may appear in
*
- * @var unknown_type
+ * @var array
*/
private $_supported_views = array('Image');
/**
* Build the HTML for the other galleries widget content.
*
- * @TODO Allow the sort order and maybe the count of galleries returned
- * to be configurable via the params array.
- *
* @return string The HTML
*/
protected function _getOtherGalleries()
/* Set up the tree */
$tree = Horde_Tree::singleton('otherAnselGalleries_' . md5($owner), 'Javascript');
$tree->setOption(array('class' => 'anselWidgets'));
- $gals = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, $owner,
- null, true, 0, 0,
- 'name', 0);
+
+ try {
+ $gals = $GLOBALS['ansel_storage']->listGalleries(Horde_Perms::SHOW, $owner,
+ null, true, 0, 0,
+ 'name', 0);
+ } catch (Ansel_Exception $e) {
+ Horde::logMessage($gal, __FILE__, __LINE__, PEAR_LOG_ERR);
+ return '';
+ }
$html = '<div style="display:'
. (($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);
- return '';
- }
-
$parents = $gal->get('parents');
if (empty($parents)) {
$parent = null;
? 'hide'
: 'show') . '"> </a></div>' . "\n";
-
-
return $html;
}
}
$author = '';
// Determine what we are requesting
- // @TODO - category
switch ($stream_type) {
case 'all':
$images = $ansel_storage->getRecentImages();
/**
* Read an image from the filesystem.
*
- * @TODO: pass in location of magic_db?
- *
* @param string $file The filename of the image.
*
* @return array The image data of the file as an array or PEAR_Error