protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }
            DataTable cntData = LegoWebSite.Buslgic.MetaContents.get_MOST_READ_CONTENTS(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());
            if (cntData.Rows.Count > 0)
            {
                CRecord   myRec = new CRecord();
                CSubfield Sf    = new CSubfield();

                string   sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
                UrlQuery myPost            = new UrlQuery();
                if (!String.IsNullOrEmpty(_default_post_page))
                {
                    myPost = new UrlQuery(_default_post_page);
                }
                CRecords outRecs = new CRecords();

                for (int i = 0; i < cntData.Rows.Count; i++)
                {
                    int meta_content_id = (int)cntData.Rows[i]["META_CONTENT_ID"];
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 0));
                    if (myRec.Datafields.Datafield("245").Subfields.get_Subfield("n", ref Sf))
                    {
                        Sf.Value = cntData.Rows[i]["READ_COUNT"].ToString();
                    }
                    else
                    {
                        Sf.ReConstruct();
                        Sf.Code  = "n";
                        Sf.Value = cntData.Rows[i]["READ_COUNT"].ToString();
                        myRec.Datafields.Datafield("245").Subfields.Add(Sf);
                    }
                    myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    outRecs.Add(myRec);
                }
                this.litContent.Text = outRecs.XsltFile_Transform(sTemplateFileName);
            }
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];
                    if (catData.Rows.Count > 0)
                    {
                        this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
                    }
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\"><a href=\"contentnavigator.aspx?catid={1}\">{2}</a></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, _category_id.ToString(), this.Title);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            DataTable cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());

            UrlQuery myPost = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                myPost = new UrlQuery(_default_post_page);
            }
            string   sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
            CRecords ouRecs            = new CRecords();
            for (int i = 0; i < cntData.Rows.Count; i++)
            {
                CRecord myRec = new CRecord();
                myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0));
                myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                ouRecs.Add(myRec);
            }
            this.litContent.Text = ouRecs.XsltFile_Transform(sTemplateFileName);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int metacontentid = 0;

        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            metacontentid = discover_content_id();
            if (metacontentid == 0 || (metacontentid > 0 && !LegoWebSite.Buslgic.MetaContents.is_META_CONTENTS_EXIST(metacontentid)))
            {
                this.litContent.Text = "<H3>No suitable data!</H3>";
                return;
            }
            CRecord myRec    = new CRecord();
            string  sMetaXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(metacontentid, 1);
            myRec.load_Xml(sMetaXml);
            string sTemplateFileName;
            if (!string.IsNullOrEmpty(_template_name))
            {
                sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
            }
            else
            {
                sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(LegoWebSite.Buslgic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(myRec.Controlfields.Controlfield("002").Value)));
            }
            string sOutHTML = myRec.XsltFile_Transform(sTemplateFileName);
            this.litContent.Text = sOutHTML;
        }
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    meta_content_id = 0;
        int    category_id     = 0;
        int    menu_id         = 0;
        string sLangCode       = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower();

        if (!IsPostBack)
        {
            //set round boxs

            if (!String.IsNullOrEmpty(_navibox_css_name))
            {
                if (_navibox_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _navibox_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(_navibox_title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litCatNaviBoxTop.Text    = sBoxTop;
                    this.litCatNaviBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _navibox_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litCatNaviBoxTop.Text    = sBoxTop;
                    this.litCatNaviBoxBottom.Text = sBoxBottom;
                }
            }
            else
            {
                this.litCatNaviBoxTop.Text    = "<div>";
                this.litCatNaviBoxBottom.Text = "</div>";
            }


            if (!String.IsNullOrEmpty(_contentbox_css_name))
            {
                if (_contentbox_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _contentbox_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(_contentbox_title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litContentBrowserBoxTop.Text    = sBoxTop;
                    this.litContentBrowserBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _contentbox_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litContentBrowserBoxTop.Text    = sBoxTop;
                    this.litContentBrowserBoxBottom.Text = sBoxBottom;
                }
            }
            else
            {
                this.litContentBrowserBoxTop.Text    = "<div>";
                this.litContentBrowserBoxBottom.Text = "</div>";
            }


            if (!String.IsNullOrEmpty(_relatedbox_css_name))
            {
                if (_relatedbox_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _relatedbox_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(_relatedbox_title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litRelatedContentBoxTop.Text    = sBoxTop;
                    this.litRelatedContentBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _relatedbox_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litRelatedContentBoxTop.Text    = sBoxTop;
                    this.litRelatedContentBoxBottom.Text = sBoxBottom;
                }
            }
            else
            {
                this.litRelatedContentBoxTop.Text    = "<div>";
                this.litRelatedContentBoxBottom.Text = "</div>";
            }

            //try to find meta_content_id in order of: meta_content_id; category_id->get top 1 meta_content_id of; menu_id->category_id->get top 1 meta_content_id of

            if (CommonUtility.GetInitialValue("contentid", null) != null)
            {
                meta_content_id = int.Parse(CommonUtility.GetInitialValue("contentid", null).ToString());
            }

            if (CommonUtility.GetInitialValue("catid", null) != null)
            {
                category_id = int.Parse(CommonUtility.GetInitialValue("catid", null).ToString());
            }

            if (CommonUtility.GetInitialValue("mnuid", null) != null)
            {
                menu_id = int.Parse(CommonUtility.GetInitialValue("mnuid", 0).ToString());
            }

            if (meta_content_id <= 0)
            {
                if (category_id > 0)
                {
                    if (!LegoWebSite.Buslgic.Categories.is_CATEGORY_EXIST(category_id))
                    {
                        this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                        return;
                    }
                    else
                    {
                        DataTable top1Data = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(category_id, 1, sLangCode);
                        if (top1Data.Rows.Count > 0)
                        {
                            meta_content_id = (int)top1Data.Rows[0]["META_CONTENT_ID"];
                            category_id     = (int)top1Data.Rows[0]["CATEGORY_ID"];
                        }
                        else
                        {
                            this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                            return;
                        }
                    }
                }
                else if (menu_id > 0)
                {
                    category_id = LegoWebSite.Buslgic.Categories.get_CATEGORY_ID_BY_MENU_ID(menu_id);
                    if (!LegoWebSite.Buslgic.Categories.is_CATEGORY_EXIST(category_id))
                    {
                        this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                        return;
                    }
                    else
                    {
                        DataTable top1Data = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(category_id, 1, sLangCode);
                        if (top1Data.Rows.Count > 0)
                        {
                            meta_content_id = (int)top1Data.Rows[0]["META_CONTENT_ID"];
                            category_id     = (int)top1Data.Rows[0]["CATEGORY_ID"];//change to specific content's category
                        }
                        else
                        {
                            this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                            return;
                        }
                    }
                }
                else
                {
                    this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                    return;
                }
            }

            if (!LegoWebSite.Buslgic.MetaContents.is_META_CONTENTS_EXIST(meta_content_id))
            {
                litContentBrowserContent.Text = "<H3>meta_content_id is not available!</H3>";
                return;
            }
            if (category_id == 0)
            {
                category_id = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_CATEGORY_ID(meta_content_id);
            }
            //Display Navigator Info
            this.litCatNaviContent.Text = LegoWebSite.Buslgic.Categories.get_NavigatePath(category_id, (String.IsNullOrEmpty(_default_post_page) == true ? Request.Url.AbsoluteUri:_default_post_page));
            #region verify access right
            //verify access right
            int iAccessLevel = LegoWebSite.Buslgic.MetaContents.get_ACCESS_LEVEL(meta_content_id);
            switch (iAccessLevel)
            {
            case 1:     //need logedin
                if (!Page.User.Identity.IsAuthenticated)
                {
                    this.litContentBrowserContent.Text = "<span><b>Only registered users can view details</b></span>";
                    return;
                }
                break;

            case 2:
                if (!Page.User.Identity.IsAuthenticated)
                {
                    this.litContentBrowserContent.Text = "<span><b>Only registered users can view details</b></span>";
                    return;
                }
                else //verify user roles
                {
                    string[] sAllowAccessRoles = LegoWebSite.Buslgic.MetaContents.get_ACCESS_ROLES(meta_content_id);
                    string[] sUserRoles        = Roles.GetRolesForUser(Page.User.Identity.Name);
                    bool     bAllowAccess      = false;
                    if (sUserRoles != null && sUserRoles.Length > 0 && sAllowAccessRoles != null && sAllowAccessRoles.Length > 0)
                    {
                        for (int x = 0; x < sUserRoles.Length; x++)
                        {
                            for (int y = 0; y < sAllowAccessRoles.Length; y++)
                            {
                                if (sUserRoles[x] == sAllowAccessRoles[y])
                                {
                                    bAllowAccess = true;
                                    break;
                                }
                            }
                            if (bAllowAccess)
                            {
                                break;
                            }
                        }
                    }
                    if (!bAllowAccess)
                    {
                        this.litContentBrowserContent.Text = "<span><b>You are not authorized to view details</b></span>";
                        return;
                    }
                }
                break;
            }
            #endregion verify access right
            //auhorized
            //Display Content Details
            CRecord myRec = new CRecord();
            myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 1));
            string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(LegoWebSite.Buslgic.Categories.get_CATEGORY_TEMPLATE_NAME(category_id));

            //find linked contents list
            CDatafields Dfs = myRec.Datafields;
            Dfs.Filter("780");
            int      iLinkedCount = Dfs.Count;
            int[]    linkedIDs    = new int[iLinkedCount + 1];
            UrlQuery linkPost     = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                linkPost = new UrlQuery(_default_post_page);
            }
            for (int i = 0; i < iLinkedCount; i++)
            {
                linkedIDs[i] = int.Parse(Dfs.Datafield(i).Subfields.Subfield("w").Value);
                //change link content id to link url
                linkPost.Set("contentid", linkedIDs[i].ToString());
                Dfs.Datafield(i).Subfields.Subfield("w").Value = linkPost.AbsoluteUri;
            }
            this.litContentBrowserContent.Text = myRec.XsltFile_Transform(sTemplateFileName);
            //increase read count
            LegoWebSite.Buslgic.MetaContents.increase_READ_COUNT(meta_content_id);
            //exception ids
            linkedIDs[iLinkedCount] = meta_content_id;//last id is current meta_content_id

            DataTable relData = LegoWebSite.Buslgic.MetaContents.get_TOP_RELATED_CONTENTS(category_id, _number_of_record, sLangCode, linkedIDs);
            if (relData.Rows.Count > 0)
            {
                CRecords outRecs = new CRecords();
                sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_related_content_template);
                for (int i = 0; i < relData.Rows.Count; i++)
                {
                    meta_content_id = (int)relData.Rows[i]["META_CONTENT_ID"];
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 1));
                    linkPost.Set("contentid", meta_content_id.ToString());
                    myRec.Controlfields.Controlfield("001").Value = linkPost.AbsoluteUri;
                    outRecs.Add(myRec);
                }
                this.litRelatedContentContent.Text = outRecs.XsltFile_Transform(sTemplateFileName);
            }
            else
            {
                this.litRelatedContentContent.Text = "";
            }
        }
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            string sliderShowScript = @"
                    <script type='text/javascript'> 
                     
                    $(document).ready(function() {		
                        
	                    //Execute the slideShow
	                    slideShow();
                     
                    });
                     
                    function slideShow() {
                     
	                    //Resize the heigh of the div according to the image heigh
	                    $('#gallery').css({height: $('#gallery a').find('img').css('height')});

	                    //Set the opacity of all images to 0
	                    $('#gallery a').css({opacity: 0.0});
                        
	                    //Get the first image and display it (set it to full opacity)
	                    $('#gallery a:first').css({opacity: 1.0});
                        
	                    //Set the caption background to semi-transparent
	                    $('#gallery .caption').css({opacity: 0.7});
                     
	                    //Resize the width of the caption according to the image width
	                    $('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
                        
	                    //Get the caption of the first image from REL attribute and display it
	                    $('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	                    .animate({opacity: 0.7}, 400);
                        
	                    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	                    setInterval('gallery()',6000);
                        
                    }
                     
                    function gallery() {
                        
	                    //if no IMGs have the show class, grab the first image
	                    var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));
                     
	                    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
	                    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
                        
	                    //Get next image caption
	                    var caption = next.find('img').attr('rel');	
                        
	                    //Set the fade in effect for the next image, show class has higher z-index
	                    next.css({opacity: 0.0})
	                    .addClass('show')
	                    .animate({opacity: 1.0}, 1000);
                     
	                    //Hide the current image
	                    current.animate({opacity: 0.0}, 1000)
	                    .removeClass('show');
                        
	                    //Set the opacity to 0 and height to 1px
	                    $('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
                        
	                    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	                    $('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '65px'},500 );
                        
	                    //Display the content
	                    $('#gallery .content').html(caption);                                               
                    }
                     
                    </script>
               ";

            int contentid = discover_content_id();

            if ((contentid <= 0) || (contentid > 0 && !LegoWebSite.Buslgic.MetaContents.is_META_CONTENTS_EXIST(contentid)))
            {
                this.litContent.Text = "<H3>No suitable data!</H3>";
                return;
            }

            CRecord myRec    = new CRecord();
            string  sMetaXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(contentid, 0);
            myRec.load_Xml(sMetaXml);
            myRec.Sort();

            string sdefaultHeight = myRec.Datafields.Datafield("300").Subfields.Subfield("h").Value;
            string sdefaultWidth  = myRec.Datafields.Datafield("300").Subfields.Subfield("w").Value;

            CDatafields Dfs = myRec.Datafields;
            Dfs.Filter("856");
            if (Dfs.Count == 0)
            {
                this.litContent.Text = "<H3>No image info</H3>";
                return;
            }
            else
            {
                string sSliderHTML = "<div id='gallery'>";
                string aFormat     = "<a href='{0}' {1}> <img src='{2}' alt='{3}' width='{4}' height='{5}' rel='<h3>{3}</h3>{6}'/></a>";
                for (int i = 0; i < Dfs.Count; i++)
                {
                    CDatafield Df = Dfs.Datafield(i);
                    if (i == 0)
                    {
                        sSliderHTML += String.Format(aFormat, String.IsNullOrEmpty(Df.Subfields.Subfield("l").Value) ? "#" : Df.Subfields.Subfield("l").Value, " class='show'", Df.Subfields.Subfield("u").Value, Df.Subfields.Subfield("3").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("w").Value) == true ? sdefaultWidth : Df.Subfields.Subfield("w").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("h").Value) == true ? sdefaultHeight: Df.Subfields.Subfield("h").Value, Df.Subfields.Subfield("a").Value);
                    }
                    else
                    {
                        sSliderHTML += String.Format(aFormat, String.IsNullOrEmpty(Df.Subfields.Subfield("l").Value) ? "#" : Df.Subfields.Subfield("l").Value, "", Df.Subfields.Subfield("u").Value, Df.Subfields.Subfield("3").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("w").Value) == true ? sdefaultWidth : Df.Subfields.Subfield("w").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("h").Value) == true ? sdefaultHeight: Df.Subfields.Subfield("h").Value, Df.Subfields.Subfield("a").Value);
                    }
                }
                sSliderHTML         += "<div class='caption'><div class='content'></div></div>";
                sSliderHTML         += "</div";
                this.litContent.Text = sSliderHTML;
            }
            Page.RegisterStartupScript("slidershowscript", sliderShowScript);
        }
    }
    protected void linkExportButton_Click(object sender, EventArgs e)
    {
        CRecords      exRecs = new CRecords();
        CRecord       myRec  = new CRecord();
        CControlfield Cf     = new CControlfield();
        CDatafield    Df     = new CDatafield();
        CSubfield     Sf     = new CSubfield();

        DataTable tbData = new DataTable();

        try
        {
            switch (radioFilterType.SelectedValue)
            {
            case "0":
                int iSectionID  = 0;
                int iCategoryID = 0;
                if (dropSections.SelectedValue != null)
                {
                    iSectionID = int.Parse(dropSections.SelectedValue.ToString());
                }
                if (dropCategories.SelectedValue != null)
                {
                    iCategoryID = int.Parse(dropCategories.SelectedValue.ToString());
                }

                tbData = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_BY_CATEGORY_ID(iCategoryID, iSectionID).Tables[0];

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    string sXmlContent = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_MARCXML(Int16.Parse(tbData.Rows[i]["META_CONTENT_ID"].ToString()), 1);
                    myRec.load_Xml(sXmlContent);
                    exRecs.Add(myRec);
                }
                break;

            case "1":

                int iFromID = String.IsNullOrEmpty(txtFromId.Text) ? 0 : int.Parse(txtFromId.Text);
                int iToID   = String.IsNullOrEmpty(txtToId.Text) ? 0 : int.Parse(txtToId.Text);
                tbData = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_BY_ID(iFromID, iToID).Tables[0];

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    string sXmlContent = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_MARCXML(Int16.Parse(tbData.Rows[i]["META_CONTENT_ID"].ToString()), 1);
                    myRec.load_Xml(sXmlContent);
                    exRecs.Add(myRec);
                }

                break;

            case "2":
                //create each system table one MarcRecord
                //leader 06 = s mean system table data record
                //001 value is TABLE NAME

                //LEGOWEB_COMMON_PARAMETERS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_COMMON_PARAMETERS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_COMMON_PARAMETERS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.CommonParameters.get_LEGOWEB_COMMON_PARAMETERS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a PARAMETER_NAME	nvarchar(50)	Unchecked
                    //b PARAMETER_TYPE	smallint	Checked
                    //c PARAMETER_VI_VALUE	nvarchar(255)	Checked
                    //d PARAMETER_EN_VALUE	nvarchar(255)	Checked
                    //e PARAMETER_DESCRIPTION	nvarchar(255)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}", row["PARAMETER_NAME"].ToString(), row["PARAMETER_TYPE"].ToString(), row["PARAMETER_VI_VALUE"].ToString(), row["PARAMETER_EN_VALUE"].ToString(), row["PARAMETER_DESCRIPTION"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_SECTIONS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_SECTIONS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_SECTIONS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Sections.get_LEGOWEB_SECTIONS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a SECTION_ID	int	Unchecked
                    //b SECTION_VI_TITLE	nvarchar(250)	Unchecked
                    //c SECTION_EN_TITLE	nvarchar(250)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}", row["SECTION_ID"].ToString(), row["SECTION_VI_TITLE"].ToString(), row["SECTION_EN_TITLE"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_CATEGORIES
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_CATEGORIES";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_CATEGORIES TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Categories.get_LEGOWEB_CATEGORIES().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a CATEGORY_ID	int	Unchecked
                    //b PARENT_CATEGORY_ID	int	Checked
                    //c SECTION_ID	int	Unchecked
                    //d CATEGORY_VI_TITLE	nvarchar(250)	Unchecked
                    //e CATEGORY_EN_TITLE	nvarchar(250)	Checked
                    //f CATEGORY_ALIAS	nvarchar(250)	Checked
                    //g CATEGORY_TEMPLATE_NAME	nvarchar(50)	Checked
                    //h CATEGORY_IMAGE_URL	nvarchar(250)	Checked
                    //i MENU_ID	int	Unchecked
                    //j IS_PUBLIC	bit	Checked
                    //k ADMIN_LEVEL	smallint	Checked
                    //l ADMIN_ROLES	nvarchar(250)	Checked
                    //m SEO_TITLE	nvarchar(100)	Checked
                    //n SEO_DESCRIPTION	nvarchar(255)	Checked
                    //o SEO_KEYWORDS	nvarchar(255)	Checked
                    //p ORDER_NUMBER smallint
                    //q SORT_CONTENT_BY smallint -- since 10-03-2012
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}$k{10}$l{11}$m{12}$n{13}$o{14}$p{15}$q{16}", row["CATEGORY_ID"].ToString(), row["PARENT_CATEGORY_ID"].ToString(), row["SECTION_ID"].ToString(), row["CATEGORY_VI_TITLE"].ToString(), row["CATEGORY_EN_TITLE"].ToString(), row["CATEGORY_ALIAS"].ToString(), row["CATEGORY_TEMPLATE_NAME"].ToString(), row["CATEGORY_IMAGE_URL"].ToString(), row["MENU_ID"].ToString(), row["IS_PUBLIC"].ToString(), row["ADMIN_LEVEL"].ToString(), row["ADMIN_ROLES"].ToString(), row["SEO_TITLE"].ToString(), row["SEO_DESCRIPTION"].ToString(), row["SEO_KEYWORDS"].ToString(), row["ORDER_NUMBER"].ToString(), row["SORT_CONTENT_BY"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_MENU_TYPES
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_MENU_TYPES";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_MENU_TYPES TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.MenuTypes.get_LEGOWEB_MENU_TYPES().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a MENU_TYPE_ID	smallint	Unchecked
                    //b MENU_TYPE_VI_TITLE	nvarchar(50)	Unchecked
                    //c MENU_TYPE_EN_TITLE	nvarchar(50)	Unchecked
                    //d MENU_TYPE_DESCRIPTION	nvarchar(250)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}", row["MENU_TYPE_ID"].ToString(), row["MENU_TYPE_VI_TITLE"].ToString(), row["MENU_TYPE_EN_TITLE"].ToString(), row["MENU_TYPE_DESCRIPTION"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);


                //LEGOWEB_MENUS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_MENUS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_MENUS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Menus.get_LEGOWEB_MENUS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a MENU_ID	int	Unchecked
                    //b PARENT_MENU_ID	int	Unchecked
                    //c MENU_TYPE_ID	int	Unchecked
                    //d MENU_VI_TITLE	nvarchar(50)	Checked
                    //e MENU_EN_TITLE	nvarchar(50)	Checked
                    //f MENU_IMAGE_URL	nvarchar(250)	Checked
                    //g MENU_LINK_URL	nvarchar(50)	Checked
                    //h BROWSER_NAVIGATE	tinyint	Unchecked
                    //i IS_PUBLIC	bit	Unchecked
                    //j ORDER_NUMBER smallint
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(), row["ORDER_NUMBER"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //#region KIPOS TABLES

                //myRec = new CRecord();
                //myRec.set_LeaderValueByPos("s", 6, 6);
                //Cf = new CControlfield();
                //Cf.Tag = "001";
                //Cf.Value = "CAT_DMD_CATEGORY";
                //myRec.Controlfields.Add(Cf);

                //Df = new CDatafield();
                //Df.Tag = "245";
                //Df.SubfieldsText = "$aCAT_DMD_CATEGORY";
                //myRec.Datafields.Add(Df);

                //tbData = LegoWebAdmin.BusLogic.Menus.get_LEGOWEB_MENUS().Tables[0];

                //foreach (DataRow row in tbData.Rows)
                //{
                //    //a MENU_ID	int	Unchecked
                //    //b PARENT_MENU_ID	int	Unchecked
                //    //c MENU_TYPE_ID	int	Unchecked
                //    //d MENU_VI_TITLE	nvarchar(50)	Checked
                //    //e MENU_EN_TITLE	nvarchar(50)	Checked
                //    //f MENU_IMAGE_URL	nvarchar(250)	Checked
                //    //g MENU_LINK_URL	nvarchar(50)	Checked
                //    //h BROWSER_NAVIGATE	tinyint	Unchecked
                //    //i IS_PUBLIC	bit	Unchecked
                //    //j ORDER_NUMBER smallint
                //    Df = new CDatafield();
                //    Df.Tag = "650";
                //    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(), row["ORDER_NUMBER"].ToString());
                //    myRec.Datafields.Add(Df);
                //}

                //exRecs.Add(myRec);
                //#endregion KIPOS TABLES
                break;
            }

            if (exRecs.Count <= 0)
            {
                throw new Exception("No data to export!");
            }
            Response.ContentType = "APPLICATION/OCTET-STREAM";
            //set the filename
            Response.AddHeader("Content-Disposition", "attachment;filename=\"legowebdata.xml\"");
            String outStream = exRecs.OuterXml;
            Response.Write(outStream);
            Response.End();
        }
        catch (Exception ex)
        {
            String errorFomat = @"<dl id='system-message'>
                                            <dd class='error message fade'>
	                                            <ul>
		                                            <li>{0}</li>
	                                            </ul>
                                            </dd>
                                            </dl>";
            litErrorSpaceHolder.Text = String.Format(errorFomat, ex.Message);
        }
    }
    private void contentNavigatorPageBind()
    {
        int    meta_content_id = 0;
        int    category_id     = 0;
        int    menu_id         = 0;
        string lang_code       = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper();

        if (CommonUtility.GetInitialValue("contentid", null) != null)
        {
            meta_content_id = int.Parse(CommonUtility.GetInitialValue("contentid", null).ToString());
        }
        if (CommonUtility.GetInitialValue("catid", null) != null)
        {
            category_id = int.Parse(CommonUtility.GetInitialValue("catid", null).ToString());
        }

        if (CommonUtility.GetInitialValue("mnuid", null) != null)
        {
            menu_id = int.Parse(CommonUtility.GetInitialValue("mnuid", 0).ToString());
        }

        //try to get category_id from menu_id
        if (category_id == 0 && menu_id > 0)
        {
            category_id = LegoWebSite.Buslgic.Categories.get_CATEGORY_ID_BY_MENU_ID(menu_id);
        }
        //try to get category_id from meta_content_id
        if (category_id == 0 && meta_content_id > 0)
        {
            category_id = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_CATEGORY_ID(meta_content_id);
        }

        if (!LegoWebSite.Buslgic.Categories.is_CATEGORY_EXIST(category_id))
        {
            this.litCatNaviContent.Text = "<H3>Category does not exist!</H3>";
            return;
        }

        this.litCatNaviContent.Text = LegoWebSite.Buslgic.Categories.get_NavigatePath(category_id, Request.Url.AbsoluteUri);


        _contentNavigatorData.PageNumber     = Convert.ToInt16(ViewState["contentNavigatorPageNumber"]);
        _contentNavigatorData.RecordsPerPage = (int)ViewState["contentNavigatorPageSize"];
        _contentNavigatorData.PageCount      = (int)ViewState["contentNavigatorPageCount"];

        DataTable Data = _contentNavigatorData.get_Current_Page(category_id, lang_code);
        // Create DataColumn objects of data types.
        DataColumn colString = new DataColumn("CONTENT_HTML");

        colString.DataType = System.Type.GetType("System.String");
        Data.Columns.Add(colString);

        string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);

        for (int i = 0; i < Data.Rows.Count; i++)
        {
            string  sContentXml = "";
            CRecord myRec       = new CRecord();
            int     icontentid  = int.Parse(Data.Rows[i]["META_CONTENT_ID"].ToString());
            string  postURL     = "ContentBrowser.aspx";

            sContentXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(icontentid, 0);    //no NTEXTS CONTENT_XML
            myRec.load_Xml(sContentXml);

            if (!String.IsNullOrEmpty(_default_post_page))
            {
                postURL = _default_post_page;
            }
            else
            {
                int iCatId = int.Parse(myRec.Controlfields.Controlfield("002").Value.ToString());
                //try to findout related menuid to get postURL
                int iMnuId       = 0;
                int iParentCatId = -1;
                while (iMnuId == 0 && iParentCatId != 0)
                {
                    DataTable CatTable = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(iCatId).Tables[0];
                    iParentCatId = int.Parse(CatTable.Rows[0]["PARENT_CATEGORY_ID"].ToString());
                    iCatId       = iParentCatId;
                    iMnuId       = int.Parse(CatTable.Rows[0]["MENU_ID"].ToString());
                }
                if (iMnuId > 0)
                {
                    DataTable MenuTable = LegoWebSite.Buslgic.Menus.get_MENUS_BY_MENU_ID(iMnuId).Tables[0];
                    if (MenuTable.Rows.Count > 0)
                    {
                        postURL = MenuTable.Rows[0]["MENU_LINK_URL"].ToString();
                    }
                }
            }
            UrlQuery postQuery = new UrlQuery(postURL);
            postQuery.Set("contentid", icontentid.ToString());
            myRec.Controlfields.Controlfield("001").Value = postQuery.AbsoluteUri;
            Data.Rows[i]["CONTENT_HTML"] = myRec.XsltFile_Transform(sTemplateFileName);
        }
        contentNavigatorRepeater.DataSource = Data;
        contentNavigatorRepeater.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (_category_id == 0)
            {
                this.litTabControlTitle.Text = "Category id prarameter is not set!";
                return;
            }

            DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];

            string TitleRoot = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
            if (catData.Rows.Count > 0)
            {
                this.litTabControlTitle.Text = "<a href ='ContentNavigator.aspx?catid=" + int.Parse(catData.Rows[0]["CATEGORY_ID"].ToString()) + "'>" + TitleRoot + "</a>";
            }

            UrlQuery myPost = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                myPost = new UrlQuery(_default_post_page);
            }
            String sTabContents = "";

            DataTable tblTabCate = LegoWebSite.Buslgic.Categories.get_CATEGORY_CHILREN(_category_id).Tables[0];

            string stabs = "";
            stabs += "<div class='container'><ul>";
            for (int i = 0; i < tblTabCate.Rows.Count; i++)
            {
                stabs += "<li>";
                stabs += "<a  href='#" + tblTabCate.Rows[i]["CATEGORY_ID"].ToString() + "'><span>" + tblTabCate.Rows[i]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString() + "</span></a>";
                stabs += "</li>";

                sTabContents += "<div id='" + tblTabCate.Rows[i]["CATEGORY_ID"].ToString() + "'>";

                //get content by tab menu
                DataTable tabDataContent = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(int.Parse(tblTabCate.Rows[i]["CATEGORY_ID"].ToString()), _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());
                CRecord   myRec          = new CRecord();
                if (tabDataContent.Rows.Count == 1)
                {
                    myRec = new CRecord();
                    string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_left_template_name);
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)tabDataContent.Rows[0]["META_CONTENT_ID"], 0));
                    myPost.Set("contentid", tabDataContent.Rows[0]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    sTabContents += "<div style='float:left;width:100%;'>" + myRec.XsltFile_Transform(sTemplateFileName) + "</div>";
                }
                else if (tabDataContent.Rows.Count > 1)
                {
                    myRec = new CRecord();

                    string sTempLeftFileName  = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_left_template_name);
                    string sTempRightFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_right_template_name);

                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)tabDataContent.Rows[0]["META_CONTENT_ID"], 0));
                    myPost.Set("contentid", tabDataContent.Rows[0]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    sTabContents += "<div style='float:left;width:50%;'>" + myRec.XsltFile_Transform(sTempLeftFileName) + "</div>";

                    sTabContents += "<div style='float:right;width:47%;'>";
                    CRecords outRecs = new CRecords();
                    for (int j = 1; j < tabDataContent.Rows.Count; j++)
                    {
                        myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)tabDataContent.Rows[j]["META_CONTENT_ID"], 0));
                        myPost.Set("contentid", tabDataContent.Rows[j]["META_CONTENT_ID"].ToString());
                        myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                        outRecs.Add(myRec);
                    }
                    sTabContents += outRecs.XsltFile_Transform(sTempRightFileName);
                    sTabContents += "</div>";
                }
                sTabContents += "</div>";
            }
            stabs            += "</ul>";
            stabs            += sTabContents;
            stabs            += "</div>";
            this.litTabs.Text = stabs;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];
            if (catData.Rows.Count > 0)
            {
                this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
            }
            else
            {
                this.litContent.Text = "<H3>category_id is not vailable!</H3>";
                return;
            }

            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            string   slidescroll = @"<script language='javascript' type='text/javascript'>
            $(function() {
                $('.webwidget_scroller_amazon').webwidget_scroller_amazon({
                    scroller_title_show: 'enable',//enable  disable
                    scroller_time_interval: '4000',
                    scroller_window_background_color: 'none',
                    scroller_window_padding: '5',
                    scroller_border_size: '0',
                    scroller_border_color: '#CCC',
                    scroller_images_width: '" + _image_width.ToString() + @"',
                    scroller_images_height: '" + _image_height.ToString() + @"',
                    scroller_title_size: '12',
                    scroller_title_color: 'black',
                    scroller_show_count: '" + _page_size.ToString() + @"',
                    directory: 'images'
                });
            });
            </script>";
            UrlQuery myPost      = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                myPost = new UrlQuery(_default_post_page);
            }
            string    sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
            CRecords  outRecs           = new CRecords();
            CRecord   myRec             = new CRecord();
            DataTable cntData           = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());
            for (int i = 0; i < cntData.Rows.Count; i++)
            {
                myRec = new CRecord();
                myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0));
                myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                outRecs.Add(myRec);
            }
            this.litContent.Text += "<div id='webwidget_scroller_amazon' class='webwidget_scroller_amazon'><div class='webwidget_scroller_simple2_mask'> <ul>";
            this.litContent.Text += outRecs.XsltFile_Transform(sTemplateFileName);
            this.litContent.Text += "</ul></div><ul class='webwidget_scroller_simple2_nav'><li></li> <li></li></ul><div style='clear: both'></div></div>";
            Page.RegisterStartupScript("slidesroll", slidescroll);
        }
    }
