From 39e6d5b3a2ca02951b292e724631046ecf7d55f0 Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 30 Nov 2010 21:37:05 +0000 Subject: [PATCH] flags for events; prio for prices git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@647 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/dialogs/eventedit.cpp | 38 +++++++++++++++++++++++++++++++------- src/dialogs/eventedit.h | 7 +++++-- wob/db/event.wolf | 2 +- www/inc/wext/flag.php | 4 ++-- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/dialogs/eventedit.cpp b/src/dialogs/eventedit.cpp index 22b6c50..71e50ac 100644 --- a/src/dialogs/eventedit.cpp +++ b/src/dialogs/eventedit.cpp @@ -70,6 +70,7 @@ MEventEditor::MEventEditor(QWidget*pw,qint64 id) gl->addWidget(lab=new QLabel(tr("ID:")),lctr,0); lab->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gl->addWidget(eventid=new QLabel,lctr,1); + eventid->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); eventid->setText(event.id().isNull()?"new":QString::number(event.id())); gl->addWidget(lab=new QLabel(tr("Title:")),++lctr,0); @@ -131,6 +132,14 @@ MEventEditor::MEventEditor(QWidget*pw,qint64 id) cancelreason->setText(event.cancelreason()); connect(cancelcheck,SIGNAL(toggled(bool)),cancelreason,SLOT(setEnabled(bool))); + gl->addWidget(lab=new QLabel(tr("Flags:")),++lctr,0); + lab->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + gl->addLayout(hl=new QHBoxLayout,lctr,1); + hl->addWidget(flags=new QLabel(event.flags()),1); + flags->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); + hl->addWidget(p=new QPushButton("..."),0); + connect(p,SIGNAL(clicked(bool)),this,SLOT(setFlags())); + tab->addTab(w=new QWidget,tr("Description")); w->setLayout(vl2=new QVBoxLayout); vl2->addWidget(new QLabel(tr("The description will be displayed on the web site, please use HTML syntax.")),0); @@ -181,6 +190,7 @@ void MEventEditor::writeBack() event.setcomment(comment->toPlainText()); event.setcapacity(capacity->value()); event.setroom(room->text()); + event.setflags(flags->text()); //artist is set in other methods already //prices are changed by the methods reacting to the table //send to server @@ -195,20 +205,28 @@ void MEventEditor::writeBack() } } +void MEventEditor::setFlags() +{ + flags->setText(MFlagEditor::edit(this, flags->text(), tr("Edit flags of event %1:").arg(event.title()))); +} + + void MEventEditor::updatePrice() { pricemodel->clear(); pricemodel->insertColumns(0,5); - pricemodel->setHorizontalHeaderLabels(QStringList()<setHorizontalHeaderLabels(QStringList()< prc=event.price(); pricemodel->insertRows(0,prc.size()); for(int i=0;isetData(pricemodel->index(i,0),prc[i].pricecategory().value().name().value()); - pricemodel->setData(pricemodel->index(i,0),prc[i].pricecategoryid().value(),Qt::UserRole); - pricemodel->setData(pricemodel->index(i,1),cent2str(prc[i].price().value())); - pricemodel->setData(pricemodel->index(i,2),prc[i].maxavailable().value()); - pricemodel->setData(pricemodel->index(i,3),prc[i].amounttickets().value()); - pricemodel->setData(pricemodel->index(i,4),prc[i].amountticketsblock().value()); + pricemodel->setData(pricemodel->index(i,0), prc[i].pricecategory().value().name().value()); + pricemodel->setData(pricemodel->index(i,0), prc[i].pricecategoryid().value(), Qt::UserRole); + pricemodel->setData(pricemodel->index(i,1), cent2str(prc[i].price().value())); + pricemodel->setData(pricemodel->index(i,2), prc[i].prio().value()); + pricemodel->setData(pricemodel->index(i,3), prc[i].maxavailable().value()); + pricemodel->setData(pricemodel->index(i,4), prc[i].amounttickets().value()); + pricemodel->setData(pricemodel->index(i,5), prc[i].amountticketsblock().value()); + pricemodel->setData(pricemodel->index(i,6), prc[i].flags().value()); } pricetable->resizeColumnsToContents(); } @@ -226,15 +244,20 @@ MEEPriceEdit::MEEPriceEdit(QWidget*pw,MOEventPrice prc,int maxseats) setLayout(vl=new QVBoxLayout); vl->addLayout(gl=new QFormLayout,10); gl->addRow(tr("Price category:"),cname=new QLabel(prc.pricecategory().value().name())); + cname->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); gl->addRow(tr("Price:"),price=new MCentSpinBox(&d,prc.price())); price->setMinimumWidth(200); gl->addRow(tr("Maximum Seats:"),cap=new QSpinBox); + gl->addRow(tr("Ordering:"),ord=new QSpinBox); gl->addRow(tr("Flags:"),hl=new QHBoxLayout); hl->addWidget(flg=new QLabel(prc.flags()),1); + flg->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); hl->addWidget(p=new QPushButton("..."),0); connect(p,SIGNAL(clicked(bool)),this,SLOT(setFlags())); cap->setRange(prc.amountticketsblock(),maxseats); cap->setValue(prc.maxavailable()); + ord->setRange(0,0x7fffffff); + ord->setValue(prc.prio()); vl->addSpacing(10); vl->addStretch(1); vl->addLayout(hl=new QHBoxLayout,0); @@ -272,6 +295,7 @@ void MEventEditor::changePrice() prc[lid].setprice(d.price->value()); prc[lid].setmaxavailable(d.cap->value()); prc[lid].setflags(d.flg->text()); + prc[lid].setprio(d.ord->value()); event.setprice(prc); updatePrice(); } diff --git a/src/dialogs/eventedit.h b/src/dialogs/eventedit.h index 2455134..8ecc03a 100644 --- a/src/dialogs/eventedit.h +++ b/src/dialogs/eventedit.h @@ -61,6 +61,9 @@ class MEventEditor:public QDialog void addPrice(); /**removes a price*/ void removePrice(); + + ///change flags + void setFlags(); private: MOEvent event; QDateTimeEdit*starttime,*endtime; @@ -68,7 +71,7 @@ class MEventEditor:public QDialog QTextEdit*description,*comment; QCheckBox*cancelcheck; QSpinBox*capacity; - QLabel*eventid; + QLabel*eventid,*flags; QTableView*pricetable; QStandardItemModel*pricemodel; }; @@ -83,7 +86,7 @@ class MEEPriceEdit:public QDialog protected: friend class MEventEditor; MCentSpinBox*price; - QSpinBox*cap; + QSpinBox*cap,*ord; QLabel*flg,*cname; MEEPriceEdit(QWidget*,MOEventPrice,int); private slots: diff --git a/wob/db/event.wolf b/wob/db/event.wolf index 6efbe2e..7086178 100644 --- a/wob/db/event.wolf +++ b/wob/db/event.wolf @@ -79,7 +79,7 @@ - order in which prices are listet, lowest prio first + order in which prices are listet, lowest number of prio first filter: who can sell tickets in this category for this event internal tags: can be used by macros and printer routines to change behavior or output diff --git a/www/inc/wext/flag.php b/www/inc/wext/flag.php index 5170eaf..01935be 100644 --- a/www/inc/wext/flag.php +++ b/www/inc/wext/flag.php @@ -40,7 +40,7 @@ class WOFlag extends WOFlagAbstract global $db; $f=$trans->getflag(); //check flag name - if(!ereg("^[a-zA-Z0-9]+$",$f->getflag())){ + if(!preg_match("/^[a-zA-Z0-9]+$/",$f->getflag())){ $trans->abortWithError("Invalid flag name."); return; } @@ -53,7 +53,7 @@ class WOFlag extends WOFlagAbstract global $db; $f=$trans->getflag(); //check flag name - if(!ereg("^[a-zA-Z0-9]+$",$f)){ + if(!preg_match("/^[a-zA-Z0-9]+$/",$f)){ $trans->abortWithError("Invalid flag name or attempt to delete special flag."); return; } -- 1.7.2.5