Changeset 17716 in main


Ignore:
Timestamp:
01/07/19 18:11:06 (11 months ago)
Author:
GarthBraithwaite_STG
Message:

db, admin, view, java - Added INITIATIVE GOAL and BASELINE values to the db and beans. Added ability to publish the raw INITs. Added updated kendo code to deal with some charts not expanding to 100% when contained within a hidden block. Also added window event to resize the chart. Fixed chart title adding mult \n when grid sort clicked. Added inputOnChangeAttribute to the ContentContainer?.xslt to allow js event handling on expand/collapse. Updated IP and QM result script generations to be similar.

Location:
trunk
Files:
3 added
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/db/src/main/scripts/mysql/data-initiative.sql

    r17596 r17716  
    1515order by SORT_ORDER
    1616;
    17 insert into INITIATIVE_TOPIC_OBJECTIVE(INITIATIVE_TOPIC_NAME, NAME, TITLE, NARRATIVE, DESCRIPTION, TARGET_TITLE, TARGET, SORT_ORDER, ACTIVE_FLAG)
     17insert into INITIATIVE_TOPIC_OBJECTIVE(INITIATIVE_TOPIC_NAME, NAME, TITLE, NARRATIVE, DESCRIPTION, TARGET_LABEL, TARGET_NARRATIVE, SORT_ORDER, ACTIVE_FLAG)
    1818select concat('HP2020.', FOCUS_AREA_NAME), concat('HP2020.', NAME), concat('Healthy People 2020 Objective ', NAME), TITLE, DESCRIPTION, 'U.S. Target', US_TARGET, SORT_ORDER, 'x'
    1919from HEALTHY_PEOPLE_OBJECTIVE
     
    2929
    3030
    31 insert into INITIATIVE_TOPIC_OBJECTIVE(INITIATIVE_TOPIC_NAME, NAME, TITLE, NARRATIVE, DESCRIPTION, TARGET_TITLE, TARGET, SORT_ORDER, ACTIVE_FLAG)
     31insert into INITIATIVE_TOPIC_OBJECTIVE(INITIATIVE_TOPIC_NAME, NAME, TITLE, NARRATIVE, DESCRIPTION, TARGET_LABEL, TARGET_NARRATIVE, SORT_ORDER, ACTIVE_FLAG)
    3232select concat('State.', FOCUS_AREA_NAME), concat('State.', NAME), concat('State Objective ', NAME), TITLE, DESCRIPTION, 'State Target', STATE_TARGET, SORT_ORDER, 'x'
    3333from HEALTHY_PEOPLE_OBJECTIVE
  • trunk/db/src/main/scripts/mysql/tab_c-initative.sql

    r17596 r17716  
    4646  URL                             varchar (1024),                               /* optional link to details: https://www.healthypeople.gov/2020/topics-objectives/topic/respiratory-diseases/objectives */
    4747  /* */
    48   TARGET_TITLE                    varchar   (30)  not null,             /* Label for the target on the view report.  U.S. Target */
    49   TARGET                          varchar  (250)  not null,             /* 21.5 Deaths per million */
     48  TARGET_LABEL                    varchar   (30)  not null,             /* Label for the target on the view report.  U.S. Target */
    5049  TARGET_NARRATIVE                varchar (4000),                               /* provides additional target definitions for age groups etc. */
    51   TARGET_MEASURE_NAME             varchar  (100),                               /* not currently used.  Left in for v3+ */
    52   TARGET_MEASURE_VALUE            double,                                               /* not currently used.  Left in for v3+ */
     50  MEASURE_NAME                    varchar  (100),                               /* assoc with the values and used to get the desired value (0 - oo) and to match IP records */
     51  TARGET_BASELINE_VALUE           double,                                               /* starting point value used for comparison*/
     52  TARGET_GOAL_VALUE               double,                                               /* end point value used for comparison */
    5353  /* */
    5454  SORT_ORDER                      int             default null,
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/config/spring/dispatcher_servlet.xml

    r17645 r17716  
    116116                                <entry key="save/initiative/topic/objective/list/**"   value-ref="initiativeTopicObjectiveSaveListController"/>
    117117                                <entry key="save/initiative/topic/objective/detail/**" value-ref="initiativeTopicObjectiveSaveDetailController"/>
     118                                <entry key="publish/initiatives"             value-ref="publishInitiativesController"/>
    118119
    119120
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/config/spring/indicator.xml

    r17685 r17716  
    6868                <property name="dataBeanDAOService"          ref="commonDataBeanDAOService"/>
    6969                <property name="datasetDataBeanToXMLService" ref="indicatorDatasetDataBeanToXMLService"/>
     70                <property name="initiativeDataBeanToXMLService" ref="initiativeDataBeanToXMLService"/>
    7071                <property name="relationDataBeanCollection"  ref="indicatorRelationDataBeanCollection"/>
    7172                <property name="dateFormat"                  ref="commonDateFormat"/>
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/config/spring/initiative.xml

    r16500 r17716  
    2020        <bean id="initiativeSelectedInitiativeTopicObjectiveNameSessionName" class="org.ibisph.model.StringHolder">
    2121                <constructor-arg value="selectedInitiativeTopicObjectiveName"/>
     22        </bean>
     23
     24
     25        <!--  S E R V I C E S  -->
     26        <bean id="initiativeDataBeanToXMLService" class="org.ibisph.indicatorprofile.service.InitiativeDataBeanToXML">
     27                <property name="dataBeanDAOService"         ref="commonDataBeanDAOService"/>
     28                <property name="dateFormat"                 ref="commonDateFormat"/>
     29                <property name="stringCleaner"              ref="commonMSWordStringCleaner"/>
    2230        </bean>
    2331
     
    7482                <property name="dataBeanDetailCollectionDetailKeyFieldName" value="INITIATIVE_TOPIC_NAME"/>
    7583        </bean>
    76         <bean id="initiativeTopicObjectiveEditDetailController" class="org.ibisph.databean.springmvc.EditDetailController">
     84        <bean id="initiativeTopicObjectiveEditDetailController" class="org.ibisph.indicatorprofile.springmvc.databean.EditInitiativeTopicObjectiveController">
    7785                <property name="dataBeanModelName"                 value="initiativeTopicObjective"/>
    7886                <property name="dataBeanClassName"                 value="org.ibisph.indicatorprofile.databean.InitiativeTopicObjective"/>
     
    167175                                <entry key="url"             value="URL"/>
    168176                                <entry key="narrative"       value="NARRATIVE"/>
    169                                 <entry key="targetTitle"     value="TARGET_TITLE"/>
    170                                 <entry key="target"          value="TARGET"/>
     177                                <entry key="targetLabel"     value="TARGET_LABEL"/>
    171178                                <entry key="targetNarrative" value="TARGET_NARRATIVE"/>
     179                                <entry key="measureName"     value="MEASURE_NAME"/>
     180                                <entry key="targetBaselineValue" value="TARGET_BASELINE_VALUE"/>
     181                                <entry key="targetGoalValue" value="TARGET_GOAL_VALUE"/>
    172182                                <entry key="sortOrder"       value="SORT_ORDER"/>
    173183                                <entry key="activeFlag"      value="ACTIVE_FLAG"/>
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/config/spring/publish.xml

    r17645 r17716  
    5454        <bean id="publishIndicatorSetsFilePathAndName" class="org.ibisph.model.StringHolder">   
    5555                <constructor-arg value="indicator/indicator_sets.xml"/>
     56        </bean>
     57        <bean id="publishInitiativesFilePathAndName" class="org.ibisph.model.StringHolder">     
     58                <constructor-arg value="initiatives.xml"/>
    5659        </bean>
    5760        <bean id="publishMapsFilePathAndName" class="org.ibisph.model.StringHolder">   
     
    184187                class="org.ibisph.indicatorprofile.springmvc.databean.PublishDimensionsToXMLFileController"
    185188        >
    186                 <property name="filePathAndName"    value="#{publishDimensionsFilePathAndName.string}"/>
     189                <property name="filePathAndName"         value="#{publishDimensionsFilePathAndName.string}"/>
    187190        </bean>
    188191
     
    194197                <property name="dataBeanClassName"       value="org.ibisph.indicatorprofile.databean.Chart"/>
    195198                <property name="containerXMLElementName" value="CHARTS"/>
     199        </bean>
     200
     201        <bean id="publishInitiativesController" class="org.ibisph.indicatorprofile.springmvc.databean.PublishInitiativesToXMLFileController">
     202                <property name="initiativeDataBeanToXMLService" ref="initiativeDataBeanToXMLService"/>
     203                <property name="filePathAndName"    value="#{publishInitiativesFilePathAndName.string}"/>
     204                <property name="documentDAOService" ref="publishDocumentDAOService"/>
    196205        </bean>
    197206
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/indicator/initiatives.jsp

    r16458 r17716  
    1616                table.List .Description
    1717                {
    18                         max-width: 350px;
     18                        width:          450px;
     19                        max-width:      550px;
    1920                }
    2021        </jsp:attribute>
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/initiative/list.jsp

    r16389 r17716  
    1414        <jsp:attribute name="contextNavigationMenuItems">
    1515                <jsp:include page="_menu_items.jsp"/>
    16                 <tag:navigationMenuItemButtons editDetailRequest="edit/initiative/detail" addNewRequest="edit/initiative/detail/-NEW-.html" saveRequest="edit/initiative/list"/>
     16                <tag:navigationMenuItemButtons
     17                        isAdmin="${userDetails.admin}"
     18                        editDetailRequest="edit/initiative/detail"
     19                        addNewRequest="edit/initiative/detail/-NEW-.html"
     20                        publishRequest="publish/initiatives"
     21                        saveRequest="edit/initiative/list"
     22                />
    1723        </jsp:attribute>
    1824
     
    6066</c:forEach>
    6167                </tag:listTable>
     68                <jsp:include page="/WEB-INF/jsp/_publish.jsp"/>
    6269        </jsp:body>
    6370
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/initiative/topic/objective/_help.jsp

    r16422 r17716  
    4747</c:set>
    4848
    49 
    5049<c:set var="narrativeHelp">
    5150        The Health Objective Narrative field contains the text of the health objective, such as, "Increase the proportion of persons with
    5251        medical insurance."
    53 </c:set>
    54 
    55 <c:set var="targetTitleHelp">
    56         The Health Objective Target Title provides the text that will be displayed in the indicator report to identify the health objective.
    57         This value may or may not be the same as the Health Objective Title, above.
    58 </c:set>
    59 
    60 <c:set var="targetHelp">
    61         The Health Objective Target is generally a numeric value which the state or nation aspires to achieve for the health indicator.
    62         Each health objective must have a value for this required field.
    63 </c:set>
    64 
    65 <c:set var="targetNarrativeHelp">
    66         This optional field may be used to further describe the target value.
    6752</c:set>
    6853
     
    8065
    8166
    82 <%-- standard variable definitions that are likely good enough...
    83 <c:set var="descriptionHelp">
     67<c:set var="targetLabelHelp">
     68        The Health Objective Topic Target Label provides the text that will be displayed
     69        identifying the type health objective target (e.g. typically U.S. Target or
     70        State Target).  This value may or may not be the same as the Health Objective Title, above.
     71</c:set>
     72<c:set var="targetNarrativeHelp">
     73        This optional field may be used to further describe the target.
     74</c:set>
     75<c:set var="measureNameHelp">
     76        Select a <span class="Bold">Measure</span> to be used for this objective's target values.
     77        <br/><br/>
     78        The Measure supplies not only the formatting of the value but the link to the
     79        associated indicator data to be used for how doing comparisons.
     80</c:set>
     81<c:set var="targetBaselineValueHelp">
     82        The Health Objective Target Baseline Value is generally a numeric value which
     83        the state or nation specifies as the minimum baseline value for the health
     84        topic objective. 
     85</c:set>
     86<c:set var="targetGoalValueHelp">
     87        The Health Objective Target Goal is a numeric value which the state or nation
     88        aspires to achieve for the health indicator.
    8489</c:set>
    8590
    86 <c:set var="sortOrderHelp">
    87 </c:set>
    88 
    89 <c:set var="modifiedDateHelp">
    90 </c:set>
    91 
    92 <c:set var="activeFlagHelp">
    93 </c:set>
    94 --%>
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/initiative/topic/objective/_menu_items.jsp

    r13315 r17716  
    33<%@ include file="../_menu_items.jsp"%>
    44
    5 <li id="initiative/topic/objective/detail" class="MultiLine" title="view associated initiative topic objective detail">
    6         <a href="javascript:requestPage('edit/initiative/topic/objective/detail', '${selectedInitiativeTopicObjectiveName}')">
    7                 Initiative Topic<br/> Objective Detail
    8         </a>
    9 </li>
  • trunk/ibisph-admin/src/main/webapp/WEB-INF/jsp/initiative/topic/objective/detail.jsp

    r16500 r17716  
    2121                        <tag:detailTableRowTextArea label="Description" name="description" maxlength="500" rows="8" text="${initiativeTopicObjective.description}"   help="${descriptionHelp}"/>
    2222                        <tag:detailTableRowTextArea label="Narrative / Overview" name="narrative" maxlength="4000" rows="8" text="${initiativeTopicObjective.narrative}" required="true" help="${narrativeHelp}"/>
     23                        <tag:detailTableRowTextArea label="URL" name="url" maxlength="1000" rows="5" text="${initiativeTopicObjective.URL}" help="${urlHelp}"/>
     24
    2325                        <tag:detailTableRowSeperator/>
    24                         <tag:detailTableRowInput    label="Target Title"     name="targetTitle" maxlength="30" value="${initiativeTopicObjective.title}" required="true" help="${targetTitleHelp}"/>
    25                         <tag:detailTableRowTextArea label="Target"           name="target" maxlength="250" rows="3" text="${initiativeTopicObjective.target}" required="true" help="${targetHelp}"/>
     26                        <tag:detailTableRowInput    label="Target Label"     name="targetLabel" maxlength="30" value="${initiativeTopicObjective.targetLabel}" required="true" help="${targetLabelHelp}"/>
    2627                        <tag:detailTableRowTextArea label="Target Narrative" name="targetNarrative" maxlength="4000" rows="5" text="${initiativeTopicObjective.targetNarrative}" help="${targetNarrativeHelp}"/>
    27                         <tag:detailTableRowTextArea label="URL" name="url" maxlength="1000" rows="5" text="${initiativeTopicObjective.URL}" help="${urlHelp}"/>
     28                        <tag:detailTableRowSelect label="Measure" name="measureName"
     29                                title="Assigned measure name used for the target values"
     30                                help="${measureNameHelp}"
     31                                options="${measures}" selectedValue="${initiativeTopicObjective.measureName}"
     32                        />
     33                        <tag:detailTableRowInput label="Baseline Value" name="targetBaselineValue" maxlength="10" value="${initiativeTopicObjective.targetBaselineValue}" type="number" help="${targetBaselineValueHelp}"/>
     34                        <tag:detailTableRowInput label="Goal Value"     name="targetGoalValue"     maxlength="10" value="${initiativeTopicObjective.targetGoalValue}"     type="number" help="${targetGoalValueHelp}"/>
     35
    2836                        <tag:detailTableRowSeperator/>
    2937                        <tag:detailTableRowInput    label="Sort Order"  name="sortOrder"   maxlength="10" value="${initiativeTopicObjective.sortOrder}" type="number" cssClass="SortOrder" help="${sortOrderHelp}"/>
  • trunk/ibisph-admin/src/main/webapp/css/_table.css

    r17015 r17716  
    3131
    3232
    33 .SortOrder input
     33.SortOrder input,
     34table.Detail input[type="number"]
    3435{
    3536        text-align:                     right;
  • trunk/ibisph-view/src/content/json/kendo/GroupedBar.json

    r17710 r17716  
    55                ,stack: false
    66                ,spacing: 0.1           // default 0.4
    7                 ,gap: 0.5               // default 1.5
     7                ,gap: 0.5                       // default 1.5
    88        }
    99        ,dataBound: rotateChartCategoryLabels
  • trunk/ibisph-view/src/content/json/kendo/_BaseChart.json

    r17710 r17716  
    11{
    2         autoBind: false
    3         ,renderAs: "svg"  // Kendo switchs to first available mode: "canvas", "svg".
     2        autoBind:  false        // "read()" will fire the "change" event of the dataSource and the widget will be bound
     3        ,renderAs: "svg"        // Kendo switchs to first available mode: "canvas", "svg".
    44        ,chartArea:
    55        {
  • trunk/ibisph-view/src/content/json/kendo/_BaseGrid.json

    r17632 r17716  
    11{
    2         autoBind:     false
     2        autoBind:     false             // "read()" will fire the "change" event of the dataSource and the widget will be bound
    33        ,columnMenu:  true
    44        ,filterable:  false
  • trunk/ibisph-view/src/main/webapp/js/kendo.js

    r17710 r17716  
    100100        var options      = dataBoundEvent.sender.options;
    101101        var maxLineWidth = dataBoundEvent.sender.getSize().width;
    102         var title        = options.title.text;
     102        var title        = options.title.text.replace("\n", " ");
    103103        var charWidth    = 10;
    104104        var totalWidth   = (charWidth * title.length);
  • trunk/ibisph-view/src/main/webapp/xsd/initiatives.xsd

    r15630 r17716  
    4747                                                                                                                                                        <xsd:element name="NARRATIVE"        type="xsd:string"  minOccurs="1"/>
    4848                                                                                                                                                        <xsd:element name="URL"              type="xsd:string"  minOccurs="0"/> 
    49 
    50                                                                                                                                                         <xsd:element name="TARGET_TITLE"     type="xsd:string"  minOccurs="1"/>
    51                                                                                                                                                         <xsd:element name="TARGET"           type="xsd:string"  minOccurs="1"/>
     49<!--
     50TARGET
     51        TITLE
     52        NARRATIVE
     53        BASELINE_NAME
     54        GOAL_VALUE
     55-->
     56                                                                                                                                                        <xsd:element name="TARGET_LABEL"     type="xsd:string"  minOccurs="1"/>
    5257                                                                                                                                                        <xsd:element name="TARGET_NARRATIVE" type="xsd:string"  minOccurs="0"/> 
     58                                                                                                                                                        <xsd:element name="MEASURE_NAME"     type="xsd:string"  minOccurs="1"/>
     59                                                                                                                                                        <xsd:element name="TARGET_BASELINE_VALUE" type="xsd:decimal"  minOccurs="0"/> 
     60                                                                                                                                                        <xsd:element name="TARGET_GOAL_VALUE" type="xsd:decimal"  minOccurs="0"/> 
    5361
    5462                                                                                                                                                        <xsd:element name="SORT_ORDER"       type="xsd:integer" minOccurs="0"/>
  • trunk/ibisph-view/src/main/webapp/xslt/html/ContentContainer.xslt

    r16650 r17716  
    250250                        "
    251251                />
     252
     253                <xsl:param name="inputOnChangeAttribute" ibis:doc="input onchange attribute"/>
     254
    252255                <xsl:param name="accesskey" ibis:doc="Optional control's quick access key."/>
    253256                <xsl:param name="show" select="false()"
     
    260263                        If content is blank then this code does not do anything."
    261264                />
    262 <xsl:param name="addWikiAttribute" select="$ContentContainer.addWikiAttributeToContentContainer"/>
     265
     266                <xsl:param name="addWikiAttribute" select="$ContentContainer.addWikiAttributeToContentContainer"/>
    263267
    264268
     
    277281                                        <xsl:if test="($controlType = 'radio') and (string-length($controlName) != 0)">
    278282                                                <xsl:attribute name="name" select="$controlName"/>
     283                                        </xsl:if>
     284                                        <xsl:if test="0 != string-length($inputOnChangeAttribute)">
     285                                                <xsl:attribute name="onchange" select="$inputOnChangeAttribute"/>
    279286                                        </xsl:if>
    280287                                </input>
  • trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/Indicator.xslt

    r17710 r17716  
    352352                </h3>
    353353                <xsl:value-of select="$initiative/INITIATIVE_TOPIC/INITIATIVE_TOPIC_OBJECTIVE/NARRATIVE"/><br/>
    354                 <span class="Bold"><xsl:value-of select="$initiative/INITIATIVE_TOPIC/INITIATIVE_TOPIC_OBJECTIVE/TARGET_TITLE"/></span>:
    355                 <xsl:value-of select="$initiative/INITIATIVE_TOPIC/INITIATIVE_TOPIC_OBJECTIVE/TARGET"/>
     354                <span class="Bold"><xsl:value-of select="$initiative/INITIATIVE_TOPIC/INITIATIVE_TOPIC_OBJECTIVE/TARGET_LABEL"/></span>.
     355<!-- GARTH TODO: Could implement the worse, same, better logic here... -->
     356                <xsl:value-of select="$initiative/INITIATIVE_TOPIC/INITIATIVE_TOPIC_OBJECTIVE/TARGET_GOAL_VALUE"/>,
    356357                <xsl:value-of select="$initiative/INITIATIVE_TOPIC/INITIATIVE_TOPIC_OBJECTIVE/TARGET_NARRATIVE"/>
    357358        </xsl:template>
  • trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/view/Page.xslt

    r17710 r17716  
    125125                                        </xsl:call-template>
    126126                                </xsl:with-param>
     127                                <xsl:with-param name="inputOnChangeAttribute" select="'resizeKendoChart()'"/>
    127128                                <xsl:with-param name="show" select="not($Page.showMap)"/>
    128129                                <xsl:with-param name="addWikiAttribute" select="false()"/>
     
    224225                        <xsl:with-param name="measure"       select="$Indicator.measure"/>
    225226                        <xsl:with-param name="showMap"       select="$Page.showMap"/>
     227                        <xsl:with-param name="showChart"     select="$Page.showChart"/>
    226228                        <xsl:with-param name="baseExportFilename" select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
    227229                </xsl:call-template>
     
    233235                <xsl:param name="indicatorView"/>
    234236                <xsl:param name="measure"/>
    235                 <xsl:param name="showMap"/>
     237                <xsl:param name="showMap"   select="$Page.showMap"/>
     238                <xsl:param name="showChart" select="$Page.showChart"/>
    236239                <xsl:param name="baseExportFilename" select="$indicatorView/TITLE"/>
    237 
    238                 <xsl:if test="$showMap">
    239                         <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
    240                 </xsl:if>
    241240
    242241                <xsl:variable name="measureValueFormatPattern" select="($Indicator.valueTypes/VALUE_TYPE[NAME = $measure/VALUE_TYPE_NAME]/XSLT_FORMAT_PATTERN)[1]"/>
     
    252251                        </xsl:call-template>
    253252                </xsl:variable>
    254 <!-- GARTH TODO: remove
    255 <xsl:message select="'xxxxxxxxxxxxxxxxxxxxxxx'"/>
    256 <xsl:message select="$recordAncillaryValueFields"/>
    257 -->
    258253
    259254                <xsl:variable name="recordDimensionFields">
     
    276271                        script.  Very messy - decided just to do simple var and include it.
    277272                -->
     273
     274                <xsl:if test="$showMap">
     275                        <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
     276                </xsl:if>
    278277                <script type="text/javascript" src="{$ibis.urlPrefix}js/jszip.js"/>
    279278                <script type="text/javascript">
     
    316315                        );
    317316
    318 <xsl:message select="'gggggggggggggg'"/>
    319 <xsl:message select="count($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
    320 <xsl:message select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
    321 <xsl:message select="$indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)]"/>
    322 <xsl:message select="'xxxxxxxxxxxx'"/>
    323 <xsl:message select="count($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/>
    324 <xsl:message select="'zzzzzzzzzz'"/>
    325 <xsl:message select="string-length($indicatorViewDatasetRecords/RECORD/NOTE)"/>
    326 
    327 
    328                         var kendoChartConstructorJSON = $.extend
    329                         (true, {}
    330                                 ,<xsl:call-template name="Kendo.baseChartJSON"/>
    331                                 ,<xsl:call-template name="Kendo.namedConfigurationJSON">
    332                                         <xsl:with-param name="configurationName" select="$indicatorView/CHART_NAME"/>
    333                                 </xsl:call-template>
    334                                 ,<xsl:call-template name="Kendo.requestChartJSON">
    335                                         <xsl:with-param name="kendoDataSourceJavascriptVariableName" select="'kendoDataSource'"/>
    336                                         <xsl:with-param name="title"         select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
    337                                         <xsl:with-param name="seriesTitle"   select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/TITLE"/>
    338                                         <xsl:with-param name="categoryTitle" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='category']/TITLE"/>
    339                                         <xsl:with-param name="valueTitle"    select="$measure/TITLE"/>
    340 
    341                                         <xsl:with-param name="seriesFieldName"    select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/NAME"/>
    342                                         <xsl:with-param name="categoryFieldName"  select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='category']/NAME"/>
    343 
    344                                         <xsl:with-param name="includeDatasetSeries" select="1 &lt; $recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/VALUE_COUNT"/>
    345                                         <xsl:with-param name="recordAncillaryValueFields" select="$recordAncillaryValueFields"/>
    346                                 </xsl:call-template>
    347                         );
    348                         console.debug("IP.Page.xslt (%o, kendoChartConstructorJSON, (JSON.stringify(kendoChartConstructorJSON):");
    349                         console.debug("%o", kendoChartConstructorJSON);
    350                         console.debug(JSON.stringify(kendoChartConstructorJSON,null,2)); 
    351 
    352                         var $kendoGrid;
    353                         var $kendoChart;
    354                         var $leafletMap;
    355                         $(document).ready(function()
    356                         {
    357                                 $kendoGrid  = $("#grid").kendoGrid (kendoGridConstructorJSON);
    358                                 $kendoChart = $("#chart").kendoChart(kendoChartConstructorJSON);
    359                                 kendoDataSource.read();         // have to have after grid and chart because .autoBind = false.
    360 //                              $kendoChart.width(1000);
    361 //                              $kendoChart.chartArea.width(1000);
    362 //                              $kendoChart.resize();
    363                                
    364 /* GARTH TODO:
    365 $("#grid tr[role='row']").on("mouseenter mouseover", function () {
    366         var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered
    367         chart.toggleHighlight(true,
    368                 function(point)
    369                 {
    370                         return point.dataItem.Id === row.rowID;
    371                 }
    372         ); //show the tooltip for the point where the Ids match
    373 });
    374 */
    375 
    376 
    377 <!-- =====================================================
    378 
    379 GARTH TODO:
    380 
    381 // var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0);
    382 // alert("first slot width" + firstSlot.width());
    383 
    384 <xsl:variable name="geoDimensionName" select="
    385         if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME))
    386         then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME
    387         else ($Indicator.dimensions/DIMENSION[
    388                         exists(GEOGRAPHY_FLAG)
    389                         and
    390                         NAME = $indicatorView//DIMENSION_USAGE/NAME
    391                 ])[1]/NAME"
    392 />
    393 
    394 <xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
    395 <xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
    396 <xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
    397 <xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/>
    398 <xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
    399 <xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/>
    400 
    401 <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
    402 <xsl:message select="$Page.comparisonDimensionName"/>
    403 <xsl:message select="$Page.comparisonDimensionValue"/>
    404 <xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
    405 
    406 Stuff to try when doing dashboard
    407 function dataSource_change(e) {
    408   console.log(e);
    409 }
    410 kendoDataSource.bind("change", dataSource_change);
    411 select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
    412 
    413 **********************************************
    414 
    415 PROBLEM: "CATEGORY":"GeoCnty.4"
    416                                                 <xsl:with-param name="geoJSONName"      select="$indicatorView/MAP_DIMENSION_NAME"/>
    417                                                
    418 ******************
    419 probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area.
    420 
    421 ************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1
    422 
    423 The IP and QM dimension files are all 1..31
    424 
    425 So, need the field name then use the geotype and parse the .XXX from the end.
    426 Then in the QM will need to build the JSON fields the same way as we do with
    427 the IP - which is the right way to do it anyway so fields can be combined???
    428 
    429 *** also have issues with if 2d and 3d...
    430         if mult series then drop down for that.
    431         if mult constants then drop down for that as well.
    432         when changed regen map.
    433         Need to specify the category field name and value
    434         Need to specify the series field name and value
    435         Need to specify the constant field name and value
    436        
    437         GeoJSON GeoID Prefix to add when doing comparison???
    438 
    439         <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/>
    440         <xsl:variable name="communityDataset"  select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/>
    441         <xsl:variable name="stateRecord"       select="$communityDataset/RECORDS/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $stateDimensionName)     and (VALUE = $stateDimensionValue)]     and DIMENSION[(NAME = $periodName) and (VALUE = $periodValue)]]]"/>
    442 
    443 
    444 GARTH TODO:
    445         <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
    446 <xsl:message select="$indicatorViewDatasetRecords[1]"/>
    447 
    448 
    449 
    450 <xsl:with-param name="dimensionFieldInclusionCriteria">
    451 records have the field names to filter.
    452 to include need field name and value.
    453 
    454 specifies the records held constant - This is to filter out not matching constant records
    455 
    456 for mouse overs, the title needs specifics - dimension title and dimension value title.
    457         <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION>
    458         <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION>
    459 </xsl:with-param>
    460 
    461 ==========================================================================
    462 <xsl:message select="$indicatorViewDatasetRecords/RECORD"/>
    463 
    464 <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
    465 <xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/>
    466 <xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/>
    467 -->
    468 
    469                         <xsl:if test="$Page.showMap">
    470                                 var leafletMapConstructorJSON = $.extend
     317                        <xsl:if test="$showMap">
     318                        var leafletMapConstructorJSON = $.extend
    471319                                (true, {}
    472320,<xsl:call-template name="LeafletMap.baseJSON"/>
     
    493341</xsl:call-template>
    494342                                );
     343                        </xsl:if>
     344
     345// GARTH TODO: remove
     346<xsl:message select="'gggggggggggggg'"/>
     347<xsl:message select="count($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
     348<xsl:message select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
     349<xsl:message select="$indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)]"/>
     350<xsl:message select="'xxxxxxxxxxxx'"/>
     351<xsl:message select="count($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/>
     352<xsl:message select="'zzzzzzzzzz'"/>
     353<xsl:message select="string-length($indicatorViewDatasetRecords/RECORD/NOTE)"/>
     354
     355
     356                        <xsl:if test="$showChart">
     357                        var chartWidthVariable = $(".ExpandableContent").innerWidth();
     358                        var kendoChartConstructorJSON = $.extend
     359                        (true, {}
     360                                ,<xsl:call-template name="Kendo.baseChartJSON"/>
     361                                ,<xsl:call-template name="Kendo.namedConfigurationJSON">
     362                                        <xsl:with-param name="configurationName" select="$indicatorView/CHART_NAME"/>
     363                                </xsl:call-template>
     364                                ,<xsl:call-template name="Kendo.requestChartJSON">
     365                                        <xsl:with-param name="kendoDataSourceJavascriptVariableName" select="'kendoDataSource'"/>
     366                                        <xsl:with-param name="title"         select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
     367                                        <xsl:with-param name="seriesTitle"   select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/TITLE"/>
     368                                        <xsl:with-param name="categoryTitle" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='category']/TITLE"/>
     369                                        <xsl:with-param name="valueTitle"    select="$measure/TITLE"/>
     370
     371                                        <xsl:with-param name="seriesFieldName"    select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/NAME"/>
     372                                        <xsl:with-param name="categoryFieldName"  select="$recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='category']/NAME"/>
     373
     374                                        <xsl:with-param name="includeDatasetSeries" select="1 &lt; $recordDimensionFields/RECORD_DIMENSION_FIELD[USAGE='series']/VALUE_COUNT"/>
     375                                        <xsl:with-param name="recordAncillaryValueFields" select="$recordAncillaryValueFields"/>
     376                                </xsl:call-template>
     377                        );
     378
     379                        // have to manually add this because Kendo can't.  See:
     380                        // https://docs.telerik.com/kendo-ui/styles-and-layout/using-kendo-in-responsive-web-pages
     381                        // another option: $(window).on("resize", function() { kendo.resize($(".chart-wrapper")); });
     382                        $(window).resize(resizeKendoChart);
     383
     384                        console.debug("IP.Page.xslt (%o, kendoChartConstructorJSON, (JSON.stringify(kendoChartConstructorJSON):");
     385                        console.debug("%o", kendoChartConstructorJSON);
     386                        console.debug(JSON.stringify(kendoChartConstructorJSON,null,2)); 
     387                        </xsl:if>
     388
     389
     390                        var $kendoGrid;
     391                        var $kendoChart;
     392                        var $leafletMap;
     393                        $(document).ready(function()
     394                        {
     395                        <xsl:if test="$showMap">
    495396                                $leafletMap = $("#map").leaflet(leafletMapConstructorJSON);
    496397                        </xsl:if>
    497 
    498                         }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    499 
     398                        <xsl:if test="$showChart">
     399                                $kendoChart = $("#chart").kendoChart(kendoChartConstructorJSON);
     400                        </xsl:if>
     401                                $kendoGrid  = $("#grid").kendoGrid(kendoGridConstructorJSON);
     402
     403                                // "read" fires the "change" event of the dataSource and any objects
     404                                // that ref the data source will be bound.  This needs to occur
     405                                // after the grid and chart are created because .autoBind = false.
     406                                // Can also fire load by issuing a sort:
     407                                // $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
     408                                kendoDataSource.read();
     409
     410                                // Kendo charts have an issue sizing the widget to the full width
     411                                // when the chart's container starts out hidden.  Tried numerous
     412                                // things with timers and setting the width to the main content
     413                                // control to firing resize when the control's input is changed.
     414                                // If set the width then even as the window resizes the chart does
     415                                // NOT change its size.  So below code was commented out and the
     416                                // input on change calls the resize func. 
     417                                // var chartContainerWidth = $(".ExpandableContent").innerWidth();
     418                                // $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
     419                        }); //~~~~~~~~~~~~~~~~~~~~ End of Ready Function ~~~~~~~~~~~~~~~~~~~
     420
     421
     422                        // Called via the chart's expandable content input element's onchange
     423                        // firing this code.  Also bound to the windonws resize event to
     424                        // properly resize the chart to fit the container.
     425                        function resizeKendoChart()
     426                        {
     427                                kendo.resize( $(".k-chart") );
     428                                // another option: $kendoChart.getKendoChart().resize();
     429                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
     430               
    500431
    501432                        var baseExportFilename = "<xsl:value-of select="$baseExportFilename"/>";
     
    503434                        function exportGrid()
    504435                        {
    505                                 var grid = $("#grid").getKendoGrid();
     436                                var grid = $kendoGrid.getKendoGrid();
    506437                                grid.options.excel.fileName = baseExportFilename + " - data.xlsx";
    507438                                grid.saveAsExcel();
    508                         } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     439                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
    509440
    510441                        function exportChart()
    511442                        {
    512                                 var chart = $("#chart").getKendoChart();
    513 
    514 <!--
     443                                var chart = $kendoChart.getKendoChart();
     444
    515445                                chart.exportImage().done
    516446                                (
     
    530460dataURI: "data:text/plain,Report title and text",
    531461*/
    532 -->
    533462                                chart.exportPDF().done
    534463                                (
     
    542471                                        }
    543472                                );
    544 
    545                         } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     473                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
    546474
    547475                        function exportMap()
    548476                        {
    549477                                alert("Map export is not current supported.");
    550                         } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     478                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
     479
     480<!--
     481==========================================================================
     482==========================================================================
     483==========================================================================
     484
     485
     486                                // Hack for vert bar charts to fill the width of the container.
     487                                // Kendo charts have an issue filling when the container is hidden.
     488                                // For some reason on my system need to wait 2 seconds for it
     489                                // to work.
     490                                // If set width then it's that size no matter what the window is
     491                                // resized to.  Only 100% sure fire way is to have open or fire
     492                                // some script when opened.
     493//                              setTimeout(resizeKendoChart, 1000);
     494                                var chartContainerWidth = $(".ExpandableContent").innerWidth();
     495//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
     496//                              $("#chart").width = $(".ExpandableContent").innerWidth();
     497                                $kendoChart.getKendoChart().resize();
     498                        });
     499
     500                        function resizeKendoChart()
     501                        {
     502//                              var chartContainerWidth = $(".ExpandableContent").innerWidth();
     503//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
     504                                $kendoChart.getKendoChart().resize();
     505//                              $kendoChart.resize($("#chart"));
     506                        };
     507
     508function myFunction() {
     509                                kendoDataSource.read();
     510                                $kendoChart.getKendoChart().resize();
     511                                $kendoChart.getKendoChart().refresh();
     512                                $kendoChart.getKendoChart().redraw();
     513                                $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
     514}
     515
     516/*                     
     517// none of these have any effect on the chart!!!
     518//                              $kendoGrid.getKendoGrid().refresh();
     519//                              $kendoChart.width(1000);
     520//                              $kendoChart.chartArea.width(1000);
     521//                              $kendoChart.getKendoChart().resize();
     522//                              $kendoChart.getKendoChart().refresh();
     523//                              $kendoChart.getKendoChart().redraw();
     524
     525$kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
     526                                $kendoGrid.getKendoGrid().refresh();
     527                                $kendoChart.getKendoChart().redraw();
     528*/
     529
     530/* GARTH TODO:
     531$("#grid tr[role='row']").on("mouseenter mouseover", function () {
     532        var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered
     533        chart.toggleHighlight(true,
     534                function(point)
     535                {
     536                        return point.dataItem.Id === row.rowID;
     537                }
     538        ); //show the tooltip for the point where the Ids match
     539
     540
     541
     542
     543GARTH TODO:
     544
     545// var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0);
     546// alert("first slot width" + firstSlot.width());
     547
     548<xsl:variable name="geoDimensionName" select="
     549        if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME))
     550        then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME
     551        else ($Indicator.dimensions/DIMENSION[
     552                        exists(GEOGRAPHY_FLAG)
     553                        and
     554                        NAME = $indicatorView//DIMENSION_USAGE/NAME
     555                ])[1]/NAME"
     556/>
     557
     558<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
     559<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
     560<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
     561<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/>
     562<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
     563<xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/>
     564
     565<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
     566<xsl:message select="$Page.comparisonDimensionName"/>
     567<xsl:message select="$Page.comparisonDimensionValue"/>
     568<xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
     569
     570Stuff to try when doing dashboard
     571function dataSource_change(e) {
     572  console.log(e);
     573}
     574kendoDataSource.bind("change", dataSource_change);
     575select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
     576
     577**********************************************
     578
     579PROBLEM: "CATEGORY":"GeoCnty.4"
     580                                                <xsl:with-param name="geoJSONName"      select="$indicatorView/MAP_DIMENSION_NAME"/>
     581                                               
     582******************
     583probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area.
     584
     585************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1
     586
     587The IP and QM dimension files are all 1..31
     588
     589So, need the field name then use the geotype and parse the .XXX from the end.
     590Then in the QM will need to build the JSON fields the same way as we do with
     591the IP - which is the right way to do it anyway so fields can be combined???
     592
     593*** also have issues with if 2d and 3d...
     594        if mult series then drop down for that.
     595        if mult constants then drop down for that as well.
     596        when changed regen map.
     597        Need to specify the category field name and value
     598        Need to specify the series field name and value
     599        Need to specify the constant field name and value
     600       
     601        GeoJSON GeoID Prefix to add when doing comparison???
     602
     603        <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/>
     604        <xsl:variable name="communityDataset"  select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/>
     605        <xsl:variable name="stateRecord"       select="$communityDataset/RECORDS/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $stateDimensionName)     and (VALUE = $stateDimensionValue)]     and DIMENSION[(NAME = $periodName) and (VALUE = $periodValue)]]]"/>
     606
     607
     608GARTH TODO:
     609        <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
     610<xsl:message select="$indicatorViewDatasetRecords[1]"/>
     611
     612
     613
     614<xsl:with-param name="dimensionFieldInclusionCriteria">
     615records have the field names to filter.
     616to include need field name and value.
     617
     618specifies the records held constant - This is to filter out not matching constant records
     619
     620for mouse overs, the title needs specifics - dimension title and dimension value title.
     621        <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION>
     622        <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION>
     623</xsl:with-param>
     624
     625==========================================================================
     626<xsl:message select="$indicatorViewDatasetRecords/RECORD"/>
     627
     628<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
     629<xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/>
     630<xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/>
     631
     632==========================================================================
     633==========================================================================
     634==========================================================================
     635-->
     636
    551637                </script>
    552638
  • trunk/ibisph-view/src/main/webapp/xslt/html/query/module/result/Result.xslt

    r17710 r17716  
    208208
    209209                <xsl:param name="valueAttributes" select="$Result.valueAttributes/VALUE_ATTRIBUITES/VALUE_ATTRIBUITE[NAME = 'x']"/>
    210 
    211 
    212                 <xsl:if test="$showMap">
    213                         <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
    214                 </xsl:if>
    215210
    216211                <xsl:variable name="dimensionUsages"
     
    266261                        script.  Very messy - decided just to do simple var and include it.
    267262                -->
     263                <xsl:if test="$showMap">
     264                        <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
     265                </xsl:if>
    268266                <script type="text/javascript" src="{$ibis.urlPrefix}js/jszip.js"/>
    269267                <script type="text/javascript">
    270                         var $kendoGrid;
    271                         var $kendoChart;
    272                         var $leafletMap;
    273268                        var records =
    274269                        [<xsl:text>&#10;</xsl:text>
     
    315310                                );
    316311
    317                         $(document).ready(
    318                                 function()
    319                                 {
    320                                         $kendoGrid  = $("#grid").kendoGrid (kendoGridConstructorJSON);
    321                                         kendoDataSource.read();         // have to have after grid and chart because .autoBind = false.
    322                                 }
    323                         );
     312                        <xsl:if test="$showMap">
     313                        var leafletMapConstructorJSON = $.extend
     314                                (true, {}
     315                                        ,<xsl:call-template name="LeafletMap.baseJSON"/>
     316                                        ,<xsl:call-template name="LeafletMap.namedConfigurationJSON">
     317                                                <xsl:with-param name="configurationName" select="$configuration/MAP_NAME"/>
     318                                        </xsl:call-template>
     319                                        ,<xsl:call-template name="LeafletMap.requestJSON">
     320<xsl:with-param name="mapType"       select="'choropleth'"/>
     321                                        </xsl:call-template>
     322
     323                                        ,<xsl:call-template name="LeafletMap.choroplethJSON">
     324                                                <xsl:with-param name="javascriptRecordArrayVariableName" select="'records'"/>
     325<xsl:with-param name="geoJSONName" select="$request/ACTUAL_GROUP_BY/CATEGORY_DIMENSION_NAME"/>
     326
     327<xsl:with-param name="geoIDFieldName"   select="'Category'"/>
     328<xsl:with-param name="geoIDFieldValuePrefixToRemove"   select="concat($request/ACTUAL_GROUP_BY/CATEGORY_DIMENSION_NAME, '.')"/>
     329<xsl:with-param name="measureValueFieldName" select="'MeasureValue'"/>
     330<xsl:with-param name="legendTitle"   select="$measure/TITLE"/>
     331<xsl:with-param name="geoTypeTitle"  select="ibis:getDimensionTitle($queryModule//DIMENSIONS/DIMENSION[NAME = $configuration/MAP_DIMENSION_NAME])"/>
     332<xsl:with-param name="reverseColors" select="$measure/DESIRABLE_VALUE = 1"/>
     333<xsl:with-param name="desirableIndexValue" select="$measure/DESIRABLE_VALUE"/>
     334<xsl:with-param name="comparisonValue" select="$datasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Result.comparisonDimensionName) and (VALUE = $Result.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
     335                                        </xsl:call-template>
     336                                );
     337                        </xsl:if>
    324338
    325339                        <xsl:if test="$showChart">
     
    343357                                        </xsl:call-template>
    344358                                );
    345 //console.debug("%o", kendoChartConstructorJSON);
    346 //console.log(JSON.stringify(kendoChartConstructorJSON,null,2)); 
     359
     360                        $(window).resize(resizeKendoChart);
    347361                        </xsl:if>
    348362
     363
     364                        var $kendoGrid;
     365                        var $kendoChart;
     366                        var $leafletMap;
    349367                        $(document).ready(function()
    350368                        {
    351                                 $kendoGrid  = $("#grid").kendoGrid(kendoGridConstructorJSON);
     369                        <xsl:if test="$showMap">
     370                                $leafletMap = $("#map").leaflet(leafletMapConstructorJSON);
     371                        </xsl:if>
    352372                        <xsl:if test="$showChart">
    353373                                $kendoChart = $("#chart").kendoChart(kendoChartConstructorJSON);
    354374                        </xsl:if>
    355                                 kendoDataSource.read();         // have to have after grid and chart because .autoBind = false.
    356 
    357                         <xsl:if test="$showMap">
    358                                 var leafletMapConstructorJSON = $.extend
    359                                         (true, {}
    360                                                 ,<xsl:call-template name="LeafletMap.baseJSON"/>
    361                                                 ,<xsl:call-template name="LeafletMap.namedConfigurationJSON">
    362                                                         <xsl:with-param name="configurationName" select="$configuration/MAP_NAME"/>
    363                                                 </xsl:call-template>
    364                                                 ,<xsl:call-template name="LeafletMap.requestJSON">
    365 <xsl:with-param name="mapType"       select="'choropleth'"/>
    366                                                 </xsl:call-template>
    367 
    368                                                 ,<xsl:call-template name="LeafletMap.choroplethJSON">
    369                                                         <xsl:with-param name="javascriptRecordArrayVariableName" select="'records'"/>
    370 <xsl:with-param name="geoJSONName" select="$request/ACTUAL_GROUP_BY/CATEGORY_DIMENSION_NAME"/>
    371 
    372 <xsl:with-param name="geoIDFieldName"   select="'Category'"/>
    373 <xsl:with-param name="geoIDFieldValuePrefixToRemove"   select="concat($request/ACTUAL_GROUP_BY/CATEGORY_DIMENSION_NAME, '.')"/>
    374         <xsl:with-param name="measureValueFieldName" select="'MeasureValue'"/>
    375         <xsl:with-param name="legendTitle"   select="$measure/TITLE"/>
    376 <xsl:with-param name="geoTypeTitle"  select="ibis:getDimensionTitle($queryModule//DIMENSIONS/DIMENSION[NAME = $configuration/MAP_DIMENSION_NAME])"/>
    377         <xsl:with-param name="reverseColors" select="$measure/DESIRABLE_VALUE = 1"/>
    378         <xsl:with-param name="desirableIndexValue" select="$measure/DESIRABLE_VALUE"/>
    379 <xsl:with-param name="comparisonValue" select="$datasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Result.comparisonDimensionName)     and (VALUE = $Result.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
    380                                 </xsl:call-template>
    381                                         );
    382                                 $leafletMap = $("#map").leaflet(leafletMapConstructorJSON);
    383                         </xsl:if>
    384 
    385                         }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     375                                $kendoGrid  = $("#grid").kendoGrid (kendoGridConstructorJSON);
     376
     377                                // "read" fires the "change" event of the dataSource and any objects
     378                                // that ref the data source will be bound.  This needs to occur
     379                                // after the grid and chart are created because .autoBind = false.
     380                                // Can also fire load by issuing a sort:
     381                                // $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
     382                                kendoDataSource.read();
     383                        }); //~~~~~~~~~~~~~~~~~~~~ End of Ready Function ~~~~~~~~~~~~~~~~~~~
     384
     385
     386                        // Called via the chart's expandable content input element's onchange
     387                        // firing this code.  Also bound to the windonws resize event to
     388                        // properly resize the chart to fit the container.
     389                        function resizeKendoChart()
     390                        {
     391                                $kendoChart.getKendoChart().resize();
     392                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
    386393
    387394                        var baseExportFilename = "<xsl:value-of select="$configuration/TITLE"/>";
    388 
    389395                        function exportGrid()
    390396                        {
     
    392398                                grid.options.excel.fileName = baseExportFilename + " - data.xlsx";
    393399                                grid.saveAsExcel();
    394                         } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    395 
     400                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
    396401                        function exportChart()
    397402                        {
     
    428433                                        }
    429434                                );
    430 
    431                         } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     435                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
    432436
    433437                        function exportMap()
    434438                        {
    435439                                alert("Map export is not current supported.");
    436                         } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     440                        } //~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~
    437441                </script>
    438442        </xsl:template>
  • trunk/ibisph-view/src/main/webapp/xslt/json/Kendo.xslt

    r17685 r17716  
    344344                <xsl:param name="includeDenominator"   select="false()"/>
    345345
     346                <xsl:param name="width"  ibis:doc="Forces/sets the chart's width (in pixels).  If not set then uses the container width if container is visible."/>
     347
    346348                <!--
    347349                        Did have code to dynamically craft - too complex and error prone.
     
    442444                </xsl:for-each>
    443445        }
     446        <xsl:if test="0 != string-length($width)">
     447        ,chartArea: {width: <xsl:value-of select="$width"/>}
     448        </xsl:if>
    444449<!-- GARTH: TODO:
    445450  config settings for the saveAsPDF call.  DNA for saveAs callback...
  • trunk/ibisph/src/main/java/org/ibisph/databean/DataBeanToXMLService.java

    r17645 r17716  
    1212import org.ibisph.util.StringCleaner;
    1313import org.ibisph.util.XMLLib;
     14
    1415
    1516/**
  • trunk/ibisph/src/main/java/org/ibisph/databean/springmvc/PublishCollectionToXMLFileController.java

    r16567 r17716  
    5454    this.lineDelimiter = lineDelimiter;
    5555  } //-------------------------- End of Method ------------------------------
    56  
     56
    5757  /**
    5858   * Sets the DAO object that will be used to save the XML content with. 
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/databean/DatasetRecord.java

    r15716 r17716  
    119119    }
    120120  }
    121 //  public Collection<DataBean> getAncillaryValueCollection() {
     121//  public Collection<DataBean> getAncillaryValues() {
    122122//    return(this.ancillaryValueCollection);
    123123//  }
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/databean/InitiativeTopicObjective.java

    r11498 r17716  
    2020    addField("NARRATIVE",                   Field.TYPE_STRING, false, true);
    2121    addField("URL",                         Field.TYPE_STRING);
    22     addField("TARGET_TITLE",                Field.TYPE_STRING, false, true);
    23     addField("TARGET",                      Field.TYPE_STRING, false, true);
     22    addField("TARGET_LABEL",                Field.TYPE_STRING, false, true);
    2423    addField("TARGET_NARRATIVE",            Field.TYPE_STRING);
     24    addField("MEASURE_NAME",                Field.TYPE_STRING);
     25    addField("TARGET_BASELINE_VALUE",       Field.TYPE_BIGDECIMAL);
     26    addField("TARGET_GOAL_VALUE",           Field.TYPE_BIGDECIMAL);
    2527    addField("SORT_ORDER",                  Field.TYPE_BIGDECIMAL);
    2628    addField("ACTIVE_FLAG",                 Field.TYPE_STRING);
     
    4850    return( getStringFieldValue("DESCRIPTION") );
    4951  }
    50   public String getTargetTitle() {
    51     return( getStringFieldValue("TARGET_TITLE") );
    52   }
    53   public String getTarget() {
    54     return( getStringFieldValue("TARGET") );
     52  public String getTargetLabel() {
     53    return( getStringFieldValue("TARGET_LABEL") );
    5554  }
    5655  public String getTargetNarrative() {
    5756    return( getStringFieldValue("TARGET_NARRATIVE") );
     57  }
     58  public String getMeasureName() {
     59    return( getStringFieldValue("MEASURE_NAME") );
     60  }
     61  public String getTargetBaselineValue() {
     62    return( getStringFieldValue("TARGET_BASELINE_VALUE") );
     63  }
     64  public String getTargetGoalValue() {
     65    return( getStringFieldValue("TARGET_GOAL_VALUE") );
    5866  }
    5967  public String getSortOrder() {
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/databean/Statuses.java

    r9600 r17716  
    2424   * @return entire status bean collection.
    2525   */
    26   public Collection<Status> getStatusDataBeanCollection() {
     26  public Collection<Status> getStatusDataBeans() {
    2727    return(this.statusDataBeanCollection);
    2828  } //-------------------------- End of Method ------------------------------
     
    5656   * @return collection of associated status beans.
    5757   */
    58   public Collection <Status> getAssociatedStatusDataBeanCollection(String statusCode) {
     58  public Collection <Status> getAssociatedStatusDataBeans(String statusCode) {
    5959    return(this.associatedStatusDataBeanMap.get(statusCode));
    6060  } //-------------------------- End of Method ------------------------------
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/service/DatasetDataBeanToXML.java

    r17685 r17716  
    402402  } //-------------------------- End of Method ------------------------------
    403403
    404 ///////////////////////////
    405 
     404
     405
     406
     407  //---------------------- Helpers for complete XML -------------------------
    406408
    407409  /**
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/service/IndicatorDataBeanToXML.java

    r17685 r17716  
    33import java.util.ArrayList;
    44import java.util.Collection;
    5 import java.util.HashSet;
    65import java.util.List;
    76
     
    1211import org.ibisph.indicatorprofile.databean.*;
    1312import org.ibisph.indicatorprofile.service.DatasetDataBeanToXML;
    14 import org.ibisph.util.StrLib;
    1513import org.ibisph.util.XMLLib;
     14
    1615
    1716/**
     
    2322public class IndicatorDataBeanToXML extends DataBeanToXMLService {
    2423
    25   protected DatasetDataBeanToXML datasetDataBeanToXMLService = null;
     24  protected DatasetDataBeanToXML    datasetDataBeanToXMLService    = null;
     25  protected InitiativeDataBeanToXML initiativeDataBeanToXMLService = null;
    2626  protected Collection<Relation> relationDataBeanCollection  = null;
    2727
     
    4040  public void setDatasetDataBeanToXMLService(DatasetDataBeanToXML datasetDataBeanToXMLService) {
    4141    this.datasetDataBeanToXMLService = datasetDataBeanToXMLService;
     42  } //-------------------------- End of Method ------------------------------
     43
     44  /**
     45   * Sets the InitiativeDataBeanToXML service that is used to get the IP's initiatives.
     46   * @param initiativeDataBeanToXMLService service used to do the conversion.
     47   */
     48  public void setInitiativeDataBeanToXMLService(InitiativeDataBeanToXML initiativeDataBeanToXMLService) {
     49    this.initiativeDataBeanToXMLService = initiativeDataBeanToXMLService;
    4250  } //-------------------------- End of Method ------------------------------
    4351
     
    7583    XMLLib.addNode(document, this.datasetDataBeanToXMLService.getDatasetsNode(datasetCollection));
    7684    XMLLib.addNode(document, getTopicsNode(indicator));
    77     XMLLib.addNode(document, getInitiativesNode(indicator));
     85    XMLLib.addNode(document, initiativeDataBeanToXMLService.getInitiativesNode(indicator));
    7886    XMLLib.addNode(document, getRelationsNode(indicator));
    7987    XMLLib.addNode(document, getIndicatorViewsNode(indicator));
     
    118126    }
    119127    return(topicsNode);
    120   } //-------------------------- End of Method ------------------------------
    121 
    122 
    123   /**
    124    * Creates initiatives container and child topic and topic objective elements.
    125    * The supplied indicator only links to topic objectives so need to work from
    126    * the lowest level back to the top. 
    127    * Struct: INITIATIVES/INITIATIVE/
    128    *           INITIATIVE_TOPIC/
    129    *             INITIATIVE_TOPIC_OBJECTIVE
    130    * @param indicator DataBean to be converted to XML
    131    * @return XML INITIATIVES element for the supplied indicator dataBean.
    132    */
    133   public Node getInitiativesNode(Indicator indicator) throws Exception {
    134     Node initiativesNode = null;
    135 
    136     // start by seeing if any topic objectives exist for this IP.
    137     ArrayList<DataBean> initiativeTopicObjectiveToIndicatorCollection = new ArrayList<DataBean>();
    138     InitiativeTopicObjectiveToIndicator initiativeTopicObjectiveToIndicator = new InitiativeTopicObjectiveToIndicator();
    139     initiativeTopicObjectiveToIndicator.setFieldValue("INDICATOR_NAME", indicator.getName());
    140     this.dataBeanDAOService.load(
    141       initiativeTopicObjectiveToIndicatorCollection,
    142       initiativeTopicObjectiveToIndicator,
    143       new String[] {"INITIATIVE_TOPIC_NAME", "SORT_ORDER"}
    144     );
    145 
    146     // If any exist then process.  Loop for all the IP's topic objective records.
    147     // The processing starts with the lowest level (topic objective) and works
    148     // it way back up to the top INITIATIVES container adding containers and
    149     // elements as needed.
    150     if(0 < initiativeTopicObjectiveToIndicatorCollection.size()) {
    151       initiativesNode = XMLLib.newNode("INITIATIVES");
    152       for(int i=0; i<initiativeTopicObjectiveToIndicatorCollection.size(); i++) {
    153         initiativeTopicObjectiveToIndicator = (InitiativeTopicObjectiveToIndicator)initiativeTopicObjectiveToIndicatorCollection.get(i);
    154 
    155         // get the lowest level element the topic objective from db and convert to xml.
    156         InitiativeTopicObjective initiativeTopicObjective = new InitiativeTopicObjective();
    157         initiativeTopicObjective.setFieldValue("NAME", initiativeTopicObjectiveToIndicator.getInitiativeTopicObjectiveName());
    158         initiativeTopicObjective.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
    159         if(0 < this.dataBeanDAOService.load(initiativeTopicObjective) ) {
    160           Node initiativeTopicObjectiveNode = this.newNode("INITIATIVE_TOPIC_OBJECTIVE", initiativeTopicObjective);
    161      
    162           // now get the parent topic element to add this to. 
    163           // new parent elements as needed.
    164           InitiativeTopic initiativeTopic = new InitiativeTopic();
    165           initiativeTopic.setFieldValue("NAME", initiativeTopicObjective.getInitiativeTopicName());
    166           initiativeTopic.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
    167           if(0 < this.dataBeanDAOService.load(initiativeTopic)) {
    168             Node initiativeTopicNode = this.newNode("INITIATIVE_TOPIC", initiativeTopic);
    169             XMLLib.addNode(initiativeTopicNode, initiativeTopicObjectiveNode);
    170 
    171             Initiative initiative = new Initiative();
    172             initiative.setFieldValue("NAME", initiativeTopic.getInitiativeName());
    173             initiative.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
    174             if(0 < this.dataBeanDAOService.load(initiative)) {
    175               Node initiativeNode = this.newNode("INITIATIVE", initiative);
    176               XMLLib.addNode(initiativeNode, initiativeTopicNode);
    177               XMLLib.addNode(initiativesNode, initiativeNode);
    178             }
    179           }
    180         }
    181       }
    182     }
    183     return(initiativesNode);
    184128  } //-------------------------- End of Method ------------------------------
    185129
     
    282226      XMLLib.addNode(indicatorViewNode, XMLLib.newNode("NAME",         indicatorView.getName()) );
    283227      XMLLib.addNode(indicatorViewNode, XMLLib.newNode("TITLE",        indicatorView.getTitle()) );
    284 // TODO: possibly need to get the PERIOD, SERIES, CATEGORY dim titles???
    285 /*
    286 XMLLib.addNode(indicatorViewNode, XMLLib.newNode("SUB_TITLE",    indicatorView.getSubTitle()) );
    287 XMLLib.addNode(indicatorViewNode, XMLLib.newNode("PERIOD_TITLE", indicatorView.getPeriodTitle()) );
    288 XMLLib.addNode(indicatorViewNode, XMLLib.newNode("Y_TITLE",      indicatorView.getYTitle()) );
    289 */
    290228      XMLLib.addNode(indicatorViewsNode, indicatorViewNode);
    291229    }
     
    313251
    314252
    315   /////////////////////////////////////////////////
     253  //---------------------- Helpers for complete XML -------------------------
     254  // 12-30-2018 commit contained older related code.
     255
    316256  public Node getMeasuresNode(Node containerNode) throws Exception {
    317257    List<Node> measureNameNodes = XMLLib.getNodes(containerNode, "//MEASURE_NAME", "text()", true);
     
    407347  } //-------------------------- End of Method ------------------------------
    408348
    409 
    410 
    411 
    412   //////////////// SAVED FOR NOW
    413 
    414   public String[] getMeasureNames(ArrayList<DataBean> datasetCollection) throws Exception {
    415     HashSet<String> measureNames = new HashSet<String>();
    416     for(DataBean dataBean : datasetCollection) {
    417       Dataset dataset = (Dataset)dataBean;
    418       measureNames.add(dataset.getMeasureName());
    419     }
    420     return((String[])measureNames.toArray());
    421   } //-------------------------- End of Method ------------------------------
    422 
    423   public ArrayList<DataBean> getMeasures(String[] measureNames) throws Exception {
    424     Measure measure = new Measure();
    425     ArrayList<DataBean> measureCollection = new ArrayList<DataBean>();
    426     for(String measureName : measureNames) {
    427       this.dataBeanDAOService.load(measure, "NAME", measureName);
    428       measureCollection.add(measure);
    429     }
    430     return(measureCollection);
    431   } //-------------------------- End of Method ------------------------------
    432 
    433   public Node getMeasuresNode(ArrayList<DataBean> measureCollection) throws Exception {
    434     Node measuresNode = XMLLib.newNode("MEASURES");
    435     for(DataBean dataBean : measureCollection) {
    436       this.addDataBeanToNode(measuresNode, dataBean);
    437     }
    438     return(measuresNode);
    439   } //-------------------------- End of Method ------------------------------
    440 
    441 
    442 
    443   public String[] getValueTypeNames(ArrayList<DataBean> measureCollection) throws Exception {
    444     HashSet<String> valueTypeNames = new HashSet<String>();
    445     for(DataBean dataBean : measureCollection) {
    446       Measure measure = (Measure)dataBean;
    447       valueTypeNames.add(measure.getValueTypeName());
    448     }
    449     return((String[])valueTypeNames.toArray());
    450   } //-------------------------- End of Method ------------------------------
    451 
    452   public Node getValueTypesNode(String[] valueTypeNames) throws Exception {
    453     Node valueTypesNode = XMLLib.newNode("VALUE_TYPES");
    454     for(String valueTypeName : valueTypeNames) {
    455       ValueType valueType = new ValueType();
    456       this.dataBeanDAOService.load(valueType, "NAME", valueTypeName);
    457       this.addDataBeanToNode(valueTypesNode, valueType);
    458     }
    459     return(valueTypesNode);
    460   } //-------------------------- End of Method ------------------------------
    461 
    462 
    463 
    464   /**
    465    * Creates DATA_SOURCES container and child elements based on the supplied
    466    * dataset.
    467    * @param dataset DataBean to be converted to XML
    468    * @return XML DATA_SOURCES element for the supplied dataset DataBean.
    469    */
    470   public Node getDataSourcesNode(String datasetName) throws Exception {
    471     Node dataSourcesNode = XMLLib.newNode("DATA_SOURCES");
    472 
    473     ArrayList<DataBean> datasetDataSourceCollection = new ArrayList<DataBean>();
    474     DataSourceToDataset datasetDataSource = new DataSourceToDataset();
    475     datasetDataSource.setFieldValue("DATASET_NAME", datasetName);
    476     this.dataBeanDAOService.load(datasetDataSourceCollection, datasetDataSource);
    477     for(DataBean dataBean : datasetDataSourceCollection) {
    478       datasetDataSource = (DataSourceToDataset)dataBean;
    479 
    480       Node dataSourceNode = XMLLib.newNode("DATA_SOURCE");
    481       XMLLib.addNode(dataSourceNode, XMLLib.newNode("NAME",  datasetDataSource.getDataSourceName()));
    482       XMLLib.addNode(dataSourceNode, XMLLib.newNode("USAGE", datasetDataSource.getDataSourceUsage()));
    483       XMLLib.addNode(dataSourcesNode, dataSourceNode);
    484     }
    485     return(dataSourcesNode);
    486   } //-------------------------- End of Method ------------------------------
    487 
    488 
    489   /**
    490    * Creates DATASET's DIMENSIONs child DIMENSION/VALUES based on actual usage. 
    491    * @param dataset DataBean to be used for getting dimension XML.
    492    * @return XML DIMENSIONS element for the supplied dataset Databean.
    493    */
    494   public Node getDatasetDimensionsNode(
    495     String datasetName,
    496     ArrayList<DataBean> recordsCollection
    497   ) throws Exception {
    498     Node containerNode = XMLLib.newNode("DIMENSIONS");
    499 
    500     ArrayList<DataBean> dimensionToDatasetCollection = new ArrayList<DataBean>();
    501     DimensionToDataset dimensionToDataset = new DimensionToDataset();
    502     dimensionToDataset.setFieldValue("DATASET_NAME", datasetName);
    503     this.dataBeanDAOService.load(dimensionToDatasetCollection, dimensionToDataset);
    504 
    505     for(int i=0; i<dimensionToDatasetCollection.size(); i++) {
    506       dimensionToDataset  = (DimensionToDataset)dimensionToDatasetCollection.get(i);
    507       Dimension dimension = new Dimension();
    508       dimension.setFieldValue("NAME", dimensionToDataset.getDimensionName());
    509       if(0 < this.dataBeanDAOService.load(dimension)) {
    510 
    511         Node dimensionNode = this.newNode("DIMENSION", dimension);
    512  
    513         ArrayList<DataBean> dimensionValueCollection = new ArrayList<DataBean>();
    514         DimensionValue dimensionValue = new DimensionValue();
    515         dimensionValue.setFieldValue("DIMENSION_NAME", dimension.getName());
    516         this.dataBeanDAOService.load(dimensionValueCollection, dimensionValue);
    517         Node dimensionValuesNode = XMLLib.newNode("VALUES");
    518         XMLLib.addNode(dimensionNode, dimensionValuesNode);
    519  
    520         // loop for all dimension values.  Add the element if it is used.
    521         DatasetRecord datasetRecord;
    522         for(int j=0; j<dimensionValueCollection.size(); j++) {
    523           dimensionValue = (DimensionValue)dimensionValueCollection.get(j);
    524           boolean dimensionValueUsed = false;
    525           for(int k=0; k<recordsCollection.size(); k++) {
    526             datasetRecord = (DatasetRecord)recordsCollection.get(k);
    527             dimensionValueUsed =
    528                 (dimension.getName().equals(datasetRecord.getDimension1Name())
    529                     && dimensionValue.getValue().equals(datasetRecord.getDimension1Value()))
    530                 ||
    531                 (dimension.getName().equals(datasetRecord.getDimension2Name())
    532                     && dimensionValue.getValue().equals(datasetRecord.getDimension2Value()))
    533                 ||
    534                 (dimension.getName().equals(datasetRecord.getPeriodDimensionName())
    535                     && dimensionValue.getValue().equals(datasetRecord.getPeriodDimensionValue()))
    536             ;
    537             if(dimensionValueUsed) break;
    538           }
    539           if(dimensionValueUsed) XMLLib.addNode(dimensionValuesNode, this.newNode("VALUE", dimensionValue));
    540         }
    541         XMLLib.addNode(containerNode, dimensionNode);
    542       }
    543     }
    544 
    545     return(containerNode);
    546   } //-------------------------- End of Method ------------------------------
    547 
    548 
    549   /**
    550    * Creates VALUE_TYPES container and child elements based on the measure and
    551    * ancillary values.
    552    * @return XML VALUE_TYPES element.
    553    */
    554   public Node getValueTypesNode(
    555     Measure measure,
    556     ArrayList<DataBean> ancillaryValueToDatasetCollection
    557   ) throws Exception {
    558     Node valueTypesNode = XMLLib.newNode("VALUE_TYPES");
    559     HashSet<String> valueTypeNameHashSet = new HashSet<String>();
    560 
    561     ValueType valueType = getValueType(measure.getValueTypeName());
    562     XMLLib.addNode(valueTypesNode, newNode("VALUE_TYPE", valueType));
    563     valueTypeNameHashSet.add(valueType.getName());
    564 
    565     for(DataBean dataBean : ancillaryValueToDatasetCollection) {
    566       AncillaryValueToDataset ancillaryValueToDataset = (AncillaryValueToDataset)dataBean;
    567       AncillaryValue ancillaryValue = new AncillaryValue();
    568       ancillaryValue.setFieldValue("NAME", ancillaryValueToDataset.getAncillaryValueName());
    569       if(0 < this.dataBeanDAOService.load(ancillaryValue)) {
    570         String valueTypeName = ancillaryValue.getValueTypeName();
    571         if(StrLib.isSomething(valueTypeName) && !valueTypeNameHashSet.contains(valueTypeName)) {
    572           valueType = getValueType(valueTypeName);
    573           XMLLib.addNode(valueTypesNode, newNode("VALUE_TYPE", valueType));
    574           valueTypeNameHashSet.add(valueType.getName());
    575         }
    576       }
    577     }
    578     return(valueTypesNode);
    579   } //-------------------------- End of Method ------------------------------
    580 
    581   public ValueType getValueType(String name) throws Exception {
    582     ValueType valueType = new ValueType();
    583     valueType.setFieldValue("NAME", name);
    584     this.dataBeanDAOService.load(valueType);
    585     return(valueType);
    586   } //-------------------------- End of Method ------------------------------
    587 
    588 
    589   /**
    590    * Creates VALUE_ATTRIBUTES container and child elements.
    591    * @return XML VALUE_ATTRIBUTES element.
    592    */
    593   public Node getValueAttributesNode() throws Exception {
    594     ArrayList<DataBean> collection = new ArrayList<DataBean>();
    595     ValueAttribute valueAttribute = new ValueAttribute();
    596     valueAttribute.setFieldValue("ACTIVE_FLAG", this.dataBeanFlagValue);
    597     this.dataBeanDAOService.load(collection, valueAttribute);
    598     Node ancillaryValuesNode = this.newNode("VALUE_ATTRIBUTES", "VALUE_ATTRIBUTE", collection);
    599     return(ancillaryValuesNode);
    600   } //-------------------------- End of Method ------------------------------
    601 
    602 
    603   /**
    604    * Creates ANCILLARY_VALUES container and child elements based on the supplied
    605    * ancillary value collection.
    606    * @param ancillaryValueToDatasetCollection to be converted to XML
    607    * @return XML ANCILLARY_VALUES element for the supplied collection.
    608    */
    609   public Node getDatasetAncillaryValuesNode() throws Exception {
    610     ArrayList<DataBean> collection = new ArrayList<DataBean>();
    611     AncillaryValue ancillaryValue = new AncillaryValue();
    612     this.dataBeanDAOService.load(collection, ancillaryValue);
    613     Node ancillaryValuesNode = this.newNode("ANCILLARY_VALUES", "ANCILLARY_VALUE", collection);
    614     return(ancillaryValuesNode);
    615   } //-------------------------- End of Method ------------------------------
    616 
    617349} //============================ END OF CLASS =================================
    618350
  • trunk/ibisph/src/main/java/org/ibisph/indicatorprofile/springmvc/databean/EditIndicatorInitiativesController.java

    r15559 r17716  
    123123    request.getSession().setAttribute(this.initiativeTopicNameSessionName, requestedInitiativeTopicName);
    124124
     125// TODO: When time, need to filter out topic objectives that do NOT match any
     126// of the IP's to INIT TOPIC OBJECTIVE MEASURE_NAMEs -or- the ITO.MN is null.
     127// This will insure that the objective comparison has a value that can be
     128// used.  This needs to be determined with the CoP.
     129
    125130    // load the assoc init topic objectives collection
    126131    InitiativeTopicObjective initiativeTopicObjective = new InitiativeTopicObjective();
Note: See TracChangeset for help on using the changeset viewer.