示例#1
0
        public IHttpHandler GetDnnHttpHandler(RequestContext requestContext, int portal, int tab, string[] passThrough)
        {
            PortalController      pcontroller  = new PortalController();
            PortalInfo            pinfo        = pcontroller.GetPortal(portal);
            PortalAliasController pacontroller = new PortalAliasController();
            PortalAliasCollection pacollection = pacontroller.GetPortalAliasByPortalID(portal);
            //pacollection.
            //PortalSettings psettings = new PortalSettings(pinfo);
            PortalSettings psettings = new PortalSettings(tab, portal);               // 64 is the stats tab. TODO: get by page name and not hardcoded id

            foreach (string key in pacollection.Keys)
            {
                psettings.PortalAlias = pacollection[key];
            }
            TabController tcontroller = new TabController();

            // psettings.ActiveTab = tcontroller.GetTab(57, 0, true);                  // 57 is the profile tab.
            requestContext.HttpContext.Items["PortalSettings"] = psettings;

            requestContext.HttpContext.Items["UrlRewrite:OriginalUrl"] = requestContext.HttpContext.Request.RawUrl;
            //UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetUserByName(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
            UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetCachedUser(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);

            requestContext.HttpContext.Items["UserInfo"] = uinfo;
            foreach (string s in passThrough)
            {
                requestContext.HttpContext.Items[s] = requestContext.RouteData.Values[s];
            }
            IHttpHandler page = BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(DotNetNuke.Framework.PageBase)) as IHttpHandler;

            return(page);
        }
示例#2
0
        public StoreUrls(StoreContext storeContext)
        {
            this.storeContext = storeContext;

            var portalSettings = PortalController.GetCurrentPortalSettings();

            if (portalSettings == null)
            {
                portalSettings = new PortalSettings(storeContext.CurrentStore.PortalId.Value);
                if (portalSettings.PortalAlias == null)
                {
                    PortalAliasController portalAliasController = new PortalAliasController();
                    var aliases = portalAliasController.GetPortalAliasByPortalID(storeContext.CurrentStore.PortalId.Value);
                    foreach (DictionaryEntry entry in aliases)
                    {
                        portalSettings.PortalAlias = entry.Value as PortalAliasInfo;
                        break;
                    }
                }
            }
            this.portalSettings = portalSettings;

            forceSslCheckout = WA.Parser.ToBool(storeContext.CurrentStore.GetSetting(StoreSettingNames.ForceSslCheckout)).GetValueOrDefault(false) ||
                               portalSettings.SSLEnabled;

            //--- Determine some URLs and Paths
            GrabUrlsAndPaths();

            // Get some info about tabs containing our modules...
            GrabTabsWithOurModules();
        }
        public override void DoWork()
        {
            try
            {
                // perform some task
                List <DNNSnapshotInfo> items;
                DNNSnapshotController  controller = new DNNSnapshotController();

                //string vText = HttpContext.Current.Request.Url.Host.ToString();
                items = controller.GetDNNSnapshotModules();


                // items[0].ToString();
                string myList    = "";
                string myMessage = "";

                string vPortalAlias = "";


                for (int i = 0; i <= items.Count - 1; i++)
                {
                    PortalAliasController paController    = new PortalAliasController();
                    PortalAliasCollection aliasCollection = paController.GetPortalAliasByPortalID(items[i].PortalID);
                    IDictionaryEnumerator hs = aliasCollection.GetEnumerator();
                    hs.MoveNext();
                    PortalAliasInfo paInfo = (PortalAliasInfo)hs.Entry.Value;

                    vPortalAlias = paInfo.HTTPAlias;


                    if (CheckPage("http://" + vPortalAlias + "/Default.aspx?TabID=" + items[i].TabID.ToString() + "&ScheduledTask=true", out myMessage) == true)
                    {
                        myList += "Status " + myMessage + " - Tab " + items[i].TabID.ToString() + " Loaded!<br>";
                    }
                    else
                    {
                        myList += myMessage + " - ERROR!!!<br>";
                    }
                }


                // report success to the scheduler framework
                ScheduleHistoryItem.Succeeded = true;
                this.ScheduleHistoryItem.AddLogNote("Processing completed at " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "<br>" + myList.ToString());
            }
            catch (Exception exc)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("EXCEPTION: " + exc.ToString());
                Errored(ref exc);
                Exceptions.LogException(exc);
            }
        }
示例#4
0
        /// <summary>
        /// SetDeleteVisibility determines whether the Delete button should be displayed
        /// </summary>
        /// <history>
        ///     [cnurse]	01/17/2005	documented
        /// </history>
        private void SetDeleteVisibility(int PortalID)
        {
            PortalAliasCollection colPortalAlias;
            PortalAliasController p = new PortalAliasController();

            colPortalAlias = p.GetPortalAliasByPortalID(PortalID);
            //Disallow delete if there is only one portal alias
            if (colPortalAlias.Count <= 1)
            {
                cmdDelete.Visible = false;
            }
        }
        private string GetPortalAlias(int PortalId)
        {
            PortalAliasController paController = new PortalAliasController();
            PortalAliasCollection paCollection = paController.GetPortalAliasByPortalID(PortalId);



            foreach (DictionaryEntry pa in paCollection)
            {
                PortalAliasInfo paI = (PortalAliasInfo)pa.Value;

                return(paI.HTTPAlias);
            }

            return("PortalAlias not found");
        }
 public IEnumerable <PortalAliasInfo> GetPortalAliasByPortalId(int portalId)
 {
     return(_legacyController.GetPortalAliasByPortalID(portalId).Values.Cast <PortalAliasInfo>());
 }
示例#7
0
        protected void OnSaveClick(object sender, EventArgs e)
        {
            const bool redirect = true;

            try
            {
                // get content
                var htmlContent = GetLatestHTMLContent();

                var pac     = new PortalAliasController();
                var aliases = from PortalAliasInfo pa in pac.GetPortalAliasByPortalID(PortalSettings.PortalId).Values select pa.HTTPAlias;
                var content = txtContent.Text;
                if (Request.QueryString["nuru"] == null)
                {
                    content = HtmlUtils.AbsoluteToRelativeUrls(content, aliases);
                }
                htmlContent.Content = content;

                var draftStateID     = _workflowStateController.GetFirstWorkflowStateID(WorkflowID);
                var publishedStateID = _workflowStateController.GetLastWorkflowStateID(WorkflowID);

                switch (CurrentWorkflowType)
                {
                case WorkflowType.DirectPublish:
                    _htmlTextController.UpdateHtmlText(htmlContent, _htmlTextController.GetMaximumVersionHistory(PortalId));

                    break;

                case WorkflowType.ContentStaging:
                    if (chkPublish.Checked)
                    {
                        //if it's already published set it to draft
                        if (htmlContent.StateID == publishedStateID)
                        {
                            htmlContent.StateID = draftStateID;
                        }
                        else
                        {
                            htmlContent.StateID = publishedStateID;
                            //here it's in published mode
                        }
                    }
                    else
                    {
                        //if it's already published set it back to draft
                        if ((htmlContent.StateID != draftStateID))
                        {
                            htmlContent.StateID = draftStateID;
                        }
                    }

                    _htmlTextController.UpdateHtmlText(htmlContent, _htmlTextController.GetMaximumVersionHistory(PortalId));
                    break;
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
                UI.Skins.Skin.AddModuleMessage(Page, "Error occurred: ", exc.Message, ModuleMessage.ModuleMessageType.RedError);
                return;
            }

            // redirect back to portal
            if (redirect)
            {
                Response.Redirect(Globals.NavigateURL(), true);
            }
        }