Ejemplo n.º 1
0
 private void FillContent(NewsInfo news)
 {
     lblContent.Text      = news.Content;
     lblDescription.Text  = news.Description;
     lblHeadline.Text     = news.Headline;
     hdAllowComment.Value = news.AllowComment.ToString();
 }
Ejemplo n.º 2
0
        private void LoadContent(int newsID)
        {
            NewsController db   = new NewsController();
            NewsInfo       news = db.Load(newsID);

            if (news != null)
            {
                FillContent(news);
                db.UpdateTotalView(newsID);

                CategoryController catCont = new CategoryController();
                CategoryInfo       cat     = catCont.Load(news.CatID);
                string             catCode = cat.CatCode;
                int startBooking           = catCode.IndexOf("@@Booking_");
                if (startBooking == 0)
                {
                    string tempCode      = catCode.Substring(10);
                    int    stopBooking   = tempCode.IndexOf(',');
                    string bookingPage   = tempCode.Substring(0, stopBooking);
                    int    bookingPageID = Convert.ToInt32(bookingPage);
                    lnkBooking.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(bookingPageID, "", "BookingID/" + newsID.ToString());
                    lnkBooking.ImageUrl    = DotNetNuke.Common.Globals.ApplicationPath + "/images/booking_" + System.Threading.Thread.CurrentThread.CurrentCulture.ToString() + ".gif";
                }
            }
            else
            {
                //if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() != Common.Globals.GetPortalSettings().DefaultLanguage) ContainerControl.Visible = false;
                //ContainerControl.Visible = false;
                //Response.Redirect("http://" + PortalSettings.PortalAlias.HTTPAlias);
            }
        }
Ejemplo n.º 3
0
        private void LoadData(int id)
        {
            if (Request.QueryString["cat"] != null)
            {
                lblCatString.Text = Request.QueryString["cat"];
            }
            NewsController db   = new NewsController();
            NewsInfo       news = db.LoadNoML(id);

            txtDescription.Text = news.Description;
            txtHeadline.Text    = news.Headline;
            if (news.ImageUrl != null && news.ImageUrl != "" && news.ImageUrl.LastIndexOf(';') > -1)
            {
                ctlURL.Url          = news.ImageUrl.Substring(news.ImageUrl.LastIndexOf(';') + 1);
                chkImageURL.Checked = true;
            }
            else
            {
                chkImageURL.Checked = false;
            }

            txtKeyWords.Text = news.KeyWords;

            ddlCategory.SelectedValue = news.CatID;
            chkPublished.Checked      = news.Published;
            chkAllowComment.Checked   = news.AllowComment;

            DataTable fDt = db.GetNewsGroupByNews(id);

            foreach (ListItem item in lstChkNewsGroup.Items)
            {
                if (IsNewsGroupInTable(item.Value, fDt))
                {
                    item.Selected = true;
                    if (item.Value == "__Shared__")
                    {
                        hdShared.Value = "1";
                    }
                }
            }

            teContent.Text = news.Content;
            //txtModifyDate.Text = news.ModifyDate.ToShortDateString();
            txtModifyDate.Text = news.ModifyDate.ToString("dd/MM/yyyy HH:mm:ss");
            txtStartDate.Text  = news.StartDate == null ? "" : ((DateTime)news.StartDate).ToShortDateString();
            txtEndDate.Text    = news.EndDate == null ? "" : ((DateTime)news.EndDate).ToShortDateString();

            int Feature = news.Feature;
            int New     = Feature % 2;
            int Hot     = (Feature - New) / 2;

            chkNew.Checked = Convert.ToBoolean(New);
            chkHot.Checked = Convert.ToBoolean(Hot);

            txtWriter.Text       = news.Writer;
            txtDonVi.Text        = news.DonVi;
            chkFromOuter.Checked = news.FromOuter;
        }