Example #10
0
    protected void linkImportContentButton_Click(object sender, EventArgs e)
    {
        litErrorSpaceHolder.Text = "";
        //try
        //{
        divDefaultCategory.Visible = false;
        DataTable contentTable = create_ContentTable();

        if (String.IsNullOrEmpty(txtFileName.Text))
        {
            throw new Exception("You must select a source file!");
        }
        //chuyển đổi địa chỉ URL sang Physycal
        string sFileURL  = txtFileName.Text;
        string sFileName = sFileURL.Replace(System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesVirtuaPath"], System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"]);

        sFileName = sFileName.Replace("/", "\\");
        if (!System.IO.File.Exists(sFileName))
        {
            throw new Exception("Source file does not exists!");
        }
        else
        {
            divDefaultCategory.Visible = true;
        }

        CRecords myRecs = new CRecords();

        myRecs.load_File(sFileName);
        int iSkipCount = 0;

        for (int i = 0; i < myRecs.Count; i++)
        {
            CRecord myRec = new CRecord();
            myRec.load_Xml(myRecs.Record(i).OuterXml);

            if (myRec.get_LeaderValueByPos(6, 6) == "s")//system tables data
            {
                import_SystemTableData(myRec);
            }
            else
            {
                Int32 iID    = String.IsNullOrEmpty(myRecs.Record(i).Controlfields.Controlfield("001").Value) ? 0 : Int32.Parse(myRecs.Record(i).Controlfields.Controlfield("001").Value);
                Int32 iCatID = String.IsNullOrEmpty(myRecs.Record(i).Controlfields.Controlfield("002").Value) ? 0 : Int32.Parse(myRecs.Record(i).Controlfields.Controlfield("002").Value);
                switch (radioImportTypes.SelectedValue)
                {
                case "0":    //append
                    myRec.Controlfields.Controlfield("001").Value = "0";
                    switch (radioForceToDefaultCategory.SelectedValue)
                    {
                    case "0":        //auto detech category id
                        if (!LegoWebAdmin.BusLogic.Categories.is_CATEGORY_ID_EXIST(iCatID))
                        {
                            myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        }
                        break;

                    case "1":         //force to default category
                        myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        break;
                    }
                    LegoWebAdmin.BusLogic.MetaContents.save_META_CONTENTS_XML(myRec.OuterXml, this.Page.User.Identity.Name);
                    break;

                case "1":    //skip if ID exsist
                    if (!LegoWebAdmin.BusLogic.MetaContents.is_META_CONTENTS_EXIST(iID))
                    {
                        switch (radioForceToDefaultCategory.SelectedValue)
                        {
                        case "0":        //auto detech category id
                            if (!LegoWebAdmin.BusLogic.Categories.is_CATEGORY_ID_EXIST(iCatID))
                            {
                                myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                            }
                            break;

                        case "1":         //force to default category
                            myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                            break;
                        }
                        LegoWebAdmin.BusLogic.MetaContents.save_META_CONTENTS_XML(myRec.OuterXml, this.Page.User.Identity.Name);
                    }
                    else
                    {
                        iSkipCount++;
                    }
                    break;

                case "2":
                    switch (radioForceToDefaultCategory.SelectedValue)
                    {
                    case "0":        //auto detech category id
                        if (!LegoWebAdmin.BusLogic.Categories.is_CATEGORY_ID_EXIST(iCatID))
                        {
                            myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        }
                        break;

                    case "1":         //force to default category
                        myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        break;
                    }
                    LegoWebAdmin.BusLogic.MetaContents.save_META_CONTENTS_XML(myRec.OuterXml, this.Page.User.Identity.Name);
                    break;
                }
            }
        }

        litErrorSpaceHolder.Text = String.Format("Imports successfully {0} records, skips {1}!.", myRecs.Count.ToString(), iSkipCount.ToString());
