*/ /** * This implements the standard gallery theme * * @package GalleryTheme * @subpackage Theme */ class PoolTheme extends GalleryTheme { /** * Constructor */ function PoolTheme() { global $gallery; $this->setId('pool'); $this->setName($gallery->i18n('Pool')); $this->setDescription($gallery->i18n('Based on the Pool WordPress theme.')); $this->setVersion('0.9.9'); /* Update upgrade() also */ $this->setRequiredCoreApi(array(6, 0)); $this->setRequiredThemeApi(array(2, 1)); $this->setStandardSettings( array('rows' => 3, 'columns' => 3, 'showImageOwner' => 0, 'showAlbumOwner' => 0, 'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '', 'colorpack' => '', 'showMicroThumbs' => 0, 'sidebarBlocks' => '', 'albumBlocks' => 'itemLinks', 'photoBlocks' => 'itemLinks')); } /** * @see GalleryTheme::showAlbumPage */ function showAlbumPage(&$template, $item, $params, $childIds) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('owner', 'viewCount', 'descendentCount', 'parents', 'peers', 'systemLinks', 'itemLinks', 'itemSummaries', 'permissions', 'itemDetailFiles', 'thumbnails', 'pageNavigator', 'jumpRange'), $childIds); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['columnWidthPct'] = floor(100 / $params['columns']); /* Add our header and styles */ return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showPhotoPage */ function showPhotoPage(&$template, $item, $params) { $dataTypes = array('owner', 'parents', 'peers', 'systemLinks', 'itemLinks', 'permissions', 'itemLinksDetailed', 'itemDetailFiles', 'itemNavigator', 'imageViews'); if (!empty($params['showMicroThumbs'])) { $dataTypes[] = 'peerThumbnails'; } $ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showModulePage */ function showModulePage(&$template, $item, $params, $templateFile) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showAdminPage */ function showAdminPage(&$template, $item, $params, $templateFile) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::showErrorPage */ function showErrorPage(&$template) { return array(GalleryStatus::success(), 'error.tpl'); } /** * @see GalleryTheme::showProgressBarPage */ function showProgressBarPage(&$template, $item, $params) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('parents', 'systemLinks')); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } return array(GalleryStatus::success(), 'theme.tpl'); } /** * @see GalleryTheme::upgrade */ function upgrade($installedVersion) { if (version_compare($installedVersion, '0.9.7', '<')) { /* Older than the big theme changeover. Set some default blocks */ foreach (array( 'sidebarBlocks' => serialize( array( array('search.SearchBlock', array('showAdvancedLink' => true)), array('core.ItemLinks', array('useDropdown' => false)), array('core.PeerList', array()), array('imageblock.ImageBlock', array()))), 'albumBlocks' => serialize( array(array('comment.ViewComments', array()))), 'photoBlocks' => serialize( array( array('exif.ExifInfo', array()), array('comment.ViewComments', array())))) as $key => $value) { $ret = $this->setParameter($key, $value); if ($ret->isError()) { return $ret->wrap(__FILE__, __LINE__); } } $installedVersion = '0.9.7'; } switch ($installedVersion) { case '0.9.7': $ret = $this->setParameter('colorpack', ''); if ($ret->isError()) { return $ret->wrap(__FILE__, __LINE__); } case '0.9.8': /* We now require theme API 2.1 */ case 'end of upgrade path': break; default: return GalleryStatus::error(ERROR_BAD_PLUGIN, __FILE__, __LINE__, sprintf('Unknown theme version %s', $installedVersion)); } return GalleryStatus::success(); } } ?>