Esempio n. 1
0
        internal void Render(HtmlTextWriter htmlWriter)
        {
            htmlWriter.Write("<!-- Begin SharePresence Navigation - {0} template -->", menuSettings.ControlStyle);

            TemplateDef.AddClientOptions(new List <ClientOption> {
                new ClientString(menuSettings.ControlStyle + "MenuOptions", menuSettings.ControlStyle)
            }, false);

            //MenuXml menuXml = new MenuXml { root = RootNode };
            //menuXml.ToString();
            TemplateDef.Render(new MenuXml {
                root = RootNode
            }, htmlWriter);

            htmlWriter.Write("<!-- End SharePresence Navigation - {0} template -->", menuSettings.ControlStyle);
        }
        internal void Render(HtmlTextWriter htmlWriter)
        {
            htmlWriter.Write("<!-- DDRmenu v02.00.01 - {0} template -->", menuSettings.MenuStyle);

            UserInfo user = null;

            if (menuSettings.IncludeContext)
            {
                user       = UserController.Instance.GetCurrentUserInfo();
                user.Roles = user.Roles;                 // Touch roles to populate
            }

            TemplateDef.AddClientOptions(new List <ClientOption> {
                new ClientString("MenuStyle", menuSettings.MenuStyle)
            }, false);

            TemplateDef.Render(new MenuXml {
                root = RootNode, user = user
            }, htmlWriter);
        }
Esempio n. 3
0
        public override void RenderWebPart(HtmlTextWriter writer)
        {
            writer.Write("<!-- Begin SharePresence DesignWebPart - {0} {1} -->", DesignType, DesignStyle);

            if (TemplateDef != null)
            {
                TemplateDef.AddClientOptions(new List <ClientOption> {
                    new ClientString(DesignType + "_DesignOptions_", DesignStyle)
                }, false);

                string data = string.Empty;
                try
                {
                    GetListItems(out data);
                    if (!string.IsNullOrEmpty(data))
                    {
                        TemplateDef.Render(data, writer);
                    }
                    else
                    {
                        HttpApplication application = HttpContext.Current.ApplicationInstance;
                        if (application.User.Identity.IsAuthenticated)
                        {
                            writer.Write("No DataSource and or Style configured. ");

                            if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Edit)
                            {
                                writer.Write(String.Format(" <a onclick=\"ShowToolPane2Wrapper('Edit',this,'{0}');return false;\"> Configure </a>", StorageKey.ToString()));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    writer.Write(ex.Message);
                    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                }
            }
            else
            {
                HttpApplication application = HttpContext.Current.ApplicationInstance;
                if (application.User.Identity.IsAuthenticated)
                {
                    if (error != null)
                    {
                        writer.Write(error.Message + ":" + error.InnerException.Message);
                    }
                    else
                    {
                        writer.Write("No DataSource and or Style configured. ");

                        if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Edit)
                        {
                            writer.Write(String.Format(" <a onclick=\"ShowToolPane2Wrapper('Edit',this,'{0}');return false;\"> Configure </a>", StorageKey.ToString()));
                        }
                    }
                }
            }

            writer.Write("<!-- End SharePresence DesignWebPart - {0} {1} -->", DesignType, DesignStyle);

            if (inEditMode)
            {
                base.RenderWebPart(writer);
            }
        }
Esempio n. 4
0
        public override void RenderWebPart(HtmlTextWriter writer)
        {
            string        output  = string.Empty;
            StringBuilder builder = new StringBuilder();

            using (var baseWriter = new HtmlTextWriter(new StringWriter(builder, CultureInfo.InvariantCulture)))
            {
                bool configure = false;
                baseWriter.Write("<!-- Begin SharePresence FormWebPart - {0} {1} -->", FormType, FormStyle);

                if (TemplateDef != null)
                {
                    List <TemplateArgument> args = new List <TemplateArgument>();
                    //var args = new XsltArgumentList();
                    if (!string.IsNullOrEmpty(FormTitle))
                    {
                        args.Add(new TemplateArgument("FormName", FormTitle));
                    }

                    if (!string.IsNullOrEmpty(FormDesciption))
                    {
                        args.Add(new TemplateArgument("FormDescription", FormDesciption));
                        //args.AddParam("FormDescription", "", FormDesciption);
                    }
                    TemplateDef.AddTemplateArguments(args, false);

                    //TemplateDef.TemplateArguments.ForEach(a => args.AddParam(a.Name, "", a.Value));

                    TemplateDef.AddClientOptions(new List <ClientOption> {
                        new ClientString(FormType + "_FormOptions_", FormStyle)
                    }, false);

                    string data = string.Empty;
                    try
                    {
                        GetListItems(out data);
                        if (!string.IsNullOrEmpty(data))
                        {
                            StringBuilder templatebuilder = new StringBuilder();
                            using (var templateWriter = new HtmlTextWriter(new StringWriter(templatebuilder, CultureInfo.InvariantCulture)))
                            {
                                TemplateDef.Render(data, templateWriter);
                            }

                            //Add Template for Canvas Render
                            contenttemplate.innerHtml = templatebuilder.ToString();

                            //formpanel.Triggers.Add(contenttemplate.canvas as UpdatePanelTrigger);
                            formpanel.RenderControl(baseWriter);
                        }
                        else
                        {
                            HttpApplication application = HttpContext.Current.ApplicationInstance;
                            if (application.User.Identity.IsAuthenticated)
                            {
                                baseWriter.Write("No DataSource and or Style configured. ");

                                if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Edit)
                                {
                                    baseWriter.Write(String.Format(" <a onclick=\"ShowToolPane2Wrapper('Edit',this,'{0}');return false;\" style=\"cursor: hand;\" >Configure</a>", StorageKey.ToString()));
                                    configure = true;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        baseWriter.Write(ex.Message);

                        if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Edit)
                        {
                            baseWriter.Write(String.Format(" <a onclick=\"ShowToolPane2Wrapper('Edit',this,'{0}');return false;\" style=\"cursor: hand;\" >Configure</a>", StorageKey.ToString()));
                            configure = true;
                        }
                    }
                }
                else
                {
                    HttpApplication application = HttpContext.Current.ApplicationInstance;
                    if (application.User.Identity.IsAuthenticated)
                    {
                        baseWriter.Write("No DataSource and or Style configured. ");

                        if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Edit)
                        {
                            baseWriter.Write(String.Format(" <a onclick=\"ShowToolPane2Wrapper('Edit',this,'{0}');return false;\">Configure</a>", StorageKey.ToString()));
                            configure = true;
                        }
                    }
                }

                baseWriter.Write("<!-- End SharePresence FormWebPart - {0} {1} -->", FormType, FormStyle);

                if (inEditMode)
                {
                    if (!configure)
                    {
                        if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Edit)
                        {
                            baseWriter.Write(String.Format(" <a onclick=\"ShowToolPane2Wrapper('Edit',this,'{0}');return false;\">Configure</a>", StorageKey.ToString()));
                        }
                    }

                    menuControls.RenderControl(baseWriter);
                    //base.RenderWebPart(baseWriter);
                }

                output = builder.ToString();
            }

            writer.Write(output);
        }