summaryrefslogtreecommitdiffstats
path: root/lib/ui.lib.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-20 02:59:31 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-20 02:59:31 +0000
commitd62207327c99ea070985d46eaa8399b139914a86 (patch)
tree2b44571cd8639a27b1649f97c57c02b5cb5e5395 /lib/ui.lib.php
parentb47b6976239b8e35284c9fa84610cec2dd6d4cd4 (diff)
downloadampache-d62207327c99ea070985d46eaa8399b139914a86.tar.gz
ampache-d62207327c99ea070985d46eaa8399b139914a86.tar.bz2
ampache-d62207327c99ea070985d46eaa8399b139914a86.zip
* Added new icons, and speed up icon display
* Fixed ORDER BY `track` on play selected * Started work on editing/flagging albums and artists
Diffstat (limited to 'lib/ui.lib.php')
-rw-r--r--lib/ui.lib.php48
1 files changed, 33 insertions, 15 deletions
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 169ce48b..a407af24 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -1274,29 +1274,47 @@ function show_box_bottom() {
* or an <img /> tag
*/
function get_user_icon($name,$hover_name='') {
+
+ /* Because we do a lot of calls cache the URLs */
+ static $url_cache = array();
- $icon_name = 'icon_' . $name . '.png';
-
- /* Build the image url */
- if (file_exists(conf('prefix') . '/themes/' . $GLOBALS['theme']['path'] . '/images/' . $icon_name)) {
- $img_url = conf('web_path') . conf('theme_path') . '/images/' . $icon_name;
+ if (isset($url_cache[$name])) {
+ $img_url = $url_cache[$name];
+ $cache_url = true;
}
- else {
- $img_url = conf('web_path') . '/images/' . $icon_name;
+ if (isset($url_cache[$hover_name])) {
+ $hover_url = $url_cache[$hover_name];
+ $cache_hover = true;
}
+
+ if (empty($hover_name)) { $cache_hover = true; }
- /* If Hover, then build its url */
- if (!empty($hover_name)) {
- $hover_icon = 'icon_' . $hover_name . '.png';
+ if (!isset($cache_url) OR !isset($cache_hover)) {
+
+ $icon_name = 'icon_' . $name . '.png';
+
+ /* Build the image url */
if (file_exists(conf('prefix') . '/themes/' . $GLOBALS['theme']['path'] . '/images/' . $icon_name)) {
- $hov_url = conf('web_path') . conf('theme_path') . '/images/' . $hover_icon;
+ $img_url = conf('web_path') . conf('theme_path') . '/images/' . $icon_name;
}
else {
- $hov_url = conf('web_path') . '/images/' . $hover_icon;
+ $img_url = conf('web_path') . '/images/' . $icon_name;
}
-
- $hov_txt = "onMouseOver=\"this.src='$hov_url'; return true;\" onMouseOut=\"this.src='$img_url'; return true;\"";
- }
+
+ /* If Hover, then build its url */
+ if (!empty($hover_name)) {
+ $hover_icon = 'icon_' . $hover_name . '.png';
+ if (file_exists(conf('prefix') . '/themes/' . $GLOBALS['theme']['path'] . '/images/' . $icon_name)) {
+ $hov_url = conf('web_path') . conf('theme_path') . '/images/' . $hover_icon;
+ }
+ else {
+ $hov_url = conf('web_path') . '/images/' . $hover_icon;
+ }
+
+ $hov_txt = "onMouseOver=\"this.src='$hov_url'; return true;\" onMouseOut=\"this.src='$img_url'; return true;\"";
+ } // end hover
+
+ } // end if not cached
$string = "<img style=\"cursor: pointer;\" src=\"$img_url\" border=\"0\" alt=\"$name\" title=\"$name\" $hov_txt/>";