summaryrefslogtreecommitdiff
path: root/utils/modules/gallery.php
diff options
context:
space:
mode:
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;
}
}