From: konrad Date: Thu, 6 Aug 2009 08:54:50 +0000 (+0000) Subject: merged in changes from stable08 -r412:435: X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=af4d431e4a3b2922c59ded3079728c6aa4919431;p=web%2Fkonrad%2Fsmoke.git merged in changes from stable08 -r412:435: *debian package (to be modified further) *help menu *automatic about box *translation changes from Achim git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@310 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/README b/README index d334a34..3306361 100644 --- a/README +++ b/README @@ -14,7 +14,7 @@ See the HTML files in the doc directory for more information. Copyrights ----------- -(c) Konrad Rosenbaum, 2007/8/9 +(c) Konrad Rosenbaum, 2007-9 (c) Peter Keller, 2007/8 Directory doc: @@ -58,4 +58,4 @@ Documentation --------------- You will find instructions on how to configure, build, and install the -software in the doc-directory. Start with doc/index.html . \ No newline at end of file +software in the doc-directory. Start with doc/index.html . diff --git a/debian/README.server b/debian/README.server new file mode 100644 index 0000000..55da69e --- /dev/null +++ b/debian/README.server @@ -0,0 +1,71 @@ +MagicSmoke Server Installation on Debian +========================================= + +Unfortunately this does not work entirely automaticly. + +1 - DocumentRoot +----------------- + +The debian package installs the server PHP files in /usr/lib/magicsmoke-server +and links them to /var/www/magicsmoke . You need to change that link if your +DocumentRoot is somewhere else or you want a different name. + +2 - Database +------------- + +Connect to your MySQL server using a client of your choice (I'll assume the +command line client below). + +Create a MySQL user - I'll assume it is called "smoke" and uses "verysecret" +as password. + mysql> CREATE USER smoke IDENTIFIED BY PASSWORD 'verysecret'; + +Create a MySQL database - I'll assume it is called "smoke". + mysql> CREATE DATABASE smoke; + +Give the user all rights on this database. + mysql> GRANT ALL ON smoke.* TO smoke; + +MagicSmoke uses a common configurable prefix for its tables ("smoke_*" per +default), so you can use an existing database or even use the same database +for multiple installations or different programs (assuming the other +programs are as tolerant as MagicSmoke). + +3 - Configuring MagicSmoke +--------------------------- + +Go to /usr/lib/magicsmoke-server and copy config.php.template to config.php. + +Now edit it, the config template is pretty self-explanatory. + +4 - Creating the Database Content +---------------------------------- + +Open a browser and direct it to admin.php in your MagicSmoke installation +(usually something like http://localhost/magicsmoke/admin.php). + +The default user name is "Admin" and the password is "SmokeInMyEye". + +Click the create database button. + +Create an initial administrator user. + +Comment out the "setAdminPassCode" line in config.php, so that noone +else can abuse this interface. + +From now on you can access it with the MagicSmoke client. Your URL for the +client ends in machine.php (eg. http://localhost/magicsmoke/machine.php). + +5 - Templates +-------------- + +MagicSmoke comes with really simplistic (and ugly looking) templates for the +web pages visible to web users. + +They are installed in /usr/share/magicsmoke-server/template . + +Copy this directory, install magicsmoke-doc and read the chapter about web +templates. + +When you are ready redirect the server to your now template directory by +editing the $template variable in config.php . diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..9be8a17 --- /dev/null +++ b/debian/control @@ -0,0 +1,32 @@ +Source: magicsmoke +Section: main +Priority: extra +Maintainer: Konrad Rosenbaum +Build-Depends: debhelper (>= 7), libqt4-dev, qt4-dev-tools, subversion, subversion-tools +Standards-Version: 3.7.3 +Homepage: http://smoke.silmor.de + +Package: magicsmoke +Architecture: any +Depends: ${shlibs:Depends} +Recommends: magicsmoke-doc +Suggests: magicsmoke-server +Description: MagicSmoke Ticket Sale System + This package contains the MagicSmoke Ticket Sales System Client. + . + It requires a server to be running somewhere. + +Package: magicsmoke-doc +Architecture: all +Depends: +Suggests: magicsmoke +Description: MagicSmoke Ticket Sale System + This package contains the MagicSmoke Ticket Sales System Documentation + in HTML format. + +Package: magicsmoke-server +Architecture: all +Depends: php5 (>= 5), php5-mysql (>= 5), php5-mhash (>= 5) +Suggests: magicsmoke-doc, magicsmoke +Description: MagicSmoke Ticket Sale System + This package contains the MagicSmoke Ticket Sales System Server. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/gencl b/debian/gencl new file mode 100755 index 0000000..9318281 --- /dev/null +++ b/debian/gencl @@ -0,0 +1,20 @@ +#!/bin/sh + +cl=debian/changelog + +REV=$(svn info|grep Revision:|cut -d " " -f 2) + +while test $(echo -n $REV|wc -c) -lt 4 ; do REV="0$REV" ; done + +if test `svn stat -q|wc -l` -gt 0 ; then + REV="$REV-uc" +fi + +echo "magicsmoke (1r$REV) stable; urgency=low" >$cl +echo >>$cl +echo " Package Generated by" `whoami`@`hostname` `date -R`>>$cl +echo >>$cl +svn2cl --stdout -i --group-by-day | sed 's/^/ /' | sed 's/\t/ /' >>$cl +echo >>$cl +echo -n ' -- konrad ' >>$cl +date -R >>$cl diff --git a/debian/magicsmoke.menu b/debian/magicsmoke.menu new file mode 100644 index 0000000..01da780 --- /dev/null +++ b/debian/magicsmoke.menu @@ -0,0 +1,3 @@ +?package(magicsmoke):needs="X11" section="Applications/Network"\ + title="MagicSmoke Client" command="/usr/bin/msmoke"\ + icon="/usr/lib/magicsmoke/icon.png" diff --git a/debian/magicsmoke.postinst b/debian/magicsmoke.postinst new file mode 100644 index 0000000..9079a48 --- /dev/null +++ b/debian/magicsmoke.postinst @@ -0,0 +1,46 @@ +#!/bin/sh +# postinst script for xpack +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + for i in /usr/share/qt4/translations/qt_*.qm; do + #echo Linking $i + ln -sf $i /usr/lib/magicsmoke/`basename $$i` + done + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + rm -f /usr/lib/magicsmoke/qt_*.qm || true + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/magicsmoke.postrm b/debian/magicsmoke.postrm new file mode 100644 index 0000000..7acb589 --- /dev/null +++ b/debian/magicsmoke.postrm @@ -0,0 +1,43 @@ +#!/bin/sh +# postrm script for xpack +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade) + ;; + + purge|disappear) + rm -f /usr/lib/magicsmoke || true + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/magicsmoke.prerm b/debian/magicsmoke.prerm new file mode 100644 index 0000000..2686f0c --- /dev/null +++ b/debian/magicsmoke.prerm @@ -0,0 +1,41 @@ +#!/bin/sh +# prerm script for xpack +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + rm -f /usr/lib/magicsmoke/qt_*.qm || true + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1e089bf --- /dev/null +++ b/debian/rules @@ -0,0 +1,141 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Debian packaging script for MagicSmoke +# (c) Konrad Rosenbaum, 2009 + +#Original comment: +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +all: binary + + +configure: configure-stamp +configure-stamp: + @echo '********************' + @echo Configuring... + dh_testdir + debian/gencl + cd src; /usr/bin/qmake + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + @echo '********************' + @echo Building... + dh_testdir + $(MAKE) -C src + cd src ; /usr/bin/lrelease smoke.pro + touch $@ + +clean: + @echo '********************' + @echo Cleaning... + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + $(MAKE) -C src distclean + dh_clean + +install: install-base install-client install-doc install-server +install-base: build + dh_testdir + dh_testroot + dh_clean -k -s + dh_clean -k -i + dh_installdirs -i + dh_installdirs -s + +install-client: + @echo '********************' + @echo Install Client... + mkdir -p $(CURDIR)/debian/magicsmoke/usr/share/doc/magicsmoke + install -D src/msmoke $(CURDIR)/debian/magicsmoke/usr/lib/magicsmoke/msmoke + cp src/icon.png $(CURDIR)/debian/magicsmoke/usr/lib/magicsmoke/ + echo '#!/bin/sh' >$(CURDIR)/debian/magicsmoke/usr/bin/msmoke + echo 'exec /usr/lib/magicsmoke/msmoke' >>$(CURDIR)/debian/magicsmoke/usr/bin/msmoke + chmod +x $(CURDIR)/debian/magicsmoke/usr/bin/msmoke + rm -rf `find $(CURDIR)/debian/magicsmoke -name .svn` + cp -L README COPYING* $(CURDIR)/debian/magicsmoke/usr/share/doc/magicsmoke + gzip `ls $(CURDIR)/debian/magicsmoke/usr/share/doc/magicsmoke/* |grep -v .gz` + cp -L src/smoke*.qm $(CURDIR)/debian/magicsmoke/usr/lib/magicsmoke + +install-doc: + @echo '********************' + @echo Install Doc... + mkdir -p $(CURDIR)/debian/magicsmoke-doc/usr/share/doc/magicsmoke + mkdir -p $(CURDIR)/debian/magicsmoke-doc/usr/share/doc/magicsmoke-doc + mkdir -p $(CURDIR)/debian/magicsmoke-doc/usr/lib/magicsmoke + cp -rL doc $(CURDIR)/debian/magicsmoke-doc/usr/share/doc/magicsmoke + ln -sf ../../share/doc/magicsmoke/doc $(CURDIR)/debian/magicsmoke-doc/usr/lib/magicsmoke/doc + cp -L README COPYING* $(CURDIR)/debian/magicsmoke-doc/usr/share/doc/magicsmoke-doc + gzip `ls $(CURDIR)/debian/magicsmoke-doc/usr/share/doc/magicsmoke-doc/* |grep -v .gz` + rm -rf `find $(CURDIR)/debian/magicsmoke-doc -name .svn` + +install-server: + @echo '********************' + @echo Install Server... + mkdir -p $(CURDIR)/debian/magicsmoke-server/usr/share/doc/magicsmoke-server + cp -rL www $(CURDIR)/debian/magicsmoke-server/usr/share/magicsmoke-server + mkdir -p $(CURDIR)/debian/magicsmoke-server/var/www + ln -sf ../../usr/share/magicsmoke-server $(CURDIR)/debian/magicsmoke-server/var/www/magicsmoke + rm -rf `find $(CURDIR)/debian/magicsmoke-server -name .svn` + rm -f $(CURDIR)/debian/magicsmoke-server/usr/share/magicsmoke-server/config.php + cp -L README COPYING* $(CURDIR)/debian/magicsmoke-server/usr/share/doc/magicsmoke-server + gzip `ls $(CURDIR)/debian/magicsmoke-server/usr/share/doc/magicsmoke-server/* |grep -v .gz` + gzip $(CURDIR)/debian/magicsmoke-server/usr/share/doc/magicsmoke-server/README.Debian-Install.gz + +binary-common: + dh_testdir + dh_testroot + dh_installchangelogs +# dh_installdocs +# dh_installexamples +# dh_install + dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo +# dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +# Build architecture independant packages using the common target. +binary-indep: + @echo '********************' + @echo Independent Packages... + $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common + +# Build architecture dependant packages using the common target. +binary-arch: + @echo '********************' + @echo Architecture dependent Packages... + $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common + +binary: build install binary-arch binary-indep + +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/src/files.qrc b/src/files.qrc index 4462340..df22d47 100644 --- a/src/files.qrc +++ b/src/files.qrc @@ -5,5 +5,6 @@ arrowright.png arrowdown.png arrowdiag.png + version.xml diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9ac8dee..9c553aa 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -16,12 +16,14 @@ #include "msinterface.h" #include "office.h" #include "overview.h" +#include "version.h" #include #include #include #include #include +#include #include #include #include @@ -38,8 +40,11 @@ #include #include +static MMainWindow *maininst=0; + MMainWindow::MMainWindow() { + maininst=this; setWindowTitle("Magic Smoke"); //create Menu Bar QMenuBar*mb=menuBar(); @@ -56,6 +61,7 @@ MMainWindow::MMainWindow() m->addAction(tr("&Generate Host Key..."),this,SLOT(generateKey())); m->addSeparator(); m->addAction(tr("&OpenOffice.org Settings..."),this,SLOT(openOfficeCfg())); + mb->addMenu(helpMenu()); //create central widget QWidget *loginwidget; @@ -119,6 +125,16 @@ MMainWindow::MMainWindow() loadProfile(); } +QMenu* MMainWindow::helpMenu() +{ + QMenu*m=new QMenu(tr("&Help")); + m->addAction("&Help",maininst,SLOT(help())); + m->addSeparator(); + m->addAction("About &MagicSmoke",maininst,SLOT(about())); + m->addAction("About &Qt",qApp,SLOT(aboutQt())); + return m; +} + void MMainWindow::initProfiles() { QSettings set; @@ -339,3 +355,27 @@ void MMainWindow::openOfficeCfg() MOfficeConfig c(this); c.exec(); } + +void MMainWindow::about() +{ + QMessageBox mb(this); + mb.setIconPixmap(QPixmap(":/icon.png")); + mb.setWindowTitle(tr("About MagicSmoke")); + mb.setText(tr( "

MagicSmoke

" + "© Konrad Rosenbaum, Peter Keller, 2007-9
" + "protected under the GNU GPL v.3 or at your option any newer

" + "See also the MagicSmoke Homepage.

" + "This version was compiled from repository %1 revision %2."). + arg(repoPart()).arg(svnRevision())); + mb.setStandardButtons(QMessageBox::Ok); + mb.exec(); +} + +void MMainWindow::help() +{ + QString d=QApplication::applicationDirPath()+"/doc/index.html"; + if(!QFile(d).exists()){ + d="http://smoke.silmor.de/doc/"+repoPart()+"/index.html"; + }else d="file:///"+d; + QDesktopServices::openUrl(QUrl(d)); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index b7282f0..7b3515f 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -30,6 +30,8 @@ class MMainWindow:public QMainWindow Q_OBJECT public: MMainWindow(); + + static QMenu*helpMenu(); private: QHttp*req; QString sessionid; @@ -54,6 +56,9 @@ class MMainWindow:public QMainWindow void importKey(); void generateKey(); void openOfficeCfg(); + //help menu + void about(); + void help(); }; #endif diff --git a/src/overview.cpp b/src/overview.cpp index bce24d5..8feed63 100644 --- a/src/overview.cpp +++ b/src/overview.cpp @@ -14,6 +14,7 @@ #include "checkdlg.h" #include "eventedit.h" #include "eventsummary.h" +#include "mainwindow.h" #include "misc.h" #include "moneylog.h" #include "msinterface.h" @@ -132,6 +133,8 @@ MOverview::MOverview(QString pk) ->setEnabled(req->hasRole("backup")); m->addAction(tr("&Backup now..."),this,SLOT(doBackup())) ->setEnabled(req->hasRole("backup")); + + mb->addMenu(MMainWindow::helpMenu()); //tabs setCentralWidget(tab=new QTabWidget); diff --git a/src/smoke.pro b/src/smoke.pro index 5283ee5..c7bf4df 100644 --- a/src/smoke.pro +++ b/src/smoke.pro @@ -95,3 +95,10 @@ include(wbase/wbase.pri) include(wob/wob.pri) LIBS += -lgmp + +versiontarget.target = version.xml +versiontarget.commands = svn info -R --xml --non-interactive .. > version.xml +versiontarget.depends = FORCE + +PRE_TARGETDEPS += version.xml +QMAKE_EXTRA_TARGETS += versiontarget diff --git a/src/smoke_de.ts b/src/smoke_de.ts index 0d50e42..89742d2 100644 --- a/src/smoke_de.ts +++ b/src/smoke_de.ts @@ -1,7 +1,6 @@ - MBackupDialog @@ -411,7 +410,7 @@ Total Income: - Umsatz: + erwarteter Umsatz: . @@ -628,7 +627,7 @@ At least %1 Bits of random are required. Username: - Nutzername: + Benutzername: @@ -742,7 +741,7 @@ At least %1 Bits of random are required. Unable to open file %1 for writing: %2 - Datei %1 kann nicht zum Schreiben geöffnet werden: %2 + Datei %1 kann zum Schreiben nicht geöffnet werden: %2 @@ -757,7 +756,7 @@ At least %1 Bits of random are required. Unable to open file %1 for reading: %2 - Datei %1 kann nicht zum Lesen geöffnet werden: %2 + Datei %1 kann zum Lesen nicht geöffnet werden: %2 @@ -971,7 +970,7 @@ At least %1 Bits of random are required. This ticket is not part of this order. - Dieses Ticket ist nicht in einer Bestellung enthalten. + Dieses Ticket ist in keiner Bestellung enthalten. @@ -1699,7 +1698,7 @@ At least %1 Bits of random are required. Clear - Von vorn + Zurücksetzen @@ -1757,7 +1756,7 @@ At least %1 Bits of random are required. Roles... - Rollen... + Rechte... @@ -1782,7 +1781,7 @@ At least %1 Bits of random are required. Please enter new user name (only letters, digits, and underscore allowed): - Neuen Nutzernamen eingeben (Buchstaben, Ziffern, Unterstrich): + Neuen Nutzernamen eingeben (Kleinbuchstaben, Ziffern, Unterstrich, Minus): @@ -2123,7 +2122,7 @@ At least %1 Bits of random are required. Find by Ticket... - Mit Kartennummer finden... + Mit Kartennummer suchen... @@ -2280,17 +2279,17 @@ Die Bestellung ist überbezahlt: es gibt noch Geld zurück. Find by Event... - Nach Veranstaltung finden... + Nach Veranstaltung suchen... Find by Customer... - Nach Kunde finden... + Nach Kunde suchen... The user name must contain only letters, digits, dots and underscores and must be at least one character long! - Nutzernamen dürfen nur Buchstaben, Ziffern, Punkte und Unterstriche enthalten und müssen mindestens ein Zeichen lang sein! + Nutzernamen dürfen nur Kleinbuchstaben, Ziffern, Punkte, Bindestriche und Unterstriche enthalten und müssen mindestens ein Zeichen lang sein! @@ -3532,7 +3531,7 @@ Verbleibender Betrag: %2 getcustomerlist - Kunden abfragen + Kundenliste abfragen @@ -3547,7 +3546,7 @@ Verbleibender Betrag: %2 deletecustomer - Nutzer löschen/ersetzen + Kunden löschen/ersetzen @@ -3592,7 +3591,7 @@ Verbleibender Betrag: %2 cancelorder - Bestellung rückgängig machen + Bestellung stornieren diff --git a/src/version.cpp b/src/version.cpp index 7c2ddc8..394eb31 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -15,3 +15,54 @@ #define defversion(x,y) const char VERSION_##x[] = #y; #include "../www/inc/machine/version.inc" #undef defversion + +#include +#include +#include +#include + +static QString rpart,srev; + +static void initVer() +{ + QFile x(":/version.xml"); + x.open(QIODevice::ReadOnly); + QDomDocument doc; + doc.setContent(&x); + QDomNodeList nl=doc.documentElement().elementsByTagName("entry"); + int baserev=0,maxrev=0; + for(int i=0;i0)u=nl2.at(0).toElement().text(); + else continue; + nl2=el.elementsByTagName("root"); + if(nl2.size()>0){ + u="."+u.mid(nl2.at(0).toElement().text().size()); + } + QStringList sl=u.split("/smoke/"); + if(sl.size()>1)rpart=sl[1]; + else rpart=u; + } + if(r>maxrev)maxrev=r; + } + srev=QString::number(baserev); + if(maxrev>baserev)srev+="-"+QString::number(maxrev); +} + +QString repoPart() +{ + if(rpart=="")initVer(); + return rpart; +} + +QString svnRevision() +{ + if(rpart=="")initVer(); + return srev; +} diff --git a/src/version.h b/src/version.h index b8a12eb..8d73366 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,8 @@ +#include #define defversion(x,y) extern const char VERSION_##x[]; #include "../www/inc/machine/version.inc" #undef defversion + +QString repoPart(); +QString svnRevision();