mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
JavaScript cleanup. Consistently use camelCase for naming JS functions. Use
Prototype functionality where possible (particularly for Ajax). Move our JS into lib/javascript (I dropped kajax as an external module since the new ajax.js is completely different apart from function headers.) Remove unused JS functions from base.js.
This commit is contained in:
parent
7549180515
commit
6277492321
23 changed files with 250 additions and 373 deletions
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 = '';
|
||||
}
|
||||
}
|
||||
|
81
lib/javascript/ajax.js
Normal file
81
lib/javascript/ajax.js
Normal file
|
@ -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
|
104
lib/javascript/base.js
Normal file
104
lib/javascript/base.js
Normal file
|
@ -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 = '';
|
||||
}
|
||||
}
|
||||
|
|
@ -716,12 +716,22 @@ 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
|
||||
|
|
|
@ -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
|
||||
*/
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
@ -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')) {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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)) { ?>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 />
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue