OrangeScape Developer Community

A community for Application Developers on OrangeScape's Platform-as-a-Service

Theming your applications - Server Side API

Template Engines are used to process web templates and content information to produce web pages, documents...

OrangeScape has been using MAKO templates. In your themes you would have used MAKO to get UserName, login / logout urls etc...

${user.FirstName}

${log_out_url}

${home_url}

From the next build we are migrating to a new Template Engine called Cheetah.  The main reasons for the switch in template engine are

  • An Overall preview from within Studio

  • .nET support (Windows Azure)

The following API calls are available



Context

context.getGlobal()

This method returns the Global model object. The values that are defined in the global model can be obtained by using the getValue(‘fieldname’) method

$context.getGlobal().getValue(‘Name’)

Top

context.getCompany()

This method returns the Company model object of the currently logged in user. The values that are defined in the Company model can be obtained by using the getValue() method.

$context.getCompany().getValue(‘SheetId’)

Top

context.getUser()

This method returns the User model object of the currently logged in user.  The values that are defined in the User model can be obtained by using the getValue() method.

$context.getUser().getValue(‘UserId’)

Top

context.getUserLogin()

This method returns the UserLoginModel model object of the currently logged in user. The values that are defined in the UserLoginModel model can be obtained by using the getValue() method.

$context.getUserLogin().getValue(‘LoginDate’)

Top

context.getInstance(modelName, instanceId)

This method returns object of the model that you request. The values that are defined in that model can be obtained by using the getValue() method.

If I have a model called TravelExpense and I want to fetch the value of the field RequestId for the record id ‘TE00001’ then the following will return the value of the field.

$context.getInstance(‘TravelExpense’, ‘TE00001’).getValue(‘RequestId’)

Top

context.getNative()


Top

HttpRequest

httprequest.getSessionId()

This method returns the sessionId.

$httprequest.getSessionId()

Top

httprequest.getParameters()

This method returns the parameter values which are part of the request URL. If the url is like http://hostname/appid/1/sheet?searchBy=UserId  the you can get the value of the parameter searchBy as follows

$httprequest.getParamters(‘SearchBy’)

Top

httprequest.getNative()


Top

Metadata

metadata.getApplication()

This method returns the Application object, which has details like Application Name, Application Id, etc...

If you want to get the Application Id of your Application, you will use as follows

$metadata.getApplication().getSheetId()

Top

metadata.getModel(modelName)

This method returns the Model object of the specified Model, which contains information like all public fields, private fields, list of actions, etc...

Top

metadata.getMenu()

This method returns the menu json of the application, for the currently logged in user.

$metadata.getMenu()

Top

metadata.getNative()


Top

Helper

helper.getHomeUrl()

This method returns the Home page URL.

$helper.getHomeUrl()

Top

helper.getLogoutUrl()

This method returns the Logout URL

$helper.getLogoutUrl()

Top

helper.getToday()

This method returns the current date and time

$helper.getToday()

Top

Path

common_static_path

This method returns the path to the folder where the system’s static files like Style Sheets, Javascript files, JSTL etc,... are kept.

${common_static_path}/common/scripts/jquery.js

Top

application_static_path

This method returns the path to the folder where the application’s static files like Style Sheets, Javascript files etc,... are kept.

${application_static_path}/static/images/header_bg.jpg

Top

template_path

This method returns the path to the folder with other Cheetah templates.

Top

jstl_path

This method is used to access the Applications Generated JSTL files.

Top


Default Template Files

The Default Template Files are:

index.html*

layout.html*

import.html

theme.html

header.html

footer.html

system files. DO NOT MODIFY


The Default arrangement of the Template files is as shown in the picture.

index.html

This is the main container. This file has all the imports which the system requires. This file should not be modified / be a part of the theme.

import.html

This is file, which you will use to import your custom css, js and other files

theme.html

This is file, which defines the page appearance that you will get during runtime. You will define the various sections of the page, and where they will appear in this file.

By default there will be defined a header section, a footer section and the middle part where all activities will happen.

header.html

This file defines the arrangement of the top part of the page. This is the file where you the home page / logout urls and menus will be defined by default.

layout.html

This is a system file. This defines and takes care of all application related screens. This file should not be modified / part of the theme.

footer.html

This file defines the arrangement of the bottom of the page.

Views: 165

Comment

You need to be a member of OrangeScape Developer Community to add comments!

Join OrangeScape Developer Community

Comment by Kamal.S on March 27, 2014 at 3:17pm

© 2018   Created by OrangeScape Technologies.   Powered by

Badges  |  Report an Issue  |  Terms of Service