diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-03-20 08:35:05 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-03-20 08:35:05 +0000 |
commit | 6f8fe88948cdc9e32dc9cb4d90c5c023bbfcfe1f (patch) | |
tree | 5fae977520a79eb3a68412d0999f801f8fcfc05d | |
parent | e1113fa54352ee57b8b2287f1a2e3b2a6896932e (diff) | |
download | ampache-6f8fe88948cdc9e32dc9cb4d90c5c023bbfcfe1f.tar.gz ampache-6f8fe88948cdc9e32dc9cb4d90c5c023bbfcfe1f.tar.bz2 ampache-6f8fe88948cdc9e32dc9cb4d90c5c023bbfcfe1f.zip |
more tweaking to catalog builds.. still in a transition point so it is a little ugly
-rw-r--r-- | admin/catalog.php | 57 | ||||
-rw-r--r-- | lib/ui.lib.php | 9 | ||||
-rw-r--r-- | templates/show_admin_catalog.inc.php | 25 | ||||
-rw-r--r-- | templates/show_confirmation.inc.php | 23 | ||||
-rw-r--r-- | templates/show_preferences.inc | 2 |
5 files changed, 67 insertions, 49 deletions
diff --git a/admin/catalog.php b/admin/catalog.php index 193c232b..ef5708ba 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -124,12 +124,14 @@ switch ($_REQUEST['action']) { } break; case 'delete_catalog': + /* Make sure they aren't in demo mode */ if (conf('demo_mode')) { break; } - if ($_REQUEST['confirm'] === 'Yes') { - $catalog = new Catalog($_REQUEST['catalog_id']); - $catalog->delete_catalog(); - } - include(conf('prefix') . '/templates/catalog.inc'); + + /* Delete the sucker, we don't need to check perms as thats done above */ + $catalog = new Catalog($_REQUEST['catalog_id']); + $catalog->delete_catalog(); + $next_url = conf('web_path') . '/admin/index.php'; + show_confirmation(_('Catalog Deleted'),_('The Catalog and all assoicated records has been deleted'),$nexturl); break; case 'remove_disabled': if (conf('demo_mode')) { break; } @@ -185,8 +187,11 @@ switch ($_REQUEST['action']) { include(conf('prefix') . '/templates/catalog.inc'); break; + // FIXME! case 'add_catalog': + /* Wah Demo! */ if (conf('demo_mode')) { break; } + if ($_REQUEST['path'] AND $_REQUEST['name']) { /* Throw all of the album art types into an array */ $art = array('id3'=>$_REQUEST['art_id3v2'],'amazon'=>$_REQUEST['art_amazon'],'folder'=>$_REQUEST['art_folder']); @@ -200,19 +205,24 @@ switch ($_REQUEST['action']) { $_REQUEST['gather_art'], $_REQUEST['parse_m3u'], $art); - include(conf('prefix') . '/templates/catalog.inc'); + $url = conf('web_path') . '/admin/index.php'; + $title = _('Catalog Created'); + $body = _('Catalog Created and Songs Indexed'); + show_confirmation($title,$body,$url); } else { $error = "Please complete the form."; include(conf('prefix') . '/templates/add_catalog.inc'); } break; - case 'really_clear_stats': + case 'clear_stats': if (conf('demo_mode')) { break; } - if ($_REQUEST['confirm'] == 'Yes') { - clear_catalog_stats(); - } - include(conf('prefix') . '/templates/catalog.inc'); + + clear_catalog_stats(); + $url = conf('web_path') . '/admin/index.php'; + $title = _('Catalog statistics cleared'); + $body = ''; + show_confirmation($title,$body,$url); break; case 'show_add_catalog': include(conf('prefix') . '/templates/add_catalog.inc'); @@ -220,18 +230,16 @@ switch ($_REQUEST['action']) { case 'clear_now_playing': if (conf('demo_mode')) { break; } clear_now_playing(); - show_confirmation(_("Now Playing Cleared"),_("All now playing data has been cleared"),"/admin/catalog.php"); + show_confirmation(_('Now Playing Cleared'),_('All now playing data has been cleared'),conf('web_path') . '/admin/index.php'); break; - case 'Clear Catalog': + case 'show_clear_stats': + /* Demo Bad! */ if (conf('demo_mode')) { break; } - show_confirm_action(_("Do you really want to clear your catalog?"), - "admin/catalog.php", "action=really_clear_catalog"); - print("<hr />\n"); - break; - case 'clear_stats': - if (conf('demo_mode')) { break; } - show_confirm_action(_("Do you really want to clear the statistics for this catalog?"), - "admin/catalog.php", "action=really_clear_stats"); + + $url = conf('web_path') . '/admin/catalog.php?action=clear_stats'; + $body = _('Do you really want to clear the statistics for this catalog?'); + $title = _('Clear Catalog Stats'); + show_confirmation($title,$body,$url,1); break; case 'show_disabled': if (conf('demo_mode')) { break; } @@ -244,10 +252,11 @@ switch ($_REQUEST['action']) { } break; case 'show_delete_catalog': + /* Stop the demo hippies */ if (conf('demo_mode')) { break; } - show_confirm_action(_("Do you really want to delete this catalog?"), - "admin/catalog.php", - "catalog_id=" . $_REQUEST['catalog_id'] . "&action=delete_catalog"); + + $nexturl = conf('web_path') . '/admin/catalog.php?action=delete_catalog&catalog_id=' . scrub_out($_REQUEST['catalog_id']); + show_confirmation(_('Delete Catalog'),_('Do you really want to delete this catalog?'),$nexturl,1); break; case 'show_flagged_songs': if (conf('demo_mode')) { break; } diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 7dd36aad..fc200ee7 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -31,11 +31,12 @@ /** * show_confirmation * shows a confirmation of an action - * @param $next_url Where to go next - * @param $title The Title of the message - * @param $text The details of the message + * $next_url Where to go next + * $title The Title of the message + * $text The details of the message + * $cancel T/F show a cancel button that uses return_referrer() */ -function show_confirmation($title,$text,$next_url) { +function show_confirmation($title,$text,$next_url,$cancel=0) { if (substr_count($next_url,conf('web_path'))) { $path = $next_url; diff --git a/templates/show_admin_catalog.inc.php b/templates/show_admin_catalog.inc.php index 6b40a8eb..73b9cb88 100644 --- a/templates/show_admin_catalog.inc.php +++ b/templates/show_admin_catalog.inc.php @@ -30,6 +30,7 @@ $catalogs = Catalog::get_catalogs(); <tr class="table-header"> <td><?php echo _('Name'); ?></td> <td align="center"><?php echo _('Action'); ?></td> +</tr> <?php foreach ($catalogs as $catalog) { ?> <tr class="<?php echo flip_class(); ?>"> <td> @@ -45,18 +46,30 @@ $catalogs = Catalog::get_catalogs(); <a href="<?php echo $web_path; ?>/admin/catalog.php?action=clean_catalog&catalogs[]=<?php echo $catalog->id; ?>"> <?php echo _('Clean'); ?></a> | <a href="<?php echo $web_path; ?>/admin/catalog.php?action=full_service&catalogs[]=<?php echo $catalog->id; ?>"> - <?php echo _('All'); ?></a> + <?php echo _('All'); ?></a> | + <a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_delete_catalog&catalog_id=<?php echo $catalog->id; ?>"> + <?php echo _('Delete'); ?></a> </td> </tr> <?php } // end foreach ?> +<?php if (!count($catalogs)) { ?> +<tr> + <td colspan="2"> + <?php echo _('No Catalogs Found'); ?> + </td> +</tr> +<?php } // end if no catalogs ?> </table> <form method="post" enctype="multipart/form-data" action="<?php echo $web_path; ?>/admin/catalog.php?action=full_service"> <input class="button" type="submit" value="<?php echo _('Update Everything'); ?>" /> </form> +</div> +<div class="text-box"> <span class="header2"><?php echo _('Other Tools'); ?></span><br /> -<ul style="list-style:none;"> - <li><a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_add_catalog"><?php echo _('Add a Catalog'); ?></a></li> - <li><a href="<?php echo $web_path; ?>/admin/duplicates.php"><?php echo _('Show Duplicate Songs'); ?></a></li> - <li><a href="<?php echo $web_path; ?>/admin/catalog.php?show_disabled"><?php echo _('Show Disabled Songs'); ?></a></li> -</ul> +<a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_add_catalog"><?php echo _('Add a Catalog'); ?></a><br /> +<a href="<?php echo $web_path; ?>/admin/duplicates.php"><?php echo _('Show Duplicate Songs'); ?></a><br /> +<a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_disabled"><?php echo _('Show Disabled Songs'); ?></a><br /> +<a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_clear_stats"><?php echo _('Clear Catalog Stats'); ?></a><br /> +<a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_now_playing"><?php echo _('Clear Now Playing'); ?></a><br /> +<a href="<?php echo $web_path; ?>/admin/catalog.php?action=gather_album_art"><?php echo _('Gather Album Art'); ?></a><br /> </div> diff --git a/templates/show_confirmation.inc.php b/templates/show_confirmation.inc.php index 2ba325a0..d561f137 100644 --- a/templates/show_confirmation.inc.php +++ b/templates/show_confirmation.inc.php @@ -19,17 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> -<br /> -<table class="text-box" align="center" cellspacing="7"> -<tr> - <td align="center"> - <span class="header1"><?php echo $title; ?></span><br /> - <?php echo $text; ?> - </td> -</tr> -<tr> - <td> - [ <a href="<?php echo $path; ?>"><?php echo _("Continue"); ?></a> ]<br /> - </td> -</tr> -</table> +<div class="text-box" style="width:35em;"> +<span class="header1"><?php echo scrub_out($title); ?></span><br /> +<?php echo scrub_out($text); ?> +<br /><br /> +[ <a href="<?php echo $path; ?>"><?php echo _('Continue'); ?></a> ] +<?php if ($cancel) { ?> + [ <a href="<?php echo return_referer(); ?>"><?php echo _('Cancel'); ?></a> ]<br /> +<?php } ?> +</div> diff --git a/templates/show_preferences.inc b/templates/show_preferences.inc index 552b91bd..e0c82225 100644 --- a/templates/show_preferences.inc +++ b/templates/show_preferences.inc @@ -79,7 +79,7 @@ if (($GLOBALS['user']->has_access(100)) AND ($user_id == '-1' AND conf('use_auth <?php } ?> </ul> </div> -<div class="text-box" style="padding-left:135px;"> +<div class="text-box"> <form method="post" name="preferences" action="<?php echo conf('web_path'); ?><?php echo $target; ?>" enctype="multipart/form-data"> <?php if ($current_tab != 'account') { |