예제 #1
0
        protected void cmdPreview_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(SkinSrc))
            {
                string strType = SkinRoot.Substring(0, SkinRoot.Length - 1);

                string strURL = Globals.AddHTTP(Globals.GetDomainName(Request)) + Globals.ApplicationURL(_objPortal.HomeTabId).Replace("~", "");
                //detect if there is already a '?' in the URL (in case of a child portal)
                if (strURL.IndexOf("?") > 0)
                {
                    strURL += "&";
                }
                else
                {
                    strURL += "?";
                }
                strURL += "portalid=" + _objPortal.PortalID + "&" + strType + "Src=" + Globals.QueryStringEncode(SkinSrc.Replace(".ascx", ""));

                if (SkinRoot == SkinInfo.RootContainer)
                {
                    if (Request.QueryString["ModuleId"] != null)
                    {
                        strURL += "&ModuleId=" + Request.QueryString["ModuleId"];
                    }
                }

                Response.Write("<script>window.open('" + strURL + "','_blank')</script>");
            }
        }
예제 #2
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"/> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            var portalId = PortalSettings.PortalId;

            // Generate Pages Array
            var pagesArray = new StringBuilder();

            pagesArray.Append("var dnnpagesSelectBox = new Array(");

            var domainName = string.Format("http://{0}", Globals.GetDomainName(context.Request, true));

            foreach (TabInfo tab in TabController.GetPortalTabs(
                         portalId, -1, false, null, true, false, true, true, true))
            {
                var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", portalId, false) &&
                             !string.IsNullOrEmpty(tab.CultureCode)
                                    ? Globals.FriendlyUrl(
                    tab,
                    string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode))
                                    : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID));


                tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase));

                var tabName = GlobalObject.escape(tab.TabName);

                if (tab.Level.Equals(0))
                {
                    pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl);
                }
                else
                {
                    var separator = new StringBuilder();

                    for (int index = 0; index < tab.Level; index++)
                    {
                        separator.Append("--");
                    }

                    pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl);
                }
            }

            if (pagesArray.ToString().EndsWith(","))
            {
                pagesArray.Remove(pagesArray.Length - 1, 1);
            }

            pagesArray.Append(");");

            context.Response.ContentType = "text/javascript";
            context.Response.Write(pagesArray.ToString());
        }
예제 #3
0
        private string ProcessContainers(string strFolderPath)
        {
            string strGallery = "";
            int    intIndex   = 0;

            if (Directory.Exists(strFolderPath))
            {
                if (cboContainers.Items.FindByValue(strFolderPath.Replace(Globals.ApplicationMapPath.ToLower(), "")) != null)
                {
                    cboContainers.Items.FindByValue(strFolderPath.Replace(Globals.ApplicationMapPath.ToLower(), "")).Selected = true;
                }

                string strContainerType;
                if (strFolderPath.ToLower().IndexOf(Globals.HostMapPath.ToLower()) != -1)
                {
                    strContainerType = "G";
                }
                else
                {
                    strContainerType = "L";
                }

                strGallery  = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
                strGallery += "<tr><td align=\"center\" bgcolor=\"#CCCCCC\" class=\"Head\">" + Localization.GetString("plContainers.Text", this.LocalResourceFile) + "</td></tr>";
                strGallery += "<tr><td align=\"center\">";
                strGallery += "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\"><tr>";

                string[] arrFiles = Directory.GetFiles(strFolderPath, "*.ascx");
                if (arrFiles.Length == 0)
                {
                    strGallery += "<td align=\"center\" valign=\"bottom\" class=\"NormalBold\">" + Localization.GetString("NoContainer.ErrorMessage", this.LocalResourceFile) + "</td>";
                }
                //string strFolder = strFolderPath.Substring( strFolderPath.LastIndexOf( "\\" ) + 1 - 1 );
                string strFolder = strFolderPath.Substring(strFolderPath.LastIndexOf("\\") + 1);
                foreach (string tempLoopVar_strFile in arrFiles)
                {
                    string strFile = tempLoopVar_strFile;
                    intIndex++;
                    if (intIndex == 4)
                    {
                        strGallery += "</tr><tr>";
                        intIndex    = 0;
                    }

                    // name
                    strFile     = strFile.ToLower();
                    strGallery += "<td align=\"center\" valign=\"bottom\" class=\"NormalBold\">";
                    strGallery += Path.GetFileNameWithoutExtension(strFile) + "<br>";
                    // thumbnail
                    string strURL;
                    if (File.Exists(strFile.Replace(".ascx", ".jpg")))
                    {
                        strURL      = strFile.Substring(strFile.IndexOf("\\portals\\"));
                        strGallery += "<a href=\"" + ResolveUrl("~" + strURL.Replace(".ascx", ".jpg")) + "\" target=\"_new\"><img src=\"" + CreateThumbnail(strFile.Replace(".ascx", ".jpg")) + "\" border=\"1\"></a>";
                    }
                    else
                    {
                        strGallery += "<img src=\"" + ResolveUrl("~/images/thumbnail.jpg") + "\" border=\"1\">";
                    }
                    // options
                    strURL = strFile.Substring(strFile.IndexOf("\\" + SkinInfo.RootContainer.ToLower() + "\\"));
                    strURL.Replace(".ascx", "");
                    strGallery += "<br><a class=\"CommandButton\" href=\"" + Globals.NavigateURL(PortalSettings.HomeTabId) + "?ContainerSrc=[" + strContainerType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/")) + "\" target=\"_new\">" + Localization.GetString("cmdPreview", this.LocalResourceFile) + "</a>";
                    strGallery += "&nbsp;&nbsp;|&nbsp;&nbsp;";
                    strGallery += "<a class=\"CommandButton\" href=\"" + Globals.ApplicationPath + Globals.ApplicationURL().Replace("~", "") + "&Root=" + SkinInfo.RootContainer + "&Type=" + strContainerType + "&Name=" + strFolder + "&Src=" + Path.GetFileName(strFile) + "&action=apply\">" + Localization.GetString("cmdApply", this.LocalResourceFile) + "</a>";
                    if (UserInfo.IsSuperUser || strContainerType == "L")
                    {
                        strGallery += "&nbsp;&nbsp;|&nbsp;&nbsp;";
                        strGallery += "<a class=\"CommandButton\" href=\"" + Globals.ApplicationPath + Globals.ApplicationURL().Replace("~", "") + "&Root=" + SkinInfo.RootContainer + "&Type=" + strContainerType + "&Name=" + strFolder + "&Src=" + Path.GetFileName(strFile) + "&action=delete\">" + Localization.GetString("cmdDelete") + "</a>";
                    }
                    strGallery += "</td>";
                }

                strGallery += "</tr></table></td></tr>";
                if (File.Exists(strFolderPath + "/" + Globals.glbAboutPage))
                {
                    strGallery += AddCopyright(strFolderPath + "/" + Globals.glbAboutPage, strFolder);
                }
                strGallery += "</table><br>";
            }

            return(strGallery);
        }