*/ /** * @package ImageBlock * @subpackage UserInterface */ class ImageBlockOption extends ItemEditOption { /** * @see ItemEditOption::handleRequestAfterEdit */ function handleRequestAfterEdit($form, &$item, &$preferred) { $error = array(); $warning = array(); GalleryCoreApi::requireOnce('modules/imageblock/classes/ImageBlockHelper.class'); if (empty($form['ImageBlockOption']['setDisabled']) || $form['ImageBlockOption']['setDisabled'] == 'off') { $setDisabled = false; } else { $setDisabled = true; } /* * We default to 'on' in the template, but checking empty() isn't valid * because 'off' doesn't necessarily send a value. */ if (isset($form['ImageBlockOption']['setRecursive']) && $form['ImageBlockOption']['setRecursive'] == 'on') { $setRecursive = true; } else { $setRecursive = false; } list ($ret, $currentlyDisabled) = ImageBlockHelper::getDisabledFlag($item->getId()); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null, null); } if ($setDisabled != $currentlyDisabled) { $ret = ImageBlockHelper::setDisabledFlag($item, $setRecursive, $setDisabled); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null, null); } } return array(null, $error, $warning); } /** * @see ItemEditOption::loadTemplate */ function loadTemplate(&$template, &$form, $item, $thumbnail) { GalleryCoreApi::requireOnce('modules/imageblock/classes/ImageBlockHelper.class'); list($ret, $form['ImageBlockOption']['setDisabled']) = ImageBlockHelper::getDisabledFlag($item->getId()); if ($ret) { return array($ret->wrap(__FILE__, __LINE__), null, null); } return array(null, 'modules/imageblock/templates/ImageBlockOption.tpl', 'modules_imageblock'); } /** * @see ItemEditOption::isSupported */ function isAppropriate($item, $thumbnail) { return array(null, GalleryUtilities::isA($item, 'GalleryAlbumItem')); } } ?>