Jump to content
Changes to the Jaspersoft community edition download ×

Ultimate Guide - Adding an Item to the Main Menu - Information in guide either Wrong/Not complete


Alex42

Recommended Posts

I have asked a previous question on the board in hopes of getting an answer(still waiting).

In the meantime i have created a fresh instance of the server(new AWS instance) and followed to the letter the guide from here: http://community.jaspersoft.com/documentation/tibco-jasperreports-server-ultimate-guide/v630/adding-item-main-menu

below are the contents of the files modified as suggested by the guide. These do not work.The menus appear changed but nothing happens when selecting the new values. It appears that the actions(actionArgs) are not treated or wrong somehow.I was expecting at least the guide to work, pretty dissapointed

pro_nav_messages.properties

NAV_001_HOME=Home
NAV_002_VIEW=View
NAV_003_MANAGE=Manage
NAV_004_LOGOUT=Log Out
NAV_005_CREATE=Create
 
NAV_020_TITLE=JasperReports Server
NAV_020_FULL_TITLE=JasperReports Server
NAV_021_TITLE_MODIFIER=professional
 
NAV_021_LIBRARY=Repository
NAV_022_REPORTS=Reports
NAV_023_OLAP_VIEWS=OLAP Views
NAV_024_EVENTS=Messages
NAV_025_ADHOC=Ad Hoc Report
NAV_026_REPOSITORY_EXPLORER=Repository Explorer  
NAV_027_SEARCH=Search Results
NAV_028_ACCOUNTS=MyCompany Accounts
 
NAV_031_USERS=Users
NAV_032_ROLES=Roles
NAV_033_OLAP_PROPERTIES=OLAP Settings
NAV_033A_OLAP_CACHE=OLAP Cache
NAV_034_FLUSH_OLAP_CACHE=Flush Now
NAV_035_MANAGE_HOME_PAGE=Admin Home
NAV_036_ADHOC_CACHE=Ad Hoc Cache
NAV_037_ETL_ADMIN=ETL
NAV_038_QUERY_GOVERNOR=Ad Hoc Options
 
NAV_050_DASHBOARD=Dashboard
NAV_051_ADHOC_REPORT=Ad Hoc View
NAV_052_SLDS_WIZARD=SL Data Source
NAV_053_SL_SCHEMA_BUILDER=SL Schema Builder
NAV_054_DATA_VIEW=Data View
NAV_055_TENANT=Organizations
NAV_056_DOMAIN=Domain
NAV_056A_LEGACY_DOMAIN=Legacy Domain
NAV_057_REPORT=Report
NAV_058_DATA_SOURCE=Data Source
 
 
# Home
home.title=Home
home.header.title=Home
home.view=View Reports
home.analyse=Analyze Data
home.createView=Create Ad Hoc View
home.createReport=Create Report
home.manage=Manage Server
 
# Manage Home
manage.home.title=Admin Home
manage.home.header.title=Admin Home
manage.home.browseRepository=Repository
manage.home.users=Users
manage.home.roles=Roles
manage.home.analysisOptions=OLAP Settings
 
NAV_140_ABOUT_JS=About JasperReports Server...
NAV_141_ABOUT_PRODUCT_VERSION=Product Version
NAV_142_ABOUT_LICENSE_TYPE=License Type
NAV_143_ABOUT_LICENSE_EXPIRATION=Expiration
NAV_144_ABOUT_BUILD_TIME=Build
NAV_145_ABOUT_LICENSE_PRODUCT_NAME=Product Name
NAV_146_ABOUT_LICENSE_PRODUCT_EDITION=Product Edition
NAV_147_ABOUT_LICENSE_FEATURES=Features
 
#Decorator Header
HELP=Help
 
