diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-05-28 00:49:41 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-28 00:49:41 -0700 |
commit | c1e55e9593a6b0ce9f749eb85c4bca1d649e358a (patch) | |
tree | 6f3e44645209471aede760e79a5c7b1836fdba8b /modules | |
parent | 93053cf83152082ce2fb365ad2ab6034c9edd4ee (diff) | |
parent | 8d2782ad1df10679b302ab6c4fafdd2f5535be4a (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/controllers/albums.php | 7 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_theme.php | 20 | ||||
-rw-r--r-- | modules/gallery/libraries/MY_ORM.php | 5 | ||||
-rw-r--r-- | modules/gallery/views/permissions_form.html.php | 155 | ||||
-rw-r--r-- | modules/tag/helpers/tag.php | 8 |
5 files changed, 101 insertions, 94 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 03a64f43..5ccadb37 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -113,8 +113,9 @@ class Albums_Controller extends Items_Controller { "resource" => url::site("albums/$new_album->id"))); } else { print json_encode( - array("result" => "error", - "form" => $form->__toString() . html::script("gallery/js/albums_form_add.js"))); + array( + "result" => "error", + "form" => $form->__toString() . html::script("modules/gallery/js/albums_form_add.js"))); } } @@ -206,7 +207,7 @@ class Albums_Controller extends Items_Controller { switch ($this->input->get("type")) { case "album": print album::get_add_form($album) . - html::script("gallery/js/albums_form_add.js"); + html::script("modules/gallery/js/albums_form_add.js"); break; case "photo": diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index 0acccb45..d45e1b98 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -23,30 +23,30 @@ class gallery_theme_Core { $buf = ""; if ($session->get("debug")) { $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("gallery/css/debug.css") . "\" />"; + url::file("modules/gallery/css/debug.css") . "\" />"; } if (($theme->page_type == "album" || $theme->page_type == "photo") && access::can("edit", $theme->item())) { $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("gallery/css/quick.css") . "\" />"; - $buf .= html::script("gallery/js/quick.js"); + url::file("modules/gallery/css/quick.css") . "\" />"; + $buf .= html::script("modules/gallery/js/quick.js"); } if ($theme->page_type == "photo" && access::can("view_full", $theme->item())) { $buf .= "<script type=\"text/javascript\" >" . " var fullsize_detail = { " . - " close: \"" . url::file("gallery/images/ico-close.png") . "\", " . + " close: \"" . url::file("modules/gallery/images/ico-close.png") . "\", " . " url: \"" . $theme->item()->file_url() . "\", " . " width: " . $theme->item()->width . ", " . " height: " . $theme->item()->height . "};" . "</script>"; - $buf .= html::script("gallery/js/fullsize.js"); + $buf .= html::script("modules/gallery/js/fullsize.js"); } if ($session->get("l10n_mode", false)) { $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("gallery/css/l10n_client.css") . "\" />"; + url::file("modules/gallery/css/l10n_client.css") . "\" />"; $buf .= html::script("lib/jquery.cookie.js"); - $buf .= html::script("gallery/js/l10n_client.js"); + $buf .= html::script("modules/gallery/js/l10n_client.js"); } return $buf; @@ -83,14 +83,14 @@ class gallery_theme_Core { $buf = ""; if ($session->get("debug")) { $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("gallery/css/debug.css") . "\" />"; + url::file("modules/gallery/css/debug.css") . "\" />"; } if ($session->get("l10n_mode", false)) { $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . - url::file("gallery/css/l10n_client.css") . "\" />"; + url::file("modules/gallery/css/l10n_client.css") . "\" />"; $buf .= html::script("lib/jquery.cookie.js"); - $buf .= html::script("gallery/js/l10n_client.js"); + $buf .= html::script("modules/gallery/js/l10n_client.js"); } return $buf; diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php index fb2f80a7..2bd9b4eb 100644 --- a/modules/gallery/libraries/MY_ORM.php +++ b/modules/gallery/libraries/MY_ORM.php @@ -27,6 +27,11 @@ class ORM extends ORM_Core { $this->db->close_paren(); return $this; } + + public function save() { + model_cache::clear($this->object_name, $this->{$this->primary_key}, $this->primary_key); + return parent::save(); + } } /** diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index 3dbd0d98..94103705 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -1,94 +1,91 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<form method="post" action="<?= url::site('permissions/edit/$item->id') ?>"> - <?= access::csrf_form_field() ?> - <fieldset> - <legend> <?= t('Edit Permissions') ?> </legend> +<fieldset> + <legend> <?= t('Edit Permissions') ?> </legend> - <table> - <tr> - <th> </th> - <? foreach ($groups as $group): ?> - <th> <?= $group->name ?> </th> - <? endforeach ?> - </tr> - - <? foreach ($permissions as $permission): ?> - <tr> - <td> <?= t($permission->display_name) ?> </td> - <? foreach ($groups as $group): ?> - <? $intent = access::group_intent($group, $permission->name, $item) ?> - <? $allowed = access::group_can($group, $permission->name, $item) ?> - <? $lock = access::locked_by($group, $permission->name, $item) ?> + <table> + <tr> + <th> </th> + <? foreach ($groups as $group): ?> + <th> <?= $group->name ?> </th> + <? endforeach ?> + </tr> - <? if ($lock): ?> - <td class="gDenied"> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" title="<?= t('denied and locked through parent album') ?>" alt="<?= t('denied icon') ?>" /> - <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album') ?>"> - <img src="<?= url::file('themes/default/images/ico-lock.png') ?>" alt="<?= t('locked icon') ?>" /> - </a> - </td> - <? else: ?> - <? if ($intent === null): ?> - <? if ($allowed): ?> - <td class="gAllowed"> - <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('allowed through parent album, click to allow explicitly') ?>"> - <img src="<?= url::file('themes/default/images/ico-success-pale.png') ?>" alt="<?= t('passive allowed icon') ?>" /> - </a> - <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('click to deny') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" /> - </a> - </td> - <? else: ?> - <td class="gDenied"> - <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('click to allow') ?>"> - <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" /> - </a> - <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('denied through parent album, click to deny explicitly') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-pale.png') ?>" alt="<?= t('passive denied icon') ?>" /> - </a> - </td> - <? endif ?> + <? foreach ($permissions as $permission): ?> + <tr> + <td> <?= t($permission->display_name) ?> </td> + <? foreach ($groups as $group): ?> + <? $intent = access::group_intent($group, $permission->name, $item) ?> + <? $allowed = access::group_can($group, $permission->name, $item) ?> + <? $lock = access::locked_by($group, $permission->name, $item) ?> - <? elseif ($intent === access::DENY): ?> + <? if ($lock): ?> + <td class="gDenied"> + <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" title="<?= t('denied and locked through parent album') ?>" alt="<?= t('denied icon') ?>" /> + <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album') ?>"> + <img src="<?= url::file('themes/default/images/ico-lock.png') ?>" alt="<?= t('locked icon') ?>" /> + </a> + </td> + <? else: ?> + <? if ($intent === null): ?> + <? if ($allowed): ?> + <td class="gAllowed"> + <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('allowed through parent album, click to allow explicitly') ?>"> + <img src="<?= url::file('themes/default/images/ico-success-pale.png') ?>" alt="<?= t('passive allowed icon') ?>" /> + </a> + <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to deny') ?>"> + <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" /> + </a> + </td> + <? else: ?> <td class="gDenied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to allow') ?>"> <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" /> </a> - <? if ($item->id == 1): ?> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" title="<?= t('denied') ?>"/> - <? else: ?> - <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('denied, click to reset') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" /> - </a> - <? endif ?> - </td> - <? elseif ($intent === access::ALLOW): ?> - <td class="gAllowed"> - <? if ($item->id == 1): ?> - <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="allowed" alt="<?= t('allowed icon') ?>" /> - <? else: ?> - <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('allowed, click to reset') ?>"> - <img src="<?= url::file('themes/default/images/ico-success.png') ?>" alt="<?= t('allowed icon') ?>" /> - </a> - <? endif ?> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('click to deny') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" /> + title="<?= t('denied through parent album, click to deny explicitly') ?>"> + <img src="<?= url::file('themes/default/images/ico-denied-pale.png') ?>" alt="<?= t('passive denied icon') ?>" /> </a> </td> <? endif ?> + + <? elseif ($intent === access::DENY): ?> + <td class="gDenied"> + <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to allow') ?>"> + <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" /> + </a> + <? if ($item->id == 1): ?> + <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" title="<?= t('denied') ?>"/> + <? else: ?> + <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('denied, click to reset') ?>"> + <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" /> + </a> + <? endif ?> + </td> + <? elseif ($intent === access::ALLOW): ?> + <td class="gAllowed"> + <? if ($item->id == 1): ?> + <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="allowed" alt="<?= t('allowed icon') ?>" /> + <? else: ?> + <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('allowed, click to reset') ?>"> + <img src="<?= url::file('themes/default/images/ico-success.png') ?>" alt="<?= t('allowed icon') ?>" /> + </a> + <? endif ?> + <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to deny') ?>"> + <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" /> + </a> + </td> <? endif ?> - </td> - <? endforeach ?> - </tr> + <? endif ?> + </td> <? endforeach ?> - </table> - </fieldset> -</form> + </tr> + <? endforeach ?> + </table> +</fieldset> diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 0ca02b42..7c4b56ba 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -81,8 +81,12 @@ class tag_Core { static function get_add_form($item) { $form = new Forge("tags", "", "post", array("id" => "gAddTagForm")); - $group = $form->group("add_tag")->label(t("Add Tag")); - $group->input("name")->label(t("Add tag"))->rules("required|length[1,64]"); + $label = $item->is_album() ? + t("Add tag to album") : + ($item->is_photo() ? t("Add tag to photo") : t("Add tag to movie")); + + $group = $form->group("add_tag")->label("Add Tag"); + $group->input("name")->label($label)->rules("required|length[1,64]"); $group->hidden("item_id")->value($item->id); $group->submit("")->value(t("Add Tag")); return $form; |