Metadata¶
The metadata.config.php file is how an application is defined. It tells what contains the application and what it does.
The most important keys are:
name: | The name of the application. |
---|---|
namespace: | In which PHP namespace all the classes of the application must be defined. |
icons: | In the 3 standard sizes 16*16, 32*32 and 64*64. |
<?php
return array(
'name' => 'Webpages',
'namespace' => 'Nos\Page',
'version' => '0.2',
'provider' => array(
'name' => 'Novius OS',
),
'icons' => array(
64 => 'static/apps/noviusos_page/img/64/page.png',
32 => 'static/apps/noviusos_page/img/32/page.png',
16 => 'static/apps/noviusos_page/img/16/page.png',
),
'permission' => array(
// Empty array for now. Leave it.
),
'i18n_file' => 'noviusos_page::metadata',
'launchers' => array(
// Optional
),
'enhancers' => array(
// Optional
),
'templates' => array(
// Optional
),
'data_catchers' => array(
// Optional
),
);
An application provides:
Launchers¶
A launcher is an icon on the home tab.
A launcher is defined by an associative array. Key is launcher ID, launcher properties is an associative array :
name: | Text to display for the icon. |
---|---|
icon: | Optional. URL to a 64*64 image, default will use the 64*64 icon of the app. |
action: | What is done when clicking on the launcher. See PHP nosActions. |
<?php
return array(
'launchers' => array(
'noviusos_page' => array(
'name' => 'Webpages',
// 'icon' is not set, so the default icon will be used
'action' => array(
// open a tab
'action' => 'nosTabs',
'tab' => array(
'url' => 'admin/noviusos_page/appdesk/index',
// 'iconUrl' is not set, so the default icon will be used
),
),
),
),
);
Enhancers¶
Enhancers are used in WYSIWYG editors. They provide functionalities for the front-office.
For example, the ‘Forms’ application allows users to insert forms in their web pages (using an enhancer).
URL enhancers, a specific type of enhancers, handle their own URLs. For example, every blog post has an URL.
An enhancer is defined with:
title: | Title of the enhancer displayed when opening the ‘Application’ menu from the wysiwyg. |
---|---|
desc: | Optional. Description of the enhancer. |
iconUrl: | Optional. URL to a 16*16 icon, displayed when opening the ‘Application’ menu from the wysiwyg, default will use the 16*16 icon of the app ; |
enhancer: | URL of the front-office controller used to render the enhancer. |
urlEnhancer: | Same that enhancer.Only one of the two keys can is used, depending if you want an URL enhancer or just a plain regular enhancer. |
previewUrl: | Optional. URL of the controller used to render the preview in the wysiwyg. |
dialog: | Optional. If you want a configuration popup, URL of the controller used to display and save the enhancer configuration. See $container.nosDialog() for the list of parameters. |
<?php
return array(
'noviusos_form' => array(
'title' => 'Form',
'desc' => '',
// Here it's just a regular enhancer
'enhancer' => 'noviusos_form/front/main',
//'urlEnhancer' => 'noviusos_form/front/main',
'iconUrl' => 'static/apps/noviusos_form/img/icons/form-16.png',
// We'll use our controller to generate the preview
'previewUrl' => 'admin/noviusos_form/enhancer/preview',
// And the user has to configure it
'dialog' => array(
'contentUrl' => 'admin/noviusos_form/enhancer/popup',
'width' => 450,
'height' => 400,
'ajax' => true,
),
),
);
Templates¶
Templates are similar to other CMS’ templates or themes. They provide a layout for the front-office.
In Novius OS, a template contains one or more WYSIWYG editable area(s), which are is placed inside a grid.
The grid has a size of cols * rows, and each editable area is positioned using absolute coordinates (it’s similar to position: absolute in CSS).
Each WYSIWYG editable area has:
- a name: it’s the key in the layout array (see below) ;
- a position: absolute coordinates inside the grid (similar to left and top in CSS) ;
- a size: similar to width and height in CSS.
In the end, a template is defined with:
file: | path to the template file (it’s a view) |
---|---|
title: | title of the template, it’s shown when selecting a template for a page |
cols: | grid width (in units) |
rows: | grid height (in units) |
layout: | list of the WYSIWYG editors inside the grid :
|
Here’s an example:
<?php
return array(
'templates' => array(
'top_menu' => array(
'file' => 'noviusos_templates_basic::top_menu',
'title' => 'Default template with a top menu',
'cols' => 1,
'rows' => 1,
'layout' => array(
// There is one WYSIWYG named 'content'
// Position inside the grid: <left>,<top>,<width>,<height>
'content' => '0,0,1,1',
),
),
),
);