mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-28 06:32:32 +02:00
2016-03-24 Fred Gleason <fredg@paravelsystems.com>
* Update web test methods in 'web/tests/'. * Added an 'RDSchedCode' class in 'lib/rdschedcode.cpp' and 'lib/rdschedcode.h'. * Implemented the 'ListSchedCodes' web method in 'web/rdxport/schedcodes.cpp'. * Implemented the 'AssignSchedCode' web method in 'web/rdxport/schedcodes.cpp'. * Implemented the 'UnassignSchedCode' web method in 'web/rdxport/schedcodes.cpp'. * Implemented the 'ListCartSchedCodes' web method in 'web/rdxport/schedcodes.cpp'. * Extended 'RDGetWebTime()' and 'RDGetWebDateTime()' functions to support XML 'xs' namespace formats. * Implemented '*_POINT' fields in the 'EditCut' web method in 'web/rdxport/carts.cpp'. * Modified the 'RDCart::removeSchedCode()' method so as to treat scheduler codes in a case-insensitve manner. * Modified the return of the 'EditCut' web method to provide a full <cutList> record in 'web/rdxport/carts.cpp'.
This commit is contained in:
parent
6fbb9a1206
commit
03cfa9d614
20
ChangeLog
20
ChangeLog
@ -14991,3 +14991,23 @@
|
||||
* Added 'web/tests/utils.js'.
|
||||
* Fixed a bug in 'web/rdxport/carts.cpp' that allowed the EditCart web
|
||||
method to set carts to non-existent groups.
|
||||
2016-03-24 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Update web test methods in 'web/tests/'.
|
||||
* Added an 'RDSchedCode' class in 'lib/rdschedcode.cpp' and
|
||||
'lib/rdschedcode.h'.
|
||||
* Implemented the 'ListSchedCodes' web method in
|
||||
'web/rdxport/schedcodes.cpp'.
|
||||
* Implemented the 'AssignSchedCode' web method in
|
||||
'web/rdxport/schedcodes.cpp'.
|
||||
* Implemented the 'UnassignSchedCode' web method in
|
||||
'web/rdxport/schedcodes.cpp'.
|
||||
* Implemented the 'ListCartSchedCodes' web method in
|
||||
'web/rdxport/schedcodes.cpp'.
|
||||
* Extended 'RDGetWebTime()' and 'RDGetWebDateTime()' functions to
|
||||
support XML 'xs' namespace formats.
|
||||
* Implemented '*_POINT' fields in the 'EditCut' web method in
|
||||
'web/rdxport/carts.cpp'.
|
||||
* Modified the 'RDCart::removeSchedCode()' method so as to treat
|
||||
scheduler codes in a case-insensitve manner.
|
||||
* Modified the return of the 'EditCut' web method to provide a full
|
||||
<cutList> record in 'web/rdxport/carts.cpp'.
|
||||
|
@ -197,6 +197,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdreport.cpp rdreport.h\
|
||||
rdringbuffer.cpp rdringbuffer.h\
|
||||
rdripc.cpp rdripc.h\
|
||||
rdschedcode.cpp rdschedcode.h\
|
||||
rdschedcodes_dialog.cpp rdschedcodes_dialog.h\
|
||||
rdsegmeter.cpp rdsegmeter.h\
|
||||
rdsettings.cpp rdsettings.h\
|
||||
|
@ -98,6 +98,7 @@ SOURCES += rdprofilesection.cpp
|
||||
SOURCES += rdpushbutton.cpp
|
||||
SOURCES += rdreport.cpp
|
||||
SOURCES += rdripc.cpp
|
||||
SOURCES += rdschedcode.cpp
|
||||
SOURCES += rdsegmeter.cpp
|
||||
SOURCES += rdslider.cpp
|
||||
SOURCES += rdsocket.cpp
|
||||
@ -231,6 +232,7 @@ HEADERS += rdprofilesection.h
|
||||
HEADERS += rdpushbutton.h
|
||||
HEADERS += rdreport.h
|
||||
HEADERS += rdripc.h
|
||||
HEADERS += rdschedcode.h
|
||||
HEADERS += rdsegmeter.h
|
||||
HEADERS += rdslider.h
|
||||
HEADERS += rdsocket.h
|
||||
|
@ -4,8 +4,6 @@
|
||||
//
|
||||
// (C) Copyright 2002-2004 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdcart.cpp,v 1.72.4.7.2.9 2014/06/02 22:52:25 cvs Exp $
|
||||
//
|
||||
// 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.
|
||||
@ -297,7 +295,7 @@ QStringList RDCart::schedCodesList() const
|
||||
}
|
||||
|
||||
|
||||
void RDCart::setSchedCodesList(const QStringList &codes)
|
||||
void RDCart::setSchedCodesList(const QStringList &codes) const
|
||||
{
|
||||
QString sched_codes="";
|
||||
|
||||
@ -309,7 +307,7 @@ void RDCart::setSchedCodesList(const QStringList &codes)
|
||||
}
|
||||
|
||||
|
||||
void RDCart::addSchedCode(const QString &code)
|
||||
void RDCart::addSchedCode(const QString &code) const
|
||||
{
|
||||
QStringList codes=schedCodesList();
|
||||
codes.push_back(code);
|
||||
@ -317,6 +315,20 @@ void RDCart::addSchedCode(const QString &code)
|
||||
}
|
||||
|
||||
|
||||
void RDCart::removeSchedCode(const QString &code) const
|
||||
{
|
||||
QStringList codes=schedCodesList();
|
||||
QStringList new_codes;
|
||||
|
||||
for(unsigned i=0;i<codes.size();i++) {
|
||||
if(codes[i].lower()!=code.lower()) {
|
||||
new_codes.push_back(codes[i]);
|
||||
}
|
||||
}
|
||||
setSchedCodesList(new_codes);
|
||||
}
|
||||
|
||||
|
||||
void RDCart::updateSchedCodes(const QString &add_codes,const QString &remove_codes) const
|
||||
{
|
||||
QString sched_codes;
|
||||
|
@ -66,8 +66,9 @@ class RDCart
|
||||
QString schedCodes() const;
|
||||
void setSchedCodes(const QString &sched_codes) const;
|
||||
QStringList schedCodesList() const;
|
||||
void setSchedCodesList(const QStringList &codes);
|
||||
void addSchedCode(const QString &code);
|
||||
void setSchedCodesList(const QStringList &codes) const;
|
||||
void addSchedCode(const QString &code) const;
|
||||
void removeSchedCode(const QString &code) const;
|
||||
void updateSchedCodes(const QString &add_codes,
|
||||
const QString &remove_codes) const;
|
||||
QString conductor() const;
|
||||
|
@ -1,12 +1,9 @@
|
||||
// rconf.c
|
||||
// A small library for handling common configuration file tasks
|
||||
// rdconf.cpp
|
||||
//
|
||||
// Small library for handling common configuration file tasks
|
||||
//
|
||||
// Adopted from conflib
|
||||
//
|
||||
// (C) Copyright 1996-2003 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdconf.cpp,v 1.15.4.7.2.1 2014/06/24 18:27:04 cvs Exp $
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Library General Public License
|
||||
// version 2 as published by the Free Software Foundation.
|
||||
|
@ -4,8 +4,6 @@
|
||||
//
|
||||
// (C) Copyright 1996-2004 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdconf.h,v 1.10.6.3 2013/12/03 23:34:34 cvs Exp $
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Library General Public License
|
||||
// version 2 as published by the Free Software Foundation.
|
||||
|
@ -4,8 +4,6 @@
|
||||
//
|
||||
// (C) Copyright 2009 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdformpost.cpp,v 1.3.2.1 2012/12/13 22:33:44 cvs Exp $
|
||||
//
|
||||
// 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.
|
||||
@ -154,19 +152,22 @@ QVariant RDFormPost::value(const QString &name,bool *ok)
|
||||
}
|
||||
|
||||
|
||||
bool RDFormPost::getValue(const QString &name,QHostAddress *addr)
|
||||
bool RDFormPost::getValue(const QString &name,QHostAddress *addr,bool *ok)
|
||||
{
|
||||
QString str;
|
||||
bool ok=getValue(name,&str);
|
||||
if(!ok) {
|
||||
bool lok=getValue(name,&str);
|
||||
if(!lok) {
|
||||
return false;
|
||||
}
|
||||
addr->setAddress(str);
|
||||
if(ok!=NULL) {
|
||||
*ok=addr->isNull();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDFormPost::getValue(const QString &name,QString *str)
|
||||
bool RDFormPost::getValue(const QString &name,QString *str,bool *ok)
|
||||
{
|
||||
if(post_values.count(name)>0) {
|
||||
*str=post_values[name].toString();
|
||||
@ -176,20 +177,20 @@ bool RDFormPost::getValue(const QString &name,QString *str)
|
||||
}
|
||||
|
||||
|
||||
bool RDFormPost::getValue(const QString &name,int *n)
|
||||
bool RDFormPost::getValue(const QString &name,int *n,bool *ok)
|
||||
{
|
||||
if(post_values.count(name)>0) {
|
||||
*n=post_values[name].toInt();
|
||||
*n=post_values[name].toInt(ok);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool RDFormPost::getValue(const QString &name,long *n)
|
||||
bool RDFormPost::getValue(const QString &name,long *n,bool *ok)
|
||||
{
|
||||
if(post_values.count(name)>0) {
|
||||
*n=post_values[name].toLongLong();
|
||||
*n=post_values[name].toLongLong(ok);
|
||||
return true;
|
||||
}
|
||||
*n=0;
|
||||
@ -197,20 +198,36 @@ bool RDFormPost::getValue(const QString &name,long *n)
|
||||
}
|
||||
|
||||
|
||||
bool RDFormPost::getValue(const QString &name,QDateTime *datetime)
|
||||
bool RDFormPost::getValue(const QString &name,QDateTime *datetime,bool *ok)
|
||||
{
|
||||
QString str;
|
||||
|
||||
if(ok!=NULL) {
|
||||
*ok=false;
|
||||
}
|
||||
if(!getValue(name,&str)) {
|
||||
return false;
|
||||
}
|
||||
*datetime=RDGetWebDateTime(str);
|
||||
if(str.length()==0) {
|
||||
*datetime=QDateTime();
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*datetime=RDGetWebDateTime(str,ok);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDFormPost::getValue(const QString &name,QTime *time)
|
||||
bool RDFormPost::getValue(const QString &name,QTime *time,bool *ok)
|
||||
{
|
||||
QString str;
|
||||
|
||||
if(ok!=NULL) {
|
||||
*ok=false;
|
||||
}
|
||||
if(!getValue(name,&str)) {
|
||||
return false;
|
||||
}
|
||||
@ -218,7 +235,7 @@ bool RDFormPost::getValue(const QString &name,QTime *time)
|
||||
*time=QTime();
|
||||
}
|
||||
else {
|
||||
*time=QTime().addMSecs(RDSetTimeLength(str));
|
||||
*time=RDGetWebTime(str,ok);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ class RDFormPost
|
||||
RDFormPost::Error error() const;
|
||||
QStringList names() const;
|
||||
QVariant value(const QString &name,bool *ok=NULL);
|
||||
bool getValue(const QString &name,QHostAddress *addr);
|
||||
bool getValue(const QString &name,QString *str);
|
||||
bool getValue(const QString &name,int *n);
|
||||
bool getValue(const QString &name,long *n);
|
||||
bool getValue(const QString &name,QDateTime *datetime);
|
||||
bool getValue(const QString &name,QTime *time);
|
||||
bool getValue(const QString &name,QHostAddress *addr,bool *ok=NULL);
|
||||
bool getValue(const QString &name,QString *str,bool *ok=NULL);
|
||||
bool getValue(const QString &name,int *n,bool *ok=NULL);
|
||||
bool getValue(const QString &name,long *n,bool *ok=NULL);
|
||||
bool getValue(const QString &name,QDateTime *datetime,bool *ok=NULL);
|
||||
bool getValue(const QString &name,QTime *time,bool *ok=NULL);
|
||||
bool isFile(const QString &name);
|
||||
QString tempDir() const;
|
||||
void dump();
|
||||
|
81
lib/rdschedcode.cpp
Normal file
81
lib/rdschedcode.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
// rdschedcode.cpp
|
||||
//
|
||||
// Abstract a Rivendell Scheduler Code
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
#include "rdconf.h"
|
||||
#include "rddb.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdschedcode.h"
|
||||
#include "rdweb.h"
|
||||
|
||||
RDSchedCode::RDSchedCode(const QString &code)
|
||||
{
|
||||
sched_code=code;
|
||||
}
|
||||
|
||||
|
||||
QString RDSchedCode::code() const
|
||||
{
|
||||
return sched_code;
|
||||
}
|
||||
|
||||
|
||||
bool RDSchedCode::exists() const
|
||||
{
|
||||
return RDDoesRowExist("SCHED_CODES","CODE",sched_code);
|
||||
}
|
||||
|
||||
|
||||
QString RDSchedCode::description() const
|
||||
{
|
||||
return RDGetSqlValue("SCHED_CODES","CODE",sched_code,"DESCRIPTION").
|
||||
toString();
|
||||
}
|
||||
|
||||
|
||||
void RDSchedCode::setDescription(const QString &desc) const
|
||||
{
|
||||
SetRow("DESCRIPTION",desc);
|
||||
}
|
||||
|
||||
|
||||
QString RDSchedCode::xml() const
|
||||
{
|
||||
QString xml;
|
||||
|
||||
xml+="<schedCode>\n";
|
||||
xml+=" "+RDXmlField("code",sched_code);
|
||||
xml+=" "+RDXmlField("description",description());
|
||||
xml+="</schedCode>\n";
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
void RDSchedCode::SetRow(const QString ¶m,const QString &value) const
|
||||
{
|
||||
RDSqlQuery *q;
|
||||
QString sql;
|
||||
|
||||
sql=QString("update SCHED_CODES set ")+
|
||||
param+"=\""+RDEscapeString(value)+"\" "+
|
||||
"where CODE=\""+RDEscapeString(sched_code)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
40
lib/rdschedcode.h
Normal file
40
lib/rdschedcode.h
Normal file
@ -0,0 +1,40 @@
|
||||
// rdschedcode.h
|
||||
//
|
||||
// Abstract a Rivendell Scheduler Code
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
#ifndef RDSCHEDCODE_H
|
||||
#define RDSCHEDCODE_H
|
||||
|
||||
class RDSchedCode
|
||||
{
|
||||
public:
|
||||
RDSchedCode(const QString &code);
|
||||
QString code() const;
|
||||
bool exists() const;
|
||||
QString description() const;
|
||||
void setDescription(const QString &desc) const;
|
||||
QString xml() const;
|
||||
|
||||
private:
|
||||
void SetRow(const QString ¶m,const QString &value) const;
|
||||
QString sched_code;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDSCHEDCODE_H
|
241
lib/rdweb.cpp
241
lib/rdweb.cpp
@ -934,7 +934,7 @@ QString RDXmlField(const QString &tag,const QDateTime &value,
|
||||
str=" "+attrs;
|
||||
}
|
||||
if(value.isValid()) {
|
||||
return QString("<")+tag+str+">"+RDWebDateTime(value)+"</"+tag+">\n";
|
||||
return QString("<")+tag+str+">"+RDXmlDateTime(value)+"</"+tag+">\n";
|
||||
}
|
||||
return RDXmlField(tag);
|
||||
}
|
||||
@ -948,7 +948,7 @@ QString RDXmlField(const QString &tag,const QTime &value,const QString &attrs)
|
||||
str=" "+attrs;
|
||||
}
|
||||
if(value.isValid()&&(!value.isNull())) {
|
||||
return QString("<")+tag+str+">"+value.toString("hh:mm:ss")+"</"+tag+">\n";
|
||||
return QString("<")+tag+str+">"+RDXmlTime(value)+"</"+tag+">\n";
|
||||
}
|
||||
return RDXmlField(tag);
|
||||
}
|
||||
@ -960,6 +960,47 @@ QString RDXmlField(const QString &tag)
|
||||
}
|
||||
|
||||
|
||||
QString RDXmlDate(const QDate &date)
|
||||
{
|
||||
return date.toString("yyyy-MM-dd")+RDXmlTimeZoneSuffix();
|
||||
}
|
||||
|
||||
|
||||
QString RDXmlTime(const QTime &time)
|
||||
{
|
||||
return time.toString("hh:mm:ss")+RDXmlTimeZoneSuffix();
|
||||
}
|
||||
|
||||
|
||||
QString RDXmlDateTime(const QDateTime &datetime)
|
||||
{
|
||||
return datetime.toString("yyyy-MM-dd")+"T"+datetime.toString("hh:mm:ss")+
|
||||
RDXmlTimeZoneSuffix();
|
||||
}
|
||||
|
||||
|
||||
QString RDXmlTimeZoneSuffix()
|
||||
{
|
||||
QString ret;
|
||||
int tz=RDTimeZoneOffset();
|
||||
|
||||
if(tz==0) {
|
||||
ret+="Z";
|
||||
}
|
||||
else {
|
||||
if(tz<0) {
|
||||
ret+="+";
|
||||
}
|
||||
if(tz>0) {
|
||||
ret+="-";
|
||||
}
|
||||
ret+=QTime(0,0,0).addSecs(tz).toString("hh:mm");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString RDXmlEscape(const QString &str)
|
||||
{
|
||||
/*
|
||||
@ -1049,58 +1090,205 @@ QString RDWebDateTime(const QDateTime &datetime)
|
||||
}
|
||||
|
||||
|
||||
QDateTime RDGetWebDateTime(const QString &str)
|
||||
QDateTime RDGetWebDateTime(const QString &str,bool *ok)
|
||||
{
|
||||
QDateTime ret;
|
||||
QStringList list;
|
||||
QStringList dlist;
|
||||
QStringList f0;
|
||||
QStringList f1;
|
||||
QStringList f2;
|
||||
int day;
|
||||
int month;
|
||||
int year;
|
||||
QTime time;
|
||||
bool lok=false;
|
||||
|
||||
if(ok!=NULL) {
|
||||
*ok=false;
|
||||
}
|
||||
|
||||
f0=f0.split(" ",str.stripWhiteSpace());
|
||||
switch(f0.size()) {
|
||||
case 1: // XML xs:dateTime Style
|
||||
f1=f1.split("T",f0[0]);
|
||||
if(f1.size()<=2) {
|
||||
f2=QStringList::split("-",f1[0]);
|
||||
if(f2.size()==3) {
|
||||
year=f2[0].toInt(&lok);
|
||||
if(lok&&(year>0)) {
|
||||
month=f2[1].toInt(&lok);
|
||||
if(lok&&(month>=1)&&(month<=12)) {
|
||||
day=f2[2].toInt(&lok);
|
||||
if(lok&&(day>=1)&&(day<=31)) {
|
||||
if(f1.size()==2) {
|
||||
time=RDGetWebTime(f1[1],&lok);
|
||||
if(lok) {
|
||||
ret=QDateTime(QDate(year,month,day),time);
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
list=list.split(" ",str);
|
||||
switch(list.size()) {
|
||||
case 4: // RFC 850 Style
|
||||
dlist=dlist.split("-",list[1]);
|
||||
if(dlist.size()==3) {
|
||||
ret=QDateTime(QDate(dlist[2].toInt()+2000,RDGetWebMonth(dlist[1]),
|
||||
dlist[0].toInt()),
|
||||
RDGetWebTime(list[2]+" "+list[3]));
|
||||
f1=f1.split("-",f0[1]);
|
||||
if(f1.size()==3) {
|
||||
month=RDGetWebMonth(f1[1],&lok);
|
||||
if(ok) {
|
||||
time=RDGetWebTime(f0[2]+" "+f0[3],&lok);
|
||||
if(lok) {
|
||||
year=f1[2].toInt(&lok);
|
||||
if(lok&&(year>0)) {
|
||||
day=f1[0].toInt(&lok);
|
||||
if(lok&&(day>0)&&(day<=31)) {
|
||||
ret=QDateTime(QDate(year+2000,month,day),time);
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // ANSI C asctime() Style
|
||||
ret=QDateTime(QDate(list[4].toInt(),RDGetWebMonth(list[1]),list[2].toInt()),
|
||||
RDGetWebTime(list[3]+" GMT"));
|
||||
month=RDGetWebMonth(f0[1],&lok);
|
||||
if(lok) {
|
||||
time=RDGetWebTime(f0[3]+" GMT",&lok);
|
||||
if(lok) {
|
||||
year=f0[4].toInt(&lok);
|
||||
if(lok&&(year>0)) {
|
||||
day=f0[2].toInt(&lok);
|
||||
if(lok&&(day>0)&&(day<=31)) {
|
||||
ret=QDateTime(QDate(year,month,day),time);
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: // RFC 822/1123 Style
|
||||
ret=QDateTime(QDate(list[3].toInt(),RDGetWebMonth(list[2]),list[1].toInt()),
|
||||
RDGetWebTime(list[4]+" "+list[5]));
|
||||
month=RDGetWebMonth(f0[2],&lok);
|
||||
if(lok) {
|
||||
time=RDGetWebTime(f0[4]+" "+f0[5],&lok);
|
||||
if(lok) {
|
||||
year=f0[3].toInt(&lok);
|
||||
if(lok&&(year>0)) {
|
||||
day=f0[1].toInt(&lok);
|
||||
if(lok&&(day>0)&&(day<=31)) {
|
||||
ret=QDateTime(QDate(year,month,day),time);
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QTime RDGetWebTime(const QString &str)
|
||||
QTime RDGetWebTime(const QString &str,bool *ok)
|
||||
{
|
||||
QTime ret;
|
||||
QStringList list;
|
||||
QStringList f0;
|
||||
QStringList f1;
|
||||
QStringList f2;
|
||||
bool lok=false;
|
||||
int tz=0;
|
||||
QTime time;
|
||||
QTime tztime;
|
||||
|
||||
list=list.split(" ",str);
|
||||
if(list.size()==2) {
|
||||
if(list[1].lower()=="gmt") {
|
||||
list=list.split(":",list[0]);
|
||||
if(list.size()==3) {
|
||||
ret=
|
||||
RDUtcToLocal(QTime(list[0].toInt(),list[1].toInt(),list[2].toInt()));
|
||||
if(ok!=NULL) {
|
||||
*ok=false;
|
||||
}
|
||||
f0=f0.split(" ",str.stripWhiteSpace());
|
||||
switch(f0.size()) {
|
||||
case 1: // XML xs:time Style
|
||||
if(f0[0].right(1).lower()=="z") { // GMT
|
||||
tz=RDTimeZoneOffset();
|
||||
f0[0]=f0[0].left(f0[0].length()-1);
|
||||
f2=f2.split(":",f0[0]);
|
||||
}
|
||||
else {
|
||||
f1=QStringList::split("+",f0[0]);
|
||||
if(f1.size()==2) { // GMT+
|
||||
f2=QStringList::split(":",f1[1]);
|
||||
if(f2.size()==2) {
|
||||
tztime=QTime(f2[0].toInt(),f2[1].toInt(),0);
|
||||
if(tztime.isValid()) {
|
||||
tz=RDTimeZoneOffset()+QTime(0,0,0).secsTo(tztime);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
f1=QStringList::split("-",f0[0]);
|
||||
if(f1.size()==2) { // GMT-
|
||||
f2=QStringList::split(":",f1[1]);
|
||||
if(f2.size()==2) {
|
||||
tztime=QTime(f2[0].toInt(),f2[1].toInt(),0);
|
||||
if(tztime.isValid()) {
|
||||
tz=RDTimeZoneOffset()-QTime(0,0,0).secsTo(tztime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
f2=f2.split(":",f1[0]);
|
||||
}
|
||||
if(f2.size()==3) {
|
||||
time=QTime(f2[0].toInt(),f2[1].toInt(),f2[2].toInt());
|
||||
if(time.isValid()) {
|
||||
ret=time.addSecs(tz);
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // RFC Style
|
||||
if(f0[1].lower()=="gmt") {
|
||||
f0=f0.split(":",f0[0]);
|
||||
if(f0.size()==3) {
|
||||
int hour=f0[0].toInt(&lok);
|
||||
if(lok) {
|
||||
int min=f0[1].toInt(&lok);
|
||||
if(lok) {
|
||||
int sec=f0[2].toInt(&lok);
|
||||
if(lok) {
|
||||
if((hour>=0)&&(hour<=23)&&(min>=0)&&(min<=59)&&(sec>=0)&&
|
||||
(sec<=60)) {
|
||||
ret=RDUtcToLocal(QTime(f0[0].toInt(),f0[1].toInt(),
|
||||
f0[2].toInt()));
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int RDGetWebMonth(const QString &str)
|
||||
int RDGetWebMonth(const QString &str,bool *ok)
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
@ -1140,6 +1328,9 @@ int RDGetWebMonth(const QString &str)
|
||||
if(str.lower()=="dec") {
|
||||
ret=12;
|
||||
}
|
||||
if(ok!=NULL) {
|
||||
*ok=ret!=0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
10
lib/rdweb.h
10
lib/rdweb.h
@ -84,13 +84,17 @@ extern QString RDXmlField(const QString &tag,const QDateTime &value,
|
||||
extern QString RDXmlField(const QString &tag,const QTime &value,
|
||||
const QString &attrs="");
|
||||
extern QString RDXmlField(const QString &tag);
|
||||
extern QString RDXmlDate(const QDate &date);
|
||||
extern QString RDXmlTime(const QTime &time);
|
||||
extern QString RDXmlDateTime(const QDateTime &datetime);
|
||||
extern QString RDXmlTimeZoneSuffix();
|
||||
extern QString RDXmlEscape(const QString &str);
|
||||
extern QString RDXmlUnescape(const QString &str);
|
||||
extern QString RDUrlEscape(const QString &str);
|
||||
extern QString RDUrlUnescape(const QString &str);
|
||||
extern QString RDWebDateTime(const QDateTime &datetime);
|
||||
extern QDateTime RDGetWebDateTime(const QString &str);
|
||||
extern QTime RDGetWebTime(const QString &str);
|
||||
extern int RDGetWebMonth(const QString &str);
|
||||
extern QDateTime RDGetWebDateTime(const QString &str,bool *ok=NULL);
|
||||
extern QTime RDGetWebTime(const QString &str,bool *ok=NULL);
|
||||
extern int RDGetWebMonth(const QString &str,bool *ok=NULL);
|
||||
|
||||
#endif // RDWEB_H
|
||||
|
@ -44,6 +44,10 @@
|
||||
#define RDXPORT_COMMAND_LISTSERVICES 21
|
||||
#define RDXPORT_COMMAND_LISTLOG 22
|
||||
#define RDXPORT_COMMAND_AUDIOSTORE 23
|
||||
#define RDXPORT_COMMAND_LISTSCHEDCODES 24
|
||||
#define RDXPORT_COMMAND_ASSIGNSCHEDCODE 25
|
||||
#define RDXPORT_COMMAND_UNASSIGNSCHEDCODE 26
|
||||
#define RDXPORT_COMMAND_LISTCARTSCHEDCODES 27
|
||||
|
||||
|
||||
#endif // RDXPORT_INTERFACE_H
|
||||
|
@ -41,6 +41,7 @@ dist_rdxport_cgi_SOURCES = audioinfo.cpp\
|
||||
import.cpp\
|
||||
logs.cpp\
|
||||
rdxport.cpp rdxport.h\
|
||||
schedcodes.cpp\
|
||||
services.cpp\
|
||||
trimaudio.cpp
|
||||
|
||||
|
@ -2,9 +2,7 @@
|
||||
//
|
||||
// Rivendell web service portal -- Cart services
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: carts.cpp,v 1.8.2.2.2.1 2014/03/19 22:13:01 cvs Exp $
|
||||
// (C) Copyright 2010-2016 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
|
||||
@ -591,6 +589,29 @@ void Xport::EditCut()
|
||||
QTime time;
|
||||
bool rotation_changed=false;
|
||||
bool length_changed=false;
|
||||
QDateTime start_datetime;
|
||||
bool use_start_datetime=false;
|
||||
QDateTime end_datetime;
|
||||
bool use_end_datetime=false;
|
||||
QTime start_daypart;
|
||||
bool use_start_daypart=false;
|
||||
QTime end_daypart;
|
||||
bool use_end_daypart=false;
|
||||
int talk_points[2];
|
||||
bool use_end_points[2]={false,false};
|
||||
int end_points[2];
|
||||
bool use_talk_points[2]={false,false};
|
||||
int segue_points[2];
|
||||
bool use_segue_points[2]={false,false};
|
||||
int hook_points[2];
|
||||
bool use_hook_points[2]={false,false};
|
||||
int fadeup_point;
|
||||
bool use_fadeup_point=false;
|
||||
int fadedown_point;
|
||||
bool use_fadedown_point=false;
|
||||
bool use_weight=false;
|
||||
int weight;
|
||||
bool ok=false;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
@ -613,13 +634,95 @@ void Xport::EditCut()
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
// Check Date/Time Values for Validity
|
||||
//
|
||||
if((use_start_datetime=xport_post->
|
||||
getValue("START_DATETIME",&start_datetime,&ok))) {
|
||||
if(!ok) {
|
||||
XmlExit("invalid START_DATETIME",400);
|
||||
}
|
||||
}
|
||||
if((use_end_datetime=xport_post->
|
||||
getValue("END_DATETIME",&end_datetime,&ok))) {
|
||||
if(!ok) {
|
||||
XmlExit("invalid END_DATETIME",400);
|
||||
}
|
||||
}
|
||||
if(use_start_datetime!=use_end_datetime) {
|
||||
XmlExit("both DATETIME values must be set together",400);
|
||||
}
|
||||
if(use_start_datetime&&(start_datetime>end_datetime)) {
|
||||
XmlExit("START_DATETIME is later than END_DATETIME",400);
|
||||
}
|
||||
|
||||
if((use_start_daypart=xport_post->
|
||||
getValue("START_DAYPART",&start_daypart,&ok))) {
|
||||
if(!ok) {
|
||||
XmlExit("invalid START_DAYPART",400);
|
||||
}
|
||||
}
|
||||
if((use_end_daypart=xport_post->
|
||||
getValue("END_DAYPART",&end_daypart,&ok))) {
|
||||
if(!ok) {
|
||||
XmlExit("invalid END_DAYPART",400);
|
||||
}
|
||||
}
|
||||
if(use_start_daypart!=use_end_daypart) {
|
||||
XmlExit("both DAYPART values must be set together",400);
|
||||
}
|
||||
|
||||
cut=new RDCut(cart_number,cut_number);
|
||||
if(!cut->exists()) {
|
||||
delete cut;
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Check pointers for validity
|
||||
//
|
||||
end_points[0]=cut->startPoint();
|
||||
end_points[1]=cut->endPoint();
|
||||
fadeup_point=cut->fadeupPoint();
|
||||
fadedown_point=cut->fadedownPoint();
|
||||
CheckPointerValidity(end_points,use_end_points,"",0);
|
||||
CheckPointerValidity(talk_points,use_talk_points,"TALK_",end_points[1]);
|
||||
CheckPointerValidity(segue_points,use_segue_points,"SEGUE_",end_points[1]);
|
||||
CheckPointerValidity(hook_points,use_hook_points,"HOOK_",end_points[1]);
|
||||
if((use_fadeup_point=xport_post->
|
||||
getValue("FADEUP_POINT",&fadeup_point,&ok))) {
|
||||
if(!ok) {
|
||||
XmlExit("invalid FADEUP_POINT",400);
|
||||
}
|
||||
if(fadeup_point>end_points[1]) {
|
||||
XmlExit("FADEUP_POINT exceeds length of cart",400);
|
||||
}
|
||||
}
|
||||
if((use_fadedown_point=xport_post->
|
||||
getValue("FADEDOWN_POINT",&fadedown_point,&ok))) {
|
||||
if(!ok) {
|
||||
XmlExit("invalid FADEDOWN_POINT",400);
|
||||
}
|
||||
if(fadeup_point>end_points[1]) {
|
||||
XmlExit("FADEDOWN_POINT exceeds length of cart",400);
|
||||
}
|
||||
}
|
||||
if(use_fadeup_point&&use_fadedown_point&&
|
||||
(fadeup_point>=0)&&(fadedown_point>=0)&&(fadeup_point>fadedown_point)) {
|
||||
XmlExit("FADEUP_POINT is greater than FADEDOWN_POINT",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Check Weight
|
||||
//
|
||||
if((use_weight=xport_post->getValue("WEIGHT",&weight,&ok))) {
|
||||
if((!ok)||(weight<0)) {
|
||||
XmlExit("invalid WEIGHT",400);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
if(xport_post->getValue("EVERGREEN",&num)) {
|
||||
cut->setEvergreen(num);
|
||||
rotation_changed=true;
|
||||
@ -636,13 +739,13 @@ void Xport::EditCut()
|
||||
if(xport_post->getValue("ISCI",&str)) {
|
||||
cut->setIsci(str);
|
||||
}
|
||||
if(xport_post->getValue("START_DATETIME",&datetime)) {
|
||||
cut->setStartDatetime(datetime,!datetime.isNull());
|
||||
if(use_start_datetime) {
|
||||
cut->setStartDatetime(start_datetime,!start_datetime.isNull());
|
||||
length_changed=true;
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("END_DATETIME",&datetime)) {
|
||||
cut->setEndDatetime(datetime,!datetime.isNull());
|
||||
if(use_end_datetime) {
|
||||
cut->setEndDatetime(end_datetime,!end_datetime.isNull());
|
||||
length_changed=true;
|
||||
rotation_changed=true;
|
||||
}
|
||||
@ -674,56 +777,56 @@ void Xport::EditCut()
|
||||
cut->setWeekPart(7,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("START_DAYPART",&time)) {
|
||||
cut->setStartDaypart(time,!time.isNull());
|
||||
if(use_start_daypart) {
|
||||
cut->setStartDaypart(start_daypart,!start_daypart.isNull());
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("END_DAYPART",&time)) {
|
||||
cut->setEndDaypart(time,!time.isNull());
|
||||
if(use_end_daypart) {
|
||||
cut->setEndDaypart(end_daypart,!end_daypart.isNull());
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("WEIGHT",&num)) {
|
||||
cut->setWeight(num);
|
||||
if(use_weight) {
|
||||
cut->setWeight(weight);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("START_POINT",&num)) {
|
||||
cut->setStartPoint(num);
|
||||
if(use_end_points[0]) {
|
||||
cut->setStartPoint(end_points[0]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("END_POINT",&num)) {
|
||||
cut->setEndPoint(num);
|
||||
if(use_end_points[1]) {
|
||||
cut->setEndPoint(end_points[1]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("FADEUP_POINT",&num)) {
|
||||
cut->setFadeupPoint(num);
|
||||
if(use_fadeup_point) {
|
||||
cut->setFadeupPoint(fadeup_point);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("FADEDOWN_POINT",&num)) {
|
||||
cut->setFadedownPoint(num);
|
||||
if(use_fadedown_point) {
|
||||
cut->setFadedownPoint(fadedown_point);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("SEGUE_START_POINT",&num)) {
|
||||
cut->setSegueStartPoint(num);
|
||||
if(use_segue_points[0]) {
|
||||
cut->setSegueStartPoint(segue_points[0]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("SEGUE_END_POINT",&num)) {
|
||||
cut->setSegueEndPoint(num);
|
||||
if(use_segue_points[1]) {
|
||||
cut->setSegueEndPoint(segue_points[1]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("HOOK_START_POINT",&num)) {
|
||||
cut->setHookStartPoint(num);
|
||||
if(use_hook_points[0]) {
|
||||
cut->setHookStartPoint(hook_points[0]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("HOOK_END_POINT",&num)) {
|
||||
cut->setHookEndPoint(num);
|
||||
if(use_hook_points[1]) {
|
||||
cut->setHookEndPoint(hook_points[1]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("TALK_START_POINT",&num)) {
|
||||
cut->setTalkStartPoint(num);
|
||||
if(use_talk_points[0]) {
|
||||
cut->setTalkStartPoint(talk_points[0]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("TALK_END_POINT",&num)) {
|
||||
cut->setTalkEndPoint(num);
|
||||
if(use_talk_points[1]) {
|
||||
cut->setTalkEndPoint(talk_points[1]);
|
||||
length_changed=true;
|
||||
}
|
||||
if(length_changed||rotation_changed) {
|
||||
@ -736,8 +839,61 @@ void Xport::EditCut()
|
||||
}
|
||||
delete cart;
|
||||
}
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cutList>\n");
|
||||
printf("%s",(const char *)cut->xml());
|
||||
printf("</cutList>\n");
|
||||
delete cut;
|
||||
XmlExit("OK",200);
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::CheckPointerValidity(int ptr_values[2],bool use_ptrs[2],
|
||||
const QString &type,unsigned max_value)
|
||||
{
|
||||
bool start_ok=false;
|
||||
bool end_ok=false;
|
||||
|
||||
use_ptrs[0]=xport_post->getValue(type+"START_POINT",&ptr_values[0],&start_ok);
|
||||
use_ptrs[1]=xport_post->getValue(type+"END_POINT",&ptr_values[1],&end_ok);
|
||||
if((!use_ptrs[0])&&(!use_ptrs[1])) {
|
||||
return;
|
||||
}
|
||||
if(!start_ok) {
|
||||
XmlExit("invalid "+type+"START_POINT",400);
|
||||
}
|
||||
if(!end_ok) {
|
||||
XmlExit("invalid "+type+"END_POINT",400);
|
||||
}
|
||||
if(use_ptrs[0]!=use_ptrs[1]) {
|
||||
XmlExit("both "+type+"*_POINT values must be set together",400);
|
||||
}
|
||||
if(use_ptrs[0]) {
|
||||
if(((ptr_values[0]<0)&&(ptr_values[1]>=0))||
|
||||
((ptr_values[0]>=0)&&(ptr_values[1]<0))) {
|
||||
XmlExit("inconsistent "+type+"*_POINT values",400);
|
||||
}
|
||||
}
|
||||
if(ptr_values[0]>=0) {
|
||||
if(ptr_values[0]>ptr_values[1]) {
|
||||
XmlExit(type+"START_POINT greater than "+type+"END_POINT",400);
|
||||
}
|
||||
if((max_value>0)&&((unsigned)ptr_values[1]>max_value)) {
|
||||
XmlExit(type+"END_POINT exceeds length of cut",400);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(max_value==0) {
|
||||
XmlExit("End markers cannot be removed",400);
|
||||
}
|
||||
else {
|
||||
ptr_values[0]=-1;
|
||||
ptr_values[1]=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,6 +231,22 @@ Xport::Xport(QObject *parent,const char *name)
|
||||
ListLog();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTSCHEDCODES:
|
||||
ListSchedCodes();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_ASSIGNSCHEDCODE:
|
||||
AssignSchedCode();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_UNASSIGNSCHEDCODE:
|
||||
UnassignSchedCode();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTCARTSCHEDCODES:
|
||||
ListCartSchedCodes();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTSERVICES:
|
||||
ListServices();
|
||||
break;
|
||||
|
@ -24,7 +24,9 @@
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include <rdaudioconvert.h>
|
||||
#include <rdconfig.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rduser.h>
|
||||
#include <rdsystem.h>
|
||||
|
||||
@ -47,6 +49,8 @@ class Xport : public QObject
|
||||
void ListCuts();
|
||||
void ListCut();
|
||||
void EditCut();
|
||||
void CheckPointerValidity(int ptr_values[2],bool use_ptrs[2],
|
||||
const QString &type,unsigned max_value);
|
||||
void RemoveCut();
|
||||
void ListGroups();
|
||||
void ListGroup();
|
||||
@ -57,6 +61,10 @@ class Xport : public QObject
|
||||
void AudioStore();
|
||||
void ListLogs();
|
||||
void ListLog();
|
||||
void ListSchedCodes();
|
||||
void AssignSchedCode();
|
||||
void UnassignSchedCode();
|
||||
void ListCartSchedCodes();
|
||||
void ListServices();
|
||||
void Exit(int code);
|
||||
void XmlExit(const QString &str,int code,
|
||||
|
185
web/rdxport/schedcodes.cpp
Normal file
185
web/rdxport/schedcodes.cpp
Normal file
@ -0,0 +1,185 @@
|
||||
// schedcodes.h
|
||||
//
|
||||
// Rivendell web service portal
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include "rdcart.h"
|
||||
#include "rddb.h"
|
||||
#include "rdschedcode.h"
|
||||
#include "rdxport.h"
|
||||
|
||||
void Xport::ListSchedCodes()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDSchedCode *schedcode;
|
||||
|
||||
//
|
||||
// Generate Scheduler Code List
|
||||
//
|
||||
sql=QString("select CODE from SCHED_CODES order by CODE");
|
||||
q=new RDSqlQuery(sql);
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<schedCodeList>\n");
|
||||
while(q->next()) {
|
||||
schedcode=new RDSchedCode(q->value(0).toString());
|
||||
printf("%s",(const char *)schedcode->xml().utf8());
|
||||
delete schedcode;
|
||||
}
|
||||
printf("</schedCodeList>\n");
|
||||
|
||||
delete q;
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::AssignSchedCode()
|
||||
{
|
||||
int cart_number;
|
||||
QString sched_code;
|
||||
QStringList codes;
|
||||
RDCart *cart=NULL;
|
||||
RDSchedCode *code;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
if(!xport_post->getValue("CODE",&sched_code)) {
|
||||
XmlExit("Missing CODE",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
code=new RDSchedCode(sched_code);
|
||||
if(!code->exists()) {
|
||||
XmlExit("No such scheduler code",404);
|
||||
}
|
||||
codes=cart->schedCodesList();
|
||||
for(unsigned i=0;i<codes.size();i++) {
|
||||
if(codes[i]==sched_code) {
|
||||
delete cart;
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
}
|
||||
cart->addSchedCode(sched_code);
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
|
||||
|
||||
void Xport::UnassignSchedCode()
|
||||
{
|
||||
int cart_number;
|
||||
QString sched_code;
|
||||
QStringList codes;
|
||||
RDCart *cart=NULL;
|
||||
RDSchedCode *code;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
if(!xport_post->getValue("CODE",&sched_code)) {
|
||||
XmlExit("Missing CODE",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
code=new RDSchedCode(sched_code);
|
||||
if(!code->exists()) {
|
||||
XmlExit("No such scheduler code",404);
|
||||
}
|
||||
cart->removeSchedCode(sched_code);
|
||||
delete cart;
|
||||
delete code;
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListCartSchedCodes()
|
||||
{
|
||||
int cart_number;
|
||||
RDCart *cart;
|
||||
QStringList codes;
|
||||
RDSchedCode *schedcode;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
//
|
||||
// Generate Scheduler Code List
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
codes=cart->schedCodesList();
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<schedCodeList>\n");
|
||||
for(unsigned i=0;i<codes.size();i++) {
|
||||
schedcode=new RDSchedCode(codes[i]);
|
||||
printf("%s",(const char *)schedcode->xml().utf8());
|
||||
delete schedcode;
|
||||
}
|
||||
printf("</schedCodeList>\n");
|
||||
|
||||
Exit(0);
|
||||
}
|
@ -2,9 +2,7 @@
|
||||
##
|
||||
## Automake.am for rivendell/web/tests
|
||||
##
|
||||
## (C) Copyright 2010,2013 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.6.6.4 2013/10/14 04:23:55 cvs Exp $
|
||||
## (C) Copyright 2010,2013-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
|
||||
@ -25,76 +23,97 @@ install-exec-am:
|
||||
mkdir -p $(DESTDIR)@libexecdir@
|
||||
cp addcart.html $(DESTDIR)@libexecdir@
|
||||
cp addcut.html $(DESTDIR)@libexecdir@
|
||||
cp assignschedcode.html $(DESTDIR)@libexecdir@
|
||||
cp audioinfo.html $(DESTDIR)@libexecdir@
|
||||
cp audiostore.html $(DESTDIR)@libexecdir@
|
||||
cp copyaudio.html $(DESTDIR)@libexecdir@
|
||||
cp delete_audio.html $(DESTDIR)@libexecdir@
|
||||
cp editcart.html $(DESTDIR)@libexecdir@
|
||||
cp editcut.js $(DESTDIR)@libexecdir@
|
||||
cp editcut.html $(DESTDIR)@libexecdir@
|
||||
cp editcart.js $(DESTDIR)@libexecdir@
|
||||
cp export.html $(DESTDIR)@libexecdir@
|
||||
cp exportpeaks.html $(DESTDIR)@libexecdir@
|
||||
cp import.html $(DESTDIR)@libexecdir@
|
||||
cp import.html $(DESTDIR)@libexecdir@
|
||||
cp listcart.html $(DESTDIR)@libexecdir@
|
||||
cp listcarts.html $(DESTDIR)@libexecdir@
|
||||
cp listcartschedcodes.html $(DESTDIR)@libexecdir@
|
||||
cp listcut.html $(DESTDIR)@libexecdir@
|
||||
cp listcuts.html $(DESTDIR)@libexecdir@
|
||||
cp listgroup.html $(DESTDIR)@libexecdir@
|
||||
cp listgroups.html $(DESTDIR)@libexecdir@
|
||||
cp listlog.html $(DESTDIR)@libexecdir@
|
||||
cp listlogs.html $(DESTDIR)@libexecdir@
|
||||
cp listschedcodes.html $(DESTDIR)@libexecdir@
|
||||
cp listservices.html $(DESTDIR)@libexecdir@
|
||||
cp removecart.html $(DESTDIR)@libexecdir@
|
||||
cp removecut.html $(DESTDIR)@libexecdir@
|
||||
cp trimaudio.html $(DESTDIR)@libexecdir@
|
||||
cp unassignschedcode.html $(DESTDIR)@libexecdir@
|
||||
cp utils.js $(DESTDIR)@libexecdir@
|
||||
|
||||
uninstall:
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)@libexecdir@/addcart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/addcut.html
|
||||
rm -f $(DESTDIR)@libexecdir@/assignschedcode.html
|
||||
rm -f $(DESTDIR)@libexecdir@/audioinfo.html
|
||||
rm -f $(DESTDIR)@libexecdir@/audiostore.html
|
||||
rm -f $(DESTDIR)@libexecdir@/copyaudio.html
|
||||
rm -f $(DESTDIR)@libexecdir@/delete_audio.html
|
||||
rm -f $(DESTDIR)@libexecdir@/editcart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/editcart.js
|
||||
rm -f $(DESTDIR)@libexecdir@/editcut.html
|
||||
rm -f $(DESTDIR)@libexecdir@/editcut.js
|
||||
rm -f $(DESTDIR)@libexecdir@/export.html
|
||||
rm -f $(DESTDIR)@libexecdir@/exportpeaks.html
|
||||
rm -f $(DESTDIR)@libexecdir@/import.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcarts.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcartschedcodes.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcut.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcuts.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listgroup.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listgroups.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listlog.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listlogs.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listschedcodes.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listservices.html
|
||||
rm -f $(DESTDIR)@libexecdir@/removecart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/removecut.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\
|
||||
assignschedcode.html\
|
||||
audioinfo.html\
|
||||
audiostore.html\
|
||||
copyaudio.html\
|
||||
delete_audio.html\
|
||||
editcart.html\
|
||||
editcart.js\
|
||||
editcut.html\
|
||||
editcut.js\
|
||||
export.html\
|
||||
exportpeaks.html\
|
||||
import.html\
|
||||
listcart.html\
|
||||
listcarts.html\
|
||||
listcartschedcodes.html\
|
||||
listcut.html\
|
||||
listcuts.html\
|
||||
listgroup.html\
|
||||
listgroups.html\
|
||||
listlog.html\
|
||||
listlogs.html\
|
||||
listschedcodes.html\
|
||||
listservices.html\
|
||||
removecart.html\
|
||||
removecut.html\
|
||||
trimaudio.html\
|
||||
unassignschedcode.html\
|
||||
utils.js
|
||||
|
||||
CLEANFILES = *~
|
||||
|
33
web/tests/assignschedcode.html
Normal file
33
web/tests/assignschedcode.html
Normal file
@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell ASSIGNSCHEDCODE Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="25">
|
||||
<table cellpadding="0" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td align="right">LOGIN NAME:</td>
|
||||
<td><input type="text" name="LOGIN_NAME" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PASSWORD:</td>
|
||||
<td><input type="password" name="PASSWORD" size="20" maxlength="32"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CODE:</td>
|
||||
<td><input type="text" name="CODE" size="12" maxlength="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -1,41 +1,159 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell EDITCART Service Test Harness</title>
|
||||
<script type="text/javascript" src="editcart.js"></script>
|
||||
<script type="text/javascript" src="utils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="14">
|
||||
<table cellpadding="0" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td align="right">LOGIN NAME:</td>
|
||||
<td><input type="text" name="LOGIN_NAME" size="20" maxlength="255"></td>
|
||||
<td><input type="text" name="LOGIN_NAME" id="LOGIN_NAME" size="64" maxlength="255"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PASSWORD:</td>
|
||||
<td><input type="password" name="PASSWORD" size="20" maxlength="32"></td>
|
||||
<td><input type="password" name="PASSWORD" id="PASSWORD" size="64" maxlength="32"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="255"></td>
|
||||
<td><input type="text" name="CART_NUMBER" id="CART_NUMBER" size="64" maxlength="255"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">INCLUDE CUTS:</td>
|
||||
<td><input type="text" name="INCLUDE_CUTS" size="2" maxlength="1"></td>
|
||||
<td><input type="text" name="INCLUDE_CUTS" id="INCLUDE_CUTS" size="2" maxlength="1"></td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">ASYNCHRONOUS:</td>
|
||||
<td><input type="text" name="ASYNCHRONOUS" id="ASYNCHRONOUS" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_ASYNCHRONOUS"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">ENFORCE_LENGTH:</td>
|
||||
<td><input type="text" name="ENFORCE_LENGTH" id="ENFORCE_LENGTH" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_ENFORCE_LENGTH"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FORCED_LENGTH:</td>
|
||||
<td><input type="text" name="FORCEE_LENGTH" id="FORCED_LENGTH" size="7" maxlength="7"></td>
|
||||
<td><input type="checkbox" id="USE_FORCED_LENGTH"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td align="right">GROUP NAME:</td>
|
||||
<td><input type="text" name="GROUP_NAME" size="20" maxlength="20"></td>
|
||||
<td><input type="text" name="GROUP_NAME" id="GROUP_NAME" size="64" maxlength="20"></td>
|
||||
<td><input type="checkbox" id="USE_GROUP_NAME"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td align="right">TITLE:</td>
|
||||
<td><input type="text" name="TITLE" size="20" maxlength="255"></td>
|
||||
<td><input type="text" name="TITLE" id="TITLE" size="64" maxlength="255"></td>
|
||||
<td><input type="checkbox" id="USE_TITLE"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
<td align="right">ARTIST:</td>
|
||||
<td><input type="text" name="ARTIST" id="ARTIST" size="64" maxlength="255"></td>
|
||||
<td><input type="checkbox" id="USE_ARTIST"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
<td align="right">YEAR:</td>
|
||||
<td><input type="text" name="YEAR" id="YEAR" size="8" maxlength="4"></td>
|
||||
<td><input type="checkbox" id="USE_YEAR"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SONG ID:</td>
|
||||
<td><input type="text" name="SONG_ID" id="SONG_ID" size="64" maxlength="32"></td>
|
||||
<td><input type="checkbox" id="USE_SONG_ID"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">ALBUM:</td>
|
||||
<td><input type="text" name="ALBUM" id="ALBUM" size="64" maxlength="255"></td>
|
||||
<td><input type="checkbox" id="USE_ALBUM"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">LABEL:</td>
|
||||
<td><input type="text" name="LABEL" id="LABEL" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_LABEL"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CLIENT:</td>
|
||||
<td><input type="text" name="CLIENT" id="CLIENT" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_CLIENT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">AGENCY:</td>
|
||||
<td><input type="text" name="AGENCY" id="AGENCY" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_AGENCY"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PUBLISHER:</td>
|
||||
<td><input type="text" name="PUBLISHER" id="PUBLISHER" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_PUBLISHER"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">COMPOSER:</td>
|
||||
<td><input type="text" name="COMPOSER" id="COMPOSER" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_COMPOSER"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CONDUCTOR:</td>
|
||||
<td><input type="text" name="CONDUCTOR" id="CONDUCTOR" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_CONDUCTOR"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">USER_DEFINED:</td>
|
||||
<td><input type="text" name="USER_DEFINED" id="USER_DEFINED" size="64" maxlength="255"></td>
|
||||
<td><input type="checkbox" id="USE_USER_DEFINED"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">OWNER:</td>
|
||||
<td><input type="text" name="OWNER" id="OWNER" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_OWNER"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top">NOTES:</td>
|
||||
<td><textarea name="NOTES" id="NOTES" cols="64" rows="4"></textarea></td>
|
||||
<td><input type="checkbox" id="USE_NOTES"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td align="left"><input type="button" onclick="EditCart_Submit();" value="OK"></td>
|
||||
<td align="right"><input type="button" onclick="EditCart_ShowPost();" value="Show POST"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
73
web/tests/editcart.js
Normal file
73
web/tests/editcart.js
Normal file
@ -0,0 +1,73 @@
|
||||
// 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(),"http://localhost/rd-bin/rdxport.cgi");
|
||||
}
|
217
web/tests/editcut.html
Normal file
217
web/tests/editcut.html
Normal file
@ -0,0 +1,217 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell EDITCUT Service Test Harness</title>
|
||||
<script type="text/javascript" src="editcut.js"></script>
|
||||
<script type="text/javascript" src="utils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="15">
|
||||
<table cellpadding="0" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td align="right">LOGIN NAME:</td>
|
||||
<td><input type="text" name="LOGIN_NAME" id="LOGIN_NAME" size="64" maxlength="255"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PASSWORD:</td>
|
||||
<td><input type="password" name="PASSWORD" id="PASSWORD" size="64" maxlength="32"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" id="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" id="CUT_NUMBER" size="8" maxlength="3"></td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">EVERGREEN:</td>
|
||||
<td><input type="text" name="EVERGREEN" id="EVERGREEN" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_EVERGREEN"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">DESCRIPTION:</td>
|
||||
<td><input type="text" name="DESCRIPTION" id="DESCRIPTION" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_DESCRIPTION"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">OUTCUE:</td>
|
||||
<td><input type="text" name="OUTCUE" id="OUTCUE" size="64" maxlength="64"></td>
|
||||
<td><input type="checkbox" id="USE_OUTCUE"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">ISRC:</td>
|
||||
<td><input type="text" name="ISRC" id="ISRC" size="16" maxlength="12"></td>
|
||||
<td><input type="checkbox" id="USE_ISRC"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">ISCI:</td>
|
||||
<td><input type="text" name="ISCI" id="ISCI" size="40" maxlength="32"></td>
|
||||
<td><input type="checkbox" id="USE_ISCI"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">START_DATETIME:</td>
|
||||
<td><input type="text" name="START_DATETIME" id="START_DATETIME" size="32" maxlength="30"></td>
|
||||
<td><input type="checkbox" id="USE_START_DATETIME"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td align="right">END_DATETIME:</td>
|
||||
<td><input type="text" name="END_DATETIME" id="END_DATETIME" size="32" maxlength="30"></td>
|
||||
<td><input type="checkbox" id="USE_END_DATETIME"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">MON:</td>
|
||||
<td><input type="text" name="MON" id="MON" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_MON"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">TUE:</td>
|
||||
<td><input type="text" name="TUE" id="TUE" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_TUE"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">WED:</td>
|
||||
<td><input type="text" name="WED" id="WED" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_WED"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">THU:</td>
|
||||
<td><input type="text" name="THU" id="THU" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_THU"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FRI:</td>
|
||||
<td><input type="text" name="FRI" id="FRI" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_FRI"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SAT:</td>
|
||||
<td><input type="text" name="SAT" id="SAT" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_SAT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SUN:</td>
|
||||
<td><input type="text" name="SUN" id="SUN" size="2" maxlength="1"></td>
|
||||
<td><input type="checkbox" id="USE_SUN"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">START DAYPART:</td>
|
||||
<td><input type="text" name="START_DAYPART" id="START_DAYPART" size="32" maxlength="30"></td>
|
||||
<td><input type="checkbox" id="USE_START_DAYPART"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td align="right">END DAYPART:</td>
|
||||
<td><input type="text" name="END_DAYPART" id="END_DAYPART" size="32" maxlength="30"></td>
|
||||
<td><input type="checkbox" id="USE_END_DAYPART"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">WEIGHT:</td>
|
||||
<td><input type="text" name="WEIGHT" id="WEIGHT" size="8" maxlength="6"></td>
|
||||
<td><input type="checkbox" id="USE_WEIGHT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">START POINT:</td>
|
||||
<td><input type="text" name="START_POINT" id="START_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_START_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">END POINT:</td>
|
||||
<td><input type="text" name="END_POINT" id="END_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_END_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FADEUP POINT:</td>
|
||||
<td><input type="text" name="FADEUP_POINT" id="FADEUP_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_FADEUP_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FADEDOWN POINT:</td>
|
||||
<td><input type="text" name="FADEDOWN_POINT" id="FADEDOWN_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_FADEDOWN_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SEGUE START POINT:</td>
|
||||
<td><input type="text" name="SEGUE_START_POINT" id="SEGUE_START_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_SEGUE_START_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SEGUE END POINT:</td>
|
||||
<td><input type="text" name="SEGUE_END_POINT" id="SEGUE_END_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_SEGUE_END_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">HOOK START POINT:</td>
|
||||
<td><input type="text" name="HOOK_START_POINT" id="HOOK_START_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_HOOK_START_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">HOOK END POINT:</td>
|
||||
<td><input type="text" name="HOOK_END_POINT" id="HOOK_END_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_HOOK_END_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">TALK START POINT:</td>
|
||||
<td><input type="text" name="TALK_START_POINT" id="TALK_START_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_TALK_START_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">TALK END POINT:</td>
|
||||
<td><input type="text" name="TALK_END_POINT" id="TALK_END_POINT" size="16" maxlength="14"></td>
|
||||
<td><input type="checkbox" id="USE_TALK_END_POINT"></td>
|
||||
<td>Modify</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td align="left"><input type="button" onclick="EditCut_Submit();" value="OK"></td>
|
||||
<td align="right"><input type="button" onclick="EditCut_ShowPost();" value="Show POST"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
78
web/tests/editcut.js
Normal file
78
web/tests/editcut.js
Normal file
@ -0,0 +1,78 @@
|
||||
// editcut.js
|
||||
//
|
||||
// Script for selecting cut label elements for the EditCut 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 EditCut_Field(field)
|
||||
{
|
||||
if(document.getElementById("USE_"+field).checked) {
|
||||
return '&'+field+'='+UrlEncode(document.getElementById(field).value);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function EditCut_MakePost()
|
||||
{
|
||||
var form='COMMAND=15';
|
||||
form+='&LOGIN_NAME='+document.getElementById("LOGIN_NAME").value;
|
||||
form+='&PASSWORD='+document.getElementById("PASSWORD").value;
|
||||
form+='&CART_NUMBER='+document.getElementById("CART_NUMBER").value;
|
||||
form+='&CUT_NUMBER='+document.getElementById("CUT_NUMBER").value;
|
||||
|
||||
form+=EditCut_Field("EVERGREEN");
|
||||
form+=EditCut_Field("DESCRIPTION");
|
||||
form+=EditCut_Field("OUTCUE");
|
||||
form+=EditCut_Field("ISRC");
|
||||
form+=EditCut_Field("ISCI");
|
||||
form+=EditCut_Field("START_DATETIME");
|
||||
form+=EditCut_Field("END_DATETIME");
|
||||
form+=EditCut_Field("MON");
|
||||
form+=EditCut_Field("TUE");
|
||||
form+=EditCut_Field("WED");
|
||||
form+=EditCut_Field("THU");
|
||||
form+=EditCut_Field("FRI");
|
||||
form+=EditCut_Field("SAT");
|
||||
form+=EditCut_Field("SUN");
|
||||
form+=EditCut_Field("START_DAYPART");
|
||||
form+=EditCut_Field("END_DAYPART");
|
||||
form+=EditCut_Field("WEIGHT");
|
||||
form+=EditCut_Field("START_POINT");
|
||||
form+=EditCut_Field("END_POINT");
|
||||
form+=EditCut_Field("FADEUP_POINT");
|
||||
form+=EditCut_Field("FADEDOWN_POINT");
|
||||
form+=EditCut_Field("SEGUE_START_POINT");
|
||||
form+=EditCut_Field("SEGUE_END_POINT");
|
||||
form+=EditCut_Field("HOOK_START_POINT");
|
||||
form+=EditCut_Field("HOOK_END_POINT");
|
||||
form+=EditCut_Field("TALK_START_POINT");
|
||||
form+=EditCut_Field("TALK_END_POINT");
|
||||
|
||||
return form;
|
||||
}
|
||||
|
||||
function EditCut_ShowPost()
|
||||
{
|
||||
alert('form: '+EditCut_MakePost());
|
||||
}
|
||||
|
||||
|
||||
function EditCut_Submit()
|
||||
{
|
||||
PostForm(EditCut_MakePost(),"http://localhost/rd-bin/rdxport.cgi");
|
||||
}
|
29
web/tests/listcartschedcodes.html
Normal file
29
web/tests/listcartschedcodes.html
Normal file
@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTCARTSCHEDCODES Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="27">
|
||||
<table cellpadding="0" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td align="right">LOGIN NAME:</td>
|
||||
<td><input type="text" name="LOGIN_NAME" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PASSWORD:</td>
|
||||
<td><input type="password" name="PASSWORD" size="20" maxlength="32"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
25
web/tests/listschedcodes.html
Normal file
25
web/tests/listschedcodes.html
Normal file
@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTSCHEDCODES Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="24">
|
||||
<table cellpadding="0" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td align="right">LOGIN NAME:</td>
|
||||
<td><input type="text" name="LOGIN_NAME" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PASSWORD:</td>
|
||||
<td><input type="password" name="PASSWORD" size="20" maxlength="32"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
33
web/tests/unassignschedcode.html
Normal file
33
web/tests/unassignschedcode.html
Normal file
@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell UNASSIGNSCHEDCODE Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="26">
|
||||
<table cellpadding="0" cellspacing="2" border="0">
|
||||
<tr>
|
||||
<td align="right">LOGIN NAME:</td>
|
||||
<td><input type="text" name="LOGIN_NAME" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">PASSWORD:</td>
|
||||
<td><input type="password" name="PASSWORD" size="20" maxlength="32"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CODE:</td>
|
||||
<td><input type="text" name="CODE" size="12" maxlength="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user