Ejemplo n.º 4
0
        public static MLNewsInfo GetNews(int ID, string Locale, bool FromCache)
        {
            StringInfo     Headline    = effority.Ealo.Controller.GetStringByQualifierAndStringName(NewsHeadlineQualifier, ID.ToString(), Locale, FromCache);
            StringInfo     Description = effority.Ealo.Controller.GetStringByQualifierAndStringName(NewsDescriptionQualifier, ID.ToString(), Locale, FromCache);
            StringInfo     Content     = effority.Ealo.Controller.GetStringByQualifierAndStringName(NewsContentQualifier, ID.ToString(), Locale, FromCache);
            MLNewsInfo     fMLNewsInfo = null;
            NewsController newsCont    = new NewsController();
            NewsInfo       newsInfo    = newsCont.LoadNoML(ID);

            fMLNewsInfo = new MLNewsInfo(newsInfo);
            if (Headline != null)
            {
                if (!String.IsNullOrEmpty(Headline.StringText))
                {
                    fMLNewsInfo.MLHeadline = Headline;
                }
            }
            if (Description != null)
            {
                if (!String.IsNullOrEmpty(Description.StringText))
                {
                    fMLNewsInfo.MLDescription = Description;
                }
            }
            if (Content != null)
            {
                if (!String.IsNullOrEmpty(Content.StringText))
                {
                    fMLNewsInfo.MLContent = Content;
                }
            }
            //if (Headline != null && String.IsNullOrEmpty(Headline.StringText))
            //{
            //    Headline.StringText = newsInfo.Headline;
            //}
            //if (Description != null && String.IsNullOrEmpty(Description.StringText))
            //{
            //    Description.StringText = newsInfo.Description;
            //}
            //if (Content != null && String.IsNullOrEmpty(Content.StringText))
            //{
            //    Content.StringText = newsInfo.Content;
            //}
            //fMLNewsInfo.MLHeadline = Headline;
            //fMLNewsInfo.MLDescription = Description;
            //fMLNewsInfo.MLContent = Content;
            return(fMLNewsInfo);
        }
Ejemplo n.º 5
0
        private void BindControls()
        {
            ArrayList tabs = DotNetNuke.Common.Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true, false, true);

            for (int i = 0; i < tabs.Count; i++)
            {
                DotNetNuke.Entities.Tabs.TabInfo tab = (DotNetNuke.Entities.Tabs.TabInfo)tabs[i];
                ddlDesktopListID.Items.Add(new ListItem(tab.TabName, tab.TabID.ToString()));
                ddlDesktopViewID.Items.Add(new ListItem(tab.TabName, tab.TabID.ToString()));
                ddlBookingPageID.Items.Add(new ListItem(tab.TabName, tab.TabID.ToString()));
            }
            ddlBookingPageID.Items.Insert(0, new ListItem("", "-1"));
            CategoryController catdb  = new CategoryController();
            string             sCatID = (Request.QueryString["id"] == null)?"":Request.QueryString["id"];
            DataTable          dt     = catdb.LoadTree(false, PortalId, sCatID);
            DataRow            row    = dt.NewRow();

            row["CatName"] = "";
            row["CatID"]   = 0;
            dt.Rows.InsertAt(row, 0);

            ddlParentID.DataSource     = dt;
            ddlParentID.DataTextField  = "CatName";
            ddlParentID.DataValueField = "CatID";
            ddlParentID.DataBind();

            if (Request.QueryString["id"] != null)
            {
                NewsController             newsCont = new NewsController();
                Dictionary <int, NewsInfo> dicNews  = newsCont.GetNewsByCat(Request.QueryString["id"]);
                ArrayList fLstNews = new ArrayList();
                NewsInfo  info     = new NewsInfo();
                info.ID       = 0;
                info.Headline = "";
                fLstNews.Add(info);
                foreach (NewsInfo fNewsInfo in dicNews.Values)
                {
                    fLstNews.Add(fNewsInfo);
                }
                ddlNews.DataSource     = fLstNews;
                ddlNews.DataTextField  = "Headline";
                ddlNews.DataValueField = "ID";
                ddlNews.DataBind();
            }
        }
