Rivendellaudio/web/tests/editcart.js
Fred Gleason 82ec0c73b5 2017-02-02 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'web/tests/editcut.js' that caused the EditCut
	test harness to fail when using non-localhost URLs.
	* Fixed a bug in 'web/tests/editcart.js' that caused the EditCut
	test harness to fail when using non-localhost URLs.
2017-02-02 12:07:49 -05:00

74 lines
2.3 KiB
JavaScript

// editcart.js
//
// Script for selecting cart label elements for the EditCart web method
//
// (C) Copyright 2015 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA.
//
function EditCart_Field(field)
{
if(document.getElementById("USE_"+field).checked) {
return '&'+field+'='+UrlEncode(document.getElementById(field).value);
}
return '';
}
function EditCart_MakePost()
{
var form='COMMAND=14';
form+='&LOGIN_NAME='+document.getElementById("LOGIN_NAME").value;
form+='&PASSWORD='+document.getElementById("PASSWORD").value;
form+='&CART_NUMBER='+document.getElementById("CART_NUMBER").value;
if(document.getElementById("INCLUDE_CUTS").value.length==0) {
form+="&INCLUDE_CUTS=0";
}
else {
form+="&INCLUDE_CUTS="+document.getElementById("INCLUDE_CUTS").value;
}
form+=EditCart_Field("ASYNCHRONOUS");
form+=EditCart_Field("ENFORCE_LENGTH");
form+=EditCart_Field("FORCED_LENGTH");
form+=EditCart_Field("GROUP_NAME");
form+=EditCart_Field("TITLE");
form+=EditCart_Field("ARTIST");
form+=EditCart_Field("YEAR");
form+=EditCart_Field("SONG_ID");
form+=EditCart_Field("ALBUM");
form+=EditCart_Field("LABEL");
form+=EditCart_Field("CLIENT");
form+=EditCart_Field("AGENCY");
form+=EditCart_Field("PUBLISHER");
form+=EditCart_Field("COMPOSER");
form+=EditCart_Field("CONDUCTOR");
form+=EditCart_Field("USER_DEFINED");
form+=EditCart_Field("OWNER");
form+=EditCart_Field("NOTES");
return form;
}
function EditCart_ShowPost()
{
alert('form: '+EditCart_MakePost());
}
function EditCart_Submit()
{
PostForm(EditCart_MakePost(),"rdxport.cgi");
}