#Welcome Login Page
LOGIN_WELCOME_PROFESSIONAL=Welcome to JasperReports Server
# the following 2 strings: (demo/demo) to view our demo dashboard (if samples were installed)
LOGIN_DEMO=to view our demo dashboard
LOGIN_SAMPLE_INSTALL=(if samples were installed)
ONLINE_HELP_PRE=Read the
ONLINE_HELP=Online Help
LOGIN_EVALUATION_GUIDE_PRE=Download the
LOGIN_EVALUATION_GUIDE=Evaluation Guide
#The following string is used as: Sign up for Online and Onsite Training
LOGIN_SIGN_UP_FOR=Sign up for
LOGIN_ABOUT=About JasperReports Server...
 
LOGIN_ROTATING_PRO_0_RESOURCES_FOR_SUCCESS_ITEM_2_1=Full
LOGIN_ROTATING_PRO_0_RESOURCES_FOR_SUCCESS_ITEM_2_2=Jaspersoft curriculum
LOGIN_ROTATING_PRO_0_RESOURCES_FOR_SUCCESS_ITEM_2_3=available live online or in the classroom.
LOGIN_ROTATING_PRO_0_RESOURCES_FOR_SUCCESS_ITEM_3_1=Considering Analysis for your organization? Check out
LOGIN_ROTATING_PRO_0_RESOURCES_FOR_SUCCESS_ITEM_3_2=Jaspersoft Enterprise
 
actionModel-navigation.xml
 
<?xml version="1.0" encoding="UTF-8"?>
<actions>
    <!--context for home-->
    <context name="main_home_mutton"/>
 
    <context name="main_library_mutton"
    test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR">
    </context>
 
    <!--context for view option on primary menu-->
        <context name="main_view_mutton" test="!banUserRole">
            <selectAction labelKey="menu.repository">
                <option labelKey="menu.search" action="primaryNavModule.navigationOption" actionArgs="search"/>
                <option labelKey="menu.all" action="primaryNavModule.navigationOption" actionArgs="browse"/>
                <option labelKey="menu.jobs" action="primaryNavModule.navigationOption" actionArgs="jobs"/>
<!--
                <option labelKey="menu.reports" action="primaryNavModule.navigationOption" actionArgs="report"/>
                <condition test="isCEVersion">
                    <option labelKey="menu.olap.views" action="primaryNavModule.navigationOption" actionArgs="olap"/>
                </condition>
                <condition test="isProVersion">
                    <condition test="isAvailableProFeature" testArgs="ANA">
                        <option labelKey="menu.olap.views" action="primaryNavModule.navigationOption" actionArgs="olap"/>
                    </condition>
                </condition>
-->
                <option labelKey="menu.events" action="primaryNavModule.navigationOption" actionArgs="event"/>
                <!--this is temp only-->
                
                <condition test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR">
                    <separator/>
                    <option labelKey="menu.samples" clientTest="!isIPad" action="primaryNavModule.navigationOption" actionArgs="samples"/>
                </condition>
                <separator/>
                <option labelKey="NAV_028_ACCOUNTS" action="primaryNavModule.navigationOption" actionArgs="accounts"/>
            </selectAction>
        </context>
 
    <!--context for manage option on primary menu-->
    <context name="main_manage_mutton" test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR">
        <condition test="isSupportedDevice">
            <selectAction labelKey="menu.administration">
                <!--pro only-->
                <condition test="isProVersion">
<!--
                    <condition test="!banUserRole">
                      <option labelKey="NAV_035_MANAGE_HOME_PAGE" action="primaryNavModule.navigationOption" actionArgs="adminHome"/>
                    </condition>
-->
                    <condition test="showMTMenuItem">
                        <option labelKey="NAV_055_TENANT" action="primaryNavModule.navigationOption" actionArgs="organization"/>
                    </condition>
                    <condition test="checkAuthenticationRoles" testArgs="ROLE_ETL_ADMIN">
                      <condition test="!banUserRole">
                          <option labelKey="NAV_037_ETL_ADMIN" action="primaryNavModule.navigationOption" actionArgs="etl"/>
                       </condition>
                    </condition>
                </condition>
                <!-- end pro only -->
                <option labelKey="menu.users" action="primaryNavModule.navigationOption" actionArgs="user"/>
                <condition test="!banUserRole">
                  <option labelKey="menu.roles" action="primaryNavModule.navigationOption" actionArgs="role"/>
                </condition>
 
                <!--pro only-->
