Esempio n. 1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            LoadXsl();
            ProcessDataSources();

            if (TemplateDef == null)
            {
                try
                {
                    TemplateDef = TemplateDefinition.FromName(ClientID, DesignType, DesignStyle, true, XslSourceData, cached);
                    TemplateDef.AddTemplateArguments(TemplateArguments, true);
                    TemplateDef.AddClientOptions(ClientOptions, true);
                }
                catch (XsltException ex)
                {
                    error = ex;
                    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                }
            }

            if (!prerendered)
            {
                if (TemplateDef != null)
                {
                    TemplateDef.PreRender(Page);
                    prerendered = true;
                }
            }
        }
Esempio n. 2
0
        private void LoadXsl()
        {
            if (!string.IsNullOrEmpty(FormType) && !string.IsNullOrEmpty(FormStyle) && TemplateDef != null)
            {
                try
                {
                    TemplateDef = TemplateDefinition.FromName(ClientID, FormType, FormStyle, false);

                    if (TemplateDef.TemplateVirtualPath != null)
                    {
                        SPFile xslFile = SPContext.Current.Web.Site.RootWeb.GetFile(TemplateDef.TemplateVirtualPath);
                        if (xslFile != null && xslFile.Exists)
                        {
                            //check cache:
                            string lastModifiedStamp = xslFile.TimeLastModified.ToString(CultureInfo.InvariantCulture);
                            if (XslSourceLastModified != lastModifiedStamp)
                            {
                                XslSourceLastModified = lastModifiedStamp;
                                XslSourceData         = GetFileData(xslFile).Replace(Environment.NewLine, "").Replace("\n", "");
                                cached = false;
                                SetPersonalizationDirty();
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    XslSourceData = string.Empty;
                }
            }
        }
Esempio n. 3
0
 public static MenuBase Instantiate(string menuStyle)
 {
     try
     {
         var templateDef = TemplateDefinition.FromName(menuStyle, "*menudef.xml");
         return(new MenuBase {
             TemplateDef = templateDef
         });
     }
     catch (Exception exc)
     {
         throw new ApplicationException(string.Format("Couldn't load menu style '{0}': {1}", menuStyle, exc));
     }
 }
Esempio n. 4
0
 internal static MenuBase Instantiate(string ClientId, string ControlType, string ControlStyle)
 {
     try
     {
         TemplateDefinition templateDef = TemplateDefinition.FromName(ClientId, ControlType, ControlStyle);
         return(new MenuBase {
             TemplateDef = templateDef
         });
     }
     catch (Exception exc)
     {
         throw new ApplicationException(String.Format("Couldn't load menu style '{0}': {1}", ControlStyle, exc));
     }
 }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        private void LoadXsl()
        {
            if (!string.IsNullOrEmpty(DesignType) && !string.IsNullOrEmpty(DesignStyle))
            {
                if (TemplateDef != null || HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    try
                    {
                        TemplateDef = TemplateDefinition.FromName(ClientID, DesignType, DesignStyle, false, cached);

                        SPFile xslFile = null;
                        if (TemplateDef.TemplateVirtualPath != null)
                        {
                            xslFile = SPContext.Current.Web.Site.RootWeb.GetFile(TemplateDef.TemplateVirtualPath);
                        }

                        if (xslFile != null && xslFile.Exists)
                        {
                            //check cache:
                            string lastModifiedStamp = xslFile.TimeLastModified.ToString(CultureInfo.InvariantCulture);
                            if (XslSourceLastModified != lastModifiedStamp)
                            {
                                XslSourceLastModified = lastModifiedStamp;
                                XslSourceData         = GetFileData(xslFile).Replace(Environment.NewLine, "").Replace("\n", "");
                                cached = false;
                                SetPersonalizationDirty();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        XslSourceData = string.Empty;
                        SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                    }
                    finally
                    {
                        TemplateDef = null;
                    }
                }
            }
        }
Esempio n. 6
0
        protected override void OnInit(EventArgs e)
        {
            LoadXsl();
            ProcessDataSources();

            formpanel = new UpdatePanel {
                ID = ID + "_UpdateFormPanel", RenderMode = UpdatePanelRenderMode.Block
            };                                                                                                     //, EnableViewState = true };

            contenttemplate           = new FormContentTemplate();
            contenttemplate.WebPart   = this;
            formpanel.ContentTemplate = contenttemplate;
            //Add on Page
            this.Controls.Add(formpanel);

            //Add Field Controls
            SetListFormFields(contenttemplate.canvas);

            formprogess = new UpdateProgress {
                AssociatedUpdatePanelID = formpanel.ID
            };
            formprogess.ProgressTemplate = new FormProgessTemplate();
            this.Controls.Add(formprogess);

            //if (TemplateDef == null)
            //{
            try
            {
                TemplateDef = TemplateDefinition.FromName(contenttemplate.canvas.ClientID, FormType, FormStyle, true, XslSourceData, cached);
                TemplateDef.AddTemplateArguments(TemplateArguments, true);
                TemplateDef.AddClientOptions(ClientOptions, true);
            }
            catch (Exception)
            {
            }
            //}

            base.OnInit(e);
        }