예제 #1
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {
            Response.Redirect(links.LoginLink, false);
        }
        else
        {
            MessageLabel.Text = gui.GreenFontStart + UID + "'s Saved Items" + gui.GreenFontEnd;
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        LoadItemDB(sort);
    }
예제 #2
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected override void OnInit(EventArgs e)
    {
        // Create dynamic controls here.

        //  Default Search Parameters.
        query = String.Empty;
        sType = SearchEngine.SearchType.Title;
        sCategory = "All Categories";
        sTime = SearchEngine.SearchTime.Today;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        searchEngine = SearchEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }

        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        LoadSearchDDL();
        GetQueryParameters();

        if (!string.IsNullOrEmpty(SearchTB.Text))
        {
            query = SearchTB.Text.Trim();
        }

        string sTypeDDLValue = SearchTypeDDL.SelectedValue;
        string sCategoryDDLValue = SearchCategoryDDL.SelectedValue;
        string sTimeDDLValue = SearchTimeDDL.SelectedValue;

        Control MasterPageSearchTable = this.Master.FindControl("SearchTable");
        MasterPageSearchTable.Visible = false;

        SearchTB.Focus();
        Page.Form.DefaultButton = SearchButton.ID;

        if (!string.IsNullOrEmpty(query))
        {
            SearchTB.Text = query;

            if (sType == SearchEngine.SearchType.Comments)
            {
                sType = SearchEngine.SearchType.Title;
                List<Item> itemList = searchEngine.LoadSearchResults(query, sType, sCategory, sTime);
                LoadItemTable(itemList);
            }
            else
            {

                //  List<Item> itemList = searchEngine.LoadSearchResults(query);
                List<Item> itemList = searchEngine.LoadSearchResults(query, sType, sCategory, sTime);

                //  LoadItemTable(itemList);

                ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
                    | ItemDisplayer.ShowItemsOptions.ShowTime
                    | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
                    | ItemDisplayer.ShowItemsOptions.ShowSaveLink
                    | ItemDisplayer.ShowItemsOptions.ShowEMailLink
                    | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
                    | ItemDisplayer.ShowItemsOptions.ShowImage
                    | ItemDisplayer.ShowItemsOptions.ShowRatings
                    | ItemDisplayer.ShowItemsOptions.ShowTags
                    | ItemDisplayer.ShowItemsOptions.CountClicks
                    | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

                string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.SearchPageLink.Replace("~\\", ""));
                ItemDiv.InnerHtml = itemTable;

            }
        }

        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        //  InitializeComponent();
        base.OnInit(e);
    }
예제 #3
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        MyAccountLink.Visible = false;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {
            Response.Redirect(links.FrontPageLink, false);
        }
        else
        {
            string queryString = "SELECT PreferredCategories FROM user WHERE UID='" + UID + "';";
            MySqlDataReader retList = dbOps.ExecuteReader(queryString);

            string prefferedCategoriesStr = string.Empty;
            if (retList != null && retList.HasRows)
            {
                while (retList.Read())
                {
                    prefferedCategoriesStr = Convert.ToString(retList["PreferredCategories"]);
                }
                retList.Close();
            }

            if (string.IsNullOrEmpty(prefferedCategoriesStr))
            {
                MessageLabel.Text = "Please visit the My Account Page and select the Categories that you would like to read more news from.";
                MyAccountLink.Visible = true;
                MyAccountLink.NavigateUrl = links.UserDetailsPageLink + "?UID=" + UID;
            }
            else
            {
                MyAccountLink.Visible = false;

                List<string> preferredCategoriesList = GetPreferredCategoriesList(prefferedCategoriesStr);
                List<Item> itemList = LoadItemDB(sort, preferredCategoriesList);
                if (itemList != null && itemList.Count > 0)
                {
                    MessageLabel.Text = gui.GreenFontStart + "Personalized Items for " + gui.GreenFontEnd + gui.BlueFontStart + UID + gui.BlueFontEnd;

                    //  LoadItemTable(itemList);

                    ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
                        | ItemDisplayer.ShowItemsOptions.ShowTime
                        | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
                        | ItemDisplayer.ShowItemsOptions.ShowSaveLink
                        | ItemDisplayer.ShowItemsOptions.ShowEMailLink
                        | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
                        | ItemDisplayer.ShowItemsOptions.ShowImage
                        | ItemDisplayer.ShowItemsOptions.ShowRatings
                        | ItemDisplayer.ShowItemsOptions.ShowTags
                        | ItemDisplayer.ShowItemsOptions.CountClicks
                        | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;
                    string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.MyNewsPageLink.Replace("~\\", ""));
                    ItemDiv.InnerHtml = itemTable;
                }
                else
                {
                    MessageLabel.Text = "getputs did not find anything worth your attention today!";
                }
            }
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists
    }
