| 4 | 
  * $Id$ | 
  * $Id$ | 
| 5 | 
  * | 
  * | 
| 6 | 
  * $Log$ | 
  * $Log$ | 
| 7 | 
  | 
  * Revision 1.12  2003/04/18 13:40:54  jonen | 
| 8 | 
  | 
  * + added 'topic' to requested vars which will currently be merged with the 'ap' var | 
| 9 | 
  | 
  * | 
| 10 | 
  | 
  * Revision 1.11  2003/04/11 00:51:10  joko | 
| 11 | 
  | 
  * minor update: just testing stuff... | 
| 12 | 
  | 
  * | 
| 13 | 
  | 
  * Revision 1.10  2003/04/10 06:03:26  joko | 
| 14 | 
  | 
  * ++ renamed keys: 'ecom_data_form_edit', 'ecom_data_form_cancel' through 'ecom_data_action_edit', 'ecom_data_action_cancel' | 
| 15 | 
  | 
  * + new key: 'ecom_data_action_delete' | 
| 16 | 
  | 
  * + Action.Delete: not really, since it's inside component in fact (self-contained ecom) | 
| 17 | 
  | 
  * | 
| 18 | 
  | 
  * Revision 1.9  2003/04/09 00:05:50  jonen | 
| 19 | 
  | 
  * added request values and functions needed for extended form handling | 
| 20 | 
  | 
  * | 
| 21 | 
  | 
  * Revision 1.8  2003/04/08 17:53:08  joko | 
| 22 | 
  | 
  * NEW: Module 'RemoteAction' in 'phase_startup' | 
| 23 | 
  | 
  * | 
| 24 | 
  * Revision 1.7  2003/04/07 22:32:27  jonen | 
  * Revision 1.7  2003/04/07 22:32:27  jonen | 
| 25 | 
  * + minor changes related to new ecom 'chooser' | 
  * + minor changes related to new ecom 'chooser' | 
| 26 | 
  * | 
  * | 