//        }
//        catch (Exception ex)
//        {
//            String errorFomat = @"<dl id='system-message'>
//                                            <dd class='error message fade'>
//	                                            <ul>
//		                                            <li>{0}</li>
//	                                            </ul>
//                                            </dd>
//                                            </dl>";
//            litErrorSpaceHolder.Text = String.Format(errorFomat, ex.Message);

//        }
    }
Example #11
0
        public static DataTable get_PollData(int iPollContentId, out string sQuestion, out int iTotalVoteCount)
        {
            iTotalVoteCount = 0;
            sQuestion       = null;
            DataTable  pollData = new DataTable();
            DataColumn IDcol    = new DataColumn("ID");

            IDcol.DataType = System.Type.GetType("System.Int32");
            pollData.Columns.Add(IDcol);

            DataColumn voteCountCol = new DataColumn("VoteCount");

            voteCountCol.DataType = System.Type.GetType("System.Int32");
            pollData.Columns.Add(voteCountCol);

            DataColumn ChoiceCol = new DataColumn("Choice");

            ChoiceCol.DataType = System.Type.GetType("System.String");
            pollData.Columns.Add(ChoiceCol);

            DataColumn orderCol = new DataColumn("OrderNumber");

            orderCol.DataType = System.Type.GetType("System.Int32");
            pollData.Columns.Add(orderCol);

            CRecord    pollRecord = new CRecord();
            CDatafield Df         = new CDatafield();
            CSubfield  Sf         = new CSubfield();

            pollRecord.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(iPollContentId, 0));

            pollRecord.Sort();
            //get Question First
            sQuestion = pollRecord.Datafields.Datafield("245").Subfields.Subfield("a").Value;

            CDatafields ChoiceDfs = pollRecord.Datafields;

            ChoiceDfs.Filter("650");

            for (int i = 0; i < ChoiceDfs.Count; i++)
            {
                string sChoice      = "";
                int    iID          = 0;
                int    iVoteCount   = 0;
                int    iOrderNumber = 0;
                Df = ChoiceDfs.Datafield(i);

                if (Df.Subfields.get_Subfield("0", ref Sf))
                {
                    iOrderNumber = String.IsNullOrEmpty(Sf.Value)?0:int.Parse(Sf.Value);
                }

                if (Df.Subfields.get_Subfield("a", ref Sf))
                {
                    sChoice = Sf.Value;
                    iID     = int.Parse(Sf.ID);
                }
                else
                {
                    sChoice = "No choice info";
                }

                if (Df.Subfields.get_Subfield("n", ref Sf))
                {
                    iTotalVoteCount += int.Parse(Sf.Value);
                    iVoteCount       = int.Parse(Sf.Value);
                }

                DataRow row = pollData.NewRow();
                row["ID"]          = iID;
                row["Choice"]      = sChoice;
                row["VoteCount"]   = iVoteCount;
                row["OrderNumber"] = iOrderNumber;
                pollData.Rows.Add(row);
            }
            pollData.DefaultView.Sort = " OrderNumber ASC";
            return(pollData);
        }
    private void contentSearchPageBind()
    {
        string sSearchField = null;
        string sSearchValue = null;


        if (CommonUtility.GetInitialValue("s_searchfield", null) != null)
        {
            sSearchField = CommonUtility.GetInitialValue("s_searchfield", null).ToString();
        }
        if (CommonUtility.GetInitialValue("s_searchvalue", null) != null)
        {
            sSearchValue = CommonUtility.GetInitialValue("s_searchvalue", null).ToString();
        }

        _contentSearchData.PageNumber     = Convert.ToInt16(ViewState["contentSearchPageNumber"]);
        _contentSearchData.RecordsPerPage = (int)ViewState["contentSearchPageSize"];
        _contentSearchData.PageCount      = (int)ViewState["contentSearchPageCount"];
        DataTable Data = _contentSearchData.get_User_Search_Current_Page(_section_id, sSearchField, sSearchValue);

        // Create DataColumn objects of data types.

        DataColumn colString = new DataColumn("CONTENT_HTML");

        colString.DataType = System.Type.GetType("System.String");
        Data.Columns.Add(colString);
        string  sContentXml   = "";
        CRecord contentRec    = new CRecord();
        Int16   iContentId    = 0;
        string  sTemplateName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);

        for (int i = 0; i < Data.Rows.Count; i++)
        {
            iContentId  = Int16.Parse(Data.Rows[i]["META_CONTENT_ID"].ToString());
            sContentXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(iContentId, 1);//no NTEXTS CONTENT_XML
            contentRec.load_Xml(sContentXml);

            UrlQuery postURL = new UrlQuery(_default_post_page);

            int iCatId = int.Parse(contentRec.Controlfields.Controlfield("002").Value.ToString());

            //try to findout related menuid to get postURL
            int iMnuId       = 0;
            int iParentCatId = -1;
            while (iMnuId == 0 && iParentCatId != 0)
            {
                DataTable CatTable = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(iCatId).Tables[0];
                iParentCatId = int.Parse(CatTable.Rows[0]["PARENT_CATEGORY_ID"].ToString());
                iCatId       = iParentCatId;
                iMnuId       = int.Parse(CatTable.Rows[0]["MENU_ID"].ToString());
            }
            if (iMnuId > 0)
            {
                DataTable MenuTable = LegoWebSite.Buslgic.Menus.get_MENUS_BY_MENU_ID(iMnuId).Tables[0];
                if (MenuTable.Rows.Count > 0)
                {
                    postURL = new UrlQuery(MenuTable.Rows[0]["MENU_LINK_URL"].ToString());
                }
                postURL.Set("contentid", iContentId.ToString());
                Data.Rows[i]["CONTENT_HTML"] = contentRec.XsltFile_Transform(sTemplateName).Replace("{POST_URL}", postURL.AbsoluteUri);
            }
            else
            {
                postURL.Set("contentid", iContentId.ToString());
                Data.Rows[i]["CONTENT_HTML"] = contentRec.XsltFile_Transform(sTemplateName).Replace("{POST_URL}", postURL.AbsoluteUri);
            }
        }
        contentSearchRepeater.DataSource = Data;
        contentSearchRepeater.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    if (_section_id > 0)
                    {
                        DataTable secData = LegoWebSite.Buslgic.Sections.get_SECTION_BY_ID(_section_id).Tables[0];
                        if (secData.Rows.Count > 0)
                        {
                            this.Title = secData.Rows[0]["SECTION_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
                        }
                    }
                    else
                    {
                        DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];
                        if (catData.Rows.Count > 0)
                        {
                            this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
                        }
                    }
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            DataTable cntData = null;

            if (_section_id > 0)
            {
                cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_NEWS_BY_SECTION(_section_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower(), _important_level);
            }
            else
            {
                cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_NEWS_BY_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower(), _important_level);
            }

            if (cntData.Rows.Count > 0)
            {
                string   sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
                CRecords outRecs           = new CRecords();
                UrlQuery myPost            = new UrlQuery();
                string   postURL           = String.IsNullOrEmpty(_default_post_page) ? Request.Url.AbsolutePath : _default_post_page;
                CRecord  myRec             = new CRecord();
                for (int i = 0; i < cntData.Rows.Count; i++)
                {
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0));
                    int iCatId = (int)cntData.Rows[i]["CATEGORY_ID"];

                    //try to findout related menuid to get postURL
                    int iMnuId       = 0;
                    int iParentCatId = -1;
                    while (iMnuId == 0 && iParentCatId != 0)
                    {
                        DataTable CatTable = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(iCatId).Tables[0];
                        iParentCatId = int.Parse(CatTable.Rows[0]["PARENT_CATEGORY_ID"].ToString());
                        iCatId       = iParentCatId;
                        iMnuId       = int.Parse(CatTable.Rows[0]["MENU_ID"].ToString());
                    }
                    if (iMnuId > 0)
                    {
                        DataTable MenuTable = LegoWebSite.Buslgic.Menus.get_MENUS_BY_MENU_ID(iMnuId).Tables[0];
                        if (MenuTable.Rows.Count > 0)
                        {
                            postURL = MenuTable.Rows[0]["MENU_LINK_URL"].ToString();
                        }
                    }
                    myPost = new UrlQuery(postURL);
                    myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    outRecs.Add(myRec);
                }
                this.litContent.Text = outRecs.XsltFile_Transform(sTemplateFileName);
            }
            else
            {
                this.litContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
            }
        }
    }