예제 #4
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        //  requestedTag = Request.QueryString["category"].Trim();
        requestedCategory = Request.QueryString.Get("category");

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (string.IsNullOrEmpty(requestedCategory))
        {
            LoadGenericCategoryTable();
        }
        else if (!(categories.CategoriesList.Contains(requestedCategory) || categories.CategoriesList.Contains(requestedCategory.ToLower())))
        {
            MessageLabel.Text = gui.RedFontStart + "Invalid Category" + gui.RedFontEnd;
        }
        else
        {
            string currentCategory = requestedCategory;
            if (imageEngine.IsIconsOn)
            {
                string iconLocation = imageEngine.LoadIconLocation(currentCategory);
                if (!string.IsNullOrEmpty(iconLocation))
                {
                    System.Web.UI.WebControls.Image icon = new System.Web.UI.WebControls.Image();
                    //  icon.ImageUrl = links.DomainLink + iconLocation;
                    icon.ImageUrl = iconLocation;
                    icon.ToolTip = currentCategory;
                    CategoryDiv.Controls.Add(icon);
                    CategoryDiv.Controls.Add(new LiteralControl(" "));
                }
            }
            MessageLabel.Text = gui.GreenFontStart + requestedCategory + gui.GreenFontEnd;
            //  MessageLabel.Text = gui.WhiteFontStart + requestedCategory + gui.WhiteFontEnd;
            LoadCategoryTable(requestedCategory, sort);
        }
    }
예제 #5
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
        {
            tag = Request.QueryString["tag"].Trim();
        }
        else
        {
            Response.Redirect(links.FrontPageLink, true);
        }

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        List<Item> itemList = GetSimilarlyTaggedItems(tag);
        if (itemList != null && itemList.Count > 0)
        {
            //  LoadItemTable(itemList);

            ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
            | ItemDisplayer.ShowItemsOptions.ShowTime
            | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
            | ItemDisplayer.ShowItemsOptions.ShowSaveLink
            | ItemDisplayer.ShowItemsOptions.ShowEMailLink
            | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
            | ItemDisplayer.ShowItemsOptions.ShowImage
            | ItemDisplayer.ShowItemsOptions.ShowRatings
            | ItemDisplayer.ShowItemsOptions.ShowTags
            | ItemDisplayer.ShowItemsOptions.CountClicks
            | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

            string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.AutoTagPageLink.Replace("~\\", "") + "?tag=" + tag);
            ItemDiv.InnerHtml = itemTable;

            MessageLabel.Text = gui.GreenFontStart + "Items automatically tagged with the tag: " + gui.GreenFontEnd + tag;
        }
        else
        {
            MessageLabel.Text = gui.GreenFontStart + "No items carry the tag: " + gui.GreenFontEnd + tag;
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //dbOps = DBOperations.Instance;
        //links = Links.Instance;
        //general = General.Instance;
        //gui = GUIVariables.Instance;
        //categories = Categories.Instance;
        //engine = ProcessingEngine.Instance;
        //imageEngine = ImageEngine.Instance;
        //tagger =Tagger.Instance;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;
        //  seperator = gui.BlueFontStart + " | " + gui.BlueFontEnd;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        //if (!string.IsNullOrEmpty(Request.QueryString["layout"]))
        //{
        //    string layoutStr = Convert.ToString(Request.QueryString["layout"]);
        //    itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(layoutStr);
        //}

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        List<Item> itemList = engine.LoadItemDB(sort);
        //  Using ASP.NET Controls.
        //  LoadItemTable(itemList);

        //  Using HTML
        ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
            | ItemDisplayer.ShowItemsOptions.ShowTime
            | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
            | ItemDisplayer.ShowItemsOptions.ShowSaveLink
            | ItemDisplayer.ShowItemsOptions.ShowEMailLink
            | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
            | ItemDisplayer.ShowItemsOptions.ShowImage
            | ItemDisplayer.ShowItemsOptions.ShowRatings
            | ItemDisplayer.ShowItemsOptions.ShowTags
            | ItemDisplayer.ShowItemsOptions.CountClicks
            | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

        string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.FrontPageLink.Replace("~\\", ""));
        ItemDiv.InnerHtml = itemTable;

        //  Master Page ItemImage and ItemContent Carousels are invisble. Make them visible only for this page.
        Control MasterPageCarouselDiv = this.Master.FindControl("CarouselDiv");
        MasterPageCarouselDiv.Visible = true;
        Control MasterPageTopAboutTable = this.Master.FindControl("TopAboutTable");
        MasterPageTopAboutTable.Visible = true;

        //  List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.New);
        if (itemList != null && itemList.Count > 0)
        {
            LoadItemImageCarousel(itemList);
            LoadItemNewsCarousel(itemList);
        }

        //  Load Item Content Carousel JavaScript START
        //if (itemList != null && itemList.Count > 0)
        //{
        //    LoadItemNewsCarousel(itemList);
        //}
        //  Load Item Content Carousel JavaScript END
    }