proxypass->setEchoMode(QLineEdit::Password);
connect(useproxy,SIGNAL(toggled(bool)),proxyuser,SLOT(setEnabled(bool)));
connect(useproxy,SIGNAL(toggled(bool)),proxypass,SLOT(setEnabled(bool)));
+ gl->setRowStretch(++lctr,10);
tab->addTab(w=new QWidget,tr("Authentication"));
w->setLayout(gl=new QGridLayout);
hl->addWidget(pb=new QPushButton(tr("Probe Server")));
connect(pb,SIGNAL(clicked()),this,SLOT(serverProbe()));
+ setSizeGripEnabled(true);
+
initProfiles();
loadProfile();
}
else return MTemplate();
}
-struct STemp{
- STemp(QString f,QString c,QString d){fname=f;checksum=c;descr=d;}
- STemp(){}
- QString fname,checksum,descr;
-};
-
void MTemplateStore::updateTemplates(bool force)
-{/*TODO
+{
//basics
QString dname=req->dataDir()+"/templates/";
QSettings set;
//get local info
QStringList files=set.childGroups();
- QMap<QString,STemp> fmap;
+ QMap<QString,MOTemplateInfo> fmap;
for(int i=0;i<files.size();i++){
- STemp t(files[i],set.value(files[i]+"/checksum").toString(), set.value(files[i]+"/description").toString());
+ MOTemplateInfo t;
+ t.setfilename(files[i]);
+ t.sethash(set.value(files[i]+"/checksum").toString()); t.setdescription(set.value(files[i]+"/description").toString());
fmap.insert(files[i],t);
}
progress.setValue(0);
//get remote info, assume it is still valid if unable to retrieve it
- if(!req->request("gettemplatelist",""))return;
- if(req->responseStatus()!=MWebRequest::Ok)return;
+ MTGetTemplateList gtl=req->queryGetTemplateList();
+ if(gtl.hasError())return;
//remember update time
set.setValue("lastupdate",QDateTime::currentDateTime().toTime_t());
- //parse info
- QDomDocument doc;
- if(!doc.setContent(req->responseBody()))return;
//scan and create new list
- QDomNodeList nl=doc.elementsByTagName("Template");
- QMap<QString,STemp>nfmap;
- for(int i=0;i<nl.size();i++){
- QDomElement el=nl.at(i).toElement();
- if(el.isNull())continue;
- QString f=el.attribute("name","");
- QString h=el.attribute("hash","");
- QString d=el.text();
- if(f=="")continue;
- nfmap.insert(f,STemp(f,h,d));
+ QList<MOTemplateInfo>nf=gtl.gettemplates();
+ QMap<QString,MOTemplateInfo>nfmap;
+ for(int i=0;i<nf.size();i++){
+ nfmap.insert(nf[i].filename(),nf[i]);
}
//check old list for removed or changed entries; remove them
if(!nfmap.contains(files[i]))
fmap.remove(files[i]);
else
- if(nfmap[files[i]].checksum != fmap[files[i]].checksum)
+ if(nfmap[files[i]].hash() != fmap[files[i]].hash())
fmap.remove(files[i]);
}
files=fmap.keys();
fmap.insert(nfiles[i],nfmap[nfiles[i]]);
}else{
//file is already up to date, still copy the current description
- fmap[nfiles[i]].descr=nfmap[nfiles[i]].descr;
+ fmap[nfiles[i]].setdescription(nfmap[nfiles[i]].description());
}
}
files=fmap.keys();
set.remove("");
//settings: create new entries
for(int i=0;i<files.size();i++){
- STemp s=fmap[files[i]];
- set.setValue(s.fname+"/checksum",s.checksum);
- set.setValue(s.fname+"/description",s.descr);
- }*/
+ MOTemplateInfo s=fmap[files[i]];
+ set.setValue(s.filename()+"/checksum",s.hash().value());
+ set.setValue(s.filename()+"/description",s.description().value());
+ }
}
bool MTemplateStore::retrieveFile(QString dname,QString fn)
-{/*TODO
+{
//request
- if(!req->request("gettemplate",fn.toUtf8()))return false;
- if(req->responseStatus()!=MWebRequest::Ok)return false;
+ MTGetTemplate gt=req->queryGetTemplate(fn);
+ if(gt.hasError())return false;
//store
QFile f(dname+"/"+fn);
if(!f.open(QIODevice::WriteOnly|QIODevice::Truncate))return false;
- f.write(req->responseBody());
+ f.write(gt.gettemplatefile().value().content());
return true;
- */return false;
}
bool MTemplateStore::setTemplate(QString n,QString f)
QString MTicketLabel::getVariable(QString var)const
{
if(var=="TICKETID"||var=="BARCODE")return tick.ticketid();
- /*if(var=="PRICE")return tick.priceString();
+ if(var=="PRICE")return tick.priceString();
if(var=="DATETIME")return tick.event().startTimeString();
if(var=="ROOM")return tick.event().room();
if(var=="TITLE")return tick.event().title();
- if(var=="ARTIST")return tick.event().artist().value().name();*/
+ if(var=="ARTIST")return tick.event().artist().value().name();
return "";
}
QString MVoucherLabel::getVariable(QString var)const
{
if(var=="VOUCHERID"||var=="BARCODE")return vouc.voucherid();
- /*if(var=="PRICE")return vouc.priceString();
- if(var=="VALUE")return vouc.valueString();*/
+ if(var=="PRICE")return vouc.priceString();
+ if(var=="VALUE")return vouc.valueString();
return "";
}
void WTransaction::webReady(int i,bool e)
{
- qDebug("finished req %i",i);
if(i!=m_httpid)return;
+ qDebug("finished req %i",i);
if(e){
m_stage=Error;
m_errtype="_web";
--- /dev/null
+//
+// C++ Implementation: MOTicket
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#include "MOTicket.h"
+#include "msinterface.h"
+
+MOEvent MOTicket::event()const
+{
+ //if I am valid...
+ if(!ticketid().isNull() && !eventid().isNull())
+ //...and the event is not...
+ if(m_event.eventid().isNull()){
+ //...then retrieve the event
+ MTGetEvent ge=req->queryGetEvent(eventid());
+ if(!ge.hasError())
+ m_event=ge.getevent();
+ }
+ //return whatever we have by now
+ return m_event;
+}
#include "MOTicketAbstract.h"
#include "misc.h"
+#include "MOEvent.h"
class MOTicket:public MOTicketAbstract
{
/**returns the ticket status as localized string*/
QString statusString()const{return TicketState2locstr(status());}
+
+ /**returns the event that this ticket belongs to - does a roundtrip to the database the first time this is called!*/
+ MOEvent event()const;
+ private:
+ //this must be mutable, since event() is semantically and technically const
+ mutable MOEvent m_event;
};
#endif
SOURCES += \
wext/MOCustomerInfo.cpp \
wext/MOOrder.cpp \
+ wext/MOTicket.cpp \
wext/MOAddress.cpp \
wext/MOEvent.cpp
\ No newline at end of file
</Table>
- <Table name="template" backup="yes">
- <Column name="filename" type="string" primarykey="yes"/>
- <Column name="description" type="string"/>
- <Column name="content" type="blob"/>
- <Column name="hash" type="string:32" notnull="yes"/> <!--md5-->
- <Column name="dolog" type="bool" default="0"/>
- <Column name="flags" type="string"/>
- </Table>
-
<Transaction name="Backup">
<Doc>This transaction allows to make a complete database backup. The backup file is replayed into the database via the admin.php interface.</Doc>
<Input/>
<Input>
<Var name="eventid" type="int"/>
</Input>
- <Call lang="php" method="$this->setevent(WOEvent::fromTableevent(WTEvent::getFromDB($this->geteventid())));"/>
+ <Call lang="php" method="$this->setevent(WOEvent::fromTableevent(WTevent::getFromDB($this->geteventid())));"/>
<Output>
<Var name="event" type="Event"/>
</Output>
<Include file="event.wolf"/>
<Include file="order.wolf"/>
<Include file="cart.wolf"/>
+ <Include file="template.wolf"/>
<Include file="audit.wolf"/>
</Wolf>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Template MagicSmoke WOLF
+ - template tables
+ -
+ - (c) Konrad Rosenbaum, 2009
+ - this file is protected under the GNU AGPLv3 or at your option any newer
+ - see COPYING.AGPL for details
+ -->
+<Wolf>
+ <Table name="template" backup="yes">
+ <Column name="filename" type="string" primarykey="yes"/>
+ <Column name="description" type="string"/>
+ <Column name="content" type="blob"/>
+ <Column name="hash" type="string:32" notnull="yes"/> <!--md5-->
+ <Column name="dolog" type="bool" default="0"/>
+ <Column name="flags" type="string"/>
+ </Table>
+
+ <Class name="Template">
+ <Abstract lang="php"/>
+ <Property name="filename" type="astring"/>
+ <Property name="description" type="string"/>
+ <Property name="content" type="blob"/>
+ <Property name="hash" type="astring"/> <!--md5-->
+ <Property name="dolog" type="bool"/>
+ <Property name="flags" type="string"/>
+ <Mapping table="template">
+ <Map column="filename"/>
+ <Map column="description"/>
+ <Map column="content"/>
+ <Map column="hash"/>
+ <Map column="dolog"/>
+ <Map column="flags"/>
+ </Mapping>
+ </Class>
+
+ <Class name="TemplateInfo">
+ <Property name="filename" type="astring"/>
+ <Property name="description" type="string"/>
+ <Property name="hash" type="astring"/> <!--md5-->
+ <Mapping table="template">
+ <Map column="filename"/>
+ <Map column="description"/>
+ <Map column="hash"/>
+ </Mapping>
+ </Class>
+
+ <Transaction name="GetTemplateList">
+ <Call lang="php" method="WOTemplate::getList($this);"/>
+ <Output>
+ <Var name="templates" type="List:TemplateInfo"/>
+ </Output>
+ </Transaction>
+
+ <Transaction name="GetTemplate">
+ <Input>
+ <Var name="filename" type="astring"/>
+ </Input>
+ <Call lang="php" method="WOTemplate::getFile($this);"/>
+ <Output>
+ <Var name="templatefile" type="Template"/>
+ </Output>
+ </Transaction>
+</Wolf>
}else
if(cls.propertyIsString(prop)){
scd+="\t\tQDomElement el=doc.createElement(\""+prop+"\");\n";
- scd+="\t\tel.appendChild(doc.createTextNode(mp_"+prop+"));\n";
+ scd+="\t\tel.appendChild(doc.createTextNode(mp_"+prop+".value()));\n";
scd+="\t\tr.appendChild(el);\n";
}else
if(cls.propertyIsBlob(prop)){
scd+="\t\tQDomElement el=doc.createElement(\""+prop+"\");\n";
- scd+="\t\tel.appendChild(doc.createTextNode(mp_"+prop+".toBase64()));\n";
+ scd+="\t\tel.appendChild(doc.createTextNode(mp_"+prop+".value().toBase64()));\n";
scd+="\t\tr.appendChild(el);\n";
}else{
qDebug("Error: cannot generate serializer for class %s property %s.",cls.name().toAscii().data(),prop.toAscii().data());
$AUTOCLASS["WOOrderInfo"]="inc/wext/order.php";
$AUTOCLASS["WOOrder"]="inc/wext/order.php";
$AUTOCLASS["WOTicket"]="inc/wext/ticket.php";
+$AUTOCLASS["WOTemplate"]="inc/wext/template.php";
?>
\ No newline at end of file
--- /dev/null
+<?
+//
+// PHP Implementation: template
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+class WOTemplate extends WOTemplateAbstract
+{
+ /**called by the TemplateList transaction*/
+ static public function getList($trans)
+ {
+ //TODO: filter by flags
+ $trans->settemplates(WOTemplateInfo::fromTableArraytemplate(WTtemplate::selectFromDB()));
+ }
+
+ /**called by the GetTemplate transaction*/
+ static public function getFile($trans)
+ {
+ //TODO: filter by flags
+ $trans->settemplatefile(WOTemplate::fromTabletemplate(WTtemplate::getFromDB($trans->getfilename())));
+ }
+};
+
+?>
\ No newline at end of file