Ejemplo n.º 6
0
 private void ImportNewsInfo(NewsInfo NewsInfo)
 {
     base.CatID        = NewsInfo.CatID;
     base.AllowComment = NewsInfo.AllowComment;
     base.Content      = NewsInfo.Content;
     base.CreatedDate  = NewsInfo.CreatedDate;
     base.CreateID     = NewsInfo.CreateID;
     base.Description  = NewsInfo.Description;
     base.Headline     = NewsInfo.Headline;
     base.ID           = NewsInfo.ID;
     base.ImageUrl     = NewsInfo.ImageUrl;
     base.KeyWords     = NewsInfo.KeyWords;
     base.ModifyDate   = NewsInfo.ModifyDate;
     base.ModifyID     = NewsInfo.ModifyID;
     base.Published    = NewsInfo.Published;
     base.Source       = NewsInfo.Source;
     base.TotalView    = NewsInfo.TotalView;
 }
Ejemplo n.º 7
0
        private void LoadData(int id)
        {
            if (Request.QueryString["cat"] != null)
            {
                lblCatString.Text = Request.QueryString["cat"];
            }
            NewsController db   = new NewsController();
            NewsInfo       news = db.LoadNoML(id);

            txtDescription.Text = news.Description;
            txtHeadline.Text    = news.Headline;
            if (news.ImageUrl != null && news.ImageUrl != "" && news.ImageUrl.LastIndexOf(';') > -1)
            {
                ctlURL.Url          = news.ImageUrl.Substring(news.ImageUrl.LastIndexOf(';') + 1);
                chkImageURL.Checked = true;
            }
            else
            {
                chkImageURL.Checked = false;
            }

            txtKeyWords.Text          = news.KeyWords;
            ddlCategory.SelectedValue = news.CatID;
            chkPublished.Checked      = news.Published;
            chkAllowComment.Checked   = news.AllowComment;

            teContent.Text = news.Content;
            //txtModifyDate.Text = news.ModifyDate.ToShortDateString();
            txtModifyDate.Text = news.ModifyDate.ToString("dd/MM/yyyy HH:mm:ss");
            txtStartDate.Text  = news.StartDate == null ? "" : ((DateTime)news.StartDate).ToShortDateString();
            txtEndDate.Text    = news.EndDate == null ? "" : ((DateTime)news.EndDate).ToShortDateString();

            int Feature = news.Feature;
            int New     = Feature % 2;
            int Hot     = (Feature - New) / 2;

            chkNew.Checked = Convert.ToBoolean(New);
            chkHot.Checked = Convert.ToBoolean(Hot);
        }
Ejemplo n.º 8
0
        private void LoadDropdown()
        {
            string path = PortalSettings.HomeDirectoryMapPath + "Xsl";

            DotNetNuke.NewsProvider.Utils.BindTemplateByName(ddlTemplate, path, "comment_list*.xsl");

            NewsController             newsCont = new NewsController();
            Dictionary <int, NewsInfo> dicNews  = newsCont.GetNewsByPortal(PortalId);
            ArrayList fLstNews = new ArrayList();
            NewsInfo  info     = new NewsInfo();

            info.ID       = 0;
            info.Headline = "";
            fLstNews.Add(info);
            foreach (NewsInfo fNewsInfo in dicNews.Values)
            {
                fLstNews.Add(fNewsInfo);
            }
            ddlNews.DataSource     = fLstNews;
            ddlNews.DataTextField  = "Headline";
            ddlNews.DataValueField = "ID";
            ddlNews.DataBind();
        }
Ejemplo n.º 9
0
 public MLNewsInfo(NewsInfo NewsInfo)
 {
     this.ImportNewsInfo(NewsInfo);
 }
