incompatible with old databases.
.
This package makes MagicSmoke available on your system, but it does not
- create a database or install it into the web server directory, please
- refer to the documentation files for details.
\ No newline at end of file
+ create a database or install it into the web server directory, please
+ refer to the documentation files for details on how to finalize the
+ installation process.
\ No newline at end of file
cl=debian/changelog
+test -x "`which svn`" || {
+ echo 'Warning: cannot find svn - do you have package subversion installed?' 2>&1
+ test -f $cl && {
+ echo cannot find svn, but $cl exists - accepting it
+ exit 0
+ } || {
+ echo 'Error: cannot find svn and' $cl 'does not exist - cannot proceed.' 1>&2
+ exit 1
+ }
+}
+test -d .svn || {
+ echo 'Warning: this is not a SVN checkout, building in non-dev mode...' 2>&1
+ test -f $cl && {
+ echo 'Info:' $cl 'does exist, accepting it for now'
+ exit 0
+ } || {
+ echo 'Error:' $cl 'does not exist, cannot proceed.' 2>&1
+ exit 1
+ }
+}
+
+echo Generating $cl ...
+
REV="$(svn info|grep Revision:|cut -d " " -f 2)"
REV="2$(echo -n $REV|wc -c|tr 0-9 c-l)$REV"
echo "magicsmoke2 ($REV) unstable; urgency=low" >$cl
echo >>$cl
-echo " Package Generated by" `whoami`@`hostname` `date -R`>>$cl
+echo " Package Generated by" `whoami`@`hostname -f` `date -R`>>$cl
echo >>$cl
-svn2cl --stdout -i --group-by-day | sed 's/^/ /' | sed 's/\t/ /' >>$cl
+test -x "`which svn2cl`" && {
+ svn2cl --stdout -i --group-by-day | sed 's/^/ /' | sed 's/\t/ /' >>$cl
+} || {
+ echo 'Warning: cannot find svn2cl - do you have subversion-tools installed?' 2>&1
+ echo 'Warning:' $cl 'will have an empty body, this may not be what you wanted.' 2>&1
+ echo ' ' `date +%Y-%m-%d` `whoami` >>$cl
+ echo ' * built package without subversion info available, sorry.' >>$cl
+}
echo >>$cl
echo -n ' -- konrad <konrad@silmor.de> ' >>$cl
date -R >>$cl
dialogs/passwdchg.h \
dialogs/pricecatdlg.h \
dialogs/aclwin.h \
- dialogs/flagedit.h
+ dialogs/flagedit.h \
+ dialogs/wizard.h
SOURCES += \
dialogs/configdialog.cpp \
dialogs/passwdchg.cpp \
dialogs/pricecatdlg.cpp \
dialogs/aclwin.cpp \
- dialogs/flagedit.cpp
+ dialogs/flagedit.cpp \
+ dialogs/wizard.cpp
INCLUDEPATH += ./dialogs
\ No newline at end of file
--- /dev/null
+//
+// C++ Implementation: order wizard
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#include "wizard.h"
+#include "overview.h"
+#include "msinterface.h"
+#include "jsengine.h"
+
+#include <QBoxLayout>
+#include <QStackedLayout>
+#include <QPushButton>
+#include <QSignalMapper>
+
+MWizard::MWizard(MOverview* parent, Qt::WindowFlags f)
+ :QDialog(parent, f),m_parent(parent)
+{
+ //main layout
+ QVBoxLayout*vl;
+ QStackedLayout*stack;
+ QHBoxLayout*hl;
+ setLayout(vl=new QVBoxLayout);
+ vl->addLayout(stack=new QStackedLayout,1);
+ //bottom buttons
+ vl->addLayout(hl=new QHBoxLayout);
+ hl->addStretch(1);
+ QPushButton*p;
+ hl->addWidget(p=new QPushButton(tr("Close Wizard")));
+ connect(p,SIGNAL(clicked()),this,SLOT(accept()));
+ hl->addWidget(p=new QPushButton(tr("Exit")));
+ connect(p,SIGNAL(clicked()),this,SLOT(accept()));
+ connect(p,SIGNAL(clicked()),parent,SLOT(close()));
+
+ //paging
+ QSignalMapper*map=new QSignalMapper(this);
+ connect(map,SIGNAL(mapped(int)),stack,SLOT(setCurrentIndex(int)));
+ QWidget*w;
+ int istart,ivou,ievt,icust,iexec;
+
+ //page: start
+ istart=stack->addWidget(w=new QWidget);
+ w->setLayout(vl=new QVBoxLayout);
+ vl->addStretch(1);
+ vl->addWidget(p=new QPushButton(tr("Sell Tickets")));
+ p->setEnabled(req->hasRight(req->PCreateOrder_CanSell));
+ connect(p,SIGNAL(clicked()),map,SLOT(map()));
+ connect(p,SIGNAL(clicked()),this,SLOT(saleMode()));
+ map->setMapping(p,ievt);
+ vl->addWidget(p=new QPushButton(tr("Order Tickets")));
+ p->setEnabled(req->hasRight(req->PCreateOrder_CanSell));
+ connect(p,SIGNAL(clicked()),map,SLOT(map()));
+ connect(p,SIGNAL(clicked()),this,SLOT(orderMode()));
+ map->setMapping(p,ievt);
+ vl->addWidget(p=new QPushButton(tr("Sell Voucher")));
+ p->setEnabled(req->hasRight(req->PCreateOrder_CanOrder));
+ connect(p,SIGNAL(clicked()),map,SLOT(map()));
+ connect(p,SIGNAL(clicked()),this,SLOT(saleMode()));
+ map->setMapping(p,ivou);
+ vl->addWidget(p=new QPushButton(tr("Order Voucher")));
+ p->setEnabled(req->hasRight(req->PCreateOrder_CanOrder));
+ connect(p,SIGNAL(clicked()),map,SLOT(map()));
+ connect(p,SIGNAL(clicked()),this,SLOT(orderMode()));
+ map->setMapping(p,ivou);
+ vl->addStretch(1);
+
+ //page: events
+ m_jseng=new MScriptEngine(parent);
+ m_jseng->addObject("Wizard",this);
+ m_jseng->evaluate("debugger");
+}
+
+MWizard::~MWizard()
+{
+ delete m_jseng;
+}
+
+
+void MWizard::orderMode()
+{
+ m_mode=OrderMode;
+}
+
+void MWizard::saleMode()
+{
+ m_mode=SaleMode;
+}
--- /dev/null
+//
+// C++ Interface: order wizard
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_WIZARD_H
+#define MAGICSMOKE_WIZARD_H
+
+#include <QDialog>
+
+class MScriptEngine;
+class MOverview;
+class MWizard:public QDialog
+{
+ Q_OBJECT
+ public:
+ MWizard(MOverview* parent = 0, Qt::WindowFlags f = 0);
+ virtual ~MWizard();
+ private slots:
+ void saleMode();
+ void orderMode();
+ private:
+ MOverview*m_parent;
+ enum Mode {SaleMode,OrderMode};
+ Mode m_mode;
+ MScriptEngine*m_jseng;
+};
+
+#endif
class MSInterface:public MInterface
{
Q_OBJECT
+ Q_PROPERTY(QString currentUser READ currentUser)
+ Q_PROPERTY(QString hostName READ hostName)
+ Q_PROPERTY(QString dataDir READ dataDir)
+ Q_PROPERTY(QString settingsGroup READ settingsGroup)
+ Q_PROPERTY(QString sessionId READ sessionId)
+ Q_PROPERTY(QString repoPart READ repoPart)
+ Q_PROPERTY(QString profileId READ profileId)
public:
/**creates the interface object, expects the profile ID as parameter*/
MSInterface(QString);
QString hostName()const{return m_host;}
/**returns whether the user is part of this role*/
- bool hasRole(QString s)const{return userroles.contains(s);}
+ Q_INVOKABLE bool hasRole(QString s)const{return userroles.contains(s);}
/**returns whether the user has a particular right*/
- bool hasRight(Right)const;
+ Q_INVOKABLE bool hasRight(Right)const;
/**returns the directory where to store data retrieved from the server*/
QString dataDir()const;
void initialize();
/**returns a pointer to the template storage engine*/
- MTemplateStore* templateStore(){return temp;}
+ Q_INVOKABLE MTemplateStore* templateStore(){return temp;}
/**returns the profile ID of this session*/
QString profileId()const{return profileid;}
// Description:
//
//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007-2010
//
// Copyright: See README/COPYING files that come with this distribution
//
#include "passwdchg.h"
#include "shipping.h"
#include "templatedlg.h"
+#include "wizard.h"
#include "aclwin.h"
#include "carttab.h"
#include "centbox.h"
#include "sclock.h"
+#include "jsengine.h"
+
#include <TimeStamp>
#include <QBoxLayout>
m->addAction(tr("Change my &Password"),this,SLOT(setMyPassword()))
->setEnabled(req->hasRight(req->RChangeMyPassword));
m->addSeparator();
+ m->addAction(tr("Switch to Wizard..."),this,SLOT(wizardMode()));
+ m->addSeparator();
m->addAction(tr("&Edit Templates..."),this,SLOT(editTemplates()));
m->addAction(tr("&Update Templates Now"),req,SLOT(updateTemplates()));
m->addSeparator();
gl->addWidget(oage=new QSpinBox,cl,1);
oage->setRange(0,99999);
oage->setValue(maxageo);
+ gl->setRowMinimumHeight(++cl,5);
+ QComboBox*udeb;
+ gl->addWidget(new QLabel(tr("Show script debugger:")),++cl,0);
+ gl->addWidget(udeb=new QComboBox,cl,1);
+ udeb->addItems(MScriptEngine::debugModes());
+ udeb->setCurrentIndex(MScriptEngine::debugMode());
gl->setRowMinimumHeight(++cl,15);
gl->addLayout(hl=new QHBoxLayout,++cl,0,1,2);
hl->addStretch(10);
maxageo=oage->value();
set.setValue("maxeventage",maxage);
set.setValue("maxorderage",maxageo);
+ MScriptEngine::setDebugMode(udeb->currentIndex());
}
te.exec();
}
+void MOverview::wizardMode()
+{
+ MWizard wiz(this);
+ hide();
+ wiz.exec();
+ show();
+}
+
+
/**********************************************/
MBackupDialog::MBackupDialog(QWidget*par,QString pk)
/**open template editor*/
void editTemplates();
+ /**switch to wizard mode*/
+ void wizardMode();
+
private:
+ friend class MWizard;
//the profile associated with this session
QString profilekey;
//widgets
--- /dev/null
+//
+// C++ Implementation: JScript Engine for MSmoke
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#include "jsengine.h"
+#include "overview.h"
+#include "msinterface.h"
+
+#include <QAction>
+#include <QScriptEngineDebugger>
+#include <QSettings>
+
+MScriptEngine::MScriptEngine(MOverview* par)
+ :QScriptEngine(par)
+{
+ addObject("MainWindow",par);
+ req->initScriptEngine(this);
+ int dm=debugMode();
+ if(dm>0){
+ QScriptEngineDebugger* deb=new QScriptEngineDebugger(this);
+ deb->attachTo(this);
+ if(dm>1)
+ deb->action(QScriptEngineDebugger::InterruptAction)->trigger();
+ }
+}
+void MScriptEngine::addObject(QString name, QObject* object)
+{
+ if(name.size()==0)return;
+ QScriptValue gval=globalObject();
+ name[0]=name[0].toUpper();
+ gval.setProperty(name, newQMetaObject(object->metaObject()));
+ name[0]=name[0].toLower();
+ gval.setProperty(name, newQObject(object, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater));
+}
+
+QStringList MScriptEngine::debugModes()
+{
+ //hint: the semantics of those entries must not change, because their indices are used
+ return QStringList()
+ <<tr("Never show debugger")
+ <<tr("Show on error")
+ <<tr("Show immediately on script start");
+}
+
+int MScriptEngine::debugMode()
+{
+ return QSettings().value("profiles/"+req->profileId()+"/JSdebugMode",0).toInt();
+}
+
+void MScriptEngine::setDebugMode(int v)
+{
+ if(v>=0 && v<debugModes().size())
+ QSettings().setValue("profiles/"+req->profileId()+"/JSdebugMode",v);
+}
--- /dev/null
+//
+// C++ Interface: JScript Engine for MSmoke
+//
+// Description:
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_JSENGINE_H
+#define MAGICSMOKE_JSENGINE_H
+
+#include <QScriptEngine>
+#include <QStringList>
+
+class MOverview;
+
+class MScriptEngine:public QScriptEngine
+{
+ Q_OBJECT
+ public:
+ MScriptEngine(MOverview*);
+
+ void addObject(QString name,QObject*object);
+
+ static QStringList debugModes();
+ static int debugMode();
+ static void setDebugMode(int);
+};
+
+#endif
--- /dev/null
+SOURCES += \
+ script/jsengine.cpp
+
+HEADERS += \
+ script/jsengine.h
+
+INCLUDEPATH += ./script
\ No newline at end of file
CONFIG += debug
CONFIG += qt thread link_prl
-QT += xml network
+QT += xml network script scripttools
win32-* {
#RC-File containing the icon:
include(crypto/crypto.pri)
include(dialogs/dialogs.pri)
include(mwin/mwin.pri)
+include(script/script.pri)
#build generated stuff last
include(wext/wext.pri)
#include "MOAddress"
#include <QStringList>
+#include <QScriptEngine>
-static int moaid=qRegisterMetaType<MOAddress>("MOAddress");
+WOSCRIPT_IMP(MOAddress)
+
+static int moaid=
+ qRegisterMetaType<MOAddress>()+
+ qRegisterMetaType<QList<MOAddress> >()+
+ qRegisterMetaType<Nullable<MOAddress> >();
QString MOAddress::fullAddress(QString nm)const
{
class MOAddress:public MOAddressAbstract
{
- WOBJECT(MOAddress);
+ Q_OBJECT
+ WOBJECT(MOAddress)
+ WOSCRIPT(MOAddress)
public:
/**returns the full address, if name is given and the address does not have its own name, it is included as top line*/
QString fullAddress(QString name=QString())const;
bool isValid()const{return !addressid().isNull() && addressid().value()>=0;}
};
-Q_DECLARE_METATYPE(MOAddress);
+Q_DECLARE_METATYPE(MOAddress)
+Q_DECLARE_METATYPE(QList<MOAddress>)
+Q_DECLARE_METATYPE(Nullable<MOAddress>)
#endif
#include "MOCustomer"
#include "MOCustomerInfo"
#include "msinterface.h"
+#include <QScriptEngine>
+
+static int mymeta=
+ qRegisterMetaType<MOCustomer>()+
+ qRegisterMetaType<QList<MOCustomer> >()+
+ qRegisterMetaType<Nullable<MOCustomer> >();
+
+WOSCRIPT_IMP(MOCustomer)
MOCustomer::MOCustomer(qint64 i)
{
class MOCustomer:public MOCustomerAbstract
{
- WOBJECT(MOCustomer);
+ Q_OBJECT
+ WOBJECT(MOCustomer)
+ WOSCRIPT(MOCustomer)
public:
/**shortcut: gets the customer from the DB*/
MOCustomer(qint64);
};
+Q_DECLARE_METATYPE(MOCustomer)
+Q_DECLARE_METATYPE(QList<MOCustomer>)
+Q_DECLARE_METATYPE(Nullable<MOCustomer>)
+
#endif
//
#include "MOCustomerInfo"
+#include <QScriptEngine>
+
+static int mymeta=
+ qRegisterMetaType<MOCustomerInfo>()+
+ qRegisterMetaType<QList<MOCustomerInfo> >()+
+ qRegisterMetaType<Nullable<MOCustomerInfo> >();
+WOSCRIPT_IMP(MOCustomerInfo)
QString MOCustomerInfo::fullName()const
{
#include "MOCustomerInfoAbstract"
class MOCustomerInfo:public MOCustomerInfoAbstract
{
- WOBJECT(MOCustomerInfo);
+ Q_OBJECT
+ WOBJECT(MOCustomerInfo)
+ WOSCRIPT(MOCustomerInfo)
public:
/**returns the full name (incl. title)*/
QString fullName()const;
Nullable<qint64> id()const{return customerid();}
};
+Q_DECLARE_METATYPE(MOCustomerInfo)
+Q_DECLARE_METATYPE(QList<MOCustomerInfo>)
+Q_DECLARE_METATYPE(Nullable<MOCustomerInfo>)
+
#endif
#include <QCoreApplication>
#include <QRegExp>
#include <QStringList>
+#include <QScriptEngine>
#include "msinterface.h"
+static int mymeta=
+ qRegisterMetaType<MOEvent>()+
+ qRegisterMetaType<QList<MOEvent> >()+
+ qRegisterMetaType<Nullable<MOEvent> >();
+WOSCRIPT_IMP(MOEvent)
+
MOEvent::MOEvent(qint64 i)
{
MTGetEvent ge=MSInterface::instance()->queryGetEvent(i);
/**encapsulation of an event, this class wraps the auto-generated event class to provide some convenience methods*/
class MOEvent:public MOEventAbstract
{
- WOBJECT(MOEvent);
+ Q_OBJECT
+ WOBJECT(MOEvent)
+ WOSCRIPT(MOEvent)
public:
/**get event directly from server*/
MOEvent(qint64);
bool isValid()const{return !eventid().isNull() && eventid().value()>0;}
};
+Q_DECLARE_METATYPE(MOEvent)
+Q_DECLARE_METATYPE(QList<MOEvent>)
+Q_DECLARE_METATYPE(Nullable<MOEvent>)
+
#endif
//
#include "MOOrder"
+#include "MOOrderInfo"
+#include "MORole"
#include "msinterface.h"
+#include <QScriptEngine>
+
+static int mymeta=
+ qRegisterMetaType<MOOrder>()+
+ qRegisterMetaType<QList<MOOrder> >()+
+ qRegisterMetaType<Nullable<MOOrder> >()+
+ qRegisterMetaType<MOOrderInfo>()+
+ qRegisterMetaType<QList<MOOrderInfo> >()+
+ qRegisterMetaType<Nullable<MOOrderInfo> >()+
+ qRegisterMetaType<MORole>()+
+ qRegisterMetaType<QList<MORole> >()+
+ qRegisterMetaType<Nullable<MORole> >();
MOOrder::MOOrder(qint64 id)
{
/**this class represents a complete order*/
class MOOrder:public MOOrderAbstract
{
+ Q_OBJECT
+ WOBJECT(MOOrder)
+ WOSCRIPT(MOOrder)
public:
- /**creates an invalid/empty order object*/
- MOOrder():MOOrderAbstract(){}
/**create order by id, retrieves it automatically from the database*/
MOOrder(qint64);
- /**copy constructor*/
- MOOrder(const MOOrder&o):MOOrderAbstract(o){}
- /**used by transactions to create order from xml*/
- MOOrder(const QDomElement&e):MOOrderAbstract(e){}
/**returns whether the order is valid (it comes from the DB and it has been understood by the parser)*/
bool isValid()const{return !orderid().isNull();}
QString fullDeliveryAddress(bool allowfallback=true)const;
};
+Q_DECLARE_METATYPE(MOOrder)
+Q_DECLARE_METATYPE(QList<MOOrder>)
+Q_DECLARE_METATYPE(Nullable<MOOrder>)
+
#endif
class MOOrderInfo:public MOOrderInfoAbstract
{
+ Q_OBJECT
+ WOBJECT(MOOrderInfo)
+ WOSCRIPT(MOOrderInfo)
public:
- MOOrderInfo(const MOOrderInfo&o):MOOrderInfoAbstract(o){}
- MOOrderInfo(const QDomElement&e):MOOrderInfoAbstract(e){}
-
QString totalPriceString()const{return cent2str(totalprice());}
QString amountPaidString()const{return cent2str(amountpaid());}
QString orderStatusString()const{return OrderState2str(status());}
bool isCancelled()const{return status()==Cancelled;}
};
+Q_DECLARE_METATYPE(MOOrderInfo)
+Q_DECLARE_METATYPE(QList<MOOrderInfo>)
+Q_DECLARE_METATYPE(Nullable<MOOrderInfo>)
+
#endif
\ No newline at end of file
#define MAGICSMOKE_MOROLE_H
#include "MORoleAbstract"
-typedef MORoleAbstract MORole;
+class MORole:public MORoleAbstract
+{
+ Q_OBJECT
+ WOBJECT(MORole)
+ WOSCRIPT(MORole)
+};
+
+Q_DECLARE_METATYPE(MORole)
+Q_DECLARE_METATYPE(QList<MORole>)
+Q_DECLARE_METATYPE(Nullable<MORole>)
#endif
\ No newline at end of file
//
#include "MOTicket"
+#include "MOVoucher"
#include "msinterface.h"
+#include <QScriptEngine>
+
+static int mymeta=
+ qRegisterMetaType<MOTicket>()+
+ qRegisterMetaType<QList<MOTicket> >()+
+ qRegisterMetaType<Nullable<MOTicket> >()+
+ qRegisterMetaType<MOVoucher>()+
+ qRegisterMetaType<QList<MOVoucher> >()+
+ qRegisterMetaType<Nullable<MOVoucher> >();
MOEvent MOTicket::event()const
{
class MOTicket:public MOTicketAbstract
{
- WOBJECT(MOTicket);
+ Q_OBJECT
+ WOBJECT(MOTicket)
+ WOSCRIPT(MOTicket)
public:
/**returns the amount to be paid for this ticket; this may be 0 even if there is a price attached*/
int amountToPay()const{if(status()&MaskPay)return price();else return 0;}
mutable MOEvent m_event;
};
+Q_DECLARE_METATYPE(MOTicket)
+Q_DECLARE_METATYPE(QList<MOTicket>)
+Q_DECLARE_METATYPE(Nullable<MOTicket>)
+
#endif
class MOVoucher:public MOVoucherAbstract
{
- WOBJECT(MOVoucher);
+ Q_OBJECT
+ WOBJECT(MOVoucher)
+ WOSCRIPT(MOVoucher)
public:
/**returns whether this is a valid voucher object (ie. it has a voucher ID)*/
bool isValid()const{return !voucherid().isNull();}
QString priceString()const{return cent2str(price());}
};
+Q_DECLARE_METATYPE(MOVoucher)
+Q_DECLARE_METATYPE(QList<MOVoucher>)
+Q_DECLARE_METATYPE(Nullable<MOVoucher>)
+
#endif
wext/orderinfo.h \
wext/role.h \
wext/ticket.h \
+ wext/voucher.h \
wext/address.h \
wext/event.h \
wext/customer.h \
<Preset><V col="ckey" val="VoucherIDChars"/><V col="cval" val="10"/></Preset>
<Preset><V col="ckey" val="Flag _admin"/><V col="cval" val="User is Admin"/></Preset>
<Preset><V col="ckey" val="Flag _web"/><V col="cval" val="User is Customer"/></Preset>
+ <Preset><V col="ckey" val="Flag _useWizard"/><V col="cval" val="User starts with the wizard mode"/></Preset>
</Table>
</Wolf>
<Include file="db/db.wolf"/>
<!-- configure output -->
- <QtClientOutput sourceDir="src" subDir="wob" priInclude="wob.pri" classPrefix="M" clean="yes" transactionBase="MTransaction"/>
+ <QtClientOutput sourceDir="src" subDir="wob" priInclude="wob.pri" classPrefix="M" clean="yes" transactionBase="MTransaction" scriptable="yes"/>
<PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes" transactionBase="MSmokeTransaction"/>
<HtmlOutput sourceDir="doc" subDir="wob" clean="yes"/>
<!-- SchemaOutput sourceDir="wob" filename="test.xsd" compound="cmp.xsd"/ -->