~ubuntu-branches/ubuntu/maverick/gallery2/maverick

« back to all changes in this revision

Viewing changes to modules/core/ItemEditTheme.inc

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2007-09-10 20:22:19 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070910202219-0jsuntvqge4ade6b
Tags: 2.2.3-2
Add Slovak translation of Debconf templates.  (Thanks to 
Ivan Masá.  Closes: #441671)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * @package GalleryCore
24
24
 * @subpackage UserInterface
25
25
 * @author Bharat Mediratta <bharat@menalto.com>
26
 
 * @version $Revision: 15513 $
 
26
 * @version $Revision: 16471 $
27
27
 */
28
28
class ItemEditTheme extends ItemEditPlugin {
29
29
 
126
126
     * @see ItemEditPlugin::loadTemplate
127
127
     */
128
128
    function loadTemplate(&$template, &$form, $item, $thumbnail) {
129
 
        $themeId = $item->getTheme();
 
129
        $themeId = $themeSettingsThemeId = $item->getTheme();
 
130
        if (empty($themeSettingsThemeId)) {
 
131
            list ($ret, $themeSettingsThemeId) =
 
132
                GalleryCoreApi::getPluginParameter('module', 'core', 'default.theme');
 
133
            if ($ret) {
 
134
                return array($ret, null, null);
 
135
            }
 
136
        }
130
137
 
131
 
        $ret = GalleryCoreApi::loadThemeSettingsForm($themeId, $item->getId(), $template, $form);
132
 
        if ($ret) {
133
 
            if ($ret->getErrorCode() & ERROR_BAD_PARAMETER) {
134
 
                /*
135
 
                 * This theme could be invalid, which can happen after an upgrade.  Swallow the
136
 
                 * error for now so that the user can get to the administration form and pick a
137
 
                 * new theme.
138
 
                 *
139
 
                 * @todo Log this error when we have a logging system.
140
 
                 */
141
 
            } else {
 
138
        list ($ret, $theme) =
 
139
            GalleryCoreApi::loadPlugin('theme', $themeSettingsThemeId, false, true);
 
140
        if (!$ret) {
 
141
            $ret = GalleryCoreApi::loadThemeSettingsForm(
 
142
                $themeSettingsThemeId, $item->getId(), $template, $form);
 
143
            if ($ret) {
142
144
                return array($ret, null, null);
143
145
            }
 
146
        } else if ($ret->getErrorCode() & (ERROR_BAD_PARAMETER | ERROR_PLUGIN_VERSION_MISMATCH)) {
 
147
            /* Ignore incompatible / missing themes.  Just show a warning. */
 
148
        } else {
 
149
            return array($ret, null, null);
144
150
        }
145
151
 
146
152
        if ($form['formName'] != 'ItemEditTheme') {
164
170
                continue;
165
171
            }
166
172
 
167
 
            list ($ret, $tmp) = GalleryCoreApi::loadPlugin('theme', $id);
 
173
            list ($ret, $tmp) = GalleryCoreApi::loadPlugin('theme', $id, false, true);
168
174
            if ($ret) {
169
 
                return array($ret, null, null);
 
175
                
 
176
                if ($ret->getErrorCode() & (ERROR_BAD_PARAMETER | ERROR_PLUGIN_VERSION_MISMATCH)) {
 
177
                    /* Ignore incompatible themes (but don't list them either) */
 
178
                    continue;
 
179
                }
 
180
                return array($ret, null, null);
170
181
            }
171
182
            $themeList[$id] = $tmp->translate($tmp->getName());
172
183
        }