Zum Hauptinhalt gehen

NavigateToUri vs OpenWebPage

Kommentare

5 Kommentare

  • Permanently deleted user

    Yep, it is by design. See this thread: https://support.geocortex.com/essentialsGSCForum?sub-nav=forum&main-nav=essentials&id=9066000000006oMAAQ

    - Matthew

    0
  • Permanently deleted user

    Yes, I agree on Bernard's point since the workflow should be Viewer agnostic.

    'NavigateToUri' Commands has not implemented in the GVH product, while the GVS has it.

    However, if you really want to use only one command 'NagigateToUri' on the workflow to support on GVS and GVH without any mofidication of the workflow file, you can implement your own custom command 'NavigateToUri.

    This is what I would do.

    // Register the command

    this.app.commandRegistry.command("NavigateToUri").register(this, this.executeNavigateToUriCommand);

    // Handler of the 'NavigateToUri' command executeNavigateToUriCommand(uri:string): void {             try {                 if (this._checkValidUrl(uri)) {                     window.open(uri, "_blank");                 }             }             catch (Err)             {                 this.app.trace.exception("Failed to navigate to {0}".format(uri), Err);             }        }
    0
  • Permanently deleted user
    Mr. Gim,

     

    Can you please explain how you implimented this code? I don't see how within Workflow Designer, unless you used Scripting. 

     

    Much appreciated,

     

    Richard
    0
  • Permanently deleted user
    To implement the NavigateToUri command please do the following:

     

    In your geocortex html5viewer folder create the following folders and javascript file.

     

    Note: you don’t have to use this folder structure but it’s what I used throughout this example

     

    C:\inetpub\wwwroot\Html5Viewer\Libraries\Compiled\Custom

     

    Create a new file called myNavigateToUri.js

     

    In the file add the following:

     

     

     

    // Begin Script: myNavigateToUri.js //

     

    dojo.declare("my.customModules.integrations.NavigateToUri", geocortex.framework.application.ModuleBase, {

     

     

     

        initialize: function (configuration) {  

     

                           

     

                            // Register the command to handle of the 'NavigateToUri' command

     

                            this.app.commandRegistry.command("NavigateToUri").register(this, function(uri) {

     

     

     

                try {

     

                    //if (this._checkValidUrl(uri)) {

     

                            //Open in new window/tab

     

                            //window.open(uri, "_blank");

     

    //Don’t open a new window/tab

     

                            window.open(uri, "_self");

     

                    //}

     

                }

     

                catch (Err)

     

                {

     

                    this.app.trace.exception("Failed to navigate to {0}".format(uri), Err);

     

                }      

     

                           

     

                            });

     

                           

     

        }

     

               

     

    });

     

     

     

    // End Script: myNavigateToUri.js //

     

     

     

    geocortex.framework.notifyLibraryDownload("NavigateToUri");

     

     

     

     

     

    Next your Desktop.json.js file in

     

    C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Default\REST Elements\Sites\GeoTest\Viewers\HTML5\VirtualDirectory\Resources\Config\Default

     

    Add the following under libraries (Note the brackets and comma. If you put it first in the library it only need a comma after the closing bracket.)

     

    "libraries": [

     

          {

     

            "id": "NavigateToUri",

     

            "uri": "Libraries/Compiled/Custom/myNavigateToUri.js"

     

          },

     

         { "id": …

     

     

     

    And the following under modules

     

    "modules": [

     

           {

     

            "moduleName": "NavigateToUri",

     

            "moduleType": "my.customModules.integrations.NavigateToUri",

     

            "libraryId": "NavigateToUri",

     

            "configuration": {},

     

            "views": [],

     

            "viewModels": []

     

          },

     

           {

     

            "moduleName": …

     

     

     

    You should now be able to use the command NavigateToUri

     

    For example in a workflow use the external command

     

    Command Name: "NavigateToUri"

     

    Command Parameter: (http://www.google.com.au/?q=customlink) www.google.com.au/?q=customlink

     

     
    0
  • Permanently deleted user
    Hi, I follow the above steps but with no sucess

     

    when i tried to add a new button "NavigateToUri" command  didn't appear in the list, do I miss any step?

     

    Cheers,

     

     
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.