cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a Please wait right on starting custom action

raghav_bhardwaj
Champ on-the-rise
Champ on-the-rise
Hi ,

I want to display a "Please wait loading" message just on starting custom action and message should stay there untill action is completed  .I know about  Alfresco.util.PopupManager.Displaymessage  but dont know how to implement it. PLease someone guide me to acomplish this task.




cheers

Raghav Bhardwaj
7 REPLIES 7

angelborroy
Community Manager Community Manager
Community Manager

Hi thanks for your reply,

I tried above solution but still not seeing any wait message. No errors on logs as well. Is it even possible with version 5.0.d. Please help

Thanks It Worked!!!!!!!!!


cheers

Raghav Bhardwaj

muralidharand
Star Contributor
Star Contributor
Can you please try the below one,

Alfresco.util.PopupManager.displayMessage({
    text : "Please wait, while loading your data",
    spanClass : "wait",
    displayTime : 0
});



If possible, can you please share your code as well?

Hi i extended actions.js and edited the existing function onActionSimpleRepoAction

This is the code from actions.js

onActionSimpleRepoAction: function dlA_onActionSimpleRepoAction(record, owner)
      {
   YAHOO.Bubbling.fire("registerAction", {
      actionName : "someco-web-enable",
      fn: function onGlacierArchiveAction(record, owner) {
         
         this.widgets.waitDialog = Alfresco.util.PopupManager.displayMessage({
            text : "testtttttttttttttttttttttttttttttttttttt",
            spanClass : "wait",
            displayTime : 100000
         });
         
         // Get action params
            var params = this.getAction(record, owner).params,
               displayName = record.displayName,
               namedParams = ["function", "action", "success", "successMessage", "failure", "failureMessage"],
               repoActionParams = {};

            for (var name in params)
            {
               if (params.hasOwnProperty(name) && !Alfresco.util.arrayContains(namedParams, name))
               {
                  repoActionParams[name] = params[name];
               }
            }

            // Deactivate action
            var ownerTitle = owner.title;
            owner.title = owner.title + "_deactivated";

            // Prepare genericAction config
            var config =
            {
               success:
               {
                  event:
                  {
                     name: "metadataRefresh",
                     obj: record
                  }
               },
               failure:
               {
                  message: this.msg(params.failureMessage, displayName),
                  fn: function showAction()
                  {
                     owner.title = ownerTitle;
                  },
                  scope: this
               },
               webscript:
               {
                  method: Alfresco.util.Ajax.POST,
                  stem: Alfresco.constants.PROXY_URI + "api/",
                  name: "actionQueue"
               },
               config:
               {
                  requestContentType: Alfresco.util.Ajax.JSON,
                  dataObj:
                  {
                     actionedUponNode: record.nodeRef,
                     actionDefinitionName: params.action,
                     parameterValues: repoActionParams
                  }
               }
            };


This is the code from share-custom-config.xml

<alfresco-config>
   

    <!– Actions –>
    <config evaluator="string-compare" condition="DocLibActions">
        <actions>
            <action id="someco-web-site" type="link" label="actions.someco.web-site" icon="someco-website">
                <param name="href">http://ecmarchitect.com</param>
                <param name="target">_blank</param>
            </action>
            <action id="someco-web-enable" type="javascript" label="actions.someco.web-enable" icon="someco-create-website">
                <param name="function">onActionSimpleRepoAction</param>
                <permissions>
                    <permission allow="true">Write</permission>
                </permissions>
                <param name="action">enable-web-flag</param>
                <param name="successMessage">message.web-flag.enabled</param>
                <param name="failureMessage">message.web-flag.failure</param>
                <evaluator negate="true">someco.evaluator.doclib.action.isActive</evaluator>
            </action>
            <action id="someco-web-disable" type="javascript" label="actions.someco.web-disable" icon="someco-delete-website">
                <param name="function">onActionSimpleRepoAction</param>
                <permissions>
                    <permission allow="true">Write</permission>
                </permissions>
                <param name="action">disable-web-flag</param>
                <param name="successMessage">message.web-flag.disabled</param>
                <param name="failureMessage">message.web-flag.failure</param>
                <evaluator>someco.evaluator.doclib.action.isActive</evaluator>
            </action>
        </actions>
        <actionGroups>
            <actionGroup id="document-browse">
                <action index="500" id="someco-web-site" />
                <action index="510" id="someco-web-enable" />
                <action index="520" id="someco-web-disable" />               
            </actionGroup>
            <actionGroup id="document-details">
                <action index="500" id="someco-web-site" />
                <action index="510" id="someco-web-enable" />
                <action index="520" id="someco-web-disable" />               
            </actionGroup>
        </actionGroups>       
    </config>
</alfresco-config>

muralidharand
Star Contributor
Star Contributor
Hi,
Can you please post your code inside the code block (< code > …… < / code >)?

Thanks
Murali.

Hi iam attaching you screenshots of both files ie actions.js and share-config-custom.xml. In actions.js i have added your code in existing function onActionSimpleRepoAction and calling this function when the action is invoked. Please help me solving this issue.