summaryrefslogtreecommitdiff
path: root/utils/modules/gallery.php
diff options
context:
space:
mode:
authordeva <deva>2009-04-23 07:41:28 +0000
committerdeva <deva>2009-04-23 07:41:28 +0000
commit3f1dda1e19e1f77e908df1d49d028d0932d0f1a1 (patch)
treed44586018a0594aa53cfbe172d7a576bbe5f593c /utils/modules/gallery.php
parent9fc8170f4492c3e5900156610061e59c84aa9d83 (diff)
A completely new forms class, to replace the old function based method. Also some work on a new config module, evenmtuelly to replace the old hardcoded values.
Diffstat (limited to 'utils/modules/gallery.php')
-rw-r--r--utils/modules/gallery.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/utils/modules/gallery.php b/utils/modules/gallery.php
index 4820a04..c6d2f86 100644
--- a/utils/modules/gallery.php
+++ b/utils/modules/gallery.php
@@ -83,8 +83,8 @@ class Album {
htmlspecialchars($this->copyright, ENT_QUOTES, "UTF-8") . "\"\n");
fwrite($fp, " icon=\"" .
htmlspecialchars($this->icon, ENT_QUOTES, "UTF-8") . "\"\n");
- fwrite($fp, " enabled=\"" .
- htmlspecialchars($this->enabled, ENT_QUOTES, "UTF-8") . "\">\n");
+ if($this->enabled) fwrite($fp, " enabled=\"true\">\n");
+ else fwrite($fp, " enabled=\"false\">\n");
foreach($this->photos as $photo) {
$photo->write($fp);
}
@@ -124,7 +124,7 @@ class Album {
$this->title = $title;
$this->copyright = $copyright;
$this->icon = $icon;
- $this->enabled = $enabled;
+ $this->enabled = $enabled == 'on';
}
}
@@ -178,9 +178,11 @@ class Gallery {
// Admin config
public $admin_title = "Gallery";
- public $admin_submodules = array("New gallery" => "newgallery");
+ public $admin_submodules = array("New album" => "new",
+ "Edit album" => "edit",
+ "Delete album" => "delete");
- public function admin_newgallery($action, $vars)
+ public function admin_new($action, $vars)
{
global $ALBUMS_DIR;
switch($action) {
@@ -194,13 +196,13 @@ class Gallery {
case "select":
default:
- beginform("create", true);
- lineedit("Album title:", "title");
- lineedit("Album copyright:", "copyright");
- lineedit("Album enabled:", "enabled", "true");
- fileupload("Select image archive:", "images", "application/zip");
- button("Create");
- endform();
+ $form = new Form("create");
+ $form->addWidget(new LineEdit("Album title:", "title"));
+ $form->addWidget(new LineEdit("Album copyright:", "copyright"));
+ $form->addWidget(new CheckBox("Album enabled:", "enabled"));
+ $form->addWidget(new FileUpload("Select image archive:", "images", "application/zip"));
+ $form->addWidget(new Button("Create"));
+ $form->render();
break;
}
}
@@ -208,8 +210,14 @@ class Gallery {
public function admin($sub, $action, $vars)
{
switch($sub) {
- case "newgallery":
- $this->admin_newgallery($action, $vars);
+ case "new":
+ $this->admin_new($action, $vars);
+ break;
+ case "edit":
+ $this->admin_new($action, $vars);
+ break;
+ case "delete":
+ $this->admin_new($action, $vars);
break;
}
}