3
* $RCSfile: FotokastenSiteAdmin.inc,v $
5
* Gallery - a web based photo album viewer and editor
6
* Copyright (C) 2000-2006 Bharat Mediratta
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or (at
11
* your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
23
* @version $Revision: 1.1 $ $Date: 2006/02/06 18:09:40 $
25
* @author Alan Harder <alan.harder@sun.com>
30
* @subpackage UserInterface
32
class FotokastenSiteAdminController extends GalleryController {
35
* @see GalleryController::handleRequest
37
function handleRequest($form) {
38
$ret = GalleryCoreApi::assertUserIsSiteAdministrator();
40
return array($ret->wrap(__FILE__, __LINE__), null);
43
$status = $error = array();
44
if (isset($form['action']['save'])) {
45
if (empty($form['affiliateId']) || !is_numeric($form['affiliateId'])) {
46
$error[] = 'form[error][affiliateId]';
48
if (empty($form['affiliateIdPass'])) {
49
$error[] = 'form[error][affiliateIdPass]';
52
foreach (array('affiliateId', 'affiliateIdPass') as $key) {
53
$ret = GalleryCoreApi::setPluginParameter(
54
'module', 'fotokasten', $key, $form[$key]);
56
return array($ret->wrap(__FILE__, __LINE__), null);
63
$method = empty($error) ? 'redirect' : 'delegate';
64
$results[$method]['view'] = 'core.SiteAdmin';
65
$results[$method]['subView'] = 'fotokasten.FotokastenSiteAdmin';
66
$results['status'] = $status;
67
$results['error'] = $error;
69
return array(null, $results);
75
* @subpackage UserInterface
77
class FotokastenSiteAdminView extends GalleryView {
80
* @see GalleryView::loadTemplate
82
function loadTemplate(&$template, &$form) {
83
$ret = GalleryCoreApi::assertUserIsSiteAdministrator();
85
return array($ret->wrap(__FILE__, __LINE__), null);
88
if ($form['formName'] != 'FotokastenSiteAdmin') {
89
$form['formName'] = 'FotokastenSiteAdmin';
90
foreach (array('affiliateId', 'affiliateIdPass') as $key) {
91
list ($ret, $form[$key]) =
92
GalleryCoreApi::getPluginParameter('module', 'fotokasten', $key);
94
return array($ret->wrap(__FILE__, __LINE__), null);
99
$template->setVariable('controller', 'fotokasten.FotokastenSiteAdmin');
101
array('body' => 'modules/fotokasten/templates/FotokastenSiteAdmin.tpl'));