Exemplo n.º 1
0
        protected void SecurableClassDefinitionTree_Click(object sender, BocTreeNodeClickEventArgs e)
        {
            if (!IsReturningPostBack)
            {
                var classDefinition = (SecurableClassDefinition)e.BusinessObjectTreeNode.BusinessObject;
                var function        = new EditPermissionsFormFunction(WxeTransactionMode.CreateRootWithAutoCommit, classDefinition.GetHandle());
                var options         = new WxeCallOptionsExternal(
                    "_blank", "width=1000, height=700, resizable=yes, menubar=no, toolbar=no, location=no, status=no", true);
                try
                {
                    ExecuteFunction(function, new WxeCallArguments((Control)sender, options));
                }
                catch (WxeCallExternalException)
                {
                }
            }
            else
            {
                var classDefinition = ((EditPermissionsFormFunction)ReturningFunction).CurrentObjectHandle.GetObject();
                UnloadService.UnloadVirtualEndPoint(
                    ClientTransaction.Current,
                    RelationEndPointID.Resolve(classDefinition, c => c.StatelessAccessControlList));
                UnloadService.UnloadVirtualEndPoint(
                    ClientTransaction.Current,
                    RelationEndPointID.Resolve(classDefinition, c => c.StatefulAccessControlLists));

                LoadTree(false, true);
            }
        }
        /// <summary>
        ///   Executes a <see cref="WxeFunction"/> outside the current function's context (i.e. asynchron) using the
        ///   specified window or frame through javascript window.open(...).
        /// </summary>
        /// <include file='..\..\doc\include\ExecutionEngine\WxePageExtensions.xml' path='WxePageExtensions/ExecuteFunctionExternal/param[@name="page" or @name="function" or @name="target" or @name="features" or @name="sender" or @name="returningPostback" or @name="createPermaUrl" or @name="useParentPermaUrl" or @name="urlParameters"]' />
        public static void ExecuteFunctionExternal(
            this IWxePage page,
            WxeFunction function,
            string target,
            string features,
            Control sender,
            bool returningPostback,
            bool createPermaUrl,
            bool useParentPermaUrl,
            NameValueCollection urlParameters)
        {
            var permaUrlOptions = CreatePermaUrlOptions(createPermaUrl, useParentPermaUrl, urlParameters);
            var options         = new WxeCallOptionsExternal(target, features, returningPostback, permaUrlOptions);
            var arguments       = new WxeCallArguments(sender, options);

            Execute(page, function, arguments);
        }
Exemplo n.º 3
0
        public void ExecuteFunctionExternal(WxeFunction function, Control sender, WxeCallOptionsExternal options)
        {
            ArgumentUtility.CheckNotNull("function", function);
            ArgumentUtility.CheckNotNull("sender", sender);
            ArgumentUtility.CheckNotNull("options", options);

            string functionToken = WxeContext.Current.GetFunctionTokenForExternalFunction(function, options.ReturningPostback);

            string href = WxeContext.Current.GetDestinationUrlForExternalFunction(function, functionToken, options.PermaUrlOptions);

            // Execute after Smart-Page was restored
            string functionName = "ExecuteFunctionExternal_" + Guid.NewGuid().ToString().Replace('-', '_');
            string openScript   = string.Format(
                "function {0} () {{ setTimeout( function () {{ window.open('{1}', '{2}', '{3}'); }}, 0); }}",
                functionName,
                href,
                options.Target,
                options.Features ?? string.Empty);

            _page.ClientScript.RegisterClientScriptBlock(_page, typeof(WxeExecutor), "WxeExecuteFunction", openScript);
            _page.RegisterClientSidePageEventHandler(SmartPageEvents.OnLoad, "WxeExecuteFunction", functionName);

            function.SetExecutionCompletedScript(GetClosingScriptForExternalFunction(functionToken, sender, options.ReturningPostback));
        }