<!--
                <condition test="isProVersion">
                <condition test="!banUserRole">
                    <condition test="checkAuthenticationRoles" testArgs="ROLE_SUPERUSER">
                        <condition test="isAvailableProFeature" testArgs="ANA">
                            <option labelKey="menu.mondrian.properties" action="primaryNavModule.navigationOption" actionArgs="analysisOptions"/>
                        </condition>
                        <option labelKey="menu.adhoc.options" action="primaryNavModule.navigationOption" actionArgs="designerOptions"/>
                        <option labelKey="menu.adhoc.cache" action="primaryNavModule.navigationOption" actionArgs="designerCache"/>
                    </condition>
                </condition>
                </condition>
-->
                <!--end pro only-->
                <condition test="isProVersion">
                <condition test="!banUserRole">
                    <condition test="checkAuthenticationRoles" testArgs="ROLE_SUPERUSER">
                        <option labelKey="menu.server.settings" action="primaryNavModule.navigationOption" actionArgs="logSettings"/>
                    </condition>
                </condition>
                </condition>
                <condition test="isCEVersion">
<!--
                    <option labelKey="menu.mondrian.properties" action="primaryNavModule.navigationOption" actionArgs="mondrianProperties"/>
-->
                    <option labelKey="menu.server.settings" action="primaryNavModule.navigationOption" actionArgs="logSettings"/>
                </condition>
            </selectAction>
        </condition>
    </context>
 
    <!--jasperserver designer pro only-->
        <context name="main_create_mutton" test="isProVersion">
         <condition test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR"> 
          <condition test="!banUserRole">
            <condition test="!isMainFeaturesDisabled">
                <selectAction labelKey="NAV_005_CREATE">
                    <condition test="isAvailableProFeature" testArgs="AHD">
                        <option labelKey="NAV_051_ADHOC_REPORT" action="primaryNavModule.navigationOption"
                                actionArgs="designer"/>
                        <option labelKey="NAV_057_REPORT" action="JRS.CreateReport.selectADV"
                                actionArgs="createReport"/>
                    </condition>
                    <condition test="isSupportedDevice">
                        <condition test="isAvailableProFeature" testArgs="DB">
                            <option labelKey="NAV_050_DASHBOARD" action="primaryNavModule.navigationOption"
                                    actionArgs="dashboard"/>
                        </condition>
                        <condition test="isAvailableProFeature" testArgs="AHD">
                            <condition test="checkAuthenticationRoles" testArgs="ROLE_ADMINISTRATOR">
                                <option labelKey="NAV_056_DOMAIN" action="primaryNavModule.navigationOption"
                                        actionArgs="domain"/>
                                <option labelKey="NAV_058_DATA_SOURCE" action="primaryNavModule.navigationOption"
                                        actionArgs="dataSource"/>
                            </condition>
                        </condition>
                    </condition>
                </selectAction>
            </condition>
          </condition>
         </condition>
        </context>
</actions>
 

actionModel.primaryNavigation.js

/*
 * Copyright © 2005 - 2014 TIBCO Software Inc. All rights reserved.
 *
 * Unless you have purchased  a commercial license agreement from Jaspersoft,
 * the following license terms  apply:
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License  as
 * published by the Free Software Foundation, either version 3 of  the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero  General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public  License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
 
 
/**
 * @version: $Id: actionModel.primaryNavigation.js 10166 2016-05-26 22:39:40Z gbacon $
 */
 
/* global isNotNullORUndefined, actionModel, __jrsConfigs__, getAsFunction */
 
