예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Callback function registration

            listControl = new List <Control>();
            listControl.Add(new WorkflowRetrieve());
            listControl.Add(new ContactsRetrieve());
            listControl.Add(new UserWorkflowSend());
            listControl.Add(new WorkflowSelection());
            listControl.Add(new PublicWFRetrieve());
            listControl.Add(new GroupSelectionToSend());
            listControl.Add(new ResultRetrieve());
            listControl.Add(new ExportResult());
            listControl.Add(new EditModel());
            listControl.Add(new EditTheme());
            listControl.Add(new CommInformation());
            listControl.Add(new ServiceFieldRetrieve());
            listControl.Add(new IdMOdelAuthServiceRetrieve());
            listControl.Add(new PublishWf());
            listControl.Add(new CommInformationPW());
            listControl.Add(new ServiceFieldPWRetrieve());
            listControl.Add(new CreateUriPW());
            listControl.Add(new CreateUri());
            listControl.Add(new RemovePublication());
            listControl.Add(new RemoveModel());
            listControl.Add(new Logout());

            String cbReference;
            String callbackScript;

            List <Control> .Enumerator it = listControl.GetEnumerator();
            while (it.MoveNext())
            {
                call.Controls.Add(it.Current);

                IControlFormFiller t = (IControlFormFiller)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);
            }

            #endregion

            string         reg = Request.Params.Get("reg");
            Security.Token tok = (Security.Token)Session["Token"];

            if (reg != null)
            {
                if (tok != null)
                {
                    if (!tok.GetCurrentUser().Registered)
                    {
                        string url = "http://" + Security.EnvironmentManagement.getEnvValue("webServerAddress") + Request.Url.PathAndQuery;//.AbsolutePath;

                        Session["ReturnURL"] = url;
                        Response.Redirect("http://" + Security.EnvironmentManagement.getEnvValue("webServerAddress") + "/FormFillier/Registration.aspx");
                    }
                }
                else
                {
                    Response.Redirect("http://" + Security.EnvironmentManagement.getEnvValue("webServerAddress") + "/FormFillier/index.aspx");
                }
            }


            if (!IsPostBack)
            {
                List <Security.Service> listTemp = new List <Security.Service>();
                if (tok != null && tok.Authenticated)
                {
                    Security.User user = tok.GetCurrentUser();
                    listTemp = user.LoggedServices;
                }
                List <Security.Service> listaServizi = Security.ExternalService.List();

                foreach (Security.Service s in listaServizi)
                {
                    ServiceList.Items.Add(s.ServiceName);
                }
                foreach (Security.Service s in listTemp)
                {
                    ServiceList.Items.Remove(s.ServiceName);
                }
            }

            if (tok != null && tok.Authenticated)
            {
                Security.User user = tok.GetCurrentUser();

                // if (user.Registered)
                //{
                labelUser.Text = "Welcome, " + user.GetNickname();
                if (ServiceList.Items.Count != 0)
                {
                    LoginService.ImageUrl = "~/lib/image/AddLogin.png";
                    LoginService.ToolTip  = "Add Login";
                    LoginService.Style.Add("margin-top", "-2px");
                }
                else if (ServiceList.Items.Count == 0)
                {
                    LoginService.Visible = false;
                }
                Logout.Visible         = true;
                ManageContacts.Visible = true;
                //ManageFiles.Visible = true;
                //}
                //else
                //{
                // labelUser.Text = "Welcome, " + user.ToString();
                //}
            }
            else
            {
                Logout.Visible         = false;
                ManageContacts.Visible = false;
                labelUser.Visible      = false;
            }

            //Login error management
            if (Session["LoginError"] != null)
            {
                string message   = (string)Session["LoginError"];
                string returnUrl = (string)Session["ReturnUrl"];
                String script    = "ShowLoginError(\" " + message + " \", \" " + returnUrl + " \");";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "LoginErrorScript", script, true);
                Session["LoginError"] = null;
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <Control> listControl    = new List <Control>();
            string         cbReference    = this.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
            string         callBackScript = @"function CallServer(arg, context){" + cbReference + ";}";

            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callBackScript, true);

            listControl.Add(new ServiceFakeLog());
            List <Control> .Enumerator it = listControl.GetEnumerator();
            while (it.MoveNext())
            {
                callFill.Controls.Add(it.Current);

                IControlFormFiller t = (IControlFormFiller)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);
            }


            if (((IComputableWorkflow)Session["wf"]) != null)
            {
                workflow = (IComputableWorkflow)Session["wf"]; //RIGA DI FIX PER NULL??!!!
                presenPanel.Attributes.Add("style", "position:relative;left:800px;width:0px;display:none;");

                /////////////////////////////////HISTORY//////////////////////////////////////////////////////////////////

                IEnumerable <WFnode> nl        = workflow.getNodeList();
                List <string>        nodeNames = new List <string>();
                foreach (WFnode n in nl)
                {
                    nodeNames.Add(n.Name);
                }

                List <string> ns = new List <string>();
                ns = workflow.GetThroughPath();

                if (ns.Count > 0)
                {
                    string initNode      = "";
                    int    initNodeIndex = 0;

                    for (int i = 0; i < nodeNames.Count; i++)
                    {
                        if (nodeNames[i] == ns[ns.Count - 1])
                        {
                            initNode      = nodeNames[i];
                            initNodeIndex = i;
                        }
                    }
                    string tmp = nodeNames[0];

                    nodeNames.RemoveAt(0);
                    nodeNames.Insert(0, initNode);
                    nodeNames.RemoveAt(initNodeIndex);
                    nodeNames.Insert(initNodeIndex, tmp);

                    int h = 1;
                    for (int i = ns.Count - 2; i >= 0; i--)
                    {
                        nodeNames.RemoveAt(h);
                        nodeNames.Insert(h, ns[i]);
                        h++;
                    }
                    //if (ns.Count < nodeNames.Count)
                    //{
                    //    nodeNames.RemoveAt(ns.Count);
                    //    nodeNames.Insert(ns.Count, workflow.GetState().Name);
                    //}
                }
                else
                {
                    string initNode      = "";
                    int    initNodeIndex = 0;

                    for (int i = 0; i < nodeNames.Count; i++)
                    {
                        if (nodeNames[i] == workflow.GetState().Name)
                        {
                            initNode      = nodeNames[i];
                            initNodeIndex = i;
                        }
                    }
                    string tmp = nodeNames[0];

                    nodeNames.RemoveAt(0);
                    nodeNames.Insert(0, initNode);
                    nodeNames.RemoveAt(initNodeIndex);
                    nodeNames.Insert(initNodeIndex, tmp);
                }

                int W = ((nodeNames.Count() - 1) * 16) + 32 + ((nodeNames.Count()) * 5);
                int L = 480 - W / 2;
                presenPanel3.Attributes.Add("style", "position:relative;width:" + W + "px;margin:4px 0px 10px 0px;left:" + L + "px;");//"style", "position:relative;width:100%;margin:4px 0px 10px 0px;left:0px;"

                WFnode actual = workflow.GetState();
                int    j      = 0;
                presenPanel3.Controls.Clear();
                foreach (string n in nodeNames)
                {
                    ImageButton l = new ImageButton();
                    l.ImageUrl = "../lib/image/backNode.PNG";
                    l.CssClass = "HistoryLabel";
                    //if (j == 0)
                    //    l.ToolTip = nodeNames[0];
                    l.ToolTip = nodeNames[j];
                    if (!IsPostBack)
                    {
                        if (j == 0)
                        {
                            l.ImageUrl = "../lib/image/currentNode.PNG";
                            l.Attributes.Add("style", "margin-left:5px;");
                        }
                        else
                        {
                            l.Enabled  = false;
                            l.ImageUrl = "../lib/image/forwardNode.PNG";
                            l.Attributes.Add("style", "margin-left:5px;margin-bottom:8px;");
                        }
                    }
                    l.ID = j.ToString();
                    //l.OnClientClick = "slideRightToLeft();";
                    l.Click           += new ImageClickEventHandler(l_Click);
                    l.CausesValidation = false;
                    presenPanel3.Controls.Add(l);
                    j++;
                }


                /////////////////////////////////HISTORY//////////////////////////////////////////////////////////////////
            }
        }