From d572c2776f5ab7f66a632f54006dabe2f159c02b Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Sat, 26 Jan 2013 01:28:34 -0500 Subject: Move show_box_{top,bottom}() from ui.lib.php to UI --- admin/catalog.php | 4 +- admin/modules.php | 8 ++-- browse.php | 4 +- lib/class/browse.class.php | 60 +++++++++++++------------- lib/class/catalog.class.php | 20 ++++----- lib/class/ui.class.php | 18 ++++++++ lib/ui.lib.php | 22 ---------- templates/header.inc.php | 4 +- templates/show_access_list.inc.php | 8 ++-- templates/show_add_access.inc.php | 4 +- templates/show_add_catalog.inc.php | 4 +- templates/show_add_live_stream.inc.php | 4 +- templates/show_add_playlist.inc.php | 4 +- templates/show_add_shout.inc.php | 4 +- templates/show_add_user.inc.php | 4 +- templates/show_adds_catalog.inc.php | 4 +- templates/show_admin_info.inc.php | 8 ++-- templates/show_admin_tools.inc.php | 8 ++-- templates/show_album.inc.php | 4 +- templates/show_album_art.inc.php | 4 +- templates/show_artist.inc.php | 4 +- templates/show_clean_catalog.inc.php | 4 +- templates/show_confirmation.inc.php | 4 +- templates/show_create_democratic.inc.php | 4 +- templates/show_debug.inc.php | 12 +++--- templates/show_democratic.inc.php | 4 +- templates/show_duplicate.inc.php | 4 +- templates/show_duplicates.inc.php | 4 +- templates/show_dynamic.inc.php | 4 +- templates/show_edit_access.inc.php | 4 +- templates/show_edit_album.inc.php | 4 +- templates/show_edit_artist.inc.php | 4 +- templates/show_edit_catalog.inc.php | 4 +- templates/show_edit_shout.inc.php | 4 +- templates/show_edit_song.inc.php | 4 +- templates/show_edit_user.inc.php | 4 +- templates/show_export.inc.php | 4 +- templates/show_gather_art.inc.php | 4 +- templates/show_get_albumart.inc.php | 4 +- templates/show_import_playlist.inc.php | 4 +- templates/show_index.inc.php | 2 +- templates/show_ip_history.inc.php | 4 +- templates/show_live_stream.inc.php | 4 +- templates/show_localplay_add_instance.inc.php | 4 +- templates/show_localplay_edit_instance.inc.php | 4 +- templates/show_localplay_instances.inc.php | 4 +- templates/show_localplay_status.inc.php | 4 +- templates/show_login_form.inc.php | 4 +- templates/show_lyrics.inc.php | 4 +- templates/show_lyrics_song.inc.php | 4 +- templates/show_mail_users.inc.php | 4 +- templates/show_manage_catalogs.inc.php | 4 +- templates/show_manage_democratic.inc.php | 4 +- templates/show_newest.inc.php | 4 +- templates/show_now_playing.inc.php | 4 +- templates/show_playlist.inc.php | 4 +- templates/show_popular.inc.php | 4 +- templates/show_preference_admin.inc.php | 4 +- templates/show_preferences.inc.php | 4 +- templates/show_random.inc.php | 4 +- templates/show_random_albums.inc.php | 4 +- templates/show_recently_played.inc.php | 4 +- templates/show_recommended_artists.inc.php | 2 +- templates/show_rename_artist.inc.php | 4 +- templates/show_rules.inc.php | 4 +- templates/show_search.inc.php | 4 +- templates/show_search_options.inc.php | 4 +- templates/show_shoutbox.inc.php | 4 +- templates/show_smartplaylist.inc.php | 4 +- templates/show_song.inc.php | 4 +- templates/show_stats.inc.php | 4 +- templates/show_stats_popular.inc.php | 8 ++-- templates/show_update_items.inc.php | 4 +- templates/show_user.inc.php | 4 +- templates/show_user_preferences.inc.php | 4 +- templates/show_user_recommendations.inc.php | 4 +- templates/show_user_stats.inc.php | 4 +- templates/show_verify_catalog.inc.php | 4 +- 78 files changed, 218 insertions(+), 222 deletions(-) diff --git a/admin/catalog.php b/admin/catalog.php index bc67c13f..472ee8ce 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -236,11 +236,11 @@ switch ($_REQUEST['action']) { // Run our initial add $catalog->run_add($_POST); - show_box_top(T_('Catalog Created'), 'box box_catalog_created'); + UI::show_box_top(T_('Catalog Created'), 'box box_catalog_created'); echo "

" . T_('Catalog Created') . "

"; Error::display('general'); Error::display('catalog_add'); - show_box_bottom(); + UI::show_box_bottom(); show_confirmation('','', Config::get('web_path').'/admin/catalog.php'); diff --git a/admin/modules.php b/admin/modules.php index bf55578b..33ec00e6 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -138,15 +138,15 @@ switch ($_REQUEST['action']) { break; case 'show_plugins': $plugins = Plugin::get_plugins(); - show_box_top(T_('Plugins'), 'box box_localplay_plugins'); + UI::show_box_top(T_('Plugins'), 'box box_localplay_plugins'); require_once Config::get('prefix') . '/templates/show_plugins.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'show_localplay': $controllers = Localplay::get_controllers(); - show_box_top(T_('Localplay Controllers'), 'box box_localplay_controllers'); + UI::show_box_top(T_('Localplay Controllers'), 'box box_localplay_controllers'); require_once Config::get('prefix') . '/templates/show_localplay_controllers.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; default: // Rien a faire diff --git a/browse.php b/browse.php index b4fcf559..b503bac9 100644 --- a/browse.php +++ b/browse.php @@ -70,12 +70,12 @@ switch($_REQUEST['action']) { $object_ids = $browse->get_saved(); $keys = array_keys($object_ids); Tag::build_cache($keys); - show_box_top(T_('Tag Cloud'), 'box box_tag_cloud'); + UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud'); $browse2 = new Browse(); $browse2->set_type('song'); $browse2->store(); require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); require_once Config::get('prefix') . '/templates/browse_content.inc.php'; break; case 'artist': diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index 074efacd..ce22728e 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -127,86 +127,86 @@ class Browse extends Query { // Switch on the type of browsing we're doing switch ($type) { case 'song': - show_box_top(T_('Songs') . $match, $class); + UI::show_box_top(T_('Songs') . $match, $class); Song::build_cache($object_ids); require_once Config::get('prefix') . '/templates/show_songs.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'album': - show_box_top(T_('Albums') . $match, $class); + UI::show_box_top(T_('Albums') . $match, $class); Album::build_cache($object_ids,'extra'); require_once Config::get('prefix') . '/templates/show_albums.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'user': - show_box_top(T_('Manage Users') . $match, $class); + UI::show_box_top(T_('Manage Users') . $match, $class); require_once Config::get('prefix') . '/templates/show_users.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'artist': - show_box_top(T_('Artists') . $match, $class); + UI::show_box_top(T_('Artists') . $match, $class); Artist::build_cache($object_ids,'extra'); require_once Config::get('prefix') . '/templates/show_artists.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'live_stream': require_once Config::get('prefix') . '/templates/show_live_stream.inc.php'; - show_box_top(T_('Radio Stations') . $match, $class); + UI::show_box_top(T_('Radio Stations') . $match, $class); require_once Config::get('prefix') . '/templates/show_live_streams.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'playlist': Playlist::build_cache($object_ids); - show_box_top(T_('Playlists') . $match, $class); + UI::show_box_top(T_('Playlists') . $match, $class); require_once Config::get('prefix') . '/templates/show_playlists.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'playlist_song': - show_box_top(T_('Playlist Songs') . $match,$class); + UI::show_box_top(T_('Playlist Songs') . $match,$class); require_once Config::get('prefix') . '/templates/show_playlist_songs.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'playlist_localplay': - show_box_top(T_('Current Playlist')); + UI::show_box_top(T_('Current Playlist')); require_once Config::get('prefix') . '/templates/show_localplay_playlist.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'smartplaylist': - show_box_top(T_('Smart Playlists') . $match, $class); + UI::show_box_top(T_('Smart Playlists') . $match, $class); require_once Config::get('prefix') . '/templates/show_smartplaylists.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'catalog': - show_box_top(T_('Catalogs'), $class); + UI::show_box_top(T_('Catalogs'), $class); require_once Config::get('prefix') . '/templates/show_catalogs.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'shoutbox': - show_box_top(T_('Shoutbox Records'),$class); + UI::show_box_top(T_('Shoutbox Records'),$class); require_once Config::get('prefix') . '/templates/show_manage_shoutbox.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'flagged': - show_box_top(T_('Flagged Records'),$class); + UI::show_box_top(T_('Flagged Records'),$class); require_once Config::get('prefix') . '/templates/show_flagged.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'tag': Tag::build_cache($tags); - show_box_top(T_('Tag Cloud'),$class); + UI::show_box_top(T_('Tag Cloud'),$class); require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'video': Video::build_cache($object_ids); - show_box_top(T_('Videos'),$class); + UI::show_box_top(T_('Videos'),$class); require_once Config::get('prefix') . '/templates/show_videos.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); break; case 'democratic': - show_box_top(T_('Democratic Playlist'),$class); + UI::show_box_top(T_('Democratic Playlist'),$class); require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php'; - show_box_bottom(); + UI::show_box_bottom(); default: // Rien a faire break; diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 029c2d67..f0c773b2 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -277,9 +277,9 @@ class Catalog extends database_object { public function run_add($options) { if ($this->catalog_type == 'remote') { - show_box_top(T_('Running Remote Sync') . '. . .'); + UI::show_box_top(T_('Running Remote Sync') . '. . .'); $this->get_remote_catalog($type=0); - show_box_bottom(); + UI::show_box_bottom(); return true; } @@ -1079,9 +1079,9 @@ class Catalog extends database_object { public function add_to_catalog() { if ($this->catalog_type == 'remote') { - show_box_top(T_('Running Remote Update') . '. . .'); + UI::show_box_top(T_('Running Remote Update') . '. . .'); $this->get_remote_catalog($type=0); - show_box_bottom(); + UI::show_box_bottom(); return true; } @@ -1127,12 +1127,12 @@ class Catalog extends database_object { $time_diff = ($current_time - $start_time) ?: 0; $rate = intval($this->count / $time_diff) ?: T_('N/A'); - show_box_top(); + UI::show_box_top(); echo "\n
" . printf(T_('Catalog Update Finished. Total Time: [%s] Total Songs: [%s] Songs Per Second: [%s]'), date('i:s', $time_diff), $this->count, $rate); echo '

'; - show_box_bottom(); + UI::show_box_bottom(); } // add_to_catalog @@ -1277,11 +1277,11 @@ class Catalog extends database_object { // Remove any orphaned artists/albums/etc. self::gc(); - show_box_top(); + UI::show_box_top(); echo ""; printf (T_ngettext('Catalog Clean Done. %d file removed.', 'Catalog Clean Done. %d files removed.', $dead_total), $dead_total); echo "
\n"; - show_box_bottom(); + UI::show_box_bottom(); ob_flush(); flush(); @@ -1381,11 +1381,11 @@ class Catalog extends database_object { self::gc(); $this->update_last_update(); - show_box_top(); + UI::show_box_top(); echo ''; printf(T_('Catalog Verify Done. %d of %d files updated.'), $total_updated, $number); echo "
\n"; - show_box_bottom(); + UI::show_box_bottom(); ob_flush(); flush(); diff --git a/lib/class/ui.class.php b/lib/class/ui.class.php index c4fd3d47..021ad67d 100644 --- a/lib/class/ui.class.php +++ b/lib/class/ui.class.php @@ -109,6 +109,24 @@ class UI { } } + /** + * show_box_top + * + * This shows the top of the box. + */ + public static function show_box_top($title = '', $class = '') { + require Config::get('prefix') . '/templates/show_box_top.inc.php'; + } + + /** + * show_box_bottom + * + * This shows the bottom of the box + */ + public static function show_box_bottom() { + require Config::get('prefix') . '/templates/show_box_bottom.inc.php'; + } + /** * truncate * diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 00f7eb27..577e9ce1 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -342,28 +342,6 @@ function show_playlist_select($name,$selected='',$style='') { } // show_playlist_select -/** - * show_box_top - * This function requires the top part of the box - * it takes title as an optional argument - */ -function show_box_top($title='',$class='') { - - require Config::get('prefix') . '/templates/show_box_top.inc.php'; - -} // show_box_top - -/** - * show_box_bottom - * This function requires the bottom part of the box - * it does not take any arguments - */ -function show_box_bottom() { - - require Config::get('prefix') . '/templates/show_box_bottom.inc.php'; - -} // show_box_bottom - /** * get_user_icon * this function takes a name and a returns either a text representation diff --git a/templates/header.inc.php b/templates/header.inc.php index f6d5a8ad..a1deb402 100644 --- a/templates/header.inc.php +++ b/templates/header.inc.php @@ -66,11 +66,11 @@ if (is_rtl(Config::get('lang'))
- + fullname; ?> [] - +
title), 'box box_lyrics'); +UI::show_box_top(sprintf(T_('%s Lyrics'), $song->title), 'box box_lyrics'); ?> @@ -48,4 +48,4 @@ show_box_top(sprintf(T_('%s Lyrics'), $song->title), 'box box_lyrics');
- + diff --git a/templates/show_lyrics_song.inc.php b/templates/show_lyrics_song.inc.php index 677f1517..eb99a1cf 100644 --- a/templates/show_lyrics_song.inc.php +++ b/templates/show_lyrics_song.inc.php @@ -20,7 +20,7 @@ * */ -show_box_top($song->title , 'box box_lyrics_song'); +UI::show_box_top($song->title , 'box box_lyrics_song'); /* Prepare the variables */ $title = scrub_out(UI::truncate($song->title)); @@ -63,4 +63,4 @@ $artist = scrub_out(UI::truncate($song->f_artist_full));
- + diff --git a/templates/show_mail_users.inc.php b/templates/show_mail_users.inc.php index 4ce04ea8..91af8eb0 100644 --- a/templates/show_mail_users.inc.php +++ b/templates/show_mail_users.inc.php @@ -21,7 +21,7 @@ */ ?> - +
@@ -122,5 +122,5 @@ - + diff --git a/templates/show_manage_catalogs.inc.php b/templates/show_manage_catalogs.inc.php index 20ef4458..c26d0778 100644 --- a/templates/show_manage_catalogs.inc.php +++ b/templates/show_manage_catalogs.inc.php @@ -20,7 +20,7 @@ * */ ?> - +
@@ -46,7 +46,7 @@
- + +UI::show_box_top(T_('Manage Democratic Playlists')); ?> @@ -69,4 +69,4 @@ show_box_top(T_('Manage Democratic Playlists')); ?>
- + diff --git a/templates/show_newest.inc.php b/templates/show_newest.inc.php index 96a1540e..8a28bb12 100644 --- a/templates/show_newest.inc.php +++ b/templates/show_newest.inc.php @@ -20,6 +20,6 @@ * */ ?> - + - + diff --git a/templates/show_now_playing.inc.php b/templates/show_now_playing.inc.php index 6b3c985b..c56aea60 100644 --- a/templates/show_now_playing.inc.php +++ b/templates/show_now_playing.inc.php @@ -30,7 +30,7 @@ if (count($results)) { $link = Config::get('use_rss') ? ' ' . Ampache_RSS::get_display('nowplaying') : ''; ?> - + - + diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php index 5580f76e..1b552d60 100644 --- a/templates/show_playlist.inc.php +++ b/templates/show_playlist.inc.php @@ -31,7 +31,7 @@ ob_start(); require Config::get('prefix') . '/templates/show_playlist_title.inc.php'; $title = ob_get_contents(); ob_end_clean(); -show_box_top('
' . $title . +UI::show_box_top('
' . $title . '
', 'info-box'); ?>
@@ -68,7 +68,7 @@ show_box_top('
' . $title .
- + set_type('playlist_song'); diff --git a/templates/show_popular.inc.php b/templates/show_popular.inc.php index 2b5bf262..e6c0b3b7 100644 --- a/templates/show_popular.inc.php +++ b/templates/show_popular.inc.php @@ -20,7 +20,7 @@ * */ -show_box_top(T_('Information')); +UI::show_box_top(T_('Information')); $object_ids = Stats::get_top('song'); $browse = new Browse(); @@ -40,5 +40,5 @@ $browse->set_type('artist'); $browse->show_objects($object_ids); $browse->store(); -show_box_bottom(); +UI::show_box_bottom(); ?> diff --git a/templates/show_preference_admin.inc.php b/templates/show_preference_admin.inc.php index 3d984e6c..69e72bef 100644 --- a/templates/show_preference_admin.inc.php +++ b/templates/show_preference_admin.inc.php @@ -20,7 +20,7 @@ * */ -show_box_top(T_('Preference Administration')); +UI::show_box_top(T_('Preference Administration')); ?>
@@ -57,4 +57,4 @@ show_box_top(T_('Preference Administration')); - + diff --git a/templates/show_preferences.inc.php b/templates/show_preferences.inc.php index 7ece8439..4e9cc556 100644 --- a/templates/show_preferences.inc.php +++ b/templates/show_preferences.inc.php @@ -26,7 +26,7 @@ */ ?> - + @@ -49,4 +49,4 @@ if ($_REQUEST['tab'] == 'account') { ?> - + diff --git a/templates/show_random.inc.php b/templates/show_random.inc.php index fb5eddab..58abec32 100644 --- a/templates/show_random.inc.php +++ b/templates/show_random.inc.php @@ -20,7 +20,7 @@ * */ ?> - +
@@ -103,7 +103,7 @@ - +
- + - + diff --git a/templates/show_recently_played.inc.php b/templates/show_recently_played.inc.php index 2aecf9e7..da8fb6d7 100644 --- a/templates/show_recently_played.inc.php +++ b/templates/show_recently_played.inc.php @@ -21,7 +21,7 @@ */ $link = Config::get('use_rss') ? ' ' . Ampache_RSS::get_display('recently_played') : ''; -show_box_top(T_('Recently Played') . $link, 'box box_recently_played'); +UI::show_box_top(T_('Recently Played') . $link, 'box box_recently_played'); ?>
@@ -111,4 +111,4 @@ show_box_top(T_('Recently Played') . $link, 'box box_recently_played');
- + diff --git a/templates/show_recommended_artists.inc.php b/templates/show_recommended_artists.inc.php index f4b6fa50..c48e394f 100644 --- a/templates/show_recommended_artists.inc.php +++ b/templates/show_recommended_artists.inc.php @@ -20,7 +20,7 @@ * */ ?> - + diff --git a/templates/show_rename_artist.inc.php b/templates/show_rename_artist.inc.php index 74ef6485..1c0d16dc 100644 --- a/templates/show_rename_artist.inc.php +++ b/templates/show_rename_artist.inc.php @@ -26,7 +26,7 @@ function insert() document.getElementById('artist_name').value = 'name; ?>'; } -name)); ?> +name)); ?> id, "artist_id", 4); ?>
@@ -37,4 +37,4 @@ function insert()  

- + diff --git a/templates/show_rules.inc.php b/templates/show_rules.inc.php index 0bd5b97c..29554514 100644 --- a/templates/show_rules.inc.php +++ b/templates/show_rules.inc.php @@ -31,7 +31,7 @@ $logic_operator = strtolower($logic_operator); - +
@@ -54,7 +54,7 @@ $logic_operator = strtolower($logic_operator);
- +