var primaryNavModule = {
  NAVIGATION_MENU_CLASS : "menu vertical dropDown",
  ACTION_MODEL_TAG : "navigationActionModel",
  CONTEXT_POSTFIX : "_mutton",
  NAVIGATION_MUTTON_DOM_ID : "navigation_mutton",
  NAVIGATION_MENU_PARENT_DOM_ID : "navigationOptions",
  JSON : null,
 
    /**
     * Navigation paths used in the navigation menu
     */
    navigationPaths : {
        browse : {url : "flow.html", params : "_flowId=searchFlow"},
        home : {url : "home.html"},
        library : {url : "flow.html", params : "_flowId=searchFlow&mode=library"},
        logOut : {url : "exituser.html"},
        search : {url : "flow.html", params : "_flowId=searchFlow&mode=search"},
        report : {url : "flow.html", params : "_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-reports&searchText="},
        accounts : {url : "flow.html", params : "_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-reports&searchText=account"},
        jobs : {url : "scheduler/main.html"},
        olap : {url : "flow.html", params : "_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-view&searchText="},
        event : {url : "flow.html", params : "_flowId=logEventFlow"},
        samples : {url : "flow.html", params : "_flowId=sampleFlow&page=dialogs"},
        adminHome : {url : "flow.html", params : "_flowId=adminHomeFlow"},
        organization : {url : "flow.html", params : "_flowId=tenantFlow"},
        etl : {url : "etl"},
        mondrianProperties : {url : "olap/properties.html"},
        flush : {url : "olap/flush.html"},
        user : {url : "flow.html", params : "_flowId=userListFlow"},
        role : {url : "flow.html", params : "_flowId=roleListFlow"},
        analysisOptions : {url : "flow.html", params : "_flowId=mondrianPropertiesFlow"},
        designerOptions : {url : "flow.html", params : "_flowId=designerOptionsFlow"},
        designerCache : {url : "flow.html", params : "_flowId=designerCacheFlow"},
        awsSettings : {url : "flow.html", params : "_flowId=awsSettingsFlow"},
        designer : {url : "flow.html", params : "_flowId=adhocFlow"},
        dashboard : {url : "dashboard/designer.html"},
        legacyDashboard : {url : "flow.html", params : "_flowId=dashboardDesignerFlow&createNew=true"},
        domain : {url : "flow.html", params : "_flowId=createSLDatasourceFlow&ParentFolderUri="},
        dataSource : {url : "flow.html", params : "_flowId=addDataSourceFlow&ParentFolderUri=" + encodeURIComponent("/datasources")},
        logSettings : {url : "log_settings.html"},
        createReport: {url:"view/view/modules/adhoc/createReport"}
    },
 
    /**
     * List of dom Id's for pages that require user confirmation before leaving.
     */
    bodyIds : {
        "designer" : "designerBase.confirmAndLeave",
        "dashboardDesigner" : "designerBase.confirmAndLeave",
        "repoBrowse": "repositorySearch.confirmAndLeave",
        "repoSearch": "repositorySearch.confirmAndLeave",
        "manage_users": "orgModule.confirmAndLeave",
        "manage_roles": "orgModule.confirmAndLeave",
        "manage_orgs": "orgModule.confirmAndLeave",
        "domainDesigner_tables": "domain.designer.confirmAndLeave",
        "domainDesigner_derivedTables": "domain.designer.confirmAndLeave",
        "domainDesigner_joins": "domain.designer.confirmAndLeave",
        "domainDesigner_calculatedFields": "domain.designer.confirmAndLeave",
        "domainDesigner_filters": "domain.designer.confirmAndLeave",
        "domainDesigner_display": "domain.designer.confirmAndLeave",
        "dataChooserDisplay": "domain.chooser.confirmAndLeave",
        "dataChooserFields": "domain.chooser.confirmAndLeave",
        "dataChooserPreFilters": "domain.chooser.confirmAndLeave",
        "dataChooserSaveAsTopic": "domain.chooser.confirmAndLeave",
        "reportViewer": "Report.confirmAndLeave"
    },
 
    globalActions : {
        "logOut" : function(bodyId) { return primaryNavModule.bodyIds[bodyId]; }
    },
 
    /**
     * This method initializes the primary menu. This needs to be called only once.
     */
    initializeNavigation : function(){
        var navKey;
        var navId;
        var navObject;
 
        if ($(this.ACTION_MODEL_TAG) === null) {
            return;
        }
 
        this.JSON =  !!$(this.ACTION_MODEL_TAG).text ? ($(this.ACTION_MODEL_TAG).text.evalJSON()) : {};
        var re = /[A-Za-z]+[_]{1}[A-Za-z]+/;
        //go through json and get keys. Keys == action model context == nav menu muttons
        for(navKey in this.JSON){
            navId = re.exec(navKey)[0]; //strip out ids
            navObject = this.JSON[navKey][0];  //get labels
            if(isNotNullORUndefined(navObject)){
                this.createMutton(navId, navObject.text);
            } else {
                if (navId === "main_home" || navId === "main_library"){
                    var leaf = $(navId);
                    leaf && $(leaf).removeClassName("hidden");
                }
            }
        }
    },
 
 
    /**
     * helper to create dom object
     */
    createMutton : function(domId, label){
        var mutton = $(this.NAVIGATION_MUTTON_DOM_ID).cloneNode("true");
        var textPlacement = $(mutton).down(".button");
 
        $(mutton).setAttribute("id", domId);
        //TODO: see if we can do this with builder (maybe not)
        var text = document.createTextNode(label);
        textPlacement.appendChild(text);
 
        var navigationMenuParent = $(this.NAVIGATION_MENU_PARENT_DOM_ID);
        navigationMenuParent && navigationMenuParent.appendChild(mutton);
    },
 
    /* Show the drop-down menu for a given top-level menu item on the menu bar. */
    showNavButtonMenu : function(event, object){
        var elementId = jQuery(object).attr("id");
        actionModel.showDropDownMenu(event, object, elementId + this.CONTEXT_POSTFIX, this.NAVIGATION_MENU_CLASS, this.ACTION_MODEL_TAG);
        $("menu").parentId = elementId;
    },
 
    /**
     * Used to determine if a element is part of the navigation button
     * @param object
     */
    isNavButton : function(object){
        return ($(object).hasClassName("mutton") || $(object).hasClassName("icon"));
 
    },
 
    /**
     * Object based method used to create a url based on the navigation path object
     * @param place Place where to go described in primaryNavModule.navigationPaths
     * @param params Request parameters
     */
    setNewLocation : function(place, params){
        var locObj = this.navigationPaths[place], queryParams = params || locObj.params;
        if(!locObj) return;
 
        queryParams = queryParams ? "?" + queryParams : "";
        window.location.href = __jrsConfigs__.urlContext + "/" + locObj.url + queryParams;
    },
 
 
    /**
     * Method used to create a url based on the navigation path object
     * @param option
     */
    navigationOption : function(option){
        var bodyId = $(document.body).readAttribute("id"), execFunction = null;
        if(primaryNavModule.globalActions[option]){
            execFunction = primaryNavModule.globalActions[option](bodyId);
        } else if(primaryNavModule.bodyIds[bodyId]){
            execFunction = primaryNavModule.bodyIds[bodyId];
        }
        if (execFunction) {
            var executableFunction = getAsFunction(execFunction);
            var answer = executableFunction();
            if (typeof answer == 'function') {
                answer(function() {
                    primaryNavModule.setNewLocation(option);
                });
                return;
            } else if(!answer){
                return;
            }
        }
        primaryNavModule.setNewLocation(option);
    },
 
    /* ==== EVENTS ==== */
 
    /**
     * Event for fired on mouse over. Used to show a menu.
     * @param event
     * @param object
     */
    onMenuHeaderMouseOver : function(event, object){
        this.showNavButtonMenu(event, object);
    }
};

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

soooo, after quite a few lost days, it turns out the guide actually works.My bad on that part. It is however not complete. It does not mention a key piece of information. CLEAR BROWSER CAHCE if you/or any user for that matter wants to see any change to the manu or the actions assignd. CLEAR AFTER EVERY CHANGE. FOR ALL USERS(they really like that!!!!). If you don't,  and any user has used the system before the change, unless they clean cache this will not work. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...