Exemple #1
0
 private void procNewOne(Object state)
 {
     try
     {
         if (t != null && t.Authenticated)
         {
             User currentUser = t.GetCurrentUser();
             wf.WorkflowName = "TESTDBFLOADING";
             WorkflowReference wfRef = currentUser.AddNewWorkFlow(wf, "--");
             if (wfRef == null)
             {
             }
             ComputableWorkflowReference computebleWfRef = null;
             computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, "--", "");
         }
     }
     catch
     {
     }
 }
Exemple #2
0
        public void RaiseCallbackEvent(string eventArgument)
        {
            if (eventArgument == null || eventArgument == "")
            {
                result = "Error on publishing, contact an administrator";
            }
            else
            {
                string[] args             = eventArgument.Split('|');
                string   type             = args[0];
                string   description      = args[1];
                string   expiration_date  = args[2];
                string   checkOption      = args[3];
                string   serviceList      = args[4];
                string   usingStaticField = args[5];

                try
                {
                    //Publishing WF
                    Security.Token tok = (Security.Token)Page.Session["Token"];
                    if (tok != null && tok.Authenticated)
                    {
                        if (tok.GetCurrentUser().Registered)
                        {
                            string uri = (string)Page.Session["uriFromComm"];


                            WorkflowReference wfRef = (WorkflowReference)Page.Session["WFE_CurrentWorkflowReference"];

                            ComputableWorkflowReference computebleWfRef = null;
                            if (type.Equals("public"))
                            {
                                if (checkOption.Equals("false"))
                                {
                                    computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, 1, description, expiration_date, uri);
                                }
                                else
                                {
                                    if (serviceList.Equals("allservices"))
                                    {
                                        computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITHOUT_REPLICATION, 1, description, expiration_date, uri);
                                    }
                                    else
                                    {
                                        computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_BY_SERVICE, int.Parse(serviceList), description, expiration_date, uri);
                                    }
                                }
                            }
                            else
                            {
                                if (checkOption.Equals("false"))
                                {
                                    computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_NOT_ANONYM, 1, description, expiration_date, uri);
                                }
                                else
                                {
                                    computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_ANONYM, 1, description, expiration_date, uri);
                                }
                            }

                            if (computebleWfRef == null)
                            {
                                result = "Database Error: An error occurred while publishing!";
                            }
                            else
                            {
                                //For Theme-Editor
                                Page.Session["WFE_CurrentWorkflow"] = computebleWfRef;
                                if (usingStaticField.Equals("true"))
                                {
                                    Page.Session["UsingStaticFields"] = true;
                                }
                                else
                                {
                                    Page.Session["UsingStaticFields"] = false;
                                }

                                result = "Workflow published";
                                Page.Session["uriFromComm"] = "";
                            }
                        }
                    }
                    else
                    {
                        result = "You are not logged in!";
                    }
                }
                catch (Exception e)
                {
                    result = e.Message;
                }
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Init the Session element that bring the logo to null
            if (Page != null)
            {
                Page.Session["TE_currentLogo"] = null;
            }
            // Taking the CurrentWorkflow from the session elemnt.
            ComputableWorkflowReference wfr = null;
            IComputableWorkflow         wf  = null;



            try
            {
                wfr = (ComputableWorkflowReference)Page.Session["WFE_CurrentWorkflow"];
                wf  = wfr.GetWorkflow();
            }
            catch (Exception)
            {
                Response.Write("No workflow in session!");
                Response.End();
                return;
            }


            bool useStaticLabel = false;

            try
            {
                useStaticLabel = (bool)Page.Session["UsingStaticFields"];
            }
            catch (Exception)
            {
                Response.Write("No UsingStaticFields in session!");
                Response.End();
                return;
            }

            if (useStaticLabel)
            {
                editStaticLabel.InnerHtml = "<label for=\"color_staticLabel\">Static Label Color:</label><input rel=\"staticLabel\" class=\"gccolor\" onblur=\"toolbox.applyChanges('staticLabel','color', this.value, 'color' );\" title=\"Color of the Static Label. Example: #ff00ff\" id=\"color_staticLabel\" type=\"text\"/><div style=\"display:none;\"><input id=\"staticLabelApplyToID\" type=\"checkbox\" /></div>";
            }
            else
            {
                editStaticLabel.InnerHtml = "";
            }

            // bla bla bla
            int tabCounter = 1;

            List <Panel> divPanel = new List <Panel>();

            presenPanel.Controls.Add(new LiteralControl("<ul class=\"tabs\">"));

            // Iterating each workflow node to render the form elemnt list

            foreach (WFnode nd in wf.getNodeList())
            {
                Panel p = new Panel();
                //p.Enabled = false;
                XmlDocument renderDoc = nd.GetRenderingDocument();



                string nodeName = XmlConvert.DecodeName(renderDoc.DocumentElement.Attributes["name"].InnerText);

                presenPanel.Controls.Add(new LiteralControl("<li><a href=\"#tabs" + tabCounter + "\" >" + nodeName + "</a></li>"));

                //p.Controls.Add(new LiteralControl("<div id=\"tabs" + tabCounter + "\" style=\"position: relative; height: 500px;\" >"));

                // Hangling the webcontrol
                XmlNode cmplexRenering = renderDoc.DocumentElement.FirstChild;
                Control wc             = nd.GetWebControl(Page.Server, cmplexRenering);

                //Disabling all BaseValidator to remove useless text <.<
                DisableControl(wc);

                p.Controls.Add(new LiteralControl("<div>"));
                p.Controls.Add(wc);
                p.Controls.Add(new LiteralControl("</div>"));

                divPanel.Add(p);

                tabCounter++;
            }

            presenPanel.Controls.Add(new LiteralControl("</ul>"));
            presenPanel.Controls.Add(new LiteralControl("<div class=\"panes\"> "));
            // Add each panel to presenPanel
            foreach (var p in divPanel)
            {
                presenPanel.Controls.Add(p);
            }
            presenPanel.Controls.Add(new LiteralControl("</div>"));

            // Retriving the current Theme informations
            IWorkflowThemeReference iwfr = (IWorkflowThemeReference)Page.Session["WFE_CurrentWorkflow"];

            if (Page.Session["CurrentTheme"] == null)
            {
                Page.Session["CurrentTheme"] = (Theme)iwfr.GetTheme();
            }

            Theme theme = (Theme)Page.Session["CurrentTheme"];

            //Theme theme = (Theme)iwfr.GetTheme();

            string propertyListJson = "<script language='javascript'> initTE('" + theme.Title + "');";

            propertyListJson += " var PropertyList=function(){";
            IBaseType field;

            foreach (Type t in FieldsManager.FieldTypes)
            {
                field = (IBaseType)FieldsManager.GetInstance(t);
                if (!String.IsNullOrEmpty(field.JSON_StyleProperties))
                {
                    propertyListJson += "var " + field.GetType().Name + "PropertyList = " + field.JSON_StyleProperties + ";";
                }
            }
            propertyListJson +=
                @"
                    return{
                        getList:function( type ){
                            if( eval( ""typeof "" + type + ""PropertyList == 'undefined'"" ) ) {
                                type = ""StringBox"";
                            }            
                            return eval( type + ""PropertyList"");
                        },
                        validate:function( type, value ){
			                if( type == ""color"" )
				                return (value.match( /#[a-fA-F0-9]{6}/ ) || value.match(/rgb\([ ]*[0-9]{1,3}[ ]*,[ ]*[0-9]{1,3}[ ]*,[ ]*[0-9]{1,3}[ ]*\)/i));
			                if( type == ""size"" ) 
				                return ( value.match( /\d+px/ ) || value.match( /\d+\%/ ) || value.match( /\d+em/ ));
			                if( type == ""none"" )
				                return true;
                            if( type == ""font"" )
                                return true;
			                return false;            
                        }
                   };
                }(); ";


            CssParser cssParser = new CssParser();

            cssParser.AddStyleSheet(theme.CSS);
            foreach (var styles in cssParser.Styles)
            {
                foreach (KeyValuePair <string, string> pv in styles.Value.Attributes)
                {
                    propertyListJson += string.Format(CssAddJS, styles.Key.Substring(0, 1), styles.Key.Substring(1), pv.Key, pv.Value);
                }
            }
            if (theme.Image != null)
            {
                Page.Session["TE_currentLogo"] = theme.Image;
                propertyListJson += "stopUpload('drawLogo.aspx', true);";
            }

            propertyListJson += "</script>";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", propertyListJson);

            //Adding the CSS to the Page Header.
            Page.Header.Controls.Add(
                new LiteralControl(
                    @"<style type='text/css'>" + theme.CSS + "</style" + ">"
                    )
                );

            //for manage contacts back button (GUI modify)
            Session["contactReturn"] = "/ThemeEditor/ThemeEditor.aspx";
        }
