diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-10-06 21:50:41 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-10-06 21:50:41 -0700 |
commit | fcbce09fc4dc85a47a78ce01abe801225beb9a94 (patch) | |
tree | c32cfafdf1177c9961115b900e9ce1ea75b70b62 | |
parent | 0c7e4581c9f89aa462d951fae46f137f5a3566c0 (diff) |
Update gallery::find_file to look for subdirectories in lib, then fall
back to looking in just lib itself. This is not consistent behavior
with the rest of our module structure, though so we should probably
make it more consistent.
Fix up the permission images to use gallery::find_file again.
-rw-r--r-- | modules/gallery/helpers/gallery.php | 11 | ||||
-rw-r--r-- | modules/gallery/views/permissions_form.html.php | 24 |
2 files changed, 21 insertions, 14 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 37a08d08..b7c68ef8 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -92,9 +92,16 @@ class gallery_Core { static function find_file($directory, $file, $required=false) { $file_name = substr($file, 0, -strlen($ext = strrchr($file, '.'))); $file_name = Kohana::find_file($directory, $file_name, $required, substr($ext, 1)); - if (!$file_name && file_exists(DOCROOT . "lib/$file")) { - return "lib/$file"; + if (!$file_name) { + if (file_exists(DOCROOT . "lib/$directory/$file")) { + Kohana::log("alert",print_r(print_r(array($directory, $file),1) . " ==> lib/$directory/$file",1)); + return "lib/$directory/$file"; + } else if (file_exists(DOCROOT . "lib/$file")) { + Kohana::log("alert",print_r(print_r(array($directory, $file),1) . " ==> lib/$file",1)); + return "lib/$file"; + } } + Kohana::log("alert",print_r(print_r(array($directory, $file),1) . " ==> $file_name",1)); if (is_string($file_name)) { // make relative to DOCROOT diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index f66f3144..f1714119 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -20,11 +20,11 @@ <? if ($lock): ?> <td class="g-denied"> - <img src="<?= url::file("lib/images/ico-denied.png") ?>" + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" title="<?= t('denied and locked through parent album')->for_html_attr() ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-lock.png") ?>" alt="<?= t('locked icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-lock.png")) ?>" alt="<?= t('locked icon')->for_html_attr() ?>" /> </a> </td> <? else: ?> @@ -32,22 +32,22 @@ <? if ($allowed): ?> <td class="g-allowed"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('allowed through parent album, click to allow explicitly')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-success-passive.png") ?>" alt="<?= t('passive allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success-passive.png")) ?>" alt="<?= t('passive allowed icon')->for_html_attr() ?>" /> </a> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to deny')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-denied-inactive.png") ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-inactive.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> </a> </td> <? else: ?> <td class="g-denied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to allow')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-success-inactive.png") ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success-inactive.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> </a> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('denied through parent album, click to deny explicitly')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-denied-passive.png") ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-passive.png")) ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" /> </a> </td> <? endif ?> @@ -56,30 +56,30 @@ <td class="g-denied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to allow')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-success-inactive.png") ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success-inactive.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> </a> <? if ($item->id == 1): ?> - <img src="<?= url::file("lib/images/ico-denied.png") ?>" alt="<?= t('denied icon')->for_html_attr() ?>" title="<?= t('denied')->for_html_attr() ?>"/> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" title="<?= t('denied')->for_html_attr() ?>"/> <? else: ?> <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('denied, click to reset')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-denied.png") ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> </a> <? endif ?> </td> <? elseif ($intent === access::ALLOW): ?> <td class="g-allowed"> <? if ($item->id == 1): ?> - <img src="<?= url::file("lib/images/ico-success.png") ?>" title="<?= t("allowed")->for_html_attr() ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" title="<?= t("allowed")->for_html_attr() ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> <? else: ?> <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('allowed, click to reset')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-success.png") ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> </a> <? endif ?> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to deny')->for_html_attr() ?>"> - <img src="<?= url::file("lib/images/ico-denied-inactive.png") ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-inactive.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> </a> </td> <? endif ?> |