Ejemplo n.º 10
0
        protected void btnSavePreview_Click(object sender, EventArgs e)
        {
            try
            {
                NewsInfo news = new NewsInfo();
                if (Request.QueryString["id"] != null)
                {
                    news.ID = Convert.ToInt32(Request.QueryString["id"]);
                }
                else if (lblNewsID.Text != "")
                {
                    news.ID = Convert.ToInt32(lblNewsID.Text);
                }
                else
                {
                    news.ID = 0;
                }
                news.CatID       = ddlCategory.SelectedValue;
                news.Content     = Server.HtmlDecode(teContent.Text);
                news.CreateID    = this.UserId;
                news.ModifyID    = this.UserId;
                news.Description = Server.HtmlDecode(txtDescription.Text);

                if (chkImageURL.Checked)
                {
                    NewsController newsCont = new NewsController();
                    DataTable      dt       = newsCont.GetFileInfo(int.Parse(ctlURL.Url.Substring(7)));
                    if (dt.Rows.Count == 1)
                    {
                        string imagePath = PortalSettings.HomeDirectory + dt.Rows[0]["Folder"].ToString() + dt.Rows[0]["FileName"].ToString();
                        news.ImageUrl = imagePath + ";" + ctlURL.Url;
                        Resize(imagePath, 600);
                    }
                }
                else
                {
                    news.ImageUrl = "";
                }

                news.Headline     = txtHeadline.Text;
                news.AllowComment = chkAllowComment.Checked;
                news.Published    = chkPublished.Checked;
                news.KeyWords     = txtKeyWords.Text.Trim();
                news.ModifyDate   = Convert.ToDateTime(txtModifyDate.Text);
                news.StartDate    = txtStartDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtStartDate.Text);
                news.EndDate      = txtEndDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtEndDate.Text);
                if (chkNew.Checked)
                {
                    news.Feature += 1;
                }
                if (chkHot.Checked)
                {
                    news.Feature += 2;
                }
                news.Writer = txtWriter.Text;
                if (txtDonVi.Text == "")
                {
                    news.DonVi = PortalSettings.PortalName;
                }
                else
                {
                    news.DonVi = txtDonVi.Text;
                }
                news.FromOuter = chkFromOuter.Checked;

                NewsController db = new NewsController();
                if (news.ID != 0)
                {
                    db.Update(news);
                }
                else
                {
                    db.Insert(news);
                }

                string NewsGroupString = "";
                foreach (ListItem item in lstChkNewsGroup.Items)
                {
                    if (item.Selected == true)
                    {
                        NewsGroupString += "@" + item.Value + "@";
                        if (item.Value == "__Shared__" && hdShared.Value == "0")
                        {
                            SendMailToSuperUser(new string[] { "*****@*****.**" }, news.Headline);
                            hdShared.Value = "1";
                        }
                    }
                }
                db.UpdateNewsGroupNews(news.ID, NewsGroupString);

                btnDelete.Visible = true;
                btnDelete.Attributes["onclick"] = "if(!confirm('" + Localization.GetString("lblConfirmDelete", Localization.GetResourceFile(this, "news_edit.ascx")) + "')) {return false;};";
                lblNewsID.Text = news.ID.ToString();

                //Resize image
                string          pattern = "(?<=<img[^<]+?src=\")[^\"]+";
                MatchCollection mc      = Regex.Matches(news.Content, pattern, RegexOptions.Multiline);
                foreach (Match m in mc)
                {
                    Resize(m.Value, 600);
                }
                //Resize image

                CategoryController catCont    = new CategoryController();
                CategoryInfo       catInfo    = catCont.Load(news.CatID);
                string             previewUrl = DotNetNuke.Common.Globals.NavigateURL(catInfo.DesktopViewID, "", "id/" + news.ID.ToString());
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "preview", "window.open('" + previewUrl + "','','width=800,height=600,scrollbars=1')", true);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Ejemplo n.º 11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                NewsInfo news = new NewsInfo();
                if (Request.QueryString["id"] != null)
                {
                    news.ID = Convert.ToInt32(Request.QueryString["id"]);
                }
                else if (lblNewsID.Text != "")
                {
                    news.ID = Convert.ToInt32(lblNewsID.Text);
                }
                else
                {
                    news.ID = 0;
                }
                news.CatID       = ddlCategory.SelectedValue;
                news.Content     = Server.HtmlDecode(teContent.Text);
                news.CreateID    = this.UserId;
                news.ModifyID    = this.UserId;
                news.Description = Server.HtmlDecode(txtDescription.Text);

                if (chkImageURL.Checked)
                {
                    NewsController newsCont = new NewsController();
                    DataTable      dt       = newsCont.GetFileInfo(int.Parse(ctlURL.Url.Substring(7)));
                    if (dt.Rows.Count == 1)
                    {
                        string imagePath = PortalSettings.HomeDirectory + dt.Rows[0]["Folder"].ToString() + dt.Rows[0]["FileName"].ToString();
                        news.ImageUrl = imagePath + ";" + ctlURL.Url;
                        Resize(imagePath, 600);
                    }
                }
                else
                {
                    news.ImageUrl = "";
                }

                news.Headline     = txtHeadline.Text;
                news.AllowComment = chkAllowComment.Checked;
                news.Published    = chkPublished.Checked;
                news.KeyWords     = txtKeyWords.Text.Trim();
                news.ModifyDate   = Convert.ToDateTime(txtModifyDate.Text);
                news.StartDate    = txtStartDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtStartDate.Text);
                news.EndDate      = txtEndDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtEndDate.Text);
                if (chkNew.Checked)
                {
                    news.Feature += 1;
                }
                if (chkHot.Checked)
                {
                    news.Feature += 2;
                }
                news.Writer    = txtWriter.Text;
                news.DonVi     = txtDonVi.Text;
                news.FromOuter = chkFromOuter.Checked;

                NewsController db = new NewsController();
                if (news.ID != 0)
                {
                    db.Update(news);
                }
                else
                {
                    db.Insert(news);
                }

                string NewsGroupString = "";
                foreach (ListItem item in lstChkNewsGroup.Items)
                {
                    if (item.Selected == true)
                    {
                        NewsGroupString += "@" + item.Value + "@";
                        if (item.Value == "__Shared__" && hdShared.Value == "0")
                        {
                            SendMailToSuperUser(new string[] { "*****@*****.**", "*****@*****.**" }, news.Headline);
                            hdShared.Value = "1";
                        }
                    }
                }
                db.UpdateNewsGroupNews(news.ID, NewsGroupString);

                //Resize image
                string          pattern = "(?<=<img[^<]+?src=\")[^\"]+";
                MatchCollection mc      = Regex.Matches(news.Content, pattern, RegexOptions.Multiline);
                foreach (Match m in mc)
                {
                    Resize(m.Value, 600);
                }
                //Resize image

                string url = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "admin_news", "mid/" + this.ModuleId.ToString(), "cat/" + lblCatString.Text);
                Response.Redirect(url);
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                NewsInfo news = new NewsInfo();
                if (Request.QueryString["id"] != null)
                {
                    news.ID = Convert.ToInt32(Request.QueryString["id"]);
                }

                news.CatID       = ddlCategory.SelectedValue;
                news.Content     = Server.HtmlDecode(teContent.Text);
                news.CreateID    = this.UserId;
                news.ModifyID    = this.UserId;
                news.Description = Server.HtmlDecode(txtDescription.Text);

                if (chkImageURL.Checked)
                {
                    NewsController newsCont = new NewsController();
                    DataTable      dt       = newsCont.GetFileInfo(int.Parse(ctlURL.Url.Substring(7)));
                    if (dt.Rows.Count == 1)
                    {
                        news.ImageUrl = PortalSettings.HomeDirectory + dt.Rows[0]["Folder"].ToString() + dt.Rows[0]["FileName"].ToString() + ";" + ctlURL.Url;
                    }
                }
                else
                {
                    news.ImageUrl = "";
                }

                news.Headline     = txtHeadline.Text;
                news.AllowComment = chkAllowComment.Checked;
                news.Published    = chkPublished.Checked;
                news.KeyWords     = txtKeyWords.Text.Trim();
                news.ModifyDate   = Convert.ToDateTime(txtModifyDate.Text);
                news.StartDate    = txtStartDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtStartDate.Text);
                news.EndDate      = txtEndDate.Text == "" ? (DateTime?)null : Convert.ToDateTime(txtEndDate.Text);
                if (chkNew.Checked)
                {
                    news.Feature += 1;
                }
                if (chkHot.Checked)
                {
                    news.Feature += 2;
                }
                NewsController db = new NewsController();
                if (Request.QueryString["id"] != null)
                {
                    db.Update(news);
                }
                else
                {
                    db.Insert(news);
                }

                string url = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "mid/" + this.ModuleId.ToString(), "cat/" + lblCatString.Text);
                Response.Redirect(url);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }