1
0

Updated to support dynamic sidebar code.

This commit is contained in:
rWatcher 2009-12-30 01:45:47 -05:00
parent 2b12d9b3f5
commit 231d9c95fc
4 changed files with 55 additions and 39 deletions

View File

@ -33,13 +33,9 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
// Figure out which boxes where checked
$dlLinks_array = Input::instance()->post("DownloadLinkOptions");
$tButton = false;
$fButton = false;
$download_original_button = false;
for ($i = 0; $i < count($dlLinks_array); $i++) {
if ($dlLinks_array[$i] == "tButton") {
$tButton = true;
}
if ($dlLinks_array[$i] == "fButton") {
$fButton = true;
}
@ -56,7 +52,6 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
}
// Save Settings.
module::set_var("downloadfullsize", "tButton", $tButton);
module::set_var("downloadfullsize", "fButton", $fButton);
message::success(t("Your Selection Has Been Saved."));
@ -74,8 +69,7 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
array("id" => "g-download-fullsize-adminForm"));
// Make an array for the different types of download links.
$linkOptions["fButton"] = array(t("Show Floppy Disk Link"), module::get_var("downloadfullsize", "fButton"));
$linkOptions["tButton"] = array(t("Show Text Download Text Link"), module::get_var("downloadfullsize", "tButton"));
$linkOptions["fButton"] = array(t("Show Floppy Disk Picture Link"), module::get_var("downloadfullsize", "fButton"));
// Setup a few checkboxes on the form.
$add_links = $form->group("DownloadLinks");

View File

@ -0,0 +1,51 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class downloadfullsize_block_Core {
static function get_site_list() {
return array("downloadfullsize" => t("Download Item"));
}
static function get($block_id, $theme) {
$item = $theme->item;
switch ($block_id) {
case "downloadfullsize":
// If Item is movie then...
if ($item && $item->is_movie() && access::can("view_full", $item)) {
$block = new Block();
$block->css_id = "g-download-fullsize";
$block->title = t("Download Movie");
$block->content = new View("downloadfullsize_block.html");
return $block;
}
// If Item is photo then...
if ($item && $item->is_photo() && access::can("view_full", $item)) {
$block = new Block();
$block->css_id = "g-download-fullsize";
$block->title = t("Download Photo");
$block->content = new View("downloadfullsize_block.html");
return $block;
}
}
return "";
}
}

View File

@ -23,33 +23,4 @@ class downloadfullsize_theme {
$theme->css("downloadfullsize_menu.css");
}
}
static function sidebar_blocks($theme) {
$item = $theme->item();
if ($item && $item->is_movie() && access::can("view_full", $item)) {
if (module::get_var("downloadfullsize", "tButton")) {
$block = new Block();
$block->css_id = "g-download-fullsize";
$block->title = t("Download");
$block->content = new View("downloadfullsize_block.html");
$block->content->item = ORM::factory("item", 1);
return $block;
}
}
if ($item && $item->is_photo() && access::can("view_full", $item)) {
if (module::get_var("downloadfullsize", "tButton")) {
$block = new Block();
$block->css_id = "g-download-fullsize";
$block->title = t("Download");
$block->content = new View("downloadfullsize_block.html");
$block->content->item = ORM::factory("item", 1);
return $block;
}
}
}
}

View File

@ -2,7 +2,7 @@
<? if ($theme->item->is_photo()) { ?>
<div class="g-download-fullsize-block">
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
<a href="<?= url::site("downloadfullsize/send/{$theme->item->id}") ?>"
title="<?= t("Download Photo") ?>"
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
</div>
@ -10,9 +10,9 @@
<? if ($theme->item->is_movie()) { ?>
<div class="g-download-fullsize-block">
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
<a href="<?= url::site("downloadfullsize/send/{$theme->item->id}") ?>"
title="<?= t("Download Video") ?>"
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Video") ?></a>
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Movie") ?></a>
</div>
<? } ?>