diff --git a/CodeCorner2.md b/CodeCorner2.md index d543571..78581f9 100644 --- a/CodeCorner2.md +++ b/CodeCorner2.md @@ -133,27 +133,63 @@ var $public_functions = array( 'testinterface' => True, ); ``` -... to our code. - -Much better, but some nagging error in the upper left corner of the frame where our app appears: ```An error occurred``` ... we added - -```php - public function create_header () - { - common::egw_header(); - echo parse_navbar(); - - } - - public function create_footer () - { - common::egw_footer(); - } -``` -so we recieve our inital page o.k. +... to our code. Much better. We recieve our inital page o.k. But on Submit. It just did not work. After some work we figured out that ```$_SERVER['PHP_SELF']``` is pointing to eGroupware Base ```index.php```. So we had to make our form-action more specific: ```php echo "
``` -this is in no way eGroupwarer - style. So this needs further refinement. \ No newline at end of file +this is in no way eGroupwarer - style. So this needs further refinement. We ended up with this whole class +```php + True, + ); + public function testinterface () + { + if (trim($_POST['fname'].$_POST['sname'])!='') + { + echo "
Hello ".$_POST['fname']." ".$_POST['sname']."
"; + echo "link('/index.php',array( + 'menuaction' => 'test.test_ui.testinterface','message'=>'YES'))."' method='post'> + +
"; + } + else + { + echo "Type a name to be greeted accordingly
"; + echo "
link('/index.php',array( + 'menuaction' => 'test.test_ui.testinterface','message'=>'NO'))."' method='post'> +

first name:

+

name:

+ + +
"; + + } + } +} +``` +So what is new here? +It is the link functionality: +```$GLOBALS['egw']->link('/index.php',array('menuaction' => 'test.test_ui.testinterface','message'=>'YES'))``` +It does enable you to call the required function/action of any application and add a key/value pair to that call. + +The whole thing looked like that: +The link functionality provides the possibility to link to internal sites and pass on all internally needed information plus the call of a function with some infos to pass in ```$_GET``` + +So we introduced functions and the call of a function as well. The major way to call functions within eGroupware is, to call them via build in functions that handle the inclusion and instantiation of the needed classes. + +```ExecMethod('test.test_ui.send_request', 'YES');``` +Execute a function, and load a class and include the class file if not done so already. This function is used to create an instance of a class, and if the class file has not been included it will do so. + +```ExecMethod2('test.test_ui.send_request2', 'YES', 'SOME MORE');``` +Execute a function with multiple arguments. The function can take object $GLOBALS[classname] from class if it exists. + +So we fiddled around with that a bit more and called it a day. + +At the campfire we discussed [[Cross Site Scripting|Cross Site Scripting]] and how to handle/avoid that pitfall. +*** +> [Wiki](Home) ▸ [Developer Docs](Developer Docs) ▸ [Code Corner](Code Corner) ▸ **day two** ▸ [day three](CodeCorner3) \ No newline at end of file