Exemple #4
0
        /// <summary>
        /// Receives client's call and saves the Workflow
        /// </summary>
        /// <param name="eventArgument">WorkflowId from client</param>
        public void RaiseCallbackEvent(string eventArgument)
        {
            //Publishing WF
            try
            {
                string[] args             = eventArgument.Split('|');
                string   wfID             = args[0];
                string   type             = args[1];
                string   description      = args[2];
                string   expiration_date  = args[3];
                string   checkOption      = args[4];
                string   serviceList      = args[5];
                string   usingStaticField = args[6];

                //Publishing WF
                Token t = (Token)Page.Session["Token"];
                if (t != null && t.Authenticated && t.GetCurrentUser().Registered)
                {
                    string uri = (string)Page.Session["uriFromComm"];
                    Page.Session["uriFromComm"] = "";

                    WorkflowReference wfRef = (WorkflowReference)Page.Session["WFE_CurrentWorkflowReference"];

                    ComputableWorkflowReference computebleWfRef = null;
                    if (type.Equals("public"))
                    {
                        if (checkOption.Equals("false"))
                        {
                            //computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, description, expiration_date);
                            computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, 1, description, expiration_date, uri);
                        }
                        else
                        {
                            if (serviceList.Equals("allservices"))
                            {
                                computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITHOUT_REPLICATION, 1, description, expiration_date, uri);
                            }
                            else
                            {
                                computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_BY_SERVICE, int.Parse(serviceList), description, expiration_date, uri);
                            }
                        }
                    }
                    else
                    {
                        if (checkOption.Equals("false"))
                        {
                            computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_NOT_ANONYM, 1, description, expiration_date, uri);
                        }
                        else
                        {
                            computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_ANONYM, 1, description, expiration_date, uri);
                        }
                    }



                    if (computebleWfRef == null)
                    {
                        callbackResult = "Database Error: An error occurred while publishing!";
                    }
                    else
                    {
                        //For Theme-Editor
                        Page.Session["WFE_CurrentWorkflow"] = computebleWfRef;
                        Page.Session["themeReturn"]         = "http://" + Security.EnvironmentManagement.getEnvValue("webServerAddress") + "/WorkflowEditor/WorkflowEditor.aspx";
                        if (usingStaticField.Equals("true"))
                        {
                            Page.Session["UsingStaticFields"] = true;
                        }
                        else
                        {
                            Page.Session["UsingStaticFields"] = false;
                        }

                        callbackResult = "OK|" + type + "|Publish OK!|" + wfID;
                        Page.Session["uriFromComm"] = "";
                    }
                }
                else
                {
                    callbackResult = "You are not logged in!";
                }
            }
            catch (Exception e)
            {
                callbackResult = e.Message;
            }
        }