mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-03 18:26:42 +07:00
started tutorial
This commit is contained in:
16
developer_manual/app/appframeworktutorial.rst
Normal file
16
developer_manual/app/appframeworktutorial.rst
Normal file
@@ -0,0 +1,16 @@
|
||||
App Tutorial (App Framework)
|
||||
============================
|
||||
This tutorial contains the MVC approach to write an app. The benefits of this approach are:
|
||||
|
||||
* Highest authentication level and security checks are enforced by default and have to explicitely be turned off
|
||||
* Possiblity to use Twig templates which escape XSS by default
|
||||
* Easy to test: The App Framework allows to unittest the whole app by using :doc:`../general/dependencyinjection`
|
||||
* Comes with AngularJS JavaScript code
|
||||
* MVC style
|
||||
|
||||
The disadvantages of this approach are:
|
||||
|
||||
* App Framework app has to be installed
|
||||
* Requires to read more documentation
|
||||
* Possible
|
||||
|
||||
14
developer_manual/app/apptutorial.rst
Normal file
14
developer_manual/app/apptutorial.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
App Tutorial
|
||||
============
|
||||
|
||||
This tutorial contains the traditional approach to write an app. The benefits of this approach are:
|
||||
|
||||
* Not dependant on the App Framework app
|
||||
* Easy and fast to create an app
|
||||
|
||||
The disadvantages of this approach are:
|
||||
|
||||
* No automatic security checks: privilege checks have to be included at the top of each file
|
||||
* No automatic XSS escaping: :class:`OC_Template` does require manual escaping of output
|
||||
* Hard to unittest: Using files instead of Controllers makes it hard to write unittests for the whole application
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Getting Started With App Development
|
||||
====================================
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
.. sectionauthor:: Bernhard Posselt <nukeawhale@gmail.com>
|
||||
|
||||
@@ -8,19 +8,19 @@ Before you start, please check if there already is a `similar app <http://apps.o
|
||||
This tutorial uses the App Framework app, a small framework that makes developing apps easier. To use it, it has to be enabled on the apps settings page.
|
||||
|
||||
|
||||
Getting Started
|
||||
Get the sources
|
||||
---------------
|
||||
There are two ways to obtain ownCloud:
|
||||
|
||||
* Using the stable version
|
||||
* Using the developement version from `GitHub`_
|
||||
|
||||
Using ownCloud stable
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
Using stable
|
||||
~~~~~~~~~~~~
|
||||
`Install the current version of ownCloud <http://doc.owncloud.org/server/5.0/admin_manual/installation.html>`_ and create a new directory in the **apps/** folder.
|
||||
|
||||
Using ownCloud development version
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Using development version (recommended)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
First `set up your webserver and database <http://doc.owncloud.org/server/5.0/admin_manual/installation.html>`_ (**Section**: Manual Installation - Prerequisites).
|
||||
|
||||
@@ -61,50 +61,3 @@ To disable JavaScript and CSS caching you'll have to turn on debugging in :file:
|
||||
.. _set up ownCloud: http://doc.owncloud.org/server/5.0/admin_manual/installation.html
|
||||
|
||||
|
||||
Create your app
|
||||
---------------
|
||||
The best way to create your application is to simply modify the `Advanced Apptemplate <https://github.com/owncloud/apps/tree/master/apptemplateadvanced>`_.
|
||||
|
||||
To do that simply make a copy and :ref:`modify <modify>` the Advanced Apptemplate:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd /var/www/apps
|
||||
sudo cp -r apptemplateadvanced yourappname
|
||||
sudo chown -R youruser:yourgroup yourappname
|
||||
|
||||
To enable your app, simply link it into the apps directory:
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo ln -s /var/www/apps/yourappname /var/www/owncloud/apps/yourappname
|
||||
|
||||
or create a second apps directory in your :file:`owncloud/config/config.php` (see :doc:`../core/configfile`)
|
||||
|
||||
.. note:: Don't forget to enable your app and the App Framework app on the apps settings page!
|
||||
|
||||
Now change into your app directory::
|
||||
|
||||
cd /var/www/apps/yourappname
|
||||
|
||||
|
||||
.. _modify:
|
||||
|
||||
Modify Advanced Apptemplate
|
||||
---------------------------
|
||||
You will want to replace the boilerplate code in the Apptemplate.
|
||||
|
||||
The following things will need to be changed:
|
||||
|
||||
* In every file: AGPL Headers
|
||||
* In every file: **namespace OCA\\AppTemplateAdvanced** to **namespace OCA\\YourAppName**
|
||||
* :file:`dependencyinjection/dicontainer.php`: The **parent::__construct('apptemplateadvanced')** to **parent::__construct('yourappname')**
|
||||
* :file:`appinfo/info.xml`: :ref:`your personal settings <xml>`
|
||||
* :file:`appinfo/app.php`: the correct navigation settings
|
||||
* :file:`appinfo/routes.php`: the name of the routes
|
||||
* :file:`coffee/app.coffee`: the route names
|
||||
|
||||
.. todo::
|
||||
|
||||
Provide some sed commands for simple transformation
|
||||
|
||||
@@ -6,6 +6,8 @@ App Developement
|
||||
:maxdepth: 1
|
||||
|
||||
gettingstarted
|
||||
apptutorial
|
||||
appframeworktutorial
|
||||
settings
|
||||
classloader
|
||||
api
|
||||
|
||||
@@ -44,7 +44,17 @@ General instructions how to build your apps using the AppFramework app.
|
||||
|
||||
If the app is finished, it can be published in the `ownCloud app store <http://apps.owncloud.com/>`_
|
||||
|
||||
Tutorial
|
||||
--------
|
||||
|
||||
* :doc:`app/gettingstarted`
|
||||
|
||||
You can choose between the traditional and MVC style (App Framework) approach. In case of the App Framework, the App Framework app has to be installed and enabled.
|
||||
|
||||
* :doc:`app/apptutorial` | :doc:`app/appframeworktutorial`
|
||||
|
||||
Basics
|
||||
------
|
||||
* :doc:`app/settings`
|
||||
* :doc:`app/classloader`
|
||||
* :doc:`app/api` | :php:class:`OCA\\AppFramework\\Core\\API`
|
||||
@@ -142,3 +152,4 @@ Index and Tables
|
||||
.. _Symfony Routing: http://symfony.com/doc/current/components/routing/introduction.html
|
||||
.. _Pimple: http://pimple.sensiolabs.org/
|
||||
.. _PHPUnit: http://www.phpunit.de/manual/current/en/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user