2020-10-16 Fred Gleason <fredg@paravelsystems.com>

* Prepended 'RD_' to the names of all common Javascript functions
	in 'web/common/utils.js'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2020-10-16 13:53:24 -04:00
parent b67fefb3fc
commit bc050f937f
9 changed files with 72 additions and 37 deletions

View File

@@ -68,7 +68,6 @@ install-exec-am:
cp savestring.html $(DESTDIR)@libexecdir@
cp trimaudio.html $(DESTDIR)@libexecdir@
cp unassignschedcode.html $(DESTDIR)@libexecdir@
cp utils.js $(DESTDIR)@libexecdir@
uninstall-local:
rm -f $(DESTDIR)@libexecdir@/addcart.html
@@ -118,7 +117,6 @@ uninstall-local:
rm -f $(DESTDIR)@libexecdir@/savestring.html
rm -f $(DESTDIR)@libexecdir@/trimaudio.html
rm -f $(DESTDIR)@libexecdir@/unassignschedcode.html
rm -f $(DESTDIR)@libexecdir@/utils.js
EXTRA_DIST = addcart.html\
addcut.html\
@@ -166,8 +164,7 @@ EXTRA_DIST = addcart.html\
savepodcast.html\
savestring.html\
trimaudio.html\
unassignschedcode.html\
utils.js
unassignschedcode.html
CLEANFILES = *~
MAINTAINERCLEANFILES = *~\

View File

@@ -2,7 +2,7 @@
//
// Script for selecting cart label elements for the EditCart web method
//
// (C) Copyright 2015-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2015-2020 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
@@ -21,7 +21,7 @@
function EditCart_Field(field,sep)
{
if(document.getElementById("USE_"+field).checked) {
return AddMimePart(field,document.getElementById(field).value,sep,false);
return RD_AddMimePart(field,document.getElementById(field).value,sep,false);
}
return '';
}
@@ -29,7 +29,7 @@ function EditCart_Field(field,sep)
function EditCart_MakePost()
{
var sep=MakeMimeSeparator();
var sep=RD_MakeMimeSeparator();
form=sep+"\r\n";
form+=EditCart_Field('ASYNCHRONOUS',sep);
@@ -49,14 +49,14 @@ function EditCart_MakePost()
form+=EditCart_Field('USER_DEFINED',sep);
form+=EditCart_Field('OWNER',sep);
form+=EditCart_Field('NOTES',sep);
form+=AddMimePart('LOGIN_NAME',document.getElementById('LOGIN_NAME').value,sep,false);
form+=AddMimePart('PASSWORD',document.getElementById('PASSWORD').value,sep,false);
form+=AddMimePart('TICKET',document.getElementById('TICKET').value,sep,false);
form+=AddMimePart('CART_NUMBER',document.getElementById('CART_NUMBER').value,sep,false);
form+=RD_AddMimePart('LOGIN_NAME',document.getElementById('LOGIN_NAME').value,sep,false);
form+=RD_AddMimePart('PASSWORD',document.getElementById('PASSWORD').value,sep,false);
form+=RD_AddMimePart('TICKET',document.getElementById('TICKET').value,sep,false);
form+=RD_AddMimePart('CART_NUMBER',document.getElementById('CART_NUMBER').value,sep,false);
if(document.getElementById("INCLUDE_CUTS").value.length==0) {
form+=AddMimePart('INCLUDE_CUTS',document.getElementById('INCLUDE_CUTS').value,sep,false);
form+=RD_AddMimePart('INCLUDE_CUTS',document.getElementById('INCLUDE_CUTS').value,sep,false);
}
form+=AddMimePart('COMMAND','14',sep,true);
form+=RD_AddMimePart('COMMAND','14',sep,true);
return form;
}
@@ -70,5 +70,5 @@ function EditCart_ShowPost()
function EditCart_Submit()
{
PostForm(EditCart_MakePost(),"rdxport.cgi");
RD_PostForm(EditCart_MakePost(),"rdxport.cgi");
}

View File

