summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-21 08:03:20 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-21 08:03:20 +0000
commit975bbcebe9c68ac729dd051b008cf6c615d443c2 (patch)
tree46737108023c5d65797d39f748c53cff0c160e10 /lib
parent742f6bfa6a7b285db898da220e1799fbb9b79ded (diff)
downloadampache-975bbcebe9c68ac729dd051b008cf6c615d443c2.tar.gz
ampache-975bbcebe9c68ac729dd051b008cf6c615d443c2.tar.bz2
ampache-975bbcebe9c68ac729dd051b008cf6c615d443c2.zip
new interface which breaks all previous themes... and current themes, still under development
Diffstat (limited to 'lib')
-rw-r--r--lib/class/stream.class.php2
-rw-r--r--lib/general.js88
-rw-r--r--lib/stream.lib.php6
-rw-r--r--lib/ui.lib.php100
4 files changed, 189 insertions, 7 deletions
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 283e0d32..16a7c722 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -270,7 +270,7 @@ class Stream {
/* If we've added songs we should start playing */
$myMpd->Play();
- header ("Location: " . return_referer());
+ header ("Location: " . conf('web_path') . "/index.php");
} // create_mpd
diff --git a/lib/general.js b/lib/general.js
new file mode 100644
index 00000000..f4ac76fb
--- /dev/null
+++ b/lib/general.js
@@ -0,0 +1,88 @@
+function disableField(element) {
+ var element_id = document.getElementById(element);
+ element_id.disabled=true;
+ element_id.value='';
+ element_id.checked=false;
+}
+function enableField(element) {
+ var element_id = document.getElementById(element);
+ element_id.disabled=false;
+
+}
+function flipField(element) {
+ var element_id = document.getElementById(element);
+ if (element_id.disabled == false) {
+ element_id.disabled=true;
+ }
+ else {
+ element_id.disabled=false;
+ }
+}
+function selectField(element)
+{
+ var element_id = document.getElementById(element);
+ element_id.focus();
+}
+ var checkflag_song = "false";
+
+ function check_songs() {
+ if (checkflag_song == "false") {
+ if (document.forms.songs.elements["song[]"].length == undefined) {
+ document.forms.songs.elements["song[]"].checked = true;
+ }
+ else {
+ for (i = 0; i < document.forms.songs.elements["song[]"].length; i++) {
+ document.forms.songs.elements["song[]"][i].checked = true;
+ }
+ }
+ checkflag_song = "true";
+ return "Unselect All";
+ }
+ else {
+ if (document.forms.songs.elements["song[]"].length == undefined) {
+ document.forms.songs.elements["song[]"].checked = false;
+ }
+ else {
+ for (i = 0; i < document.forms.songs.elements["song[]"].length; i++) {
+ document.forms.songs.elements["song[]"][i].checked = false;
+ }
+ }
+ checkflag_song = "false";
+ return "Select All";
+ }
+ }
+
+ function invert_songs() {
+ for( i = 0; i < document.forms.songs.elements["song[]"].length; ++i ) {
+ document.forms.songs.elements["song[]"][i].checked = !document.forms.songs.elements["song[]"][i].checked
+ }
+ }
+
+ var checkflag_results = "false";
+
+ function check_results() {
+ if (checkflag_results == "false") {
+ if (document.results.elements["results[]"].length == undefined) {
+ document.results.elements["results[]"].checked = true;
+ }
+ else {
+ for (i = 0; i < document.results.elements["results[]"].length; i++) {
+ document.results.elements["results[]"][i].checked = true;
+ }
+ }
+ checkflag_results = "true";
+ return "Unselect All";
+ }
+ else {
+ if (document.results.elements["results[]"].length == undefined) {
+ document.results.elements["results[]"].checked = false;
+ }
+ else {
+ for (i = 0; i < document.results.elements["results[]"].length; i++) {
+ document.results.elements["results[]"][i].checked = false;
+ }
+ }
+ checkflag_results = "false";
+ return "Select All";
+ }
+}
diff --git a/lib/stream.lib.php b/lib/stream.lib.php
index 50e9f22f..57be2fe3 100644
--- a/lib/stream.lib.php
+++ b/lib/stream.lib.php
@@ -250,7 +250,11 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) {
$fp = @popen($downsample_command, 'r');
- return ($fp);
+ /* We need more than just the handle here */
+ $return_array['handle'] = $fp;
+ $return_array['size'] = $sample_ration*$song->size;
+
+ return ($return_array);
} // start_downsample
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 781dbe33..7722b251 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -218,10 +218,8 @@ function show_admin_menu ($admin_highlight) {
*/
function access_denied() {
- show_template('style');
- show_footer();
echo "<br /><br /><br />";
- echo "<div class=\"fatalerror\">Error Access Denied</div>\n";
+ echo "<div class=\"fatalerror\">" . _("Error Access Denied") . "</div>\n";
show_footer();
exit();
@@ -385,8 +383,9 @@ function truncate_with_ellipsis($text, $max=27) {
* shows the footer of the page
*/
function show_footer() {
- $class = "table-header";
- echo "<br /><br /><br /><div class=\"$class\" style=\"border: solid thin black;\">&nbsp;</div>";
+
+ require_once(conf('prefix') . '/templates/footer.inc');
+
} // show_footer
/**
@@ -758,4 +757,95 @@ function show_artist_pulldown ($artist_id,$select_name='artist') {
echo "</select>\n";
} // show_artist_pulldown
+
+/**
+ * show_submenu
+ * This shows the submenu mojo for the sidebar, and I guess honestly anything
+ * else you would want it to... takes an array of items which have ['url'] ['title']
+ * and ['active']
+ */
+function show_submenu($items) {
+
+ require (conf('prefix') . '/templates/subnavbar.inc.php');
+
+} // show_submenu
+
+
+/**
+ * get_location
+ * This function gets the information about said persons currently location
+ * this is used for A) Sidebar highlighting & submenu showing and B) Titlebar information
+ * it returns an array of information about what they are currently doing
+ * Possible array elements
+ * ['title'] Text name for the page
+ * ['page'] actual page name
+ * ['section'] name of the section we are in, admin, browse etc (submenu control)
+ * @package General
+ */
+function get_location() {
+
+ $location = array();
+
+ /* Sanatize the $_SERVER['PHP_SELF'] variable */
+ $location['page'] = preg_replace("/^\/(.+\.php)\/?.*/","$1",$_SERVER['PHP_SELF']);
+
+ switch ($location['page']) {
+ case 'index.php':
+ $location['title'] = 'Home';
+ break;
+ case 'search.php':
+ $location['title'] = 'Search';
+ break;
+ case 'preferences.php':
+ $location['title'] = 'Preferences';
+ break;
+ case 'admin/index.php':
+ $location['title'] = 'Admin';
+ $location['section'] = 'admin';
+ break;
+ case 'admin/catalog.php':
+ $location['title'] = 'Catalog';
+ $location['section'] = 'admin';
+ break;
+ case 'admin/users.php':
+ $location['title'] = 'User Management';
+ $location['section'] = 'admin';
+ break;
+ case 'admin/mail.php':
+ $location['title'] = 'Mail Users';
+ $location['section'] = 'admin';
+ break;
+ case 'admin/access.php':
+ $location['title'] = 'Manage Access Lists';
+ $location['section'] = 'admin';
+ break;
+ case 'admin/preferences.php':
+ $location['title'] = 'Site Preferences';
+ $location['section'] = 'admin';
+ break;
+ case 'browse.php':
+ $location['title'] = 'Browse Music';
+ $location['section'] = 'browse';
+ break;
+ case 'albums.php':
+ $location['title'] = 'Albums';
+ $location['section'] = 'browse';
+ break;
+ case 'artists.php':
+ $location['title'] = 'Artists';
+ $location['section'] = 'browse';
+ break;
+ case 'genre.php':
+ $location['title'] = 'Genre';
+ $location['section'] = 'browse';
+ break;
+ default:
+ $location['title'] = '';
+ break;
+ } // switch on raw page location
+
+ return $location;
+
+} // get_location
+
?>