From bc050f937f967c1f1a22e1974876106b38eb8c49 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 16 Oct 2020 13:53:24 -0400 Subject: [PATCH] 2020-10-16 Fred Gleason * Prepended 'RD_' to the names of all common Javascript functions in 'web/common/utils.js'. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ configure.ac | 1 + web/Makefile.am | 3 ++- web/common/Makefile.am | 33 +++++++++++++++++++++++++++++++++ web/{tests => common}/utils.js | 12 ++++++------ web/tests/Makefile.am | 5 +---- web/tests/editcart.js | 20 ++++++++++---------- web/tests/editcut.js | 20 ++++++++++---------- web/webget/webget.js | 12 ++++++------ 9 files changed, 72 insertions(+), 37 deletions(-) create mode 100644 web/common/Makefile.am rename web/{tests => common}/utils.js (93%) diff --git a/ChangeLog b/ChangeLog index 05f7c3c9..53f3c73a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20481,3 +20481,6 @@ filename for downloaded content. 2020-10-16 Fred Gleason * Removed 'rdcastmanager.cgi'. +2020-10-16 Fred Gleason + * Prepended 'RD_' to the names of all common Javascript functions + in 'web/common/utils.js'. diff --git a/configure.ac b/configure.ac index 52a17988..99f84c20 100644 --- a/configure.ac +++ b/configure.ac @@ -526,6 +526,7 @@ AC_CONFIG_FILES([rivendell.spec \ rdhpi/Makefile \ cae/Makefile \ web/Makefile \ + web/common/Makefile \ web/rdxport/Makefile \ web/tests/Makefile \ web/webget/Makefile \ diff --git a/web/Makefile.am b/web/Makefile.am index e51250b5..6cee3088 100644 --- a/web/Makefile.am +++ b/web/Makefile.am @@ -20,7 +20,8 @@ ## ## Use automake to process this into a Makefile.in -SUBDIRS = rdxport\ +SUBDIRS = common\ + rdxport\ tests\ webget diff --git a/web/common/Makefile.am b/web/common/Makefile.am new file mode 100644 index 00000000..1077c521 --- /dev/null +++ b/web/common/Makefile.am @@ -0,0 +1,33 @@ +## automake.am +## +## Automake.am for rivendell/web/common +## +## (C) Copyright 2020 Fred Gleason +## +## 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. +## +## Use automake to process this into a Makefile.in + +install-exec-am: + mkdir -p $(DESTDIR)@libexecdir@ + cp utils.js $(DESTDIR)@libexecdir@ + +uninstall-local: + rm -f $(DESTDIR)@libexecdir@/utils.js + +EXTRA_DIST = utils.js + +CLEANFILES = *~ +MAINTAINERCLEANFILES = *~\ + Makefile.in diff --git a/web/tests/utils.js b/web/common/utils.js similarity index 93% rename from web/tests/utils.js rename to web/common/utils.js index 00932b00..416cbe54 100644 --- a/web/tests/utils.js +++ b/web/common/utils.js @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -function PostForm(form,url) +function RD_PostForm(form,url) { var http=GetXMLHttpRequest(); if(http==null) { @@ -42,7 +42,7 @@ function PostForm(form,url) } -function MakeMimeSeparator() +function RD_MakeMimeSeparator() { sep='----------------------------'; for(var i=0;i<27;i++) { @@ -53,7 +53,7 @@ function MakeMimeSeparator() } -function AddMimePart(name,value,sep,is_last) +function RD_AddMimePart(name,value,sep,is_last) { var form='Content-Disposition: form-data; name="'+name+'"\r\n'; form+='\r\n'; @@ -68,7 +68,7 @@ function AddMimePart(name,value,sep,is_last) } -function UrlEncode(str) { +function RD_UrlEncode(str) { var ret=new String; for(i=0;i +// (C) Copyright 2015-2020 Fred Gleason // // 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"); } diff --git a/web/tests/editcut.js b/web/tests/editcut.js index bf03c480..45280ea9 100644 --- a/web/tests/editcut.js +++ b/web/tests/editcut.js @@ -2,7 +2,7 @@ // // Script for selecting cut label elements for the EditCut web method // -// (C) Copyright 2015 Fred Gleason +// (C) Copyright 2015-2020 Fred Gleason // // 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"); } diff --git a/web/webget/webget.js b/web/webget/webget.js index cf36a965..b71a2b05 100644 --- a/web/webget/webget.js +++ b/web/webget/webget.js @@ -24,13 +24,13 @@ function Id(id) function MakePost() { - var sep=MakeMimeSeparator(); + var sep=RD_MakeMimeSeparator(); form=sep+"\r\n"; - form+=AddMimePart('title',Id('title').value,sep,false); - form+=AddMimePart('preset',Id('preset').value,sep,false); - form+=AddMimePart('LOGIN_NAME',Id('LOGIN_NAME').value,sep,false); - form+=AddMimePart('PASSWORD',Id('PASSWORD').value,sep,true); + form+=RD_AddMimePart('title',Id('title').value,sep,false); + form+=RD_AddMimePart('preset',Id('preset').value,sep,false); + form+=RD_AddMimePart('LOGIN_NAME',Id('LOGIN_NAME').value,sep,false); + form+=RD_AddMimePart('PASSWORD',Id('PASSWORD').value,sep,true); return form; } @@ -44,7 +44,7 @@ function ProcessOkButton() function SendForm(form,url) { - var http=GetXMLHttpRequest(); + var http=RD_GetXMLHttpRequest(); if(http==null) { return; }