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); } }
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); }