From 41f933cf15bb3f44f96968efa3c5b10f8e091d21 Mon Sep 17 00:00:00 2001 From: leithoff Date: Tue, 31 May 2016 14:39:54 +0200 Subject: [PATCH] Created CodeCorner1 (markdown) --- CodeCorner1.md | 123 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 CodeCorner1.md diff --git a/CodeCorner1.md b/CodeCorner1.md new file mode 100644 index 0000000..8c9f284 --- /dev/null +++ b/CodeCorner1.md @@ -0,0 +1,123 @@ +((Code Corner|Up)) | ((CodeCorner2|the day after)) +*** +On our first day, we had do do some of the stuff of day zero - the "how to get started" stuff - to be up to date. We went through the setup of the eGroupware Application, which is described ((AdminDocs|elsewhere)). + +As first application we decided to do: Hello World +The motivation for this was to learn the very basics of: what does an eGroupware application need. + +Every application needs an application directory within the egroupware tree. +Consider [droyws] the document root of your web-server. +Then [droyws]/Egroupware is the root of your eGroupware-application. +Your own Application, we will baptise it test, for obvious reasons needs a folder "test" just there: +[droyws]/Egroupware/test + +Within test the following structure is needed, for eGroupware to recognize our new application: +*** +```bash +/index.php +/inc +/setup +/setup/setup.inc.php (required) +/setup/tables_current.inc.php (optional) +/templates +/templates/default +/templates/default/images +/templates/default/images/navbar.png (optional) +``` +*** +Obviously ```inc```, ```setup```, ```templates```, ```templates/default``` and ```templates/default/images``` are folders. + +After suplying the structure, you have to register the application with eGroupware. +This is done via the setup area within eGroupware (via the egw/setup/ URL). +But you need the (required) file ```setup.inc.php``` in folder ```$app/setup```. +```$app/setup/setup.inc.php``` should contain the information to setup your application. +*** +```php + 'phpgwapi', + 'versions' => Array('1.8','1.9'), + ); + $setup_info['test']['depends'][] = array( // this is only necessary as long the etemplate-class is not in the api + 'appname' => 'etemplate', + 'versions' => Array('1.6','1.8','1.9'), + ); + +``` +*** +Within the setup area you go to manage Applications (Setup Main Menu) check the name of your application (the name of the folder within the eGroupwaretree, where your Application is going to reside) and click install. +*** +Or you can do it via directly accessing the mySQL database: +```php + INSERT INTO egw_applications (app_name, app_enabled) VALUES('appname', 1); +``` +*** +_**Apply sufficient rights, ...**_ + After adding the entry there you have to allow yourself or your group the access to the newly registered application. + You do that by using the admin/preferences module, choosing Usergroups/Useraccounts , choosing a User or a ::Group and checking the newly registered application. + After logoff/logon you should be able to access the new application via eGroupware. + You will get an error - for sure. Since there is no suitable index.php within the new application subtree. +_**... and some code to the file index.php and off you go.**_ + +The content of test/index.php should include: +*** +```php + array( + 'currentapp'=> 'test' , + 'noheader' => False, + 'nonavbar' => False, +)); +/* + include THE eGroupware header, that takes care of the sessionhandling + and the other background stuff + the information provided above is used/required here in order to get the application running +*/ +include('../header.inc.php'); + +// display some debug content +// _debug_array($GLOBALS['egw_info']); +_debug_array($_REQUEST); + +//Your content…. +echo "Hello World!"; + +//display the eGroupware footer +common::egw_footer(); +``` +*** + +We provided only the starting ``` kl + [last_domain] => default + [ZDEDebuggerPresent] => php,phtml,php3 + [sessionid] => 4714244cc683c6292e5b952273abb048 + [kp3] => 20b9f6fea8a0f6d2d8e99aca3d3b977a + [domain] => default +``` +*** +If you loose your sessionid you loose connection to eGroupware, or to put it straight: eGroupware throws you out. + + +Back to ((Code Corner)) Go on to ((CodeCorner2|the refining of the first days work)) \ No newline at end of file