]project-open[ : @This Wiki
Portrait

Welcome, Unregistered Visitor

 ·  ·  ·  Contact ·  Index · Login · Register

Contents

Remote Training
Support
SaaS Service

3 registered users
 in last 24 hours

Creating Sencha AJAX Portlets and Widgets

This howto document guides you through the process of developing GUI elements using the Sencha JavaScript AJAX library. It will show you how to extend ]project-open[ without having to know the TCL language.

As an example for this tutorial we will use the "sales pipeline" of a company that consists of the value of all potential projects weighted by their sales probability.

Data Source

We start off by defining a SQL query that provides us with the data that we want to show.

select  p.project_status_id,
        im_category_from_id(p.project_status_id) as project_status,
        sum(coalesce(p.presales_value, p.cost_quotes_cache) * coalesce(p.presales_probability, 0.01)) as value
from    im_projects p
where   p.parent_id is null and
        p.project_status_id in (select * from im_sub_categories(71))
group by p.project_status_id
order by p.project_status_id

In this query we are looking at the project values "presales_value" and "presales_probability" in order to calculate the value of the portfolio:

  • coalesce(...): We also can take the quoted amount of the project if the presales values is not defined and "1%"
    if the probability is not defined. "coalesce" returns the first of its arguments that is not null.
  • p.parent_id is null: We only want to look at main projects (exclude sub-projects that have parent_id set).
  • p.project_status in (select * from im_sub_categories(71)): "71" represents the project status "potential".
    Below "potential" there can also be additional states which im_sub_categories() will return.

We will now "deploy" this SQL as a dynamic report in the Reporting package:

  • Go to Reporting -> New Report and enter the SQL into the Report SQL field.
  • Other fields: Name = "REST Presales Pipeline", Report Code = "rest_presales_pipeline",
    Report Group = "REST System Reports", Sort Order = 10,
    Description = "Returns the value and probability of potential projects."
  • Go to Reporting and click on the "REST Presales Pipeline" link so check the results of the report.
    Please go to Projects and create a number of potential projects with presales values and presales probability in order to create reasonable sample data for your data source.

Now we will check the JSON data of this report. Please observe the URL of the page showing the report results, where we are not going to add a URL parameter "format=json".

  • http://<server>/intranet-reporting/view?report_id=64012&format=json
As an alternative to report_id we can also use the report code that we entered during the creation of the report. This is the recommended way to reference a report, because the report_id will be different across different ]po[ systems:
  • http://<server>/intranet-reporting/view?report_code=rest_presales_pipeline&format=json

Static Page

 

 

The following example assumes that the package intranet-rest is installed in your system. intranet-rest contains the Sencha libraries and resources. Also, at the moment you need a symbolic link in ~/www/ to the "resources" subdirectory of intrane-sencha:

# cd ~/www/
# ls -l | grep resources
resources -> ../packages/intranet-sencha/www/resources/

The source code of the sample is available at /packages/intranet-sencha/www/sales-pipeline.adp

Wrapping the Widget as a Portlet

In this section we will take the static HTML page above and wrap this page as a ]po[ portlet.

ToDo


Please take a moment to complete this form to help us improve our service.

Note:
Please only provide feedback in regards to content this page shows. For support inquiries please refer either to the Community Support forum at Sourceforge or check out our 'Professional Support'

Did this page help you to achieve your goal?

 Yes  No  Don't know

Please provide us with comments to improve this page:

How useful is the information?

 1  2  3  4  5
Not
useful
      Extremely
useful
 
  

Explore

Installers
Demo Server
Modules & Functionality
Packages
Business Processes supported
FAQ's

Help

Getting started
User Manuals
Configuration Manuals
Community Support
Professional Support

News

News
Twitter
RSS Community / Sourceforge
Register for Newsletter

Get in touch

Contact
Register



Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Generic License - Privacy Policy