*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
-
require_once dirname(__FILE__) . '/lib/base.php';
$images = Horde_Util::getFormData('image', array());
exit;
}
-/* Includes */
-require_once ANSEL_BASE . '/lib/Forms/ImageDate.php';
-require_once 'Horde/Form/Renderer.php';
-
/* Set up the form */
$vars = Horde_Variables::getDefaultVariables();
-$form = new ImageDateForm($vars, _("Edit Dates"));
+$form = new Ansel_Form_ImageDate($vars, _("Edit Dates"));
/* Are we doing the edit now? */
if ($actionID == 'edit_dates') {
$count = 0;
*/
require_once dirname(__FILE__) . '/lib/base.php';
-require_once 'Horde/Form/Renderer.php';
/* Get all the form data */
$actionID = Horde_Util::getFormData('actionID');
} else {
$vars->set('actionID', 'savecloseimage');
}
- $form = new ImageForm($vars, $title);
+ $form = new Ansel_Form_Image($vars, $title);
$renderer = new Horde_Form_Renderer();
/* Set up the gallery attributes. */
$vars = Horde_Variables::getDefaultVariables();
$vars->set('actionID', 'save');
$renderer = new Horde_Form_Renderer();
- $form = new ImageForm($vars, _("Edit a photo"));
+ $form = new Ansel_Form_Image($vars, _("Edit a photo"));
/* Update existing image. */
if ($form->validate($vars)) {
require_once ANSEL_BASE . '/lib/Forms/Watermark.php';
$vars = Horde_Variables::getDefaultVariables();
$vars->set('actionID', 'previewcustomwatermark');
- $form = new WatermarkForm($vars, _("Watermark"));
+ $form = new Ansel_Form_Watermark($vars, _("Watermark"));
$renderer = new Horde_Form_Renderer();
require ANSEL_TEMPLATES . '/common-header.inc';
*/
require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Forms/Ecard.php';
-require_once 'Horde/Form/Renderer.php';
/* Abort if ecard sending is disabled. */
if (empty($conf['ecard']['enable'])) {
$vars = Horde_Variables::getDefaultVariables();
$vars->set('actionID', 'send');
$vars->set('image_desc', strlen($image->caption) ? $image->caption : $image->filename);
-$form = new EcardForm($vars, $title);
+$form = new Ansel_Form_Ecard($vars, $title);
$renderer = new Horde_Form_Renderer();
if ($browser->hasFeature('rte')) {
*/
require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Forms/Upload.php';
-require_once 'Horde/Form/Renderer.php';
$gallery_id = Horde_Util::getFormData('gallery');
$gallery = &$ansel_storage->getGallery($gallery_id);
$page = Horde_Util::getFormData('page', 0);
$vars = Horde_Variables::getDefaultVariables();
-$form = new UploadForm($vars, _("Upload photos"));
+$form = new Ansel_Form_Upload($vars, _("Upload photos"));
if ($form->validate($vars)) {
$valid = true;
$uploaded = 0;
--- /dev/null
+<?php
+/**
+ * Ecard generator.
+ *
+ * @package Ansel
+ */
+
+class Ansel_Form_Ecard extends Horde_Form {
+
+ protected $_useFormToken = false;
+
+ public function __construct(&$vars, $title)
+ {
+ parent::Horde_Form($vars, $title);
+
+ $this->setButtons(_("Send"));
+ $this->addHidden('', 'actionID', 'text', false);
+ $this->addHidden('', 'gallery', 'text', false);
+ $this->addHidden('', 'image', 'text', false);
+ $this->addHidden('', 'image_desc', 'text', false);
+
+ $user = Horde_Auth::getAuth();
+ if (empty($user)) {
+ $this->addVariable(_("Use the following return address:"), 'ecard_retaddr', 'text', true);
+ } else {
+ require_once 'Horde/Identity.php';
+ $identity = Identity::singleton();
+ $from_addr = $identity->getDefaultFromAddress();
+ $vars->set('ecard_retaddr', $from_addr);
+ $this->addHidden('', 'ecard_retaddr', 'text', true);
+ }
+
+ $this->addVariable(_("Send ecard to the following address:"), 'ecard_addr', 'text', true);
+ $this->addVariable(_("Comments:"), 'ecard_comments', 'longtext', false, false, null, array('15', '60'));
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Copyright 2003-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 Chuck Hagenbuch <chuck@horde.org>
+ */
+class Ansel_Form_Image extends Horde_Form
+{
+ protected $_useFormToken = false;
+
+ public function __construct(&$vars, $title)
+ {
+ global $gallery;
+
+ parent::Horde_Form($vars, $title);
+
+ $this->setButtons(_("Save"));
+ $this->addHidden('', 'actionID', 'text', false);
+ $this->addHidden('', 'gallery', 'text', false);
+ $this->addHidden('', 'image', 'text', false);
+ $this->addHidden('', 'page', 'text', false);
+
+ $filesize = ini_get('upload_max_filesize');
+ if (substr($filesize, -1) == 'M') {
+ $filesize = $filesize * 1048576;
+ }
+ $filesize = $this->_get_size($filesize);
+ $this->addVariable(_("Make this the default photo for this gallery?"),
+ 'image_default', 'boolean', false);
+ $this->addVariable(_("Caption"), 'image_desc', 'longtext', false, false,
+ null, array('4', '40'));
+
+ $this->addVariable(_("Original Date"), 'image_originalDate',
+ 'monthdayyear', true, false, null,
+ array('start_year' => 1900));
+
+ $this->addVariable(_("Tags"), 'image_tags', 'text', false);
+
+ $this->addHidden('', 'image0', 'text', false);
+ $upload = &$this->addVariable(
+ _("Replace photo with this file"), 'file0', 'image', false, false,
+ _("Maximum photo size:") . ' ' . $filesize, array(false));
+ $upload->setHelp('upload');
+ }
+
+ /**
+ * Format file size
+ */
+ protected function _get_size($size)
+ {
+ $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
+
+ foreach ($bytes as $val) {
+ if ($size > 1024) {
+ $size = $size / 1024;
+ } else {
+ break;
+ }
+ }
+
+ return round($size, 2) . ' ' . $val;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * 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>
+ */
+class Ansel_Form_ImageDate extends Horde_Form
+{
+ protected $_useFormToken = false;
+
+ public function __construct(&$vars, $title)
+ {
+ global $gallery;
+
+ parent::Horde_Form($vars, $title);
+
+ $this->setButtons(_("Save"));
+ $this->addHidden('', 'actionID', 'text', false);
+ $this->addHidden('', 'gallery', 'text', false);
+ $this->addHidden('', 'image', 'text', false);
+ $this->addHidden('', 'page', 'text', false);
+ $this->addVariable(_("Editing dates for the following photos"), 'image_list', 'html', false, true);
+ $this->addVariable(_("Original Date"), 'image_originalDate',
+ 'monthdayyear', true, false, null,
+ array('start_year' => 1900));
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Image uploader. Provides 3 different options - single images,
+ * multiple images, and zip file.
+ *
+ * @package Ansel
+ */
+class Ansel_Form_Upload extends Horde_Form
+{
+ protected $_useFormToken = false;
+
+ public function __construct(&$vars, $title)
+ {
+ global $gallery, $conf;
+
+ parent::Horde_Form($vars, $title);
+
+ $filesize = ini_get('upload_max_filesize');
+ if (substr($filesize, -1) == 'M') {
+ $filesize = $filesize * 1048576;
+ }
+ $filesize = $this->_get_size($filesize);
+
+ $postsize = ini_get('post_max_size');
+ if (substr($postsize, -1) == 'M') {
+ $postsize = $postsize * 1048576;
+ }
+ $postsize = $this->_get_size($postsize);
+
+ $this->setButtons(array(_("Upload"), _("Cancel")));
+ $this->addHidden('', 'gallery', 'text', false);
+ $this->addHidden('', 'page', 'text', false);
+
+ $this->setSection('single_file', _("Single Photo"));
+ $this->addHidden('', 'image0', 'text', false);
+ if (!strlen($vars->get('image0'))) {
+ $upload = &$this->addVariable(
+ _("File to upload"), 'file0', 'image', false, false,
+ _("Maximum photo size:") . ' ' . $filesize, array(false));
+ $upload->setHelp('upload');
+ }
+ $this->addVariable(_("Make this the default photo for this gallery?"), 'image0_default', 'boolean', false);
+ $this->addVariable(_("Caption"), 'image0_desc', 'longtext', false, false, null, array('4', '40'));
+ $this->addVariable(_("Tags"), 'image0_tags', 'text', false, false, _("Separate tags with commas."));
+
+ $this->setSection('multi_file', _("Multiple Photos"));
+
+ if (!strlen($vars->get('image0'))) {
+ $msg = sprintf(_("Maximum photo size: %s; with a total of: %s"),
+ $filesize, $postsize);
+ $this->addVariable($msg, 'description', 'description', false);
+ }
+
+ // start at $i = 1 because 0 is used above.
+ for ($i = 1; $i <= $conf['image']['num_uploads']; $i++) {
+ $this->addHidden('', 'image' . $i, 'text', false);
+ if (!strlen($vars->get('image' . $i))) {
+ $upload = &$this->addVariable(sprintf(_("File %s"), $i), 'file' . $i, 'image', false, false, null, array(false));
+ $upload->setHelp('upload');
+ }
+ }
+
+ $this->setSection('zip_file', _("Zip File Upload"));
+ $this->addHidden('', 'image' . ($conf['image']['num_uploads'] + 1), 'text', false);
+ if (!strlen($vars->get('zip'))) {
+ $upload = &$this->addVariable(
+ _("File to upload"),
+ 'file' . ($conf['image']['num_uploads'] + 1),
+ 'file', false, false,
+ _("Maximum file size:") . ' ' . $filesize);
+ $upload->setHelp('upload');
+ }
+ }
+
+ /**
+ * Format file size
+ */
+ protected function _get_size($size)
+ {
+ $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
+
+ foreach ($bytes as $val) {
+ if ($size > 1024) {
+ $size = $size / 1024;
+ } else {
+ break;
+ }
+ }
+
+ return round($size, 2) . ' ' . $val;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Copyright 2003-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 Chuck Hagenbuch <chuck@horde.org>
+ */
+class Ansel_Form_Watermark extends Horde_Form
+{
+ protected $_useFormToken = false;
+
+ public function __construct(&$vars, $title)
+ {
+ global $gallery, $prefs;
+
+ parent::Horde_Form($vars, $title);
+
+ $this->setButtons(_("Save"));
+ $this->addHidden('', 'actionID', 'text', false);
+ $this->addHidden('', 'gallery', 'text', false);
+ $this->addHidden('', 'image', 'text', false);
+ $this->addHidden('', 'page', 'text', false);
+
+ $w = &$this->addVariable(_("Custom Watermark"), 'watermark', 'text',
+ false, false, null);
+ $w->setDefault($prefs->getValue('watermark_text'));
+
+ $fonts = array('tiny' => _("Tiny"),
+ 'small' => _("Small"),
+ 'medium' => _("Medium"),
+ 'large' => _("Large"),
+ 'giant' => _("Giant"));
+ $f = &$this->addVariable(_("Watermark Font"), 'font', 'enum', false,
+ false, null, array($fonts));
+ $f->setDefault($prefs->getValue('watermark_font'));
+
+ $ha = array('left' => _("Left"),
+ 'center' => _("Center"),
+ 'right' => _("Right"));
+ $wha = &$this->addVariable(_("Horizontal Alignment"), 'whalign', 'enum',
+ false, false, null, array($ha));
+ $wha->setDefault($prefs->getValue('watermark_horizontal'));
+
+ $va = array('top' => _("Top"),
+ 'center' => _("Center"),
+ 'bottom' => _("Bottom"));
+ $wva = &$this->addVariable(_("Vertical Alignment"), 'wvalign', 'enum',
+ false, false, null, array($va));
+ $wva->setDefault($prefs->getValue('watermark_vertical'));
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * Ecard generator.
- *
- * @package Ansel
- */
-
-class EcardForm extends Horde_Form {
-
- var $_useFormToken = false;
-
- function EcardForm(&$vars, $title)
- {
- parent::Horde_Form($vars, $title);
-
- $this->setButtons(_("Send"));
- $this->addHidden('', 'actionID', 'text', false);
- $this->addHidden('', 'gallery', 'text', false);
- $this->addHidden('', 'image', 'text', false);
- $this->addHidden('', 'image_desc', 'text', false);
-
- $user = Horde_Auth::getAuth();
- if (empty($user)) {
- $this->addVariable(_("Use the following return address:"), 'ecard_retaddr', 'text', true);
- } else {
- require_once 'Horde/Identity.php';
- $identity = Identity::singleton();
- $from_addr = $identity->getDefaultFromAddress();
- $vars->set('ecard_retaddr', $from_addr);
- $this->addHidden('', 'ecard_retaddr', 'text', true);
- }
-
- $this->addVariable(_("Send ecard to the following address:"), 'ecard_addr', 'text', true);
- $this->addVariable(_("Comments:"), 'ecard_comments', 'longtext', false, false, null, array('15', '60'));
- }
-
-}
+++ /dev/null
-<?php
-/**
- * Copyright 2003-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 Chuck Hagenbuch <chuck@horde.org>
- */
-class ImageForm extends Horde_Form {
-
- var $_useFormToken = false;
-
- function ImageForm(&$vars, $title)
- {
- global $gallery;
-
- parent::Horde_Form($vars, $title);
-
- $this->setButtons(_("Save"));
- $this->addHidden('', 'actionID', 'text', false);
- $this->addHidden('', 'gallery', 'text', false);
- $this->addHidden('', 'image', 'text', false);
- $this->addHidden('', 'page', 'text', false);
-
- $filesize = ini_get('upload_max_filesize');
- if (substr($filesize, -1) == 'M') {
- $filesize = $filesize * 1048576;
- }
- $filesize = $this->_get_size($filesize);
- $this->addVariable(_("Make this the default photo for this gallery?"),
- 'image_default', 'boolean', false);
- $this->addVariable(_("Caption"), 'image_desc', 'longtext', false, false,
- null, array('4', '40'));
-
- $this->addVariable(_("Original Date"), 'image_originalDate',
- 'monthdayyear', true, false, null,
- array('start_year' => 1900));
-
- $this->addVariable(_("Tags"), 'image_tags', 'text', false);
-
- $this->addHidden('', 'image0', 'text', false);
- $upload = &$this->addVariable(
- _("Replace photo with this file"), 'file0', 'image', false, false,
- _("Maximum photo size:") . ' ' . $filesize, array(false));
- $upload->setHelp('upload');
- }
-
- /**
- * Format file size
- */
- function _get_size($size)
- {
- $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
-
- foreach ($bytes as $val) {
- if ($size > 1024) {
- $size = $size / 1024;
- } else {
- break;
- }
- }
-
- return round($size, 2) . ' ' . $val;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * 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>
- */
-class ImageDateForm extends Horde_Form {
-
- var $_useFormToken = false;
-
- function ImageDateForm(&$vars, $title)
- {
- global $gallery;
-
- parent::Horde_Form($vars, $title);
-
- $this->setButtons(_("Save"));
- $this->addHidden('', 'actionID', 'text', false);
- $this->addHidden('', 'gallery', 'text', false);
- $this->addHidden('', 'image', 'text', false);
- $this->addHidden('', 'page', 'text', false);
- $this->addVariable(_("Editing dates for the following photos"), 'image_list', 'html', false, true);
- $this->addVariable(_("Original Date"), 'image_originalDate',
- 'monthdayyear', true, false, null,
- array('start_year' => 1900));
- }
-
-}
+++ /dev/null
-<?php
-/**
- * Image uploader. Provides 3 different options - single images,
- * multiple images, and zip file.
- *
- * @package Ansel
- */
-class UploadForm extends Horde_Form {
-
- var $_useFormToken = false;
-
- function UploadForm(&$vars, $title)
- {
- global $gallery, $conf;
-
- parent::Horde_Form($vars, $title);
-
- $filesize = ini_get('upload_max_filesize');
- if (substr($filesize, -1) == 'M') {
- $filesize = $filesize * 1048576;
- }
- $filesize = $this->_get_size($filesize);
-
- $postsize = ini_get('post_max_size');
- if (substr($postsize, -1) == 'M') {
- $postsize = $postsize * 1048576;
- }
- $postsize = $this->_get_size($postsize);
-
- $this->setButtons(array(_("Upload"), _("Cancel")));
- $this->addHidden('', 'gallery', 'text', false);
- $this->addHidden('', 'page', 'text', false);
-
- $this->setSection('single_file', _("Single Photo"));
- $this->addHidden('', 'image0', 'text', false);
- if (!strlen($vars->get('image0'))) {
- $upload = &$this->addVariable(
- _("File to upload"), 'file0', 'image', false, false,
- _("Maximum photo size:") . ' ' . $filesize, array(false));
- $upload->setHelp('upload');
- }
- $this->addVariable(_("Make this the default photo for this gallery?"), 'image0_default', 'boolean', false);
- $this->addVariable(_("Caption"), 'image0_desc', 'longtext', false, false, null, array('4', '40'));
- $this->addVariable(_("Tags"), 'image0_tags', 'text', false, false, _("Separate tags with commas."));
-
- $this->setSection('multi_file', _("Multiple Photos"));
-
- if (!strlen($vars->get('image0'))) {
- $msg = sprintf(_("Maximum photo size: %s; with a total of: %s"),
- $filesize, $postsize);
- $this->addVariable($msg, 'description', 'description', false);
- }
-
- // start at $i = 1 because 0 is used above.
- for ($i = 1; $i <= $conf['image']['num_uploads']; $i++) {
- $this->addHidden('', 'image' . $i, 'text', false);
- if (!strlen($vars->get('image' . $i))) {
- $upload = &$this->addVariable(sprintf(_("File %s"), $i), 'file' . $i, 'image', false, false, null, array(false));
- $upload->setHelp('upload');
- }
- }
-
- $this->setSection('zip_file', _("Zip File Upload"));
- $this->addHidden('', 'image' . ($conf['image']['num_uploads'] + 1), 'text', false);
- if (!strlen($vars->get('zip'))) {
- $upload = &$this->addVariable(
- _("File to upload"),
- 'file' . ($conf['image']['num_uploads'] + 1),
- 'file', false, false,
- _("Maximum file size:") . ' ' . $filesize);
- $upload->setHelp('upload');
- }
- }
-
- /**
- * Format file size
- */
- function _get_size($size)
- {
- $bytes = array('B', 'KB', 'MB', 'GB', 'TB');
-
- foreach ($bytes as $val) {
- if ($size > 1024) {
- $size = $size / 1024;
- } else {
- break;
- }
- }
-
- return round($size, 2) . ' ' . $val;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * Copyright 2003-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 Chuck Hagenbuch <chuck@horde.org>
- */
-class WatermarkForm extends Horde_Form {
-
- var $_useFormToken = false;
-
- function WatermarkForm(&$vars, $title)
- {
- global $gallery, $prefs;
-
- parent::Horde_Form($vars, $title);
-
- $this->setButtons(_("Save"));
- $this->addHidden('', 'actionID', 'text', false);
- $this->addHidden('', 'gallery', 'text', false);
- $this->addHidden('', 'image', 'text', false);
- $this->addHidden('', 'page', 'text', false);
-
- $w = &$this->addVariable(_("Custom Watermark"), 'watermark', 'text',
- false, false, null);
- $w->setDefault($prefs->getValue('watermark_text'));
-
- $fonts = array('tiny' => _("Tiny"),
- 'small' => _("Small"),
- 'medium' => _("Medium"),
- 'large' => _("Large"),
- 'giant' => _("Giant"));
- $f = &$this->addVariable(_("Watermark Font"), 'font', 'enum', false,
- false, null, array($fonts));
- $f->setDefault($prefs->getValue('watermark_font'));
-
- $ha = array('left' => _("Left"),
- 'center' => _("Center"),
- 'right' => _("Right"));
- $wha = &$this->addVariable(_("Horizontal Alignment"), 'whalign', 'enum',
- false, false, null, array($ha));
- $wha->setDefault($prefs->getValue('watermark_horizontal'));
-
- $va = array('top' => _("Top"),
- 'center' => _("Center"),
- 'bottom' => _("Bottom"));
- $wva = &$this->addVariable(_("Vertical Alignment"), 'wvalign', 'enum',
- false, false, null, array($va));
- $wva->setDefault($prefs->getValue('watermark_vertical'));
- }
-
-}