Config (element)

From JRapid

Jump to: navigation, search

config is an element, child of app.


Contents

Description

The config element is used to declare global statements. A global statement affects all HTML pages inside the project.

This element is commonly used to import Community Add-Ons like Widgets, Views and Transformers and external JavaScript and CSS files into the project.

Child elements of config are:

  • labels: customize buttons and labels text.
  • theme: set default theme and layout.
  • usescript: used to call an external JavaScript file.
  • usestylesheet: used to call an external CSS file.
  • useview, usewidget: used to import either a View or Widget.
  • restrict: used to add global security for all your HTML pages.

Attributes of config are:

  • uploadpath: overrides the default path to the uploaded files directory.

JRapid Designer

The web-based designer has a Config Editor where you can edit or add new JavaScript or CSS declarations.

Editing Config Window

Usage

<config 
        uploadpath = UPLOAD_PATH
        ((labels|usescript|usestylesheet|usewidget|useview|restrict)*)
/>


Examples

  • Include a JavaScript file:
<app>
 ...
 <config>
     ...
     <usescript location="../js/scripts.js"/>
     ...
 </config>
 ...
</app>
  • Include a CSS file:
<app>
 ...
 <config>
     ...
     <usestylesheet location="../css/styles.css"/>
     ...
 </config>
 ...
</app>
  • Import Community Add-Ons(View or Widget):

The <useview> and <usewidget> elements are automatically added to the <config> element after the first generation since the item is imported.

<app>
 ...
 <config>
     ...
     <useview ... />
     <usewidget ... />
     ...
 </config>
 ...
</app>
  • Adding Basic Access Authentication to all the HTML pages in the project:

This is done by using the restriction element.

<config>
   ...
   <restrict authentication="basic"> 
      <allow privilege="ADMIN" />
      <user name="your_username" password="your_password" privileges="ADMIN" /> 
   </restrict>
   ... 
</config> 
  • Adding a default theme, layout and UI behavior.

This is done by using the theme element.

<config>
   ...
   <theme forms="default" layout="desktop" listing="basic" tags="flash"/>
   ...
</config> 

See also

Personal tools