diff options
-rw-r--r-- | lib/class/ajax.class.php | 28 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 52 | ||||
-rw-r--r-- | lib/class/stream.class.php | 3 | ||||
-rw-r--r-- | lib/class/vauth.class.php | 2 | ||||
-rw-r--r-- | lib/javascript-base.js | 116 | ||||
-rw-r--r-- | lib/javascript/ajax.js | 81 | ||||
-rw-r--r-- | lib/javascript/base.js | 104 | ||||
-rw-r--r-- | lib/ui.lib.php | 16 | ||||
-rw-r--r-- | modules/kajax/README | 24 | ||||
-rw-r--r-- | modules/kajax/ajax.js | 147 | ||||
-rw-r--r-- | server/democratic.ajax.php | 2 | ||||
-rw-r--r-- | server/stream.ajax.php | 2 | ||||
-rw-r--r-- | templates/browse_filters.inc.php | 2 | ||||
-rw-r--r-- | templates/header.inc.php | 4 | ||||
-rw-r--r-- | templates/javascript_refresh.inc.php | 18 | ||||
-rw-r--r-- | templates/show_album.inc.php | 2 | ||||
-rw-r--r-- | templates/show_install.inc.php | 2 | ||||
-rw-r--r-- | templates/show_install_lang.inc.php | 2 | ||||
-rw-r--r-- | templates/show_lyrics_song.inc.php | 2 | ||||
-rw-r--r-- | templates/show_now_playing_row.inc.php | 2 | ||||
-rw-r--r-- | templates/show_registration_confirmation.inc.php | 4 | ||||
-rw-r--r-- | templates/show_user_activate.inc.php | 4 | ||||
-rw-r--r-- | templates/show_user_registration.inc.php | 4 |
23 files changed, 250 insertions, 373 deletions
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php index b1e9997a..1b69e17a 100644 --- a/lib/class/ajax.class.php +++ b/lib/class/ajax.class.php @@ -22,8 +22,9 @@ /** * Ajax class - * This class is specifically for setuping/printing out ajax related - * elements onto a page it takes care of the observing and all that raz-a-ma-taz + * This class is specifically for setting up/printing out ajax related + * elements onto a page. It takes care of the observing and all that + * raz-a-ma-taz. */ class Ajax { @@ -41,7 +42,8 @@ class Ajax { /** * observe - * This returns a string with the correct and full ajax 'observe' stuff from prototype + * This returns a string with the correct and full ajax 'observe' stuff + * from prototype */ public static function observe($source,$method,$action,$post='') { @@ -69,8 +71,8 @@ class Ajax { /** * action - * This takes the action, the source and the post (if passed) and generated the full - * ajax link + * This takes the action, the source and the post (if passed) and + * generates the full ajax link */ public static function action($action,$source,$post='') { @@ -98,8 +100,8 @@ class Ajax { /** * button - * This prints out an img of the specified icon with the specified alt text - * and then sets up the required ajax for it + * This prints out an img of the specified icon with the specified alt + * text and then sets up the required ajax for it. */ public static function button($action,$icon,$alt,$source='',$post='',$class='') { @@ -113,8 +115,9 @@ class Ajax { $string = get_user_icon($icon,$alt); - // Generate a <a> so that it's more compliant with older browsers - // (ie :hover actions) and also to unify linkbuttons (w/o ajax) display + // Generate an <a> so that it's more compliant with older + // browsers (ie :hover actions) and also to unify linkbuttons + // (w/o ajax) display $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class>".$string."</a>\n"; $string .= self::observe($source,'click',$ajax_string); @@ -161,7 +164,8 @@ class Ajax { /** * set_include_override - * This sets the cinlduing div override, used only one place kind of a hack + * This sets the including div override, used only one place. Kind of a + * hack. */ public static function set_include_override($value) { @@ -171,8 +175,8 @@ class Ajax { /** * start_container - * This checks to see if we're AJAX'in if we aren't then it echos out the - * html needed to start a container that can be replaced by Ajax + * This checks to see if we're AJAXin'. If we aren't then it echoes out + * the html needed to start a container that can be replaced by Ajax. */ public static function start_container($name) { diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 694ad523..425bfe22 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -596,10 +596,8 @@ class Catalog extends database_object { $this->count++; if ( (time() > $ticker+1)) { $file = str_replace(array('(',')','\''),'',$full_file); - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $this->count ."','add_count_" . $this->id . "');"; - echo "update_txt('" . scrub_out($file) . "','add_dir_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('add_count_' . $this->id, $this->count); + update_text('add_dir_' . $this->id, scrub_out($file)); flush(); $ticker = time(); } // update our current state @@ -617,10 +615,8 @@ class Catalog extends database_object { // This should only happen on the last run if ($path == $this->path) { - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $this->count ."','add_count_" . $this->id . "');"; - echo "update_txt('" . scrub_out($file) . "','add_dir_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('add_count_' . $this->id, $this->count); + update_text('add_dir_' . $this->id, scrub_out($file)); flush(); } @@ -722,10 +718,8 @@ class Catalog extends database_object { /* Stupid little cutesie thing */ $search_count++; if ( time() > $ticker+1) { - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');"; - echo "update_txt('" . addslashes($album->name) . "','read_art_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('count_art_' . $this->id, $search_count); + update_text('read_art_' . $this->id, scrub_out($album->name)); flush(); $ticker = time(); } //echos song count @@ -734,10 +728,8 @@ class Catalog extends database_object { } // foreach albums // One last time for good measure - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');"; - echo "update_txt('" . addslashes($album->name) . "','read_art_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('count_art_' . $this->id, $search_count); + update_text('read_art_' . $this->id, scrub_out($album->name)); flush(); self::$_art_albums = array(); @@ -765,18 +757,14 @@ class Catalog extends database_object { /* Stupid little cutesie thing */ $thumb_count++; if ( time() > $ticker+1) { - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $search_count ."','count_thumb_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('count_thumb_' . $this->id, $search_count); flush(); $ticker = time(); } //echos thumb count } // end foreach albums - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $search_count ."','count_thumb_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('count_thumb_' . $this->id, $search_count); flush(); } // generate_thumbnails @@ -1603,10 +1591,8 @@ class Catalog extends database_object { $count++; if (time() > $ticker+1) { $file = str_replace(array('(',')','\''),'',$results['file']); - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $count ."','clean_count_" . $this->id . "');"; - echo "update_txt('" . scrub_out($file) . "','clean_dir_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('clean_count_' . $this->id, $count); + update_text('clean_dir_' . $this->id, scrub_out($file)); flush(); $ticker = time(); } //echos song count @@ -1684,9 +1670,7 @@ class Catalog extends database_object { self::clean($catalog_id); /* Return dead files, so they can be listed */ - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $count ."','clean_count_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('clean_count_' . $this->id, $count); show_box_top(); echo "<strong>"; printf (ngettext('Catalog Clean Done. %d file removed.','Catalog Clean Done. %d files removed.',$dead_files), $dead_files); @@ -1976,10 +1960,8 @@ class Catalog extends database_object { $count++; if (time() > $ticker+1) { $file = str_replace(array('(',')','\''),'',$media->file); - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $count . "','verify_count_" . $catalog_id . "');"; - echo "update_txt('" . scrub_out($file) . "','verify_dir_" . $catalog_id . "');"; - echo "\n</script>\n"; + update_text('verify_count_' . $catalog_id, $count); + update_text('verify_dir_' . $catalog_id, scrub_out($file)); flush(); $ticker = time(); } //echos song count @@ -2004,9 +1986,7 @@ class Catalog extends database_object { $this->update_last_update(); // One final time! - echo "<script type=\"text/javascript\">\n"; - echo "update_txt('" . $this->count . "','count_verify_" . $this->id . "');"; - echo "\n</script>\n"; + update_text('count_verify_' . $this->id, $this->count); flush(); show_box_top(); diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index 35f0f4a3..a36e547e 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -857,8 +857,7 @@ class Stream { // Load our javascript echo "<script type=\"text/javascript\">"; - //echo "reload_util();"; - echo "reload_util('".$_SESSION['iframe']['target']."');"; + echo "reloadUtil('".$_SESSION['iframe']['target']."');"; echo "</script>"; } // run_playlist_method diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php index 761e4dc7..3e034f55 100644 --- a/lib/class/vauth.class.php +++ b/lib/class/vauth.class.php @@ -180,7 +180,7 @@ class vauth { header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); - $results['rfc3514'] = '<script type="text/javascript">reload_logout("'.$target.'")</script>'; + $results['rfc3514'] = '<script type="text/javascript">reloadRedirect("' . $target . '")</script>'; echo xml_from_array($results); } else { diff --git a/lib/javascript-base.js b/lib/javascript-base.js deleted file mode 100644 index fa5c1465..00000000 --- a/lib/javascript-base.js +++ /dev/null @@ -1,116 +0,0 @@ -// -// -// Copyright (c) Ampache.org -// All rights reserved. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License v2 -// as published by the Free Software Foundation. -// -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// - -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(); -} - -// function for the catalog mojo fluf -function update_txt(value,field) { - document.getElementById(field).innerHTML=value; -} - -// Function for enabling/disabling a div (display:none) used for loading div -function toggle_visible(element) { - - var obj = document.getElementById(element); - if (obj.style.display == 'block') { - obj.style.display = 'none'; - } - else { - obj.style.display = 'block'; - } -} - -/// -// DelayRun -// This function delays the run of another function by X milliseconds -function DelayRun(element,time,method,page,source) { - - var function_string = method + '(\'' + page + '\',\'' + source + '\')'; - - var action = function () { eval(function_string); }; - - if (element.zid) { - clearTimeout(element.zid); - } - - element.zid = setTimeout(action,time); - -} // DelayRun - - -// Reload our util frame -// IE issue fixed by Spocky, we have to use the iframe for Democratic Play & Localplay -// which don't actually prompt for a new file -function reload_util(target) { - - if (navigator.appName == 'Opera') { - document.getElementById('util_iframe').contentWindow.location.reload(true); - } - else if (navigator.appName == 'Konqueror') { - document.getElementById('util_iframe').contentDocument.location.reload(true); - } - else { - document.getElementById('util_iframe').src = document.getElementById('util_iframe').src; - } -} - -// Log them out -function reload_logout(target) { - window.location = target; -} - -function popup_art(url) { - var newwindow; - newwindow=window.open(url, "ampache_art", "menubar=no,toolbar=no,location=no,directories=no"); - if (window.focus) {newwindow.focus()} -} - -function check_inline_song_edit(type, song) { - if ($(type+'_select_'+song).options[$(type+'_select_'+song).selectedIndex].value == -1) { - $(type+'_select_song_'+song).innerHTML = '<input type="textbox" name="'+type+'_name" value="New '+type+'" />'; - } else { - $(type+'_select_song_'+song).innerHTML = ''; - } -} - diff --git a/lib/javascript/ajax.js b/lib/javascript/ajax.js new file mode 100644 index 00000000..7c46c5d7 --- /dev/null +++ b/lib/javascript/ajax.js @@ -0,0 +1,81 @@ +// vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab:
+//
+// Copyright (c) Ampache.org
+// All rights reserved.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License v2
+// as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Softwar
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+// Some cutesy flashing thing while we run
+Ajax.Responders.register({
+ onCreate: function(){
+ $('ajax-loading').style.display = 'block';
+ },
+ onComplete: function() {
+ $('ajax-loading').style.display = 'none';
+ }
+});
+
+// ajaxPost
+// Post the contents of a form.
+function ajaxPost(url, input, source) {
+ if ($(source)) {
+ Event.stopObserving(source, 'click', function() { ajaxPost(url, input, source); });
+ }
+
+ new Ajax.Request(url, {
+ method: 'post',
+ parameters: $(input).serialize(true),
+ onSuccess: processContents
+}
+} // ajaxPost
+
+// ajaxPut
+// Get response from the specified URL.
+function ajaxPut(url, source) {
+ if ($(source)) {
+ Event.stopObserving(source, 'click', function(){ ajaxPut(url, source); });
+ }
+
+ new Ajax.Request(url, {
+ method: 'put',
+ onSuccess: processContents
+ });
+} // ajaxPut
+
+// ajaxState
+// Post the contents of a form without doing any observe() things.
+function ajaxState(url, input) {
+ new Ajax.Request(url, {
+ method: 'post',
+ parameters: $(input).serialize(true),
+ onSuccess: processContents
+ });
+} // ajaxState
+
+
+// processContents
+// Iterate over a response and do any updates we received.
+function processContents(transport) {
+ $A(transport.responseXML.getElementsByTagName('content')).each(updateElement);
+} // processContents
+
+// updateElement
+// This isn't an anonymous function because I'm ornery. Does the actual
+// updates for processContents.
+function updateElement(contentXML) {
+ var newID = contentXML.getAttribute('div');
+ if($(newID)) {
+ $(newID).update(contentXML.firstChild.nodeValue);
+}
+} // updateElement
diff --git a/lib/javascript/base.js b/lib/javascript/base.js new file mode 100644 index 00000000..feb07b58 --- /dev/null +++ b/lib/javascript/base.js @@ -0,0 +1,104 @@ +// +// Copyright (c) Ampache.org +// All rights reserved. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License v2 +// as published by the Free Software Foundation. +// +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// + +// flipField +// Toggles the disabled property on the specifed field +function flipField(field) { + if ($(field).disabled == false) { + $(field).disabled = true; + } + else { + $(field).disabled = false; +} +} // flipField + +// updateText +// Changes the specified elements innards. Used for the catalog mojo fluff. +function updateText(field, value) { + $(field).innerHTML = value; +} // updateText + +// toggleVisible +// Toggles display type between block and none. Used for ajax loading div. +function toggleVisible(element) { + + if ($(element).style.display == 'block') { + $(element).style.display = 'none'; + } + else { + $(element).style.display = 'block'; +} +} // toggleVisible + +// delayRun +// This function delays the run of another function by X milliseconds +function delayRun(element, time, method, page, source) { + + var function_string = method + '(\'' + page + '\',\'' + source + '\')'; + + var action = function () { eval(function_string); }; + + if (element.zid) { + clearTimeout(element.zid); + } + + element.zid = setTimeout(action,time); + +} // delayRun + +// reloadUtil +// Reload our util frame +// IE issue fixed by Spocky, we have to use the iframe for Democratic Play & +// Localplay, which don't actually prompt for a new file +function reloadUtil(target) { + + if (navigator.appName == 'Opera') { + $('util_iframe').contentWindow.location.reload(true); + } + else if (navigator.appName == 'Konqueror') { + $('util_iframe').contentDocument.location.reload(true); + } + else { + $('util_iframe').src = $('util_iframe').src; +} +} // reloadUtil + +// reloadRedirect +// Send them elsewhere +function reloadRedirect(target) { + window.location = target; +} // reloadRedirect + +// popupWindow +// Loads the specified URL in a new window. Used for art. +function popupWindow(url) { + var newWindow = window.open(url, "ampache_art", "menubar=no,toolbar=no,location=no,directories=no"); + if (window.focus) { newWindow.focus(); } +} // popupWindow + +// This is kind of ugly. Let's not mess with it too much. +function check_inline_song_edit(type, song) { + var target = type + '_select_' + song; + if ($(target).options[$(target).selectedIndex].value == -1) { + $(target).innerHTML = '<input type="textbox" name="' + type + '_name" value="New ' + type + '" />'; + } else { + $(target).innerHTML = ''; + } +} + diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 6c1d56fa..4a5767a9 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -716,13 +716,23 @@ function ajax_include($include) { */ function toggle_visible($element) { - echo "<script type=\"text/javascript\">\n"; - echo "toggle_visible('$element');"; - echo "\n</script>\n"; + echo '<script type="text/javascript">'; + echo "toggleVisible('$element');"; + echo "</script>\n"; } // toggle_visible /** + * update_text + * Convenience function + */ +function update_text($field, $value) { + echo '<script type="text/javascript">'; + echo "updateText('$field', '$value');"; + echo "</script>\n"; +} + +/** * print_bool * This function takes a boolean value and then prints out a friendly text * message. diff --git a/modules/kajax/README b/modules/kajax/README deleted file mode 100644 index b945c5dd..00000000 --- a/modules/kajax/README +++ /dev/null @@ -1,24 +0,0 @@ -/* - - Copyright (c) 2001 - 2006 Ampache.org - All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/** - * Library Created by Kevin Riker - * Modified by Karl Vollmer - */ diff --git a/modules/kajax/ajax.js b/modules/kajax/ajax.js deleted file mode 100644 index 4a3e105a..00000000 --- a/modules/kajax/ajax.js +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Ampache.org
-// All rights reserved.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License v2
-// as published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// uid is an array of uids that need to be replaced
-function ajaxPut(url,source) {
-
- if (document.getElementById(source)) {
- Event.stopObserving(source,'click',function(){ajaxPut(url,source);});
- }
-
- if (window.ActiveXObject) { // IE
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e) {}
- }
- }
- else { // Mozilla
- IE = false;
- http_request = new XMLHttpRequest();
- }
- if (!http_request) {
- return false;
- }
- http_request.onreadystatechange = function() { getContents(http_request); };
- http_request.open('GET', url, true);
- http_request.send(null);
-}
-
-// uid is an array of uids that need to be replaced
-function ajaxState(url,input) {
-
- var data = document.getElementById(input).value
-
- var post_data = input + '=' + encodeURI(data);
-
- var http_request = false;
- if (window.XMLHttpRequest) { // Mozilla, Safari,...
- http_request = new XMLHttpRequest();
- } else if (window.ActiveXObject) { // IE
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {}
- }
- }
- if (!http_request) {
- return false;
- }
- http_request.onreadystatechange = function() { getContents(http_request); };
- http_request.open('POST', url, true);
- http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- http_request.setRequestHeader("Content-length", post_data.length);
- http_request.setRequestHeader("Connection", "close");
- http_request.send(post_data);
-
-} // ajaxState
-
-
-///
-// getContents
-// This is the nitty gritty wait for a good xml document and then decode it
-function getContents(http_request) {
-
- // Display the loading doodly
- document.getElementById('ajax-loading').style.display = 'block';
-
- if (http_request.readyState == 4) {
- if (http_request.status == 200) {
- var data = http_request.responseXML;
- var newContent = http_request.responseXML.getElementsByTagName('content');
-
-
- for(var i=0; i < newContent.length; i++) {
- var newID = newContent[i].getAttribute('div');
- if (document.getElementById(newID)) {
- $(newID).update(newContent[i].firstChild.nodeValue);
- }
- }
- document.getElementById('ajax-loading').style.display = 'none';
- }
- }
-}
-
-function ajaxPost(url,input,source) {
-
- if (document.getElementById(source)) {
- Event.stopObserving(source,'click',function(){ajaxPost(url,input,source);});
- }
-
- var post_data = 'a=0';
- var data = document.getElementById(input).elements;
-
- // For the post data we recieved
- for(i=0;i<data.length;i++) {
- var frm_field = data[i];
-
- // This makes the value of the checkbox the checked status, more usefull
- if (frm_field.type == 'checkbox') {
- frm_field.value = frm_field.checked;
- }
- post_data = post_data +'&' + frm_field.name + '=' + encodeURI(frm_field.value);
- }
-
- var http_request = false;
- if (window.XMLHttpRequest) { // Mozilla, Safari,...
- http_request = new XMLHttpRequest();
- } else if (window.ActiveXObject) { // IE
- try {
- http_request = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- http_request = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {}
- }
- }
- if (!http_request) {
- return false;
- }
- http_request.onreadystatechange = function() { getContents(http_request); };
- http_request.open('POST', url, true);
- http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- http_request.setRequestHeader("Content-length", post_data.length);
- http_request.setRequestHeader("Connection", "close");
- http_request.send(post_data);
-
-}
-
diff --git a/server/democratic.ajax.php b/server/democratic.ajax.php index 48fc6fd0..0d345119 100644 --- a/server/democratic.ajax.php +++ b/server/democratic.ajax.php @@ -53,7 +53,7 @@ switch ($_REQUEST['action']) { } $_SESSION['iframe']['target'] = Config::get('web_path') . '/stream.php?action=democratic&democratic_id=' . scrub_out($_REQUEST['democratic_id']); - $results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>'; + $results['rfc3514'] = '<script type="text/javascript">reloadUtil("'.$_SESSION['iframe']['target'].'")</script>'; break; case 'clear_playlist': if (!Access::check('interface','100')) { diff --git a/server/stream.ajax.php b/server/stream.ajax.php index c49d79d4..50923698 100644 --- a/server/stream.ajax.php +++ b/server/stream.ajax.php @@ -84,7 +84,7 @@ switch ($_REQUEST['action']) { // We need to set the basket up! $_SESSION['iframe']['target'] = Config::get('web_path') . '/stream.php?action=basket&playlist_method=' . scrub_out($_REQUEST['playlist_method']); - $results['rfc3514'] = '<script type="text/javascript">reload_util(\''.$_SESSION['iframe']['target'] . '\');</script>'; + $results['rfc3514'] = '<script type="text/javascript">reloadUtil(\''.$_SESSION['iframe']['target'] . '\');</script>'; break; default: $results['rfc3514'] = '0x1'; diff --git a/templates/browse_filters.inc.php b/templates/browse_filters.inc.php index c8c65a14..c902cd1b 100644 --- a/templates/browse_filters.inc.php +++ b/templates/browse_filters.inc.php @@ -27,7 +27,7 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path'); <?php if (in_array('starts_with',$allowed_filters)) { ?> <form id="multi_alpha_filter_form" method="post" action="javascript:void(0);"> <label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo _('Starts With'); ?></label> - <input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php echo scrub_out($browse->get_filter('starts_with')); ?>" onKeyUp="DelayRun(this, '400', 'ajaxState', '<?php echo $ajax_info; ?>?page=browse&action=browse&browse_id=<?php echo $browse->id; ?>&key=starts_with', 'multi_alpha_filter');"> + <input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php echo scrub_out($browse->get_filter('starts_with')); ?>" onKeyUp="delayRun(this, '400', 'ajaxState', '<?php echo $ajax_info; ?>?page=browse&action=browse&browse_id=<?php echo $browse->id; ?>&key=starts_with', 'multi_alpha_filter');"> </form> <?php } // end if alpha_match ?> <?php if (in_array('minimum_count',$allowed_filters)) { ?> diff --git a/templates/header.inc.php b/templates/header.inc.php index fc5ff91e..7493cf9c 100644 --- a/templates/header.inc.php +++ b/templates/header.inc.php @@ -51,9 +51,9 @@ if (Config::get('use_rss')) { ?> <link rel="stylesheet" href="<?php echo $web_path; ?>/templates/print.css" type="text/css" media="print" /> </head> <body> -<script src="<?php echo $web_path; ?>/lib/javascript-base.js" language="javascript" type="text/javascript"></script> -<script src="<?php echo $web_path; ?>/modules/kajax/ajax.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script> <!-- rfc3514 implementation --> <div id="rfc3514" style="display:none;">0x0</div> <div id="maincontainer"> diff --git a/templates/javascript_refresh.inc.php b/templates/javascript_refresh.inc.php index 5f0a07ed..b0c8d9f5 100644 --- a/templates/javascript_refresh.inc.php +++ b/templates/javascript_refresh.inc.php @@ -22,27 +22,13 @@ ?> <script type="text/javascript" language="javascript"> -<!-- Begin // Set refresh interval (in seconds) -var refreshinterval=<?php echo $refresh_limit ?>; - -function doLoad() -{ - // the timeout value should be the same as in the "refresh" meta-tag - setTimeout( "refresh()", refreshinterval*1000 ); -} +var refreshInterval=<?php echo $refresh_limit ?>; function refresh() { - // This version of the refresh function will cause a new - // entry in the visitor's history. It is provided for - // those browsers that only support JavaScript 1.0. - // ajaxPut('<?php echo $ajax_url; ?>'); - doLoad(); } -// start with page-load -doLoad(); -// End --> +new PeriodicalExecuter(refresh, refreshInterval); </script> diff --git a/templates/show_album.inc.php b/templates/show_album.inc.php index 3c49a3d1..9f7ac06a 100644 --- a/templates/show_album.inc.php +++ b/templates/show_album.inc.php @@ -37,7 +37,7 @@ $title .= ' - ' . $album->f_artist_link; $name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name); $aa_url = $web_path . "/image.php?id=" . $album->id . "&type=popup&sid=" . session_id(); - echo "<a target=\"_blank\" href=\"$aa_url\" onclick=\"popup_art('$aa_url'); return false;\">"; + echo "<a target=\"_blank\" href=\"$aa_url\" onclick=\"popupWindow('$aa_url'); return false;\">"; echo "<img src=\"" . $web_path . "/image.php?id=" . $album->id . "&thumb=2\" alt=\"".$name."\" title=\"".$name."\" height=\"128\" width=\"128\" />"; echo "</a>\n"; } diff --git a/templates/show_install.inc.php b/templates/show_install.inc.php index 963267cc..bf7caaad 100644 --- a/templates/show_install.inc.php +++ b/templates/show_install.inc.php @@ -31,7 +31,7 @@ $dir = is_rtl($htmllang) ? 'rtl' : 'ltr'; <meta http-equiv="Content-Type" content="text/html; Charset=<?php echo $charset; ?>" /> </head> <body> -<script src="lib/javascript-base.js" language="javascript" type="text/javascript"></script> +<script src="lib/javascript/base.js" language="javascript" type="text/javascript"></script> <div id="header"> <h1><?php echo _("Ampache Installation"); ?></h1> <p>Pour l'Amour de la Musique</p> diff --git a/templates/show_install_lang.inc.php b/templates/show_install_lang.inc.php index 803c41ac..779cdee1 100644 --- a/templates/show_install_lang.inc.php +++ b/templates/show_install_lang.inc.php @@ -31,7 +31,7 @@ $prefix = realpath(dirname(__FILE__). "/../"); <meta http-equiv="Content-Type" content="text/html; Charset=<?php echo $charset; ?>" /> </head> <body> -<script src="lib/javascript-base.js" language="javascript" type="text/javascript"></script> +<script src="lib/javascript/base.js" language="javascript" type="text/javascript"></script> <div id="header"> <h1><?php echo _('Ampache Installation'); ?></h1> <p>For the love of Music</p> diff --git a/templates/show_lyrics_song.inc.php b/templates/show_lyrics_song.inc.php index e32b4776..c4a59ace 100644 --- a/templates/show_lyrics_song.inc.php +++ b/templates/show_lyrics_song.inc.php @@ -30,7 +30,7 @@ $artist = scrub_out(truncate_with_ellipsis($song->f_artist_full)); <div class="np_group"> <?php if (Config::get('show_album_art')) { ?> <div class="np_cell cel_albumart"> - <a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>'); return false;"> + <a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>" onclick="popupWindow('<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&type=popup&sid=<?php echo session_id(); ?>'); return false;"> <img align="middle" src="<?php echo $web_path; ?>/image.php?id=<?php echo $song->album; ?>&thumb=1&sid=<?php echo session_id(); ?>" alt="<?php echo scrub_out($song->f_album_full); ?>" title="<?php echo scrub_out($song->f_album_full); ?>" height="75" width="75" /> </a> </div> diff --git a/templates/show_now_playing_row.inc.php b/templates/show_now_playing_row.inc.php index a5f291e8..ad33429f 100644 --- a/templates/show_now_playing_row.inc.php +++ b/templates/show_now_playing_row.inc.php @@ -76,7 +76,7 @@ $artist = scrub_out(truncate_with_ellipsis($media->f_artist_full)); <?php if (Art::is_enabled()) { ?> <div class="np_group"> <div class="np_cell cel_albumart"> - <a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup'); return false;"> + <a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup" onclick="popupWindow('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup'); return false;"> <img align="middle" src="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&thumb=1&sid=<?php echo session_id(); ?>" alt="<?php echo scrub_out($media->f_album_full); ?>" title="<?php echo scrub_out($media->f_album_full); ?>" height="75" width="75" /> </a> </div> diff --git a/templates/show_registration_confirmation.inc.php b/templates/show_registration_confirmation.inc.php index a0f826b7..3a2dc1a6 100644 --- a/templates/show_registration_confirmation.inc.php +++ b/templates/show_registration_confirmation.inc.php @@ -36,9 +36,9 @@ $web_path = Config::get('web_path'); <h1><?php echo scrub_out(Config::get('site_title')); ?></h1> <?php echo _('Registration Complete'); ?>... </div> -<script src="<?php echo $web_path; ?>/lib/javascript-base.js" language="javascript" type="text/javascript"></script> -<script src="<?php echo $web_path; ?>/modules/kajax/ajax.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script> <div id="maincontainer"> <?php echo _('Your account has been created. An activation key has been sent to the e-mail address you provided. Please check your e-mail for further information'); ?> <br /><br /> diff --git a/templates/show_user_activate.inc.php b/templates/show_user_activate.inc.php index d9e9c356..5b1a5fb9 100644 --- a/templates/show_user_activate.inc.php +++ b/templates/show_user_activate.inc.php @@ -37,9 +37,9 @@ $web_path = Config::get('web_path'); <?php echo _('Registration'); ?>... </div> -<script src="<?php echo $web_path; ?>/lib/javascript-base.js" language="javascript" type="text/javascript"></script> -<script src="<?php echo $web_path; ?>/modules/kajax/ajax.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script> <div id="maincontainer"> <?php diff --git a/templates/show_user_registration.inc.php b/templates/show_user_registration.inc.php index 5cf20676..d80e5019 100644 --- a/templates/show_user_registration.inc.php +++ b/templates/show_user_registration.inc.php @@ -36,9 +36,9 @@ $web_path = Config::get('web_path'); <h1><?php echo scrub_out(Config::get('site_title')); ?></h1> <?php echo _('Registration'); ?>... </div> -<script src="<?php echo $web_path; ?>/lib/javascript-base.js" language="javascript" type="text/javascript"></script> -<script src="<?php echo $web_path; ?>/modules/kajax/ajax.js" language="javascript" type="text/javascript"></script> <script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script> +<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script> <div id="maincontainer"> <?php |