From: konrad Date: Sun, 4 Apr 2010 13:04:06 +0000 (+0000) Subject: docu for changed params, some forgotten lines X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=d691df752a9a5db59605c24b60f8d902b3630773;p=konrad%2Fpack.git docu for changed params, some forgotten lines git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@434 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/doc/woc.html b/doc/woc.html index 66823d4..c0046ea 100644 --- a/doc/woc.html +++ b/doc/woc.html @@ -66,7 +66,7 @@ Outputs should be declared after the basics have been declared, but before any t
 <QtClientOutput sourceDir="src" subDir="wob" priInclude="wob.pri"/>
-<PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes"/>
+<PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes" transactionBase="WobTransaction"/>
 <HtmlOutput sourceDir="doc" subDir="wob"/>
 
@@ -74,7 +74,7 @@ The attribute "sourceDir" tells woc which directory (above baseDir) is the root The QtClientOutput tag tells woc to create a generator for a Qt based client - the priInclude attribute tells woc which name it should give to the QMake include for its generated output.

-The PHPServerOutput tag tells woc to create a generator for a PHP based server. The "extension" attribute tells woc which file extension to use for the generated files (default is .php). Woc will automatically create a "autoload" (plus extension) file that should be included from the main body of the PHP project to load the automatically generated classes.

+The PHPServerOutput tag tells woc to create a generator for a PHP based server. The "extension" attribute tells woc which file extension to use for the generated files (default is .php). Woc will automatically create a "autoload" (plus extension) file that should be included from the main body of the PHP project to load the automatically generated classes. The transactionBase attribute allows to chose an extended class as base class of generated transactions - it is recommended to overwrite some protected functions in order to be able to get more information inside transactions.

The HtmlOutput tag tells woc where to generate API documentation. diff --git a/phpbase/transaction.php b/phpbase/transaction.php index 09f164d..bfc1915 100644 --- a/phpbase/transaction.php +++ b/phpbase/transaction.php @@ -50,6 +50,7 @@ class WobTransactionBase { { header("X-WobResponse-Status: Error"); print("Request is not known, Aborting.\n"); + $this->abortTransaction(); exit(); } @@ -57,6 +58,7 @@ class WobTransactionBase { public function notAuthenticated(){ header("X-WobResponse-Status: Error"); print("User is not authenticated or does not have permission to execute this request, Aborting.\n"); + $this->abortTransaction(); exit(); } @@ -64,6 +66,7 @@ class WobTransactionBase { public function xmlParserError(){ header("X-WobResponse-Status: Error"); print("Error while parsing request XML, Aborting.\n"); + $this->abortTransaction(); exit(); } @@ -71,6 +74,7 @@ class WobTransactionBase { public function handleException($ex){ header("X-WobResponse-Status: Error"); print("".xq($ex->getMessage())."\n"); + $this->abortTransaction(); exit(); } @@ -81,6 +85,7 @@ class WobTransactionBase { public function abortWithError($text,$type="server"){ header("X-WobResponse-Status: Error"); print("".xq($text)."\n"); + $this->abortTransaction(); exit(); } @@ -89,6 +94,20 @@ class WobTransactionBase { { $this->abortWithError(tr("Transaction not implemented.")); } + + /**stub: overwrite this to implement a real transaction start action (eg. sending the DB a "BEGIN TRANSACTION" statement)*/ + protected function startTransaction(){} + /**stub: overwrite this to implement a real transaction commit action (eg. sending the DB a "COMMIT TRANSACTION" statement)*/ + protected function commitTransaction(){} + /**stub: overwrite this to implement a real transaction abort action (eg. sending the DB a "ROLLBACK TRANSACTION" statement)*/ + protected function abortTransaction(){} + + /**stub: returns whether the user is authenticated, overwrite if you want to use authenticated or authorized transactions*/ + protected function isAuthenticated(){return false;} + /**stub: returns whether the user is authorized to run a specific transaction, overwrite if you want to use authorized transactions*/ + protected function isAuthorized($transactioName){return false;} + /**stub: returns the name of the user (default returns empty string)*/ + protected function userName(){return "";} }; ?> \ No newline at end of file diff --git a/woc/phpout.h b/woc/phpout.h index 7cb4819..ee751bd 100644 --- a/woc/phpout.h +++ b/woc/phpout.h @@ -36,7 +36,6 @@ class WocPHPServerOut:public WocOutput virtual void newTransaction(const WocTransaction&); private: QString m_basedir,m_subdir,m_fileext; - //QString m_isauth,m_hasrole,m_username,m_authinit; QString m_transbase; QFile m_loader,m_schema,m_transact;