Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        body.Attributes.Add("data-user-id", ((SunamoPage)Page).idLoginedUser.ToString());
        if (txtSearchText.Value != "")
        {
            string red = "http://" + Request.Url.Host + "/Lyrics/Search/" + UH.UrlEncode(txtSearchText.Value.Replace(".", "-")).Replace('+', ' ');
            ((SunamoPage)Page).WriteToDebugWithTime(red);
        }

        footer.InnerHtml = SunamoPageHelper.GetFooterHtml(MySites.Lyrics);

        imgColorPiano.Src = web.UH.GetWebUri(this.Page, "css/Lyr/colorpiano.png");
        aHome.HRef        = web.UH.GetWebUri(this.Page, "Lyrics/Home");

        MasterPageHelper.WriteGeneralCode(this.Page, false, true);
        SunamoCzMetroUIHelper.SetHtmlMetroUpperBarV3(this, horniLista, MySites.Lyrics);

        btnLogOut.ServerClick += new EventHandler(btnLogOut_ServerClick);
        btnLogIn.ServerClick  += new EventHandler(btnLogIn_ServerClick);

        LoginedUser pu = SessionManager.GetLoginedUser(Page);

        if (pu.login != "")
        {
            loginForm.Visible = false;
            logined.Visible   = true;
        }
        else
        {
            loginForm.Visible = true;
            logined.Visible   = false;
        }
    }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     MasterPageHelper.SetTitle(this, "排水沟信息查询");
     if (!Page.IsPostBack)
     {
         get_data();
     }
 }
 public TemplateRepository(IScopeAccessor scopeAccessor, CacheHelper cache, ILogger logger, ITemplatesSection templateConfig, IFileSystems fileSystems)
     : base(scopeAccessor, cache, logger)
 {
     _masterpagesFileSystem = fileSystems.MasterPagesFileSystem;
     _viewsFileSystem       = fileSystems.MvcViewsFileSystem;
     _templateConfig        = templateConfig;
     _viewHelper            = new ViewHelper(_viewsFileSystem);
     _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);
 }
 internal TemplateRepository(IScopeUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax, IFileSystem masterpageFileSystem, IFileSystem viewFileSystem, ITemplatesSection templateConfig)
     : base(work, cache, logger, sqlSyntax)
 {
     _masterpagesFileSystem = masterpageFileSystem;
     _viewsFileSystem       = viewFileSystem;
     _templateConfig        = templateConfig;
     _viewHelper            = new ViewHelper(_viewsFileSystem);
     _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);
 }
        /// <summary>
        /// Undoes the addStringToHtml Execute() method, by removing the same string from the same template.
        /// </summary>
        /// <param name="packageName">Name of the package.</param>
        /// <param name="xmlData">The XML data.</param>
        /// <returns></returns>
        public bool Undo(string packageName, XmlNode xmlData)
        {
            string templateAlias = xmlData.Attributes["templateAlias"].Value;
            string htmlElementId = xmlData.Attributes["htmlElementId"].Value;
            string value         = XmlHelper.GetNodeValue(xmlData);
            var    tmp           = Current.Services.FileService.GetTemplate(templateAlias);

            value = MasterPageHelper.EnsureMasterPageSyntax(templateAlias, value);

            _removeStringFromHtmlElement(tmp, value, htmlElementId);
            return(true);
        }
        //Helper method to replace umbraco tags that breaks the xml format..
        public static string ParseToValidXml(ITemplate templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid)
        {
            string retVal = template;

            if (toValid)
            {
                // test for asp:content as the first part of the design
                if (retVal.StartsWith("<asp:content", StringComparison.OrdinalIgnoreCase))
                {
                    hasAspNetContentBeginning = true;
                    retVal = retVal.Substring(retVal.IndexOf(">") + 1);
                    retVal = retVal.Substring(0, retVal.Length - 14);
                }
                //shorten empty macro tags..
                retVal = retVal.Replace("></umbraco:macro>", " />");
                retVal = retVal.Replace("></umbraco:Macro>", " />");

                retVal = retVal.Replace("<umbraco:", "<umbraco__");
                retVal = retVal.Replace("</umbraco:", "</umbraco__");
                retVal = retVal.Replace("<asp:", "<asp__");
                retVal = retVal.Replace("</asp:", "</asp__");

                retVal = retVal.Replace("?UMBRACO_GETITEM", "UMBRACO_GETITEM");
                retVal = retVal.Replace("?UMBRACO_TEMPLATE_LOAD_CHILD", "UMBRACO_TEMPLATE_LOAD_CHILD");
                retVal = retVal.Replace("?UMBRACO_MACRO", "UMBRACO_MACRO");
                retVal = retVal.Replace("?ASPNET_FORM", "ASPNET_FORM");
                retVal = retVal.Replace("?ASPNET_HEAD", "ASPNET_HEAD");
            }
            else
            {
                retVal = retVal.Replace("<umbraco__", "<umbraco:");
                retVal = retVal.Replace("</umbraco__", "</umbraco:");
                retVal = retVal.Replace("<asp__", "<asp:");
                retVal = retVal.Replace("</asp__", "</asp:");
                retVal = retVal.Replace("UMBRACO_GETITEM", "?UMBRACO_GETITEM");
                retVal = retVal.Replace("UMBRACO_TEMPLATE_LOAD_CHILD", "?UMBRACO_TEMPLATE_LOAD_CHILD");
                retVal = retVal.Replace("UMBRACO_MACRO", "?UMBRACO_MACRO");
                retVal = retVal.Replace("ASPNET_FORM", "?ASPNET_FORM");
                retVal = retVal.Replace("ASPNET_HEAD", "?ASPNET_HEAD");
                retVal = retVal.Replace("<root>", "");
                retVal = retVal.Replace("<root xmlns:asp=\"http://microsoft.com\">", "");
                retVal = retVal.Replace("</root>", "");

                // add asp content element
                if (hasAspNetContentBeginning)
                {
                    retVal = MasterPageHelper.GetMasterContentElement(templateObj /*templateObj.MasterTemplate*/) + retVal + "</asp:content>";
                }
            }

            return(retVal);
        }
        /// <summary>
        /// Executes the specified package action.
        /// </summary>
        /// <param name="packageName">Name of the package.</param>
        /// <param name="xmlData">The XML data.</param>
        /// <example><code><code>
        ///     <Action runat="install" alias="addStringToHtmlElement" templateAlias="news" htmlElementId="newsSection" position="[beginning/end"><![CDATA[hello world!]]></action>
        /// </code></code></example>
        /// <returns>True if executed successfully</returns>
        public bool Execute(string packageName, XmlNode xmlData)
        {
            string templateAlias = xmlData.Attributes["templateAlias"].Value;
            string htmlElementId = xmlData.Attributes["htmlElementId"].Value;
            string position      = xmlData.Attributes["position"].Value;
            string value         = XmlHelper.GetNodeValue(xmlData);
            var    tmp           = Current.Services.FileService.GetTemplate(templateAlias);

            value = MasterPageHelper.EnsureMasterPageSyntax(templateAlias, value);

            _addStringToHtmlElement(tmp, value, htmlElementId, position);

            return(true);
        }
