root/dev/mods/xajax/xajax_core/xajaxPlugin.inc.php @ 259

Revision 259, 5.0 KB (checked in by exi, 13 years ago)

Including the xajax mod into svn

Line 
1<?php
2/*
3        File: xajaxPlugin.inc.php
4
5        Contains the xajaxPlugin class
6
7        Title: xajaxPlugin class
8
9        Please see <copyright.inc.php> for a detailed description, copyright
10        and license information.
11*/
12
13/*
14        @package xajax
15        @version $Id: xajaxPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
16        @copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
17        @license http://www.xajaxproject.org/bsd_license.txt BSD License
18*/
19
20/*
21        Class: xajaxPlugin
22       
23        The base class for all xajax plugins.
24*/
25class xajaxPlugin
26{
27}
28
29/*
30        Class: xajaxRequestPlugin
31       
32        The base class for all xajax request plugins.
33       
34        Request plugins handle the registration, client script generation and processing of
35        xajax enabled requests.  Each plugin should have a unique signature for both
36        the registration and processing of requests.  During registration, the user will
37        specify a type which will allow the plugin to detect and handle it.  During client
38        script generation, the plugin will generate a <xajax.request> stub with the
39        prescribed call options and request signature.  During request processing, the
40        plugin will detect the signature generated previously and process the request
41        accordingly.
42*/
43class xajaxRequestPlugin extends xajaxPlugin
44{
45        /*
46                Function: configure
47               
48                Called by the <xajaxPluginManager> when a configuration setting is changing.
49                Plugins should store a local copy of the settings they wish to use during
50                registration, client script generation or request processing.
51        */
52        function configure($sName, $mValue)
53        {
54        }
55       
56        /*
57                Function: register
58               
59                Called by the <xajaxPluginManager> when a user script when a function, event
60                or callable object is to be registered.  Additional plugins may support other
61                registration types.
62        */
63        function register($aArgs)
64        {
65                return false;
66        }
67       
68        /*
69                Function: generateClientScript
70               
71                Called by <xajaxPluginManager> when the page's HTML is being sent to the browser.
72                This allows each plugin to inject some script / style or other appropriate tags
73                into the HEAD of the document.  Each block must be appropriately enclosed, meaning
74                javascript code must be enclosed in SCRIPT and /SCRIPT tags.
75        */
76        function generateClientScript()
77        {
78        }
79       
80        /*
81                Function: canProcessRequest
82               
83                Called by the <xajaxPluginManager> when a request has been received to determine
84                if the request is for a xajax enabled function or for the initial page load.
85        */
86        function canProcessRequest()
87        {
88                return false;
89        }
90       
91        /*
92                Function: processRequest
93               
94                Called by the <xajaxPluginManager> when a request is being processed.  This
95                will only occur when <xajax> has determined that the current request is a valid
96                (registered) xajax enabled function via <xajax->canProcessRequest>.
97        */
98        function processRequest()
99        {
100                return false;
101        }
102}
103
104/*
105        Class: xajaxResponsePlugin
106       
107        Base class for all xajax response plugins.
108       
109        A response plugin provides additional services not already provided by the
110        <xajaxResponse> class with regard to sending response commands to the
111        client.  In addition, a response command may send javascript to the browser
112        at page load to aid in the processing of it's response commands.
113*/
114class xajaxResponsePlugin extends xajaxPlugin
115{
116        /*
117                Object: objResponse
118               
119                A reference to the current <xajaxResponse> object that is being used
120                to build the response that will be sent to the client browser.
121        */
122        var $objResponse;
123       
124        /*
125                Function: setResponse
126               
127                Called by the <xajaxResponse> object that is currently being used
128                to build the response that will be sent to the client browser.
129               
130                objResponse - (object):  A reference to the <xajaxResponse> object
131        */
132        function setResponse(&$objResponse)
133        {
134                $this->objResponse =& $objResponse;
135        }
136       
137        /*
138                Function: addCommand
139               
140                Used internally to add a command to the response command list.  This
141                will call <xajaxResponse->addPluginCommand> using the reference provided
142                in <xajaxResponsePlugin->setResponse>.
143        */
144        function addCommand($aAttributes, $sData)
145        {
146                $this->objResponse->addPluginCommand($this, $aAttributes, $sData);
147        }
148       
149        /*
150                Function: getName
151               
152                Called by the <xajaxPluginManager> when the user script requests a plugin.
153                This name must match the plugin name requested in the called to
154                <xajaxResponse->plugin>.
155        */
156        function getName()
157        {
158//SkipDebug
159                $objLanguageManager =& xajaxLanguageManager::getInstance();
160                trigger_error(
161                        $objLanguageManager->getText('XJXPLG:GNERR:01')
162                        , E_USER_ERROR
163                        );
164//EndSkipDebug
165        }
166       
167        /*
168                Function: process
169               
170                Called by <xajaxResponse> when a user script requests the service of a
171                response plugin.  The parameters provided by the user will be used to
172                determine which response command and parameters will be sent to the
173                client upon completion of the xajax request process.
174        */
175        function process()
176        {
177//SkipDebug
178                $objLanguageManager =& xajaxLanguageManager::getInstance();
179                trigger_error(
180                        $objLanguageManager->getText('XJXPLG:PERR:01')
181                        , E_USER_ERROR
182                        );
183//EndSkipDebug
184        }
185}
Note: See TracBrowser for help on using the browser.