@@ -2,7 +2,7 @@
//
// Script for selecting cut label elements for the EditCut web method
//
// (C) Copyright 2015 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2015-2020 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
@@ -21,7 +21,7 @@
function EditCut_Field(field,sep)
{
if(document.getElementById("USE_"+field).checked) {
return AddMimePart(field,document.getElementById(field).value,sep,false);
return RD_AddMimePart(field,document.getElementById(field).value,sep,false);
}
return '';
}
@@ -29,7 +29,7 @@ function EditCut_Field(field,sep)
function EditCut_MakePost()
{
var sep=MakeMimeSeparator();
var sep=RD_MakeMimeSeparator();
form=sep+"\r\n";
form+=EditCut_Field('EVERGREEN',sep);
@@ -59,12 +59,12 @@ function EditCut_MakePost()
form+=EditCut_Field('TALK_START_POINT',sep);
form+=EditCut_Field('TALK_END_POINT',sep);
form+=EditCut_Field('WEIGHT',sep);
form+=AddMimePart('LOGIN_NAME',document.getElementById('LOGIN_NAME').value,sep,false);
form+=AddMimePart('PASSWORD',document.getElementById('PASSWORD').value,sep,false);
form+=AddMimePart('TICKET',document.getElementById('TICKET').value,sep,false);
form+=AddMimePart('CART_NUMBER',document.getElementById('CART_NUMBER').value,sep,false);
form+=AddMimePart('CUT_NUMBER',document.getElementById('CUT_NUMBER').value,sep,false);
form+=AddMimePart('COMMAND','15',sep,true);
form+=RD_AddMimePart('LOGIN_NAME',document.getElementById('LOGIN_NAME').value,sep,false);
form+=RD_AddMimePart('PASSWORD',document.getElementById('PASSWORD').value,sep,false);
form+=RD_AddMimePart('TICKET',document.getElementById('TICKET').value,sep,false);
form+=RD_AddMimePart('CART_NUMBER',document.getElementById('CART_NUMBER').value,sep,false);
form+=RD_AddMimePart('CUT_NUMBER',document.getElementById('CUT_NUMBER').value,sep,false);
form+=RD_AddMimePart('COMMAND','15',sep,true);
return form;
}
@@ -78,5 +78,5 @@ function EditCut_ShowPost()
function EditCut_Submit()
{
PostForm(EditCut_MakePost(),"rdxport.cgi");
RD_PostForm(EditCut_MakePost(),"rdxport.cgi");
}

View File

@@ -1,161 +0,0 @@
// utils.js
//
// Common java script utility functions.
//
// (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 PostForm(form,url)
{
var http=GetXMLHttpRequest();
if(http==null) {
return;
}
//
// Send the form
//
http.open("POST",url,false);
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http.send(form);
//
// Process the response
//
var html=http.responseText;
document.open(http.getResponseHeader("Content-Type"));
document.write(html);
document.close();
}
function MakeMimeSeparator()
{
sep='----------------------------';
for(var i=0;i<27;i++) {
num=Math.floor(Math.random()*10);
sep+=num.toString();
}
return sep;
}
function AddMimePart(name,value,sep,is_last)
{
var form='Content-Disposition: form-data; name="'+name+'"\r\n';
form+='\r\n';
form+=value+'\r\n';
form+=sep;
if(is_last) {
form+='--';
}
form+='\r\n';
return form;
}
function UrlEncode(str) {
var ret=new String;
for(i=0;i<str.length;i++) {
switch(str.charAt(i)) {
case '$':
case '&':
case '+':
case ',':
case '/':
case ':':
case ';':
case '=':
case '?':
case '@':
case ' ':
case '"':
case '<':
case '>':
case '#':
case '%':
case '{':
case '}':
case '|':
case '\\':
case '^':
case '~':
case '[':
case ']':
case '`':
ret+=EncodeChar(str.charCodeAt(i));
break;
default:
if((str.charCodeAt(i)<0x20)||(str.charCodeAt(i)>=0x7F)) {
ret+=EncodeChar(str.charCodeAt(i));
}
else {
ret+=str.charAt(i);
}
break;
}
}
return ret;
}
function EncodeChar(c) {
var ret=new String;
ret="%";
if(c<16) {
ret+="0";
}
ret+=c.toString(16);
return ret;
}
var http_factory=null;
var http_factories=[
function() {
return new XMLHttpRequest();
},
function() {
return new ActiveXObject("Microsoft.XMLHTTP");
},
function() {
return new ActiveXObject("MSXML2.XMLHTTP.3.0");
},
function() {
return new ActiveXObject("MSXML2.XMLHTTP");
}
];
function GetXMLHttpRequest() {
for(var i=0;i<http_factories.length;i++) {
try {
var factory=http_factories[i];
var request=factory();
if(request!=null) {
http_factory=factory;
return request;
}
}
catch(e) {
continue;
}
}
return null;
}