Owncloud App Development Manual
Owncloud App Development Manual
in 60 minutes
Page 1 of 2
How to start
All the ownCloud code is located at gitorious.org [7] In the apps repository are a lot of application located that you can use to look into and learn how an ownCloud application is structured. [1] Before you start, please check if there already is a similar app you could contribute to. For the beginning we suggest to use the application template as a starting point for the development. [2] You can always ask questions on the mailinglists, forum or the chat channel. You nd all the possible ways to contact the core team here: [3]
l10n Put your translations into this folder if you want to support more than english. As soon as the translation detects a l10n folder it knows that this program is translatable. You nd more information about the translation system here [6] lib Please put you application logic, classes and functions into php les in this folder. ownCloud uses the MVC principle. The libraries represent the model. Basically all data should be handled here so the php les the user calls only interact with the library. If you have a look at the lib folder in, for example the contacts app, you will see three les: addressbook. php, hooks.php and connector_sabre.php. addressbook.php contains all methods that are required for handling addresses. We mostly use the classes as namespaces and write static functions, real OOP with dynamicaly instansiated objects is only used if it is useful. templates Templates for your userinterface should go into this folder. ownCloud has its own template system. The templates are php les that are included by OC_Template. Having a look at an example le should show you everything you need to know. The variables are assigned by using $tmpl>assign(name, value);, You nd more information here [4] The API You nd the complete API documentation here [4] The most important calls are: OCP\App::addNavigationEntry This adds an navigation of your application to the main navigation on the left. You usually call this in app.php
OCP\App::setActiveNavigationEntry This calls activated a navigation entry. You do this when inside your application OCP\App::registerPersonal You can use this call to register an personal settings section on the user settings page. OCP\App::registerAdmin You can use this call to register an admin settings section on the main admin page. OCP\Cong::getUserValue Use this call to to read a setting for the currently logged in user from the settings store. OCP\Cong::setUserValue Use this call to to write a setting for the currently logged in user to the settings store. OCP\DB::prepare Prepare an SQL statement for execution. OCP\User::isLoggedIn Check if a user is currently logged in. OCP\Util::addscript Load an additional JS script OCP\Util::addStyle Load an additional CSS style
[1] https://github.com/owncloud/apps [2] https://github.com/owncloud/apps/ tree/master/appframework [3] http://owncloud.org/contact/ [4] http://owncloud.org/dev/apps/ getting-started/ [5] http://api.owncloud.org [6] http://owncloud.org/dev/translation/ [7] https://github.com/owncloud
Page 2 of 2
ownCloud, Inc. 10 Foster Road Lexington, MA 02421 United States mail: [email protected] phone: +1 (877) 394-2030 https://www.owncloud.com