Beispiel #8
0
        internal TemplateRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax, IFileSystem masterpageFileSystem, IFileSystem viewFileSystem, ITemplatesSection templateConfig)
            : base(work, cache, logger, sqlSyntax)
        {
            _masterpagesFileSystem = masterpageFileSystem;
            _viewsFileSystem       = viewFileSystem;
            _templateConfig        = templateConfig;
            _viewHelper            = new ViewHelper(_viewsFileSystem);
            _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);

            _cacheOptions = new RepositoryCacheOptions
            {
                //Allow a zero count cache entry because GetAll() gets used quite a lot and we want to ensure
                // if there are no templates, that it doesn't keep going to the db.
                GetAllCacheAllowZeroCount = true,
                //GetAll gets called a lot, we want to ensure that all templates are in the cache, default is 100 which
                // would normally be fine but we'll increase it in case people have a ton of templates.
                GetAllCacheThresholdLimit = 500
            };
        }
Beispiel #9
0
        /// <summary>
        /// This checks what the default rendering engine is set in config but then also ensures that there isn't already
        /// a template that exists in the opposite rendering engine's template folder, then returns the appropriate
        /// rendering engine to use.
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// The reason this is required is because for example, if you have a master page file already existing under ~/masterpages/Blah.aspx
        /// and then you go to create a template in the tree called Blah and the default rendering engine is MVC, it will create a Blah.cshtml
        /// empty template in ~/Views. This means every page that is using Blah will go to MVC and render an empty page.
        /// This is mostly related to installing packages since packages install file templates to the file system and then create the
        /// templates in business logic. Without this, it could cause the wrong rendering engine to be used for a package.
        /// </remarks>
        public RenderingEngine DetermineTemplateRenderingEngine(ITemplate template)
        {
            var engine     = _templateConfig.DefaultRenderingEngine;
            var viewHelper = new ViewHelper(_viewsFileSystem);

            if (!viewHelper.ViewExists(template))
            {
                if (template.Content.IsNullOrWhiteSpace() == false && MasterPageHelper.IsMasterPageSyntax(template.Content))
                {
                    //there is a design but its definitely a webforms design and we haven't got a MVC view already for it
                    return(RenderingEngine.WebForms);
                }
            }

            var masterPageHelper = new MasterPageHelper(_masterpagesFileSystem);

            switch (engine)
            {
            case RenderingEngine.Mvc:
                //check if there's a view in ~/masterpages
                if (masterPageHelper.MasterPageExists(template) && viewHelper.ViewExists(template) == false)
                {
                    //change this to webforms since there's already a file there for this template alias
                    engine = RenderingEngine.WebForms;
                }
                break;

            case RenderingEngine.WebForms:
                //check if there's a view in ~/views
                if (viewHelper.ViewExists(template) && masterPageHelper.MasterPageExists(template) == false)
                {
                    //change this to mvc since there's already a file there for this template alias
                    engine = RenderingEngine.Mvc;
                }
                break;
            }
            return(engine);
        }
Beispiel #10
0
 protected override void OnLoad(System.EventArgs e)
 {
     base.OnLoad(e);
     MasterPageHelper.AddFavicon(this, MySites.Lyrics);
 }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     MasterPageHelper.SetTitle(this, "水源工程信息查询");
 }
 public void IsMasterPageSyntax(string design)
 {
     Assert.IsTrue(MasterPageHelper.IsMasterPageSyntax(design));
 }
Beispiel #13
0
        public static void MasterPage_Trasnformation()
        {
            MasterPageHelper objMasterHelper = new MasterPageHelper();

            objMasterHelper.ChangeMasterPageForWeb(@"E:\VirendraKumar\ProjectTest\MasterPage", "https://intranet.poc.com/sites/TestContosoPublishingSite", "contoso.master", "seattle.master", true, true, "", "OP", "ms-mla-paraja", "Password123", "mgmt7");
        }