Beispiel #1
0
 /// <summary>
 /// Adds a field in the node
 /// </summary>
 /// <param name="toNodeID">The field-required's type</param>
 private IBaseType getField(string fieldType)
 {
     foreach (Type t in FieldsManager.FieldTypes)
     {
         if (t.ToString() == ("Fields." + fieldType))
         {
             return((IBaseType)FieldsManager.GetInstance(t));
         }
     }
     return(null);
 }
Beispiel #2
0
        public string GetValue(Control src, XmlNode renderingDocument)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<" + nodeTypeName + ">");

            var cmplxTypeSchema = (XmlSchemaComplexType)this.GetNodeSchemas().GlobalTypes[new XmlQualifiedName(nodeTypeName)];

            sb.Append(
                FieldsManager.GetInstance(
                    renderingDocument, cmplxTypeSchema, GetNodeSchemas()).GetValue(((NamingUpdatePanel)src).ContentTemplateContainer.Controls[0], renderingDocument));

            sb.Append("</" + nodeTypeName + ">");

            return(sb.ToString());
        }
Beispiel #3
0
        public Control GetWebControl(HttpServerUtility server, XmlNode renderingDocument)
        {
            NamingUpdatePanel np = new NamingUpdatePanel();

            np.ID = this.NodeTypeName;

            var cmplxType       = renderingDocument;
            var cmplxTypeSchema = (XmlSchemaComplexType)this.GetNodeSchemas().GlobalTypes[new XmlQualifiedName(nodeTypeName)];
            var fld             = FieldsManager.GetInstance(cmplxType, cmplxTypeSchema, this.GetNodeSchemas());

            if (IsWfNodeInstance && nodeIstance.DocumentElement.SchemaInfo != null)
            {
                ((IField)(fld)).SetValue(nodeIstance.DocumentElement.ChildNodes.ToList());
            }
            else if (IsWfNodeInstance && nodeIstance.DocumentElement.SchemaInfo == null)
            {
                throw new InvalidOperationException("Value not conforming the schema!");
            }

            np.ContentTemplateContainer.Controls.Add(fld.GetWebControl(server, cmplxType));
            return(np);
        }
Beispiel #4
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";
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            listControl = new List <Control>();
            listControl.Add(new WFG_addNode());
            listControl.Add(new WFG_addArc());
            listControl.Add(new WFG_createWorkflow());
            listControl.Add(new WFE_saveWorkflow());
            listControl.Add(new WFC_publishWorkflow());
            listControl.Add(new WFG_initialNode());
            listControl.Add(new WFG_finalNode());
            listControl.Add(new WFF_addField());
            listControl.Add(new WFG_removeArc());
            listControl.Add(new WFG_removeNode());
            listControl.Add(new WFC_getPredicates());
            listControl.Add(new WFC_getOperations());
            listControl.Add(new WFC_setProperties());
            listControl.Add(new WFC_syncNode());
            listControl.Add(new WFF_getConstraints());
            listControl.Add(new WFF_saveConstraints());
            listControl.Add(new WFC_LoadXmlDocFromSession());
            listControl.Add(new WFC_getAuthServiceList());
            //listControl.Add(new WebInterface.FormFillier.action.ContactsRetrieve());
            //listControl.Add(new WebInterface.FormFillier.action.UserWorkflowSend());

            String cbReference;
            String callbackScript;

            List <Control> .Enumerator it = listControl.GetEnumerator();
            while (it.MoveNext())
            {
                Page.Controls.Add(it.Current);
                IControlWorkflowEditor t = (IControlWorkflowEditor)it.Current;
                cbReference =
                    Page.ClientScript.GetCallbackEventReference(it.Current, "arg", t.getNameFunctionServerResponse(), "context");
                callbackScript = "function " + t.getNameFunctionServerCall() + "(arg, context)" +
                                 "{ " + cbReference + ";}";

                Page.ClientScript.RegisterClientScriptBlock(it.Current.GetType(),
                                                            t.getNameFunctionServerCall(), callbackScript, true);
            }

            //Add WebControls to the UpdatePanel
            IBaseType field;
            //OLD System.Drawing.Image field_icon;
            WebControl field_icon, field_preview, field_rendering, special_icon, field_precondition;

            foreach (Type t in FieldsManager.FieldTypes)
            {
                //instantiate the Field for each type of field
                field = (IBaseType)FieldsManager.GetInstance(t);
                //get the type name
                field.TypeName = t.ToString();
                //get the icon
                field_icon = FieldsManager.GetIconControl(t);
                //get the preview html()
                field_preview = FieldsManager.GetPreviewControl(t);
                //get the rendering (big image) to be added onmouseover
                field_rendering    = FieldsManager.GetPreviewTooltipControl(t);
                field_precondition = FieldsManager.GetUnrelatedControl(t);


                String[] s1 = t.ToString().Split('.');
                field_preview.Attributes.Add("class", "WFF_" + s1[1]);
                HtmlGenericControl p1 = new HtmlGenericControl("div");
                p1.Controls.Add(field_preview);
                p1.Attributes.Add("id", s1[1]);
                upcontrols.ContentTemplateContainer.Controls.Add(p1);

                HtmlGenericControl p2 = new HtmlGenericControl("div");
                p2.Attributes.Add("id", s1[1]);
                p2.Attributes.Add("class", "WFF_widget_in_uppanel");
                p2.Controls.Add(field_icon);
                upicons.ContentTemplateContainer.Controls.Add(p2);

                HtmlGenericControl p3 = new HtmlGenericControl("div");
                p3.Attributes.Add("id", s1[1]);
                p3.Attributes.Add("class", "WFF_rendering_preview");
                p3.Controls.Add(field_rendering);
                uprendering.ContentTemplateContainer.Controls.Add(p3);

                field_precondition.Attributes.Add("class", "precondition_webcontrol_preview");
                HtmlGenericControl p4 = new HtmlGenericControl("div");
                p4.Controls.Add(field_precondition);
                p4.Attributes.Add("id", "precondition_" + s1[1]);
                //preconditionup.ContentTemplateContainer.Controls.Add(p4);
            }

            foreach (Type s in FieldsManager.SpecialFieldTypes)
            {
                //get the type name
                string sname = (s.ToString().Split('.'))[1];

                //get the icon
                special_icon = FieldsManager.GetIconControl(s);

                special_icon.Attributes.Add("class", "WFF_" + sname);
                HtmlGenericControl p1 = new HtmlGenericControl("div");
                p1.Controls.Add(special_icon);
                p1.Attributes.Add("id", sname);
                p1.Attributes.Add("class", "WFF_widget_in_upspecial");
                upspecial.ContentTemplateContainer.Controls.Add(p1);
            }

            //for manage contacts back button
            Session["contactReturn"] = "/WorkflowEditor/WorkflowEditor.aspx";
        }