| 99 | 
     $this->add_model( array( | 
     $this->add_model( array( | 
| 100 | 
       //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), | 
       //args => array( 'classname', 'guid', 'action', 'data_locator_key', 'block' ), | 
| 101 | 
       request_args => array(  | 
       request_args => array(  | 
| 102 | 
  | 
         // ApplicationTopic | 
| 103 | 
  | 
         'topic', | 
| 104 | 
         // ApplicationPage | 
         // ApplicationPage | 
| 105 | 
         'ap', | 
         'ap', | 
| 106 | 
         // important/required parameters for valid ecom-components | 
         // important/required parameters for valid ecom-components | 
| 109 | 
         'ecom_data_locator_key', | 
         'ecom_data_locator_key', | 
| 110 | 
         'ecom_data_ident',  | 
         'ecom_data_ident',  | 
| 111 | 
         'ecom_data_meta',  | 
         'ecom_data_meta',  | 
| 112 | 
         'ecom_data_form_edit', 'ecom_data_form_cancel', | 
         'ecom_data_action_edit', 'ecom_data_action_cancel', 'ecom_data_action_delete',  | 
| 113 | 
  | 
         'ecom_data_form_checkbox', 'ecom_data_form_action', | 
| 114 | 
         'ecom_data_source_key' | 
         'ecom_data_source_key' | 
| 115 | 
       ), | 
       ), | 
| 116 | 
       request_arg => array( | 
       request_arg => array( | 
| 117 | 
  | 
         'topic' => array( query_arg => 't' ), | 
| 118 | 
         'ap' => array( query_arg => 'ap' ), | 
         'ap' => array( query_arg => 'ap' ), | 
| 119 | 
         'ecom_label' => array( query_arg => 'ecl' ), | 
         'ecom_label' => array( query_arg => 'ecl' ), | 
| 120 | 
         'ecom_type' => array( query_arg => 'ect' ), | 
         'ecom_type' => array( query_arg => 'ect' ), | 
| 123 | 
         'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), | 
         'ecom_data_locator_key' => array( query_arg => 'ecdlk' ), | 
| 124 | 
         'ecom_data_ident' => array( query_arg => 'ecdid' ), | 
         'ecom_data_ident' => array( query_arg => 'ecdid' ), | 
| 125 | 
         'ecom_data_meta' => array( query_arg => 'ecdm' ), | 
         'ecom_data_meta' => array( query_arg => 'ecdm' ), | 
| 126 | 
         'ecom_data_form_edit' => array( query_arg => 'ecdfe' ), | 
         'ecom_data_action_edit' => array( query_arg => 'ecdfe' ), | 
| 127 | 
         'ecom_data_form_cancel' => array( query_arg => 'ecdfc' ), | 
         'ecom_data_action_cancel' => array( query_arg => 'ecdfc' ), | 
| 128 | 
  | 
         'ecom_data_action_delete' => array( query_arg => 'ecdfd' ), | 
| 129 | 
  | 
         'ecom_data_form_action' => array( query_arg => 'ecdfa' ), | 
| 130 | 
  | 
         'ecom_data_form_checkbox' => array( query_arg => 'checkbox' ), | 
| 131 | 
         'ecom_data_source_key' => array( query_arg => 'ecds' ), | 
         'ecom_data_source_key' => array( query_arg => 'ecds' ), | 
| 132 | 
       ), | 
       ), | 
| 133 | 
  | 
  | 
| 188 | 
  | 
  | 
| 189 | 
       rules => array( | 
       rules => array( | 
| 190 | 
          | 
          | 
 | 
  | 
  | 
| 191 | 
         // get last page state | 
         // get last page state | 
| 192 | 
         create_function('&$_in, &$_out', ' | 
         create_function('&$_in, &$_out', ' | 
| 193 | 
           $requestTracker = mkObject("Application::Request::Tracker"); | 
           $requestTracker = mkObject("Application::Request::Tracker"); | 
| 204 | 
           $_out = $pre_out; | 
           $_out = $pre_out; | 
| 205 | 
         '), | 
         '), | 
| 206 | 
  | 
  | 
| 207 | 
  | 
         // reset machine | 
| 208 | 
  | 
         create_function('&$_in, &$_out', ' | 
| 209 | 
  | 
             // HACK!!! | 
| 210 | 
  | 
             // FIXME: review and implement in a more clean way? | 
| 211 | 
  | 
             //print "RESET!<br/>"; | 
| 212 | 
  | 
              | 
| 213 | 
  | 
             $_out[options][ecoms][phase_startup] = "RESET"; | 
| 214 | 
  | 
         '), | 
| 215 | 
  | 
  | 
| 216 | 
         // rewrite idents | 
         // rewrite idents | 
| 217 | 
         create_function('&$_in, &$_out', ' | 
         create_function('&$_in, &$_out', ' | 
| 218 | 
  | 
            // map Topic to Page if exists | 
| 219 | 
  | 
            if($_in[topic]) { | 
| 220 | 
  | 
             $_in[ap] = $_in[topic]; | 
| 221 | 
  | 
           } | 
| 222 | 
           $idents = array ( ap, ); | 
           $idents = array ( ap, ); | 
| 223 | 
           foreach($idents as $key) { | 
           foreach($idents as $key) { | 
| 224 | 
             $_out[options][idents][$key] = $_in[$key]; | 
             $_out[options][idents][$key] = $_in[$key]; | 
| 230 | 
  | 
  | 
| 231 | 
         // write components variables to out | 
         // write components variables to out | 
| 232 | 
         create_function('&$_in, &$_out', ' | 
         create_function('&$_in, &$_out', ' | 
| 233 | 
           $vars = array( ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta ); | 
           $vars = array(  | 
| 234 | 
  | 
             ecom_type, ecom_abstract_type, ecom_mode, ecom_data_locator_key, ecom_data_ident, ecom_data_meta | 
| 235 | 
  | 
           ); | 
| 236 | 
  | 
           //  ecom_call_method, ecom_call_args | 
| 237 | 
           if($_in[ecom_label]) { | 
           if($_in[ecom_label]) { | 
| 238 | 
             foreach($vars as $key) { | 
             foreach($vars as $key) { | 
| 239 | 
               if($_in[$key]) { | 
               if($_in[$key]) { | 
| 268 | 
           return; | 
           return; | 
| 269 | 
         '), | 
         '), | 
| 270 | 
  | 
  | 
| 271 | 
  | 
  | 
| 272 | 
  | 
         // handle data form action(button) | 
| 273 | 
  | 
         create_function('&$_in, &$_out', ' | 
| 274 | 
  | 
           $label = $_in[ecom_label]; | 
| 275 | 
  | 
           if($_in[ecom_data_form_action] && is_array($_in[ecom_data_form_checkbox])) { | 
| 276 | 
  | 
             $cnt = sizeof($_in[ecom_data_form_checkbox]); | 
| 277 | 
  | 
             if($cnt == 1) { | 
| 278 | 
  | 
               foreach($_in[ecom_data_form_checkbox] as $ident) { | 
| 279 | 
  | 
                 $_out[options][ecoms][$label][ecom_data_ident] = $ident; | 
| 280 | 
  | 
               } | 
| 281 | 
  | 
               $_out[options][ecoms][$label][ecom_data_meta] = $_in[ecom_data_ident]; | 
| 282 | 
  | 
               $_out[options][ecoms][$label][ecom_mode] = $_in[ecom_data_form_action]; | 
| 283 | 
  | 
               $_out[options][ecoms][$label][ecom_abstract_type] = "item"; | 
| 284 | 
  | 
             } else { | 
| 285 | 
  | 
               // TODO: implement multi-selection actions on rows(items) here!! | 
| 286 | 
  | 
             } | 
| 287 | 
  | 
           } | 
| 288 | 
  | 
         '), | 
| 289 | 
  | 
  | 
| 290 | 
  | 
  | 
| 291 | 
         // handle data form buttons | 
         // handle data form buttons | 
| 292 | 
         create_function('&$_in, &$_out', ' | 
         create_function('&$_in, &$_out', ' | 
| 293 | 
           $label = $_in[ecom_label]; | 
           $label = $_in[ecom_label]; | 
| 294 | 
           if($_in[ecom_data_form_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } | 
           if($_in[ecom_data_action_edit]) { $_out[options][ecoms][$label][ecom_mode] = "edit"; } | 
| 295 | 
           if($_in[ecom_data_form_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } | 
           if($_in[ecom_data_action_cancel]) { $_out[options][ecoms][$label][ecom_mode] = "view"; } | 
| 296 | 
  | 
            | 
| 297 | 
  | 
           // Action.Delete [new of 2003-04-09] | 
| 298 | 
  | 
           if ($_in[ecom_data_action_delete]) { | 
| 299 | 
  | 
              | 
| 300 | 
  | 
             //$_out[options][ecoms][content][ecom_mode] = "view"; | 
| 301 | 
  | 
  | 
| 302 | 
  | 
             // the code here vanished to the component itself! | 
| 303 | 
  | 
             // could/should we do this for "edit" and/or "view" actions as well? | 
| 304 | 
  | 
             // look at ecom/FlexibleDataItem! | 
| 305 | 
  | 
  | 
| 306 | 
  | 
           } | 
| 307 | 
  | 
          | 
| 308 | 
         '), | 
         '), | 
| 309 | 
  | 
  | 
| 310 | 
         // propagate datasources to ecoms | 
         // propagate datasources to ecoms | 
| 313 | 
         // datasource if requested - otherwise everything will fall back to defaults | 
         // datasource if requested - otherwise everything will fall back to defaults | 
| 314 | 
         create_function('&$_in, &$_out', ' | 
         create_function('&$_in, &$_out', ' | 
| 315 | 
           if ($_in[ecom_data_source_key]) { | 
           if ($_in[ecom_data_source_key]) { | 
| 316 | 
  | 
              | 
| 317 | 
  | 
             print "YAI: ecom_data_source_key<br/>"; | 
| 318 | 
  | 
              | 
| 319 | 
             //print Dumper($_out[options][ecoms]); | 
             //print Dumper($_out[options][ecoms]); | 
| 320 | 
             //print "ds: " . $_in[ecom_data_source_key] . "<br/>"; | 
             //print "ds: " . $_in[ecom_data_source_key] . "<br/>"; | 
| 321 | 
             /* | 
             /* | 
| 326 | 
             } | 
             } | 
| 327 | 
             */ | 
             */ | 
| 328 | 
             $_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; | 
             $_out[options][main][ecom_data_source_key] = $_in[ecom_data_source_key]; | 
| 329 | 
  | 
  | 
| 330 | 
  | 
  | 
| 331 | 
  | 
             // 2003-04-07 - enhanced | 
| 332 | 
  | 
             // now activates a special ecom-component - a "RemoteAction" - replacing | 
| 333 | 
  | 
             // the "content"-ecom instead of displaying an empty page / overriding any | 
| 334 | 
  | 
             // view reached by "normal dispatching" | 
| 335 | 
  | 
  | 
| 336 | 
  | 
             $_out[options][ecoms][phase_startup] = array( | 
| 337 | 
  | 
               ecom_type => "call", | 
| 338 | 
  | 
               ecom_abstract_type => "auto", | 
| 339 | 
  | 
               ecom_mode => "link", | 
| 340 | 
  | 
               ecom_data_locator_key => "rpc", | 
| 341 | 
  | 
               // new attributes/properties/arguments that control further / trigger different DataFlow: | 
| 342 | 
  | 
               // FIXME: add these to declaration at top! | 
| 343 | 
  | 
               ecom_call_method => "selectSource", | 
| 344 | 
  | 
               ecom_call_args => $_in[ecom_data_source_key] | 
| 345 | 
  | 
             ); | 
| 346 | 
  | 
  | 
| 347 | 
           } | 
           } | 
| 348 | 
         '), | 
         '), | 
| 349 | 
          | 
          |