Hi,
hard problems hitting me. I have to use the prototype framework in some extensions but I've no idea to handle this. I need a seperate php-File which handels the requests but also i need db-connection and tite and article objects.
so how can this be implemented.
best regards mic
Hi Michael,
we have done some extension using prototype, whereas the extension itself is implemented as a Special Page, accessing and using the db-connection of the Wiki.
We put the js-include in the execute-function of the Special Page like this:
$wgOut->addScript('<script type="text/javascript" src="'.$path.'extensions/compilation/prototype.js"></script>');
Regards, Mathias
On 9/12/07, Michael Heyder Info@hafenvolleyballer.de wrote:
Hi,
hard problems hitting me. I have to use the prototype framework in some extensions but I've no idea to handle this. I need a seperate php-File which handels the requests but also i need db-connection and tite and article objects.
so how can this be implemented.
best regards mic
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Mathias Conradt schrieb:
Hi Michael,
we have done some extension using prototype, whereas the extension itself is implemented as a Special Page, accessing and using the db-connection of the Wiki.
We put the js-include in the execute-function of the Special Page like this:
$wgOut->addScript('<script type="text/javascript" src="'.$path.'extensions/compilation/prototype.js"></script>');
Regards, Mathias
On 9/12/07, Michael Heyder Info@hafenvolleyballer.de wrote:
Hi,
hard problems hitting me. I have to use the prototype framework in some extensions but I've no idea to handle this. I need a seperate php-File which handels the requests but also i need db-connection and tite and article objects.
so how can this be implemented.
best regards mic
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
thats obviously clear ... but
var myAjax = new Ajax.Request('/wiki/extensions/NewArticleWizard/Response.php', { method: 'post', postBody: 'title='+elem1.value, onSuccess: function(e) { $('edit_title').innerHTML= e.responseText;
} }); return false; }
so the response.php handels the response for the request. So in this file I need db-connection and title & article objects. Thats my problem
regards
Use the wfGetDB function in response.php to retrieve the data (i.e. articles) from the database.
... $theDoc->updateTitle(); ... public function updateTitle() { $dbr = wfGetDB( DB_SLAVE ); $theData = array(); $theData['title'] = $this->title; $theWhere = array('id='.$this->uid); $dbr->update('page_make_up', $theData,$theWhere); $dbr->commit(); } ...
Mathias Conradt schrieb:
Use the wfGetDB function in response.php to retrieve the data (i.e. articles) from the database.
... $theDoc->updateTitle(); ... public function updateTitle() { $dbr = wfGetDB( DB_SLAVE ); $theData = array(); $theData['title'] = $this->title; $theWhere = array('id='.$this->uid); $dbr->update('page_make_up', $theData,$theWhere); $dbr->commit(); } ...
Thats the problem: the response.php is a standalone file. No claases are integrated. It's only called from the ajax request. So none global vars and/or claases are implemented.
Hope someone can understand my problem.
regards mic
Mathias Conradt schrieb:
Use the wfGetDB function in response.php to retrieve the data (i.e. articles) from the database.
... $theDoc->updateTitle(); ... public function updateTitle() { $dbr = wfGetDB( DB_SLAVE ); $theData = array(); $theData['title'] = $this->title; $theWhere = array('id='.$this->uid); $dbr->update('page_make_up', $theData,$theWhere); $dbr->commit(); } ...
Thats the problem: the response.php is a standalone file. No claases are integrated. It's only called from the ajax request. So none global vars and/or claases are implemented.
Hope someone can understand my problem.
regards mic
Ok, so if it needs to be standalone and cannot include any wiki files for db support, you can implement your own code to retrieve the database connection - taking the DB settings from the LocalSettings.php, which would mean you at least have to include them. Or hard code them again into the Response.php.
I don't exactly see where the problem is? You want to avoid implementing your own code for the database connection retrieval? You want to avoid storing the connection info (username, pw, etc.) in two different places?
(Why does it need to be standalone in the first place? Wouldn't it make things easier using the Wiki classes? We use the SpecialPage as well to handle the Ajax requests, not a complete standalone page)
On 9/12/07, Michael Heyder Info@hafenvolleyballer.de wrote:
Mathias Conradt schrieb:
Use the wfGetDB function in response.php to retrieve the data (i.e. articles) from the database.
... $theDoc->updateTitle(); ... public function updateTitle() { $dbr = wfGetDB( DB_SLAVE ); $theData = array(); $theData['title'] = $this->title; $theWhere = array('id='.$this->uid); $dbr->update('page_make_up', $theData,$theWhere); $dbr->commit(); } ...
Thats the problem: the response.php is a standalone file. No claases are integrated. It's only called from the ajax request. So none global vars and/or claases are implemented.
Hope someone can understand my problem.
regards mic
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Mathias Conradt schrieb:
Ok, so if it needs to be standalone and cannot include any wiki files for db support, you can implement your own code to retrieve the database connection - taking the DB settings from the LocalSettings.php, which would mean you at least have to include them. Or hard code them again into the Response.php.
I don't exactly see where the problem is? You want to avoid implementing your own code for the database connection retrieval? You want to avoid storing the connection info (username, pw, etc.) in two different places?
(Why does it need to be standalone in the first place? Wouldn't it make things easier using the Wiki classes? We use the SpecialPage as well to handle the Ajax requests, not a complete standalone page)
On 9/12/07, Michael Heyder Info@hafenvolleyballer.de wrote:
Mathias Conradt schrieb:
Use the wfGetDB function in response.php to retrieve the data (i.e. articles) from the database.
... $theDoc->updateTitle(); ... public function updateTitle() { $dbr = wfGetDB( DB_SLAVE ); $theData = array(); $theData['title'] = $this->title; $theWhere = array('id='.$this->uid); $dbr->update('page_make_up', $theData,$theWhere); $dbr->commit(); } ...
Thats the problem: the response.php is a standalone file. No claases are integrated. It's only called from the ajax request. So none global vars and/or claases are implemented.
Hope someone can understand my problem.
regards mic
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
------------------------------- We use the SpecialPage as well to handle the Ajax requests, not a complete standalone page)
I tried it, but failes
require_once './includes/WizardBase.php'; $wgAutoloadClasses['naw_WizardFunctions']='./extensions/NewArticleWizard/NewArticleWizardFunctions.php';
class NewArticleWizard extends SpecialPage implements WizardBase { function __construct() { global $wgRequest, $wgUser, $wgParser, $wgTitle,$wgOut; } } and my wizard.js var myAjax = new Ajax.Request('/wiki/extensions/NewArticleWizard/NewArticleWizard.php', { method: 'post', postBody: 'title='+elem1.value, onSuccess: function(e) { $('edit_title').innerHTML= e.responseText;
} }); return false; } regards
What's the error message of the failure?
Of course you have to implement the logic to do something with the Ajax-request in the execute-method.
wizard.js: postBody: 'title='+elem1.value+'&action=editTitle',
and in NewArticleWizard.php something like
function execute( $par ) { global $wgRequest, $wgOut;
$this->setHeaders(); //var_dump($_REQUEST); switch (@$_REQUEST['action']){ case 'editTitle': Documentation::insert($_REQUEST['title']); break; ...
On 9/12/07, Michael Heyder Info@hafenvolleyballer.de wrote:
Mathias Conradt schrieb:
Ok, so if it needs to be standalone and cannot include any wiki files for db support, you can implement your own code to retrieve the database connection - taking the DB settings from the LocalSettings.php, which would mean you at least have to include them. Or hard code them again into the Response.php.
I don't exactly see where the problem is? You want to avoid implementing your own code for the database connection retrieval? You want to avoid storing the connection info (username, pw, etc.) in two different places?
(Why does it need to be standalone in the first place? Wouldn't it make things easier using the Wiki classes? We use the SpecialPage as well to handle the Ajax requests, not a complete standalone page)
On 9/12/07, Michael Heyder Info@hafenvolleyballer.de wrote:
Mathias Conradt schrieb:
Use the wfGetDB function in response.php to retrieve the data (i.e. articles) from the database.
... $theDoc->updateTitle(); ... public function updateTitle() { $dbr = wfGetDB( DB_SLAVE ); $theData = array(); $theData['title'] = $this->title; $theWhere = array('id='.$this->uid); $dbr->update('page_make_up', $theData,$theWhere); $dbr->commit(); } ...
Thats the problem: the response.php is a standalone file. No claases are integrated. It's only called from the ajax request. So none global vars and/or claases are implemented.
Hope someone can understand my problem.
regards mic
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
We use the SpecialPage as well to handle the Ajax requests, not a complete standalone page)
I tried it, but failes
require_once './includes/WizardBase.php'; $wgAutoloadClasses['naw_WizardFunctions']='./extensions/NewArticleWizard/NewArticleWizardFunctions.php';
class NewArticleWizard extends SpecialPage implements WizardBase { function __construct() { global $wgRequest, $wgUser, $wgParser, $wgTitle,$wgOut; } } and my wizard.js var myAjax = new Ajax.Request('/wiki/extensions/NewArticleWizard/NewArticleWizard.php', { method: 'post', postBody: 'title='+elem1.value, onSuccess: function(e) { $('edit_title').innerHTML= e.responseText;
} }); return false; }
regards
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org