Inheritance: MonoBehaviour
 public static void setMessage(PlaceHolder placeholder, string message, string level)
 {
     placeholder.Controls.Add(new LiteralControl(
                 "<div class='alert alert-"+level+" col-sm-10 col-sm-offset-1'>"
                     + message
                     + "</div>"));
 }
    /// <summary>
    /// 初始化页面
    /// </summary>
    /// <param name="thepage">当前页面对象</param>
    /// <param name="index">页面菜单索引</param>
    /// <param name="title">页面标题</param>
    /// <param name="plhdTitle">标题控件</param>
    /// <param name="plhdHeader">头部控件</param>
    /// <param name="plhdSlide">侧栏控件</param>
    /// <param name="plhdFooter">底部控件</param>
    public static void initPage(Page thepage, int index, string title, PlaceHolder plhdTitle, PlaceHolder plhdHeader, PlaceHolder plhdSlide, PlaceHolder plhdFooter)
    {
        string titleID = "u_title";
        string headerID = "u_header";
        string sliderID = "u_slider";
        string footerID = "u_footer";

        //get menu name
        string menuName = "menu" + index;
        string subMenuName = "subMenu" + index;

        //get title
        Control ctitle = thepage.LoadControl("pageControl/title.ascx");
        ctitle.ID = titleID;
        (ctitle.FindControl("ltrTitle") as Literal).Text = title;
        plhdTitle.Controls.Add(ctitle);

        //get header
        Control cheader = thepage.LoadControl("pageControl/header.ascx");
        cheader.ID = headerID;
        (cheader.FindControl(menuName) as Literal).Text = " class=\"current\"";//高亮父菜单
        cheader.FindControl(subMenuName).Visible = true;//高亮子菜单
        plhdHeader.Controls.Add(cheader);

        //get slider
        Control cslider = thepage.LoadControl("pageControl/slidePanel.ascx");
        cslider.ID = sliderID;
        plhdSlide.Controls.Add(cslider);

        //get footer
        Control cfooter = thepage.LoadControl("pageControl/footer.ascx");
        cfooter.ID = footerID;
        plhdFooter.Controls.Add(cfooter);
    }
    public void grdEmpl_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        String loginid = "";
        DataSet dsExpand = new DataSet();
        WhitfieldPayroll _dbClass = new WhitfieldPayroll();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    loginid = Convert.ToString(grdEmpl.DataKeys[e.Item.ItemIndex]);
                    dsExpand = _dbClass.GetPayRollProjectHoursForEmployee(loginid, txtFromDate.Text.Trim(), txtToDate.Text.Trim());
                    PlaceHolder exp = new PlaceHolder();
                    exp = (System.Web.UI.WebControls.PlaceHolder)e.Item.Cells[7].FindControl("ExpandedContent");
                    ImageButton img = new ImageButton();
                    img = (System.Web.UI.WebControls.ImageButton)e.Item.Cells[0].FindControl("btnExpand");
                    if (dsExpand.Tables[0].Rows.Count > 0)
                    {
                        if (img.ImageUrl == "assets/img/Plus.gif")
                        {
                            img.ImageUrl = "assets/img/Minus.gif";
                            exp.Visible = true;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).DisplayGrid(loginid, txtFromDate.Text.Trim(), txtToDate.Text.Trim());

                        }
                        else
                        {
                            exp.Visible = false;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                            img.ImageUrl = "assets/img/Plus.gif";
                        }
                    }
                    else
                    {
                        if (img.ImageUrl == "assets/img/Plus.gif")
                        {
                            //((ViewDesignAdmin)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            img.ImageUrl = "assets/img/Minus.gif";
                            exp.Visible = true;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).DisplayGrid(loginid, txtFromDate.Text.Trim(), txtToDate.Text.Trim());
                        }
                        else
                        {
                            exp.Visible = false;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                            img.ImageUrl = "assets/img/Plus.gif";
                        }

                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
        public string Render(PlaceHolder placeHolder, PageEntry pageEntry, System.Xml.XmlDocument content, Stack<string> placeHolderStack, out bool containsCacheableContent)
        {
            string output;
            switch (placeHolder.Expression.ToLower())
            {
                case "subscribe":
                    output = ResourceLoader.LoadTextResource("Sprocket.Web.CMS.Pages.Widgets.Newsletter.newsletter-subscribe.htm")
                        .Replace("[blurb]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/SubscribeBlurb").FirstChild.Value)
                        .Replace("[label]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/EmailFieldLabel").FirstChild.Value)
                        .Replace("[button]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/SubscribeButtonText").FirstChild.Value)
                        .Replace("[pleasewait]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/SubscribingBlurb").FirstChild.Value)
                        .Replace("[subscribed]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/SubscribedBlurb").FirstChild.Value)
                        ;
                    break;

                case "unsubscribe":
                    output = ResourceLoader.LoadTextResource("Sprocket.Web.CMS.Pages.Widgets.Newsletter.newsletter-unsubscribe.htm")
                        .Replace("[blurb]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/UnsubscribeBlurb").FirstChild.Value)
                        .Replace("[label]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/EmailFieldLabel").FirstChild.Value)
                        .Replace("[button]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/UnsubscribeButtonText").FirstChild.Value)
                        .Replace("[pleasewait]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/UnsubscribingBlurb").FirstChild.Value)
                        .Replace("[unsubscribed]", GeneralRegistry.XmlDoc.SelectSingleNode("/General/Newsletter/UnsubscribedBlurb").FirstChild.Value)
                        ;
                    break;

                default:
                    containsCacheableContent = false;
                    return "[Newsletter renderer expects expression of \"Subscribe\" or \"Unsubscribe\"]";
            }

            containsCacheableContent = true;
            return output;
        }
Exemple #5
0
 public void AddControls(
     string strXML,
     PlaceHolder plaPlaceHolder,
     Page pagMain)
 {
     AddControls(strXML, plaPlaceHolder, pagMain, true);
 }
	private void LoadSelectedControl(string entityId, Dictionary<string, string> selectorList)
	{
		Dictionary<string, PlaceHolder> placeholderList = new Dictionary<string, PlaceHolder>();
		foreach (KeyValuePair<string, string> kvp1 in selectorList)
		{
			PlaceHolder p = new PlaceHolder();
			Settings.Controls.Add(p);
			placeholderList.Add(kvp1.Key, p);
		}
				
		//List<string> paths = new List<string>();

		BXCommand command = new BXCommand("Bitrix.Main.OnGlobalOptionsEdit");
		//command.FilterListeners = new string[] { entityId };
		command.Parameters.Add("EntityId", entityId);
		command.Send();

		BXCommandResult r;
		if (command.CommandResultDictionary.TryGetValue(entityId, out r) && r.CommandResult == BXCommandResultType.Ok)
		{
			string path = r.Result.ToString();
			if (File.Exists(BXPath.MapPath(path)))
			{
				Control ctrl = LoadControl(path);
				placeholderList[entityId].Controls.Add(ctrl);
			}
		}
	}
        public void InstantiateIn(Control container)
        {

            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);
            templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);
        }
 public long GetID( ObjectIDGenerator IDGen )
 {
     PlaceHolder p = new PlaceHolder();
     p.holder = 0;
     bool temp;
     lock (p) {
     return IDGen.GetId(p, out temp); }
 }
Exemple #9
0
 protected void OnAuctionTypeReached(
     PlaceHolder plaPlaceHolder)
 {
     if (AuctionTypeReached != null)
     {
         AuctionTypeReached(plaPlaceHolder);
     }
 }
Exemple #10
0
 public override void display(PlaceHolder p)
 {
     p.Controls.Add(base.l);
     p.Controls.Add(new LiteralControl("<br />"));
     p.Controls.Add(rbl);
     p.Controls.Add(base.fl); p.Controls.Add(base.fh);
     p.Controls.Add(new LiteralControl("<br />"));
     p.Controls.Add(new LiteralControl("<br />"));
 }
    void conConverter_AuctionTypeReached(PlaceHolder plaPlaceHolder)
    {
        Controls_AuctionBidSummary absSummary = 
			  (Controls_AuctionBidSummary)LoadControl("AuctionBidSummary.ascx");

		  absSummary.PlaceBidClick += absSummary_PlaceBidClick;
		  plaPlaceHolder.Controls.Add(absSummary);
        Controls_AuctionBidSummary.PopulateBidSummary(absSummary, m_dasAuction);
    }
        public void InstantiateIn(Control container)
        {

            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);

            Literal divContainer = new Literal();
            divContainer.Text = "<div id=\"gridContainer\">";

            Obout.Grid.Grid grid1 = new Obout.Grid.Grid();
            grid1.ID = "Grid1";
            grid1.DataSourceID = "SqlDataSource1";
            grid1.AutoGenerateColumns = false;
            grid1.AllowPaging = false;
            grid1.AllowPageSizeSelection = false;
            grid1.AllowSorting = false;
            grid1.PageSize = -1;
            grid1.AllowMultiRecordSelection = false;
            grid1.AllowAddingRecords = false;
            grid1.ClientSideEvents.ExposeSender = true;
            grid1.ClientSideEvents.OnClientSelect = "Grid1_Select";

            Obout.Grid.Column oCol1 = new Obout.Grid.Column();
            oCol1.DataField = "CustomerID";
            oCol1.Visible = false;
            oCol1.HeaderText = "CUSTOMER";

            Obout.Grid.Column oCol2 = new Obout.Grid.Column();
            oCol2.DataField = "CompanyName";
            oCol2.HeaderText = "NAME";

            Obout.Grid.Column oCol3 = new Obout.Grid.Column();
            oCol3.DataField = "City";
            oCol3.HeaderText = "CITY";

            Obout.Grid.Column oCol4 = new Obout.Grid.Column();
            oCol4.DataField = "Country";
            oCol4.HeaderText = "COUNTRY";

            grid1.Columns.Add(oCol1);
            grid1.Columns.Add(oCol2);
            grid1.Columns.Add(oCol3);
            grid1.Columns.Add(oCol4);

            grid1.ScrollingSettings.ScrollHeight = 175;
            grid1.PagingSettings.ShowRecordsCount = false;

            Literal divContainer2 = new Literal();
            divContainer2.Text = "</div>";

            templatePlaceHolder.Controls.Add(divContainer);
            templatePlaceHolder.Controls.Add(grid1);
            templatePlaceHolder.Controls.Add(divContainer2);
        }
Exemple #13
0
	public void InstantiateIn(System.Web.UI.Control container)
	{
		PlaceHolder ph = new PlaceHolder();
		Label label1 = new Label();
		label1.ID = "Label1";
		label1.Text = "A full page postback occurred.";
		Button button1 = new Button();
		button1.ID = "Button1";
		button1.Text = "Refresh Panel";
		button1.Click += new EventHandler(button1_Click);
		ph.Controls.Add(label1);
		ph.Controls.Add(new LiteralControl("<br/>"));
		ph.Controls.Add(button1);
		container.Controls.Add(ph);
	}
Exemple #14
0
        // �R���X�g���N�^
        public TemplateRegexParser(EcmProject proj, EcmLog log, string templateName)
        {
            myProject = proj;
            myLog = log;
            myTemplateName = templateName;

            myPlaceHolderSets["{num}"] = new PlaceHolder("num", "-?[0-9]*", "-100");
            myPlaceHolderSets["{num+}"] = new PlaceHolder("num", "-?[0-9]+", "-100");
            myPlaceHolderSets["{uri}"] = new PlaceHolder("uri", "[-._~;?:@&=*+&,/#\\[\\]()a-zA-Z0-9]*", "#");
            myPlaceHolderSets["{uri+}"] = new PlaceHolder("uri", "[-._~;?:@&=*+&,/#\\[\\]()a-zA-Z0-9]*", "#");
            myPlaceHolderSets["{text}"] = new PlaceHolder("text", "[^\\n<]*", "�e�L�X�g�e�L�X�g�e�L�X�g");
            myPlaceHolderSets["{text+}"] = new PlaceHolder("text", "[^\\n<]+", "�e�L�X�g�e�L�X�g�e�L�X�g");
            myPlaceHolderSets["{any}"] = new PlaceHolder("any", ".*", "??????????");
            myPlaceHolderSets["{any+}"] = new PlaceHolder("any", ".+", "??????????");
        }
    public void CreateEditCountryTemplate(Object sender, Obout.Grid.GridRuntimeTemplateEventArgs e)
    {
        PlaceHolder oPlaceHolder = new PlaceHolder();
        e.Container.Controls.Add(oPlaceHolder);
       
        Obout.ComboBox.ComboBox ComboBox1 = new Obout.ComboBox.ComboBox();
        ComboBox1.ID = "ComboBox1";
        ComboBox1.Height = 100;
        ComboBox1.Width = Unit.Percentage(100);
        ComboBox1.DataSourceID = "SqlDataSource2";
        ComboBox1.DataTextField = "CountryName";
        ComboBox1.AppendDataBoundItems = false;
        ComboBox1.DataValueField = "CountryName";

        oPlaceHolder.Controls.Add(ComboBox1);
    }
        public void InstantiateIn(Control container)
        {
            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);

            Literal id = new Literal();
            id.Text = "<div class=\"header c1\">ID</div>";
            Literal companyname = new Literal();
            companyname.Text = "<div class=\"header c2\">COMPANY NAME</div>";
            Literal city = new Literal();
            city.Text = "<div class=\"header c3\">CITY</div>";

            templatePlaceHolder.Controls.Add(id);
            templatePlaceHolder.Controls.Add(companyname);
            templatePlaceHolder.Controls.Add(city);
        }
         public void InstantiateIn(Control container)
         {
             PlaceHolder templatePlaceHolder = new PlaceHolder();
             container.Controls.Add(templatePlaceHolder);

             Obout.ListBox.ListBox listBox1 = new Obout.ListBox.ListBox();
             templatePlaceHolder.Controls.Add(listBox1);

             listBox1.ID = "ShipCountry";
             listBox1.DataSourceID = "SqlDataSource2";
             listBox1.Width = Unit.Percentage(100);
             listBox1.Height = Unit.Pixel(150);
             listBox1.DataValueField = "ShipCountry";
             listBox1.DataTextField = "ShipCountry";

             templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);
         }
    public void CreateCountryTemplate(Object sender, Obout.Grid.GridRuntimeTemplateEventArgs e)
    {
        PlaceHolder ph1 = new PlaceHolder();
        e.Container.Controls.Add(ph1);

        ComboBox comboBox = new ComboBox();
        comboBox.ID = "ComboBox1";
        comboBox.Width = Unit.Percentage(100);
        comboBox.Height = Unit.Pixel(200);
        comboBox.DataTextField = "CountryName";
        comboBox.DataValueField = "CountryName";
        comboBox.EmptyText = "Select a country ...";
        comboBox.EnableLoadOnDemand = true;
        comboBox.LoadingItems += ComboBox1_LoadingItems;

        ph1.Controls.Add(comboBox);
    }
        public void InstantiateIn(Control container)
        {

            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);
            templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);

            Literal cont11 = new Literal();
            cont11.Text = "<div class=\"item c1\">";

            Literal Container1 = new Literal();
            Container1.ID = "Container1";

            Literal cont12 = new Literal();
            cont12.Text = "</div>";

            Literal cont21 = new Literal();
            cont21.Text = "<div class=\"item c2\">";

            Literal Container2 = new Literal();
            Container2.ID = "Container2";

            Literal cont22 = new Literal();
            cont22.Text = "</div>";

            Literal cont31 = new Literal();
            cont31.Text = "<div class=\"item c3\">";

            Literal Container3 = new Literal();
            Container3.ID = "Container3";

            Literal cont32 = new Literal();
            cont32.Text = "</div>";

            templatePlaceHolder.Controls.Add(cont11);
            templatePlaceHolder.Controls.Add(Container1);
            templatePlaceHolder.Controls.Add(cont12);
            templatePlaceHolder.Controls.Add(cont21);
            templatePlaceHolder.Controls.Add(Container2);
            templatePlaceHolder.Controls.Add(cont22);
            templatePlaceHolder.Controls.Add(cont31);
            templatePlaceHolder.Controls.Add(Container3);
            templatePlaceHolder.Controls.Add(cont32);

        }
        public void InstantiateIn(Control container)
        {
            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);
            templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);

            Literal divContainer = new Literal();
            divContainer.Text = "<div class=\"item\">";

            CheckBox CheckBox1 = new CheckBox();
            CheckBox1.ID = "CheckBox1";

            Literal innerContainer = new Literal();

            templatePlaceHolder.Controls.Add(divContainer);
            templatePlaceHolder.Controls.Add(CheckBox1);
            templatePlaceHolder.Controls.Add(innerContainer);
        }
        public void InstantiateIn(Control container)
        {
            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);

            Obout.Ajax.UI.HTMLEditor.Editor editor1 = new Obout.Ajax.UI.HTMLEditor.Editor();

            templatePlaceHolder.Controls.Add(editor1);

                 
            editor1.ID = "Editor1";
            editor1.TopToolbar.Appearance = Obout.Ajax.UI.HTMLEditor.EditorTopToolbar.AppearanceType.Lite;
            editor1.EditPanel.ContextMenu.Style[HtmlTextWriterStyle.ZIndex] = "3000";
            editor1.Width = 550;
            editor1.Height = 300;
   
            templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);
        }
    public void grdEstimateMaterials_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        Int32 qual_id = 0;

        contingency mm = new contingency();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    qual_id = Convert.ToInt32(grdEstimateMaterials.DataKeys[Convert.ToInt32(e.Item.ItemIndex)]);
                    qual_id = Convert.ToInt32(grdEstimateMaterials.DataKeys[e.Item.ItemIndex]);
                    DataSet dsExpand = mm.FetchSubQualData(qual_id);
                    PlaceHolder exp = new PlaceHolder();
                    exp = (System.Web.UI.WebControls.PlaceHolder)e.Item.Cells[6].FindControl("ExpandedContent");
                    ImageButton img = new ImageButton();
                    img = (System.Web.UI.WebControls.ImageButton)e.Item.Cells[0].FindControl("btnExpand");
                    // if (dsExpand.HasRows())
                    // {
                    if (img.ImageUrl == "assets/img/Plus.gif")
                    {
                        img.ImageUrl = "assets/img/Minus.gif";
                        exp.Visible = true;
                        ((master_quals1)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                        ((master_quals1)(e.Item.FindControl("DynamicTable1"))).qual_id = qual_id;
                        ((master_quals1)(e.Item.FindControl("DynamicTable1"))).LoadDetails(dsExpand);

                    }
                    else
                    {
                        exp.Visible = false;
                        ((master_quals1)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                        img.ImageUrl = "assets/img/Plus.gif";
                    }
                    //}
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
      /// <summary>
      /// Create a record to a placeHolder by name and apply a record
      /// </summary>
		/// <param name="placeHolders">List of placeholder which should be applied</param>
		/// <param name="placeHolderName">Name of placeholder</param>
		/// <param name="recordName">Name of record</param>
      /// <param name="variableName">Variable to set</param>
      /// <param name="value">New value of the variable</param>
		/// <returns>Return true if one or more was applied</returns>
      public bool CreateRecordWithValueAndApply(PlaceHolder[] placeHolders, string placeHolderName, string recordName, string variableName, string value)
		{
			List<PlaceHolder> foundPlaceHolder = placeHolders
				.Where(placeHolder => placeHolder.Name.Equals(placeHolderName)) // name
				.ToList();

			foreach (PlaceHolder placeHolder in foundPlaceHolder)
			{
				placeHolder.AddRecord(recordName);
				placeHolder.set_Value(recordName, variableName, value);
				using (Transaction transaction = new TransactionManager().CreateTransaction())
				{
					placeHolder.ApplyRecord(recordName, true); // apply (with page data)
					transaction.Commit(); // needed if not placed in project
				}
			}

			return foundPlaceHolder.Any(); // true == found | false == not found
		}
        public void InstantiateIn(Control container)
        {
            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);

            Literal divContainer1 = new Literal();
            divContainer1.Text = "<div style=\"height: 150px; overflow: auto; position: relative;\">";

            RadioButtonList RadioButtonList1 = new RadioButtonList();
            RadioButtonList1.ID = "Country";
            RadioButtonList1.DataSourceID = "SqlDataSource2";
            RadioButtonList1.Height = Unit.Pixel(150);
            RadioButtonList1.DataValueField = "CountryID"; 
            RadioButtonList1.DataTextField="CountryName";
        
            Literal divContainer2 = new Literal();
            divContainer2.Text = "</div>";

            templatePlaceHolder.Controls.Add(divContainer1);
            templatePlaceHolder.Controls.Add(RadioButtonList1);
            templatePlaceHolder.Controls.Add(divContainer2);
        }
        public void InstantiateIn(Control container)
        {
            PlaceHolder templatePlaceHolder = new PlaceHolder();
            container.Controls.Add(templatePlaceHolder);
            templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate);

            Literal divContainer = new Literal();
            divContainer.Text = "<div class=\"item\"><span>";

            Obout.Interface.OboutCheckBox OboutCheckBox1 = new Obout.Interface.OboutCheckBox();
            OboutCheckBox1.ID = "OboutCheckBox1";
            OboutCheckBox1.ClientSideEvents.OnCheckedChanged = "updateListBoxSelection";

            Literal divContainer2 = new Literal();
            divContainer2.Text = "</span>";

            Literal innerContainer = new Literal();

            templatePlaceHolder.Controls.Add(divContainer);
            templatePlaceHolder.Controls.Add(OboutCheckBox1);
            templatePlaceHolder.Controls.Add(divContainer2);
            templatePlaceHolder.Controls.Add(innerContainer);
        }
Exemple #26
0
    /// <summary>
    /// Creates the section within the wizard
    /// </summary>
    /// <param name="name">Section name</param>
    /// <param name="renderSteps">If true, this section renders steps</param>
    /// <param name="loadControl">If true, the given control is rendered instead of the web part zone</param>
    /// <param name="path">Path to the control to load</param>
    private void CreateSection(string name, bool renderSteps, bool loadControl, string path)
    {
        // Set the property name
        string heightPropertyName = name + "Height";

        string height = ValidationHelper.GetString(GetValue(heightPropertyName), "");

        string rowId = "section_" + name;

        if (IsDesign)
        {
            Append("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%\"><tr><td id=\"", ShortClientID, "_", rowId, "\"");
        }
        else
        {
            Append("<div");
        }

        string style = "vertical-align: top;";

        // Section height
        if (!String.IsNullOrEmpty(height))
        {
            style += "height: " + height + ";";
        }

        // Append style
        if (!String.IsNullOrEmpty(style))
        {
            Append(" style=\"", style, "\"");
        }

        // Cell class
        string thisRowClass = ValidationHelper.GetString(GetValue(name + "CSSClass"), "");

        if (!String.IsNullOrEmpty(thisRowClass))
        {
            Append(" class=\"", thisRowClass, "\"");
        }
        else
        {
            Append(" class=\"Wizard", name, "\"");
        }

        Append(">");

        // Add the zone
        if (renderSteps)
        {
            int currentStep = CurrentStepIndex;

            if (IsDesign)
            {
                // Render all steps
                for (int i = 1; i <= Steps; i++)
                {
                    AppendItemStart(currentStep, i);

                    // Render the step
                    RenderStep(i, mStepContainer);

                    AppendItemEnd();
                }
            }
            else
            {
                PortalContext.EditableControlsHidden = true;

                // Prepare the container for steps
                mStepContainer    = new PlaceHolder();
                mStepContainer.ID = "plcStep";

                AddControl(mStepContainer);

                // Render only current step
                RenderStep(currentStep, mStepContainer);
            }
        }
        else
        {
            if (loadControl)
            {
                // Load the user control instead of zone
                AddControl(path);
            }
            else
            {
                // Render the section zone
                AddZone(ID + "_" + name, "[" + name + "]");
            }
        }

        if (IsDesign)
        {
            Append("</td></tr>");

            // Resizers
            if (AllowDesignMode)
            {
                Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript(rowId, heightPropertyName), " return false;\">&nbsp;</td></tr>");
            }

            Append("</table>");
        }
        else
        {
            Append("</div>");
        }
    }
        private void load_hyperlinks(PlaceHolder output, bool special_order)
        {
            //instantiate a collection for enabled groups
            StringCollection enabled = new StringCollection();

            //determine if there is an application state with enabled groups
            if (Application["main_order_form"] != null)
            {
                //if a state exists grab the data from the state
                enabled = (StringCollection)Application["main_order_form"];
            }
            //no application state exists
            else
            {
                //define the path to the category data file
                string data_path = Server.MapPath("category_data.mff");

                //the file exists
                if (File.Exists(data_path))
                {
                    StreamReader reader = new StreamReader(data_path);
                    if (!reader.EndOfStream)
                    {
                        string data = reader.ReadLine();
                        enabled = parseString(data);
                    }

                    //close the reader
                    reader.Close();
                }
                //the file doesn't exist
                else
                {
                    //redirect to the home page
                    Response.Redirect("http://kinexus.ca");
                }
            }



            output.Controls.Add(new LiteralControl("<table id=\"searchTable\" ><tr><td colspan=\"4\">" +
                                                   "<h2>Search Menu</h2><br /><br /></td></tr>"));
            //initialize a collection for the group order
            List <string> groupOrder = new List <string>();

            StringCollection orderedGroups = new StringCollection();

            //arrange the order of the items
            groupOrder.Add("Antibody");
            groupOrder.Add("Protein Enzyme");
            groupOrder.Add("Peptide");
            groupOrder.Add("Protein Substrate");
            groupOrder.Add("Bioactive Compound");
            groupOrder.Add("Array");

            //enable the groups in the order collection
            for (int i = 0; i < 6; i++)
            {
                //add the groups in client's order
                if (enabled.Contains(groupOrder[i]))
                {
                    //add the group to the collection
                    orderedGroups.Add(groupOrder[i]);
                }
            }

            //if the special order flag is set to true then use the orderd group collection otherwise use the enabled colletion
            StringCollection groups = special_order ? orderedGroups : enabled;

            //traverse all the groups in the enabled collection
            foreach (string group in groups)
            {
                //instantiate a label for the group name
                Label label = new Label();

                //define the label
                label.Text = group;
                label.ID   = group.Replace(" ", "_") + "_slabel";

                //add the control to the panel
                output.Controls.Add(new LiteralControl("<tr><td>"));
                output.Controls.Add(label);
            }

            //close the table
            output.Controls.Add(new LiteralControl("</table>"));
        }
    /// <summary>
    /// Creates the section within the wizard
    /// </summary>
    /// <param name="name">Section name</param>
    /// <param name="renderSteps">If true, this section renders steps</param>
    /// <param name="loadControl">If true, the given control is rendered instead of the web part zone</param>
    /// <param name="path">Path to the control to load</param>
    private void CreateSection(string name, bool renderSteps, bool loadControl, string path)
    {
        // Set the property name
        string heightPropertyName = name + "Height";

        string height = ValidationHelper.GetString(GetValue(heightPropertyName), "");

        string rowId = "section_" + name;

        if (IsDesign)
        {
            Append("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%\"><tr><td id=\"", ShortClientID, "_", rowId, "\"");
        }
        else
        {
            Append("<div");
        }

        string style = "vertical-align: top;";

        // Section height
        if (!String.IsNullOrEmpty(height))
        {
            style += "height: " + height + ";";
        }

        // Append style
        if (!String.IsNullOrEmpty(style))
        {
            Append(" style=\"", style, "\"");
        }

        // Cell class
        string thisRowClass = ValidationHelper.GetString(GetValue(name + "CSSClass"), "");
        if (!String.IsNullOrEmpty(thisRowClass))
        {
            Append(" class=\"", thisRowClass, "\"");
        }
        else
        {
            Append(" class=\"Wizard", name , "\"");
        }

        Append(">");

        // Add the zone
        if (renderSteps)
        {
            int currentStep = CurrentStepIndex;

            if (IsDesign)
            {
                // Render all steps
                for (int i = 1; i <= Steps; i++)
                {
                    AppendItemStart(currentStep, i);

                    // Render the step
                    RenderStep(i, mStepContainer);

                    AppendItemEnd();
                }
            }
            else
            {
                PortalContext.EditableControlsHidden = true;

                // Prepare the container for steps
                mStepContainer = new PlaceHolder();
                mStepContainer.ID = "plcStep";

                AddControl(mStepContainer);

                // Render only current step
                RenderStep(currentStep, mStepContainer);
            }
        }
        else
        {
            if (loadControl)
            {
                // Load the user control instead of zone
                AddControl(path);
            }
            else
            {
                // Render the section zone
                AddZone(ID + "_" + name, "[" + name + "]");
            }
        }

        if (IsDesign)
        {
            Append("</td></tr>");

            // Resizers
            if (AllowDesignMode)
            {
                Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript(rowId, heightPropertyName), " return false;\">&nbsp;</td></tr>");
            }

            Append("</table>");
        }
        else
        {
            Append("</div>");
        }
    }
    /// <summary>
    /// Helper method to display both the noscript and conventional versions of
    /// buttons for BOA.
    /// </summary>
    /// <param name="id"></param>
    /// <param name="placeholderID"></param>
    public static void writeBOASafeButton(string id, PlaceHolder ph, string buttontext, EventHandler onclickserverfunction, HttpRequest request, string LinkURL)
    {
        //evaluate the browser type based on user agent and apply correct stylesheet.
        //Based on javascript in hs_safebuttons.js file.
        string cssType;

        //detecting Opera
        if ((request.UserAgent.IndexOf("Opera") != -1) || (request.UserAgent.IndexOf("Opera") != -1))
        {
            cssType = "opera";
        }
        //detecting Firefox
        else if (request.UserAgent.IndexOf("Firefox") > 0)
        {
            cssType = "saf";
        }
        //detecting Safari
        else if (request.UserAgent.IndexOf("Safari") > 0)
        {
            cssType = "saf";
        }
        //detecting IE
        else if (request.UserAgent.IndexOf("MSIE") > 0 && request.UserAgent.IndexOf("Opera") < 0)
        {
            cssType = "ie";
        }
        //detecting newer Netscapes
        else if (request.UserAgent.IndexOf("Netscape") > 0 && request.UserAgent.IndexOf("Opera") < 0)
        {
            cssType = "ns6";
        }
        //detecting older Netscapes
        else
        {
            cssType = "saf";
        }

        //create the noscript tag and add a submit button
        HtmlGenericControl noscripttag = new HtmlGenericControl("noscript");
        Button             btnSubmit   = new Button();

        btnSubmit.ID   = "btn" + id;
        btnSubmit.Text = buttontext;

        if (buttontext == "Next")
        {
            btnSubmit.ToolTip = "View next page";
        }
        else if (buttontext == "Previous")
        {
            btnSubmit.ToolTip = "View previous page";
        }
        else
        {
            btnSubmit.ToolTip = buttontext;
        }

        btnSubmit.CssClass = "btn";
        btnSubmit.Click   += new EventHandler(onclickserverfunction);

        //add the button to the noscript tag
        noscripttag.Controls.Add(btnSubmit);

        //now lets build the "boa" button...
        HtmlTable t = new HtmlTable();

        t.CellPadding = 0;
        t.CellSpacing = 0;
        t.Border      = 0;
        t.Attributes.Add("summary", string.Empty);

        HtmlTableRow  tr = new HtmlTableRow();
        HtmlTableCell td = new HtmlTableCell();

        td.Attributes.Add("class", "whitebg");
        HtmlGenericControl d = new HtmlGenericControl("div");

        d.Attributes.Add("class", cssType + "-btn");
        d.Attributes.Add("style", "display: none");
        d.ID = "d" + id;
        LinkButton l = new LinkButton();

        ///apply buttons on job detail page must be

        l.Attributes.Add("class", cssType + "-btn");
        l.Attributes.Add("onfocus", "bt_rollover(this,'" + cssType + "-btn-over" + "')");
        l.Attributes.Add("onBlur", "bt_rollover(this,'" + cssType + "-btn" + "')");
        l.ID = "lb" + id;

        if (buttontext.StartsWith("ApplyNow|*|"))
        {
            string auraltext = "Apply Now";
            string countryID = HttpContext.Current.Request["countryid"] == null ? "1" : HttpContext.Current.Request["countryid"].ToString();

            if (countryID != "1")
            {
                auraltext = auraltext + " <span class='auraltext' title='Apply Now. Link opens in new window.'>For `" + buttontext.Replace("ApplyNow|*|", "").ToString() + "`. If you have any difficulties, refer to the below alternatives. Opens in a new window.</span>";
            }

            l.Text = auraltext
                     + "<span class='hidden'>Apply Now. Link opens a new window</span>";
            l.ToolTip = " Apply Now. Link opens in new window. ";

            DateTime MaintenanceStartDate = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["MaintenanceStartDate"].ToString());
            DateTime MaintenanceEndDate   = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["MaintenanceEndDate"].ToString());
            if ((countryID == Location.USA) && DateTime.Compare(MaintenanceStartDate, DateTime.Now) < 0 && DateTime.Compare(MaintenanceEndDate, DateTime.Now) > 0)
            {
                l.PostBackUrl = System.Configuration.ConfigurationManager.AppSettings["MaintenancePage"].ToString();
            }
            else
            {
                l.Attributes.Add("onclick", "javascript:window.open('" + LinkURL + "','ApplyNow')");
            }
        }
        else
        {
            l.Text = buttontext;

            if (buttontext == "Next")
            {
                l.ToolTip = "View next page";
            }
            else if (buttontext == "Previous")
            {
                l.ToolTip = "View previous page";
            }
            else
            {
                l.ToolTip = buttontext;
            }

            l.Click += new EventHandler(onclickserverfunction);
        }

        d.Controls.Add(l);
        td.Controls.Add(d);
        tr.Cells.Add(td);
        t.Rows.Add(tr);


        //add the controls to the placeholder
        if (ph != null)
        {
            ph.Controls.Add(noscripttag);
            ph.Controls.Add(t);
        }


        //now lets add javascript in a literal to get the divs to display on script enabled browsers
        Literal lit = new Literal();

        lit.Text = @"<script language=""JavaScript"" type=""text/javascript"">
					document.getElementById('"                     + d.ClientID + @"').style.display=""inline"";
					</script>"                    ;
        if (ph != null)
        {
            ph.Controls.Add(lit);
        }
    }
Exemple #30
0
        protected PlaceHolder MakeDraft(DataTable DT)
        {
            PlaceHolder p      = new PlaceHolder();
            enter       obj    = new enter();
            int         userid = (int)(Session["userid"]);

            foreach (DataRow row in DT.Rows)
            {
                DataTable t1        = new DataTable();
                int       tweetid   = row.Field <int>(0);
                bool      checklike = false;
                int       get1      = obj.readTweet(tweetid, ref t1);
                int       get2      = obj.numOfLikes(userid, tweetid, ref checklike);
                int       get3      = obj.numOfcomments(tweetid);
                int       get4      = obj.numOfretweets(tweetid);
                if (get1 != -1 && get2 != -1 && get3 != -1 && get4 != -1)
                {
                    PlaceHolder np = new PlaceHolder();
                    np.ID = np.UniqueID;
                    Label t = new Label();
                    t.ID = t.UniqueID;
                    t.Attributes.Add("style", "font-family: Times New Roman; font-size: 25px; background-color: #ffffff;");
                    t.BorderStyle = BorderStyle.Solid;
                    t.Text        = t1.Rows[0].Field <string>(0);
                    t.Attributes.Add("runat", "server");
                    Button b1 = new Button();
                    b1.ID = b1.UniqueID;
                    b1.Attributes.Add("runat", "server");
                    b1.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                    if (checklike == false)
                    {
                        b1.Text = "LIKE ";
                    }
                    else
                    {
                        b1.Text = "UNLIKE ";
                    }
                    b1.Text  += get2;
                    b1.Click += (se, ev) =>
                    {
                        bool ret   = false;
                        int  found = obj.EnterLike(userid, tweetid, ref ret);
                        if (found != -1)
                        {
                            if (!ret)
                            {
                                b1.Text  = "UNLIKE ";
                                b1.Text += found;
                            }
                            else
                            {
                                b1.Text  = "LIKE ";
                                b1.Text += found;
                            }
                        }
                    };
                    //b1.OnClientClick = "return false;";
                    Button b2 = new Button();
                    b2.ID = b2.UniqueID;
                    b2.Attributes.Add("runat", "server");
                    b2.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                    b2.Text  = "COMMENT ";
                    b2.Text += get3;
                    Button b3 = new Button();
                    b3.ID = b3.UniqueID;
                    b3.Attributes.Add("runat", "server");
                    b3.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                    b3.Text   = "RETWEET ";
                    b3.Text  += get4;
                    b2.Click += (se, ev) =>
                    {
                        DataTable d  = new DataTable();
                        int       f1 = obj.GetComments(tweetid, ref d);
                        if (f1 == -1)
                        {
                            TextBox tb = new TextBox();
                            tb.ID = tb.UniqueID;
                            tb.Attributes.Add("style", "font-size: 20px;");
                            tb.BorderStyle = BorderStyle.Solid;
                            tb.Attributes.Add("runat", "server");
                            Button b4 = new Button();
                            b4.ID = b4.UniqueID;
                            b4.Attributes.Add("runat", "server");
                            b4.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                            b4.Text   = "~Tweet";
                            b4.Click += (ser, eve) =>
                            {
                                int cmnt = obj.InsertComment(userid, tweetid, tb.Text);
                            };
                            np.Controls.Add(tb);
                            np.Controls.Add(new LiteralControl("&nbsp"));
                            np.Controls.Add(b4);
                        }
                        else
                        {
                            np.Controls.Add(MakeDraft(d));
                            TextBox tb = new TextBox();
                            tb.ID = tb.UniqueID;
                            tb.Attributes.Add("style", "font-size: 20px;");
                            tb.BorderStyle = BorderStyle.Solid;
                            tb.Attributes.Add("runat", "server");
                            Button b4 = new Button();
                            b4.ID = b4.UniqueID;
                            b4.Attributes.Add("runat", "server");
                            b4.Attributes.Add("style", "height: 35px; width: 100px; font-family: Times New Roman; font-size: 10px; background-color: #ffffff;");
                            b4.Text   = "~Tweet";
                            b4.Click += (ser, eve) =>
                            {
                                int cmnt = obj.InsertComment(userid, tweetid, tb.Text);
                            };
                            np.Controls.Add(tb);
                            np.Controls.Add(new LiteralControl("&nbsp"));
                            np.Controls.Add(b4);
                        }
                    };
                    np.Controls.Add(t);
                    np.Controls.Add(new LiteralControl("<br />"));
                    np.Controls.Add(b1);
                    np.Controls.Add(new LiteralControl("&nbsp"));
                    np.Controls.Add(b2);
                    np.Controls.Add(new LiteralControl("&nbsp"));
                    np.Controls.Add(b3);
                    np.Controls.Add(new LiteralControl("<br />"));
                    p.Controls.Add(np);
                    p.Controls.Add(new LiteralControl("<br /><br /><br />"));
                }
                else
                {
                    Label t = new Label();
                    t.ID = t.UniqueID;
                    t.Attributes.Add("style", "font-family: Times New Roman; font-size: 25px; background-color: #ffffff;");
                    t.BorderStyle = BorderStyle.Solid;
                    t.Text        = "An error occured. Please reload!";
                    p.Controls.Add(new LiteralControl("<br />"));
                    p.Controls.Add(t);
                    p.Controls.Add(new LiteralControl("<br /><br /><br />"));
                }
            }
            return(p);
        }
Exemple #31
0
        protected void display(SqlDataReader reader)
        {
            IDataRecord record;
            int         i = 1;
            int         p = 0;

            while (reader.Read())
            {
                record = (IDataRecord)reader;
                PlaceHolder PH1 = new PlaceHolder();


                Label no = new Label();
                no.Text = string.Format("{0}. ", i);;
                Label forName = new Label();
                forName.Text = "Product name:  ";
                Label Nmae = new Label();
                Nmae.Text = record["ProductName"].ToString();
                Label ForQuantity = new Label();
                ForQuantity.Text = "Quantity:  ";
                Label Quantity = new Label();
                Quantity.Text = record["Quantity"].ToString();
                Label ForPrice = new Label();
                ForPrice.Text = "Price:  ";
                Label Price = new Label();
                Price.Text = record["Retail"].ToString();



                Button myButton = new Button();
                myButton.Text     = "Delete";
                myButton.ID       = record["OrderItem1ID"].ToString();
                myButton.Click   += new EventHandler(Delete_Click);
                myButton.CssClass = "deleteBtn";
                Label newline = new Label();
                newline.Text = "<br/>";
                Label newline2 = new Label();
                newline2.Text = "&nbsp";
                Label newline3 = new Label();
                newline3.Text = "&nbsp";
                Label newline4 = new Label();
                newline4.Text = "&nbsp";
                Label newline5 = new Label();
                newline5.Text = "&nbsp";
                PlaceHolder1.Controls.Add(PH1);
                PH1.Controls.Add(no);
                PH1.Controls.Add(newline2);
                PH1.Controls.Add(forName);
                PH1.Controls.Add(Nmae);
                PH1.Controls.Add(newline3);
                PH1.Controls.Add(ForQuantity);
                PH1.Controls.Add(Quantity);
                PH1.Controls.Add(newline5);
                PH1.Controls.Add(ForPrice);
                PH1.Controls.Add(Price);
                PH1.Controls.Add(newline4);
                PH1.Controls.Add(myButton);
                PH1.Controls.Add(newline);
                i++;
                p = +Convert.ToInt32(record["Retail"]);
            }
            SubTotal.Text = p.ToString();
            Tax.Text      = (p * 0.13).ToString();
            Total.Text    = (p * 1.13).ToString();
        }
 /// <summary> Abstract method allows controls to be added directory to a place holder, rather than just writing to the output HTML stream </summary>
 /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the bulk of the item viewer's output is displayed</param>
 /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
 /// <remarks> This MUST be implemented by all classes that implement this abstract class </remarks>
 public abstract void Add_Main_Viewer_Section(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer);
Exemple #33
0
 public OptionSelection ParseFromPlaceholder(Option baseOption, PlaceHolder ph, string prefix = null)
 {
     return(null);
 }
Exemple #34
0
        /// <summary>
        /// Generates the target-specific inner markup for the Web control to which the control adapter is attached.
        /// </summary>
        /// <param name="writer">
        /// The <see cref="T:System.Web.UI.HtmlTextWriter"/> containing methods to render the target-specific output.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (this.Extender.AdapterEnabled)
            {
                var dataList = this.Control as DataList;
                if (dataList != null)
                {
                    writer.Indent++;
                    writer.WriteLine();
                    writer.WriteBeginTag("table");
                    writer.WriteAttribute("cellpadding", "0");
                    writer.WriteAttribute("cellspacing", "0");
                    writer.WriteAttribute("summary", this.Control.ToolTip);
                    writer.Write(HtmlTextWriter.TagRightChar);
                    writer.Indent++;

                    if (dataList.HeaderTemplate != null)
                    {
                        var container = new PlaceHolder();
                        dataList.HeaderTemplate.InstantiateIn(container);
                        container.DataBind();

                        if ((container.Controls.Count == 1) &&
                            typeof(LiteralControl).IsInstanceOfType(container.Controls[0]))
                        {
                            writer.WriteLine();
                            writer.WriteBeginTag("caption");
                            writer.Write(HtmlTextWriter.TagRightChar);

                            var literalControl = container.Controls[0] as LiteralControl;
                            if (literalControl != null)
                            {
                                writer.Write(literalControl.Text.Trim());
                            }

                            writer.WriteEndTag("caption");
                        }
                        else
                        {
                            writer.WriteLine();
                            writer.WriteBeginTag("thead");
                            writer.Write(HtmlTextWriter.TagRightChar);
                            writer.Indent++;

                            writer.WriteLine();
                            writer.WriteBeginTag("tr");
                            writer.Write(HtmlTextWriter.TagRightChar);
                            writer.Indent++;

                            writer.WriteLine();
                            writer.WriteBeginTag("th");
                            writer.WriteAttribute("colspan", this.RepeatColumns.ToString());
                            writer.Write(HtmlTextWriter.TagRightChar);
                            writer.Indent++;

                            writer.WriteLine();
                            container.RenderControl(writer);

                            writer.Indent--;
                            writer.WriteLine();
                            writer.WriteEndTag("th");

                            writer.Indent--;
                            writer.WriteLine();
                            writer.WriteEndTag("tr");

                            writer.Indent--;
                            writer.WriteLine();
                            writer.WriteEndTag("thead");
                        }
                    }

                    if (dataList.FooterTemplate != null)
                    {
                        writer.WriteLine();
                        writer.WriteBeginTag("tfoot");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;

                        writer.WriteLine();
                        writer.WriteBeginTag("tr");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;

                        writer.WriteLine();
                        writer.WriteBeginTag("td");
                        writer.WriteAttribute("colspan", this.RepeatColumns.ToString());
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;

                        var container = new PlaceHolder();
                        dataList.FooterTemplate.InstantiateIn(container);
                        container.DataBind();
                        container.RenderControl(writer);

                        writer.Indent--;
                        writer.WriteLine();
                        writer.WriteEndTag("td");

                        writer.Indent--;
                        writer.WriteLine();
                        writer.WriteEndTag("tr");

                        writer.Indent--;
                        writer.WriteLine();
                        writer.WriteEndTag("tfoot");
                    }

                    if (dataList.ItemTemplate != null)
                    {
                        writer.WriteLine();
                        writer.WriteBeginTag("tbody");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Indent++;

                        var nItemsInColumn = (int)Math.Ceiling(dataList.Items.Count / ((Double)this.RepeatColumns));
                        for (var iItem = 0; iItem < dataList.Items.Count; iItem++)
                        {
                            var nRow          = iItem / this.RepeatColumns;
                            var nCol          = iItem % this.RepeatColumns;
                            var nDesiredIndex = iItem;
                            if (dataList.RepeatDirection == RepeatDirection.Vertical)
                            {
                                nDesiredIndex = (nCol * nItemsInColumn) + nRow;
                            }

                            if ((iItem % this.RepeatColumns) == 0)
                            {
                                writer.WriteLine();
                                writer.WriteBeginTag("tr");
                                writer.Write(HtmlTextWriter.TagRightChar);
                                writer.Indent++;
                            }

                            writer.WriteLine();
                            writer.WriteBeginTag("td");
                            writer.Write(HtmlTextWriter.TagRightChar);
                            writer.Indent++;

                            foreach (Control itemCtrl in dataList.Items[iItem].Controls)
                            {
                                itemCtrl.RenderControl(writer);
                            }

                            writer.Indent--;
                            writer.WriteLine();
                            writer.WriteEndTag("td");

                            if (((iItem + 1) % this.RepeatColumns) == 0)
                            {
                                writer.Indent--;
                                writer.WriteLine();
                                writer.WriteEndTag("tr");
                            }
                        }

                        if ((dataList.Items.Count % this.RepeatColumns) != 0)
                        {
                            writer.Indent--;
                            writer.WriteLine();
                            writer.WriteEndTag("tr");
                        }

                        writer.Indent--;
                        writer.WriteLine();
                        writer.WriteEndTag("tbody");
                    }

                    writer.Indent--;
                    writer.WriteLine();
                    writer.WriteEndTag("table");

                    writer.Indent--;
                    writer.WriteLine();
                }
            }
            else
            {
                base.RenderContents(writer);
            }
        }
        /// <summary>
        /// Handles the ItemDataBound event of the rptrGroupAttributes control.
        /// </summary>
        /// <param name="sender">The object that sent the message.</param>
        /// <param name="e">Event arguments.</param>
        protected void rptrGroupAttributes_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            PlaceHolder phAttributes = e.Item.FindControl("phAttributes") as PlaceHolder;

            Helper.AddEditControls(( GroupMember )e.Item.DataItem, phAttributes, !_isGroupMembershipRebind, BlockValidationGroup, true);
        }
Exemple #36
0
 void FillPlaceHolderWithProblems(PlaceHolder holder, IEnumerable<Problem> problems)
 {
     foreach (Problem p in problems)
     {
         holder.Controls.Add(new HyperLink()
         {
             Text = HttpUtility.HtmlEncode(p.Name),
             NavigateUrl = "~/Problem/?id=" + p.ID
         });
         holder.Controls.Add(new Literal() { Text = " " });
     }
 }
 /// <summary>
 ///     Creates the respective HtmlControl object of this Option, based upon the specified OptionType.
 /// </summary>
 /// <param name="ph">An instance of the Placeholder control to add the resulting object to.</param>
 /// <param name="prefix">
 ///     (optional) When specified, this value will be included as a prefix to the Id and Name attributes
 ///     of the rendered items.
 /// </param>
 public void RenderAsControl(PlaceHolder ph, string prefix = null)
 {
     Processor.RenderAsControl(this, ph, prefix);
 }
Exemple #38
0
        protected override void CreateChildControls()
        {
            if (this.WebPartManager.DisplayMode.Name == "Design")
            {
                //this.ChromeType = PartChromeType.TitleOnly;
                this.AllowEdit = true;
            }
            else
            {
                //this.ChromeType = PartChromeType.None;
                this.AllowEdit = false;
            }
            this.AllowHide = false;

            String sID = this.ClientID;

            PlaceHolder displayPh = new PlaceHolder();
            PlaceHolder editPh    = new PlaceHolder();

            displayPh.ID              = "displayPanel";
            displayPh.Visible         = false;
            displayPh.EnableViewState = false;

            editPh.ID              = "editPanel";
            editPh.Visible         = false;
            editPh.EnableViewState = false;

            this.Controls.Add(new LiteralControl("<div class=\"yammerEmbedWpWrapper\">"));

            //if in edit mode then show edit panel
            if (this.WebPartManager.DisplayMode == System.Web.UI.WebControls.WebParts.WebPartManager.EditDisplayMode ||
                this.WebPartManager.DisplayMode == System.Web.UI.WebControls.WebParts.WebPartManager.DesignDisplayMode)
            {
                /*edit panel*/
                editPh.Controls.Add(new LiteralControl(DrawEditPanel()));
                editPh.Visible = true;

                this.Controls.Add(editPh);
            }             /*end edit panel*/
            else          //display panel
            {
                displayPh.Controls.Add(new LiteralControl(DrawDisplayPanel()));
                displayPh.Visible = true;
                this.Controls.Add(displayPh);
            }             //end display panel


            //messages
            if (errorArray.Count > 0)
            {
                this.Controls.Add(new LiteralControl("<div class=\"yammerEmbedWpMessages\">"));
                BulletedList errors = new BulletedList();
                errors.ID         = "ErrorList";
                errors.DataSource = errorArray;
                errors.DataBind();
                this.Controls.Add(errors);
                this.Controls.Add(new LiteralControl("</div>"));
            }
            //end messages

            this.Controls.Add(new LiteralControl("</div>"));
        }
Exemple #39
0
        public static void IncludeCss(this Page page, string path, bool first,
                                      string ieCondition = null)
        {
            if (page.Header == null)
            {
                return;
            }
            path = path.Replace('\\', '/');

            string resolvedPath;

            if (path.Contains("://"))
            {
                resolvedPath = path;
            }
            else
            {
                // strip query buster
                int pos;
                if ((pos = path.IndexOf("?", StringComparison.Ordinal)) >= 0)
                {
                    path = path.Substring(0, pos);
                }
                resolvedPath = page.ResolveClientUrl(path);
                var file = new FileInfo(page.Server.MapPath(resolvedPath));

                // skip if no such file
                if (!file.Exists)
                {
                    return;
                }

                // append mod time to defeat browser caching
                resolvedPath += "?" + file.LastWriteTimeUtc.Ticks;
            }

            // skip if already added
            HtmlLink firstStylesheet = null;

            foreach (Control control in page.Header.Controls)
            {
                if (control is HtmlLink htmlLink)
                {
                    if (htmlLink.Attributes["rel"].IsEqIgnoreCase("stylesheet"))
                    {
                        if (firstStylesheet == null)
                        {
                            firstStylesheet = htmlLink;
                        }
                        if (htmlLink.Href.IsEqIgnoreCase(resolvedPath))
                        {
                            return;
                        }
                    }
                }
            }
            var newLink = new HtmlLink {
                Href = resolvedPath
            };

            newLink.Attributes.Add("type", "text/css");
            newLink.Attributes.Add("rel", "stylesheet");
            Control toAdd;

            if (IsNullOrWhiteSpace(ieCondition))
            {
                toAdd = newLink;
            }
            else
            {
                toAdd = new PlaceHolder();
                new LiteralControl("\n<!--[" + ieCondition + "]>\n").AddTo(toAdd);
                newLink.AddTo(toAdd);
                new LiteralControl("\n<![endif]-->\n").AddTo(toAdd);
            }
            if (first && firstStylesheet != null)
            {
                var index = page.Header.Controls.IndexOf(firstStylesheet);
                page.Header.Controls.AddAt(index, toAdd);
            }
            else
            {
                toAdd.AddTo(page.Header);
            }
        }
Exemple #40
0
 public void SetSelectionsInPlaceholder(Option baseOption, PlaceHolder ph, OptionSelectionList selections)
 {
     // do nothing;
 }
        /// <summary>
        /// Loads the categories based on the enabled groupings.
        /// </summary>
        /// <param name="output">The placeholder to draw to.</param>
        ///

        private void load_categories(PlaceHolder output, bool special_order)
        {
            //instantiate a collection for enabled groups
            StringCollection enabled = new StringCollection();

            //determine if there is an application state with enabled groups
            if (Application["main_order_form"] != null)
            {
                //if a state exists grab the data from the state
                enabled = (StringCollection)Application["main_order_form"];
            }
            //no application state exists
            else
            {
                //define the path to the category data file
                string data_path = Server.MapPath("category_data.mff");

                //the file exists
                if (File.Exists(data_path))
                {
                    StreamReader reader = new StreamReader(data_path);
                    if (!reader.EndOfStream)
                    {
                        string data = reader.ReadLine();
                        enabled = parseString(data);
                    }

                    //close the reader
                    reader.Close();
                }
                //the file doesn't exist
                else
                {
                    //redirect to the home page
                    Response.Redirect("http://kinexus.ca");
                }
            }

            //add the table tag to the control

            output.Controls.Add(new LiteralControl("<table id=\"searchTable\" ><tr><td colspan=\"4\">" +
                                                   "<h2>Search Menu</h2><span class=\"gray30\">Select desired category and type in at least 2 letters of the product name or view a complete list<span> <br /><br /></td></tr>"));

            //initialize a collection for the group order
            List <string> groupOrder = new List <string>();

            StringCollection orderedGroups = new StringCollection();

            //arrange the order of the items
            groupOrder.Add("Antibody");
            groupOrder.Add("Protein Enzyme");
            groupOrder.Add("Peptide");
            groupOrder.Add("Protein Substrate");
            groupOrder.Add("Bioactive Compound");
            groupOrder.Add("Microarray");

            //enable the groups in the order collection
            for (int i = 0; i < 6; i++)
            {
                //add the groups in client's order
                if (enabled.Contains(groupOrder[i]))
                {
                    //add the group to the collection
                    orderedGroups.Add(groupOrder[i]);
                }
            }

            //if the special order flag is set to true then use the orderd group collection otherwise use the enabled colletion
            StringCollection groups = special_order ? orderedGroups : enabled;

            //traverse all the groups in the enabled collection
            foreach (string group in groups)
            {
                //instantiate a label for the group name
                Label label = new Label();

                //instantiate a textbox for the query string
                TextBox box = new TextBox();

                //instantiate buttons for search and for product list
                Button search_button = new Button(), list_button = new Button();

                //define the label
                label.Text = group;
                label.ID   = group.Replace(" ", "_") + "_slabel";

                //add the control to the panel
                output.Controls.Add(new LiteralControl("<tr><td>"));
                output.Controls.Add(label);

                //define textbox
                box.ID = group.Replace(" ", "_") + "_textbx";
                box.Attributes.Add("class", "searchBox");
                box.Text = "Enter Search Term";
                box.Attributes.Add("onfocus", "rmText($(this))");
                box.Attributes.Add("onblur", "rpText($(this))");
                //add the control to the panel
                output.Controls.Add(new LiteralControl("</td><td>"));
                output.Controls.Add(box);

                //define the search button
                search_button.Text = "Search";
                search_button.ID   = group.Replace(" ", "_") + "_button";

                //attach the click event
                search_button.Click += new EventHandler(search_click);

                //attach the form attributes
                search_button.Attributes.Add("method", "post");
                search_button.Attributes.Add("type", "submit");

                //add the control to the panel
                output.Controls.Add(new LiteralControl("</td><td>"));
                output.Controls.Add(search_button);
                output.Controls.Add(new LiteralControl("</td><td>"));
                //define the product list button
                list_button.Text = "Product List";
                list_button.ID   = group.Replace(" ", "_") + "_pdlist";

                //attach the click event
                list_button.Click += new EventHandler(list_click);

                //attach the form attributes
                list_button.Attributes.Add("method", "post");
                list_button.Attributes.Add("type", "submit");

                //add the control to the panel
                output.Controls.Add(list_button);
                output.Controls.Add(new LiteralControl("</td></tr>"));
            }

            //close the table
            output.Controls.Add(new LiteralControl("</table>"));
        }
Exemple #42
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //validate!
            int id;

            if (int.TryParse(Request.QueryString["id"], out id) == false)
            {
                //if this is invalid show an error
                this.DisplayFatalError("Invalid query string");
                return;
            }
            _contentId = id;


            _unPublish.Click += UnPublishDo;

            //Loading Content via new public service to ensure that the Properties are loaded correct
            var content = ApplicationContext.Current.Services.ContentService.GetById(id);

            _document = new Document(content);

            //check if the doc exists
            if (string.IsNullOrEmpty(_document.Path))
            {
                //if this is invalid show an error
                this.DisplayFatalError("No document found with id " + _contentId);
                //reset the content id to null so processing doesn't continue on OnLoad
                _contentId = null;
                return;
            }

            // we need to check if there's a published version of this document
            _documentHasPublishedVersion = _document.HasPublishedVersion();

            // Check publishing permissions
            if (base.getUser().GetPermissions(_document.Path).Contains(ActionPublish.Instance.Letter.ToString()) == false)
            {
                // Check to see if the user has send to publish permissions
                if (!base.getUser().GetPermissions(_document.Path).Contains(ActionToPublish.Instance.Letter.ToString()))
                {
                    //If no send to publish permission then revert to NoPublish mode
                    _canPublish = controls.ContentControl.publishModes.NoPublish;
                }
                else
                {
                    _canPublish = controls.ContentControl.publishModes.SendToPublish;
                }
            }

            _cControl = new controls.ContentControl(_document, _canPublish, "TabView1");

            _cControl.ID = "TabView1";

            _cControl.Width  = Unit.Pixel(666);
            _cControl.Height = Unit.Pixel(666);

            // Add preview button

            foreach (uicontrols.TabPage tp in _cControl.GetPanels())
            {
                AddPreviewButton(tp.Menu, _document.Id);
            }

            plc.Controls.Add(_cControl);


            var publishStatus = new PlaceHolder();

            if (_documentHasPublishedVersion)
            {
                _littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToShortDateString() + " &nbsp; ";

                publishStatus.Controls.Add(_littPublishStatus);
                if (getUser().GetPermissions(_document.Path).IndexOf("U") > -1)
                {
                    _unPublish.Visible = true;
                }
                else
                {
                    _unPublish.Visible = false;
                }
            }
            else
            {
                _littPublishStatus.Text = ui.Text("content", "itemNotPublished", base.getUser());
                publishStatus.Controls.Add(_littPublishStatus);
                _unPublish.Visible = false;
            }

            _unPublish.Text = ui.Text("content", "unPublish", base.getUser());
            _unPublish.ID   = "UnPublishButton";
            _unPublish.Attributes.Add("onClick", "if (!confirm('" + ui.Text("defaultdialogs", "confirmSure", base.getUser()) + "')) return false; ");
            publishStatus.Controls.Add(_unPublish);

            _publishProps.addProperty(ui.Text("content", "publishStatus", base.getUser()), publishStatus);

            // Template
            var template     = new PlaceHolder();
            var DocumentType = new DocumentType(_document.ContentType.Id);

            _cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));


            //template picker
            _cControl.PropertiesPane.addProperty(ui.Text("template"), template);
            int defaultTemplate;

            if (_document.Template != 0)
            {
                defaultTemplate = _document.Template;
            }
            else
            {
                defaultTemplate = DocumentType.DefaultTemplate;
            }

            if (getUser().UserType.Name == "writer")
            {
                if (defaultTemplate != 0)
                {
                    template.Controls.Add(new LiteralControl(businesslogic.template.Template.GetTemplate(defaultTemplate).Text));
                }
                else
                {
                    template.Controls.Add(new LiteralControl(ui.Text("content", "noDefaultTemplate")));
                }
            }
            else
            {
                _ddlDefaultTemplate.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
                foreach (var t in DocumentType.allowedTemplates)
                {
                    var tTemp = new ListItem(t.Text, t.Id.ToString());
                    if (t.Id == defaultTemplate)
                    {
                        tTemp.Selected = true;
                    }
                    _ddlDefaultTemplate.Items.Add(tTemp);
                }
                template.Controls.Add(_ddlDefaultTemplate);
            }


            // Editable update date, release date and expire date added by NH 13.12.04
            _dp.ID   = "updateDate";
            _dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString();
            _publishProps.addProperty(ui.Text("content", "updateDate", getUser()), _dp);

            _dpRelease.ID       = "releaseDate";
            _dpRelease.DateTime = _document.ReleaseDate;
            _dpRelease.ShowTime = true;
            _publishProps.addProperty(ui.Text("content", "releaseDate", getUser()), _dpRelease);

            _dpExpire.ID       = "expireDate";
            _dpExpire.DateTime = _document.ExpireDate;
            _dpExpire.ShowTime = true;
            _publishProps.addProperty(ui.Text("content", "expireDate", getUser()), _dpExpire);

            _cControl.Save           += Save;
            _cControl.SaveAndPublish += Publish;
            _cControl.SaveToPublish  += SendToPublish;

            // Add panes to property page...
            _cControl.tpProp.Controls.AddAt(1, _publishProps);
            _cControl.tpProp.Controls.AddAt(2, _linkProps);

            // add preview to properties pane too
            AddPreviewButton(_cControl.tpProp.Menu, _document.Id);
        }
Exemple #43
0
        public Control GetWebControl(System.Web.HttpServerUtility server, XmlNode renderingDocument)
        {
            PlaceHolder ph = new PlaceHolder();

            Label lbl = new Label();

            if (renderingDocument.Attributes["label"] != null)
            {
                lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server);
            }
            else
            {
                lbl.Text = this.Name.FromXmlName2Render(server);
            }
            lbl.CssClass = "label";
            ph.Controls.Add(lbl);

            VEMapControl vem = new VEMapControl(this);

            if (renderingDocument.Attributes["class"] != null)
            {
                vem.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server);
            }
            if (renderingDocument.Attributes["rel"] != null)
            {
                renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server);
            }
            if (renderingDocument.Attributes["description"] != null)
            {
                vem.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server);
            }

            ph.Controls.Add(vem);

            // Validators

            List <XmlSchemaElement> baseSchemaElements = Common.getElementsFromSchema(baseSchema);

            if (!baseSchemaElements[0].IsNillable)
            {
                RequiredFieldValidator rqfv = new RequiredFieldValidator();
                rqfv.ErrorMessage      = "Required fields shouldn't be empty";
                rqfv.ControlToValidate = vem.ID + "$latitude";
                rqfv.ValidationGroup   = "1";
                rqfv.Display           = ValidatorDisplay.Dynamic;
                ph.Controls.Add(rqfv);
            }
            if (!baseSchemaElements[1].IsNillable)
            {
                RequiredFieldValidator rqfv = new RequiredFieldValidator();
                rqfv.ErrorMessage      = "Required fields shouldn't be empty";
                rqfv.ControlToValidate = vem.ID + "$longitude";
                rqfv.Display           = ValidatorDisplay.Dynamic;
                ph.Controls.Add(rqfv);
                rqfv.ValidationGroup = "1";
            }

            // Setting up base validators
            // ( validators for min and max of latitude (-90,90) and longitude (-180,180) )

            CompareValidator maxLatitudeValidator = new CompareValidator();

            maxLatitudeValidator.ID = this.Name + "_maxLatitudeValidator";
            maxLatitudeValidator.ControlToValidate = vem.ID + "$latitude";;
            maxLatitudeValidator.Type            = ValidationDataType.Integer;
            maxLatitudeValidator.ValueToCompare  = "90";
            maxLatitudeValidator.Operator        = ValidationCompareOperator.LessThanEqual;
            maxLatitudeValidator.ErrorMessage    = "The value has to be lower than or equal to 90";
            maxLatitudeValidator.Text            = maxLatitudeValidator.ErrorMessage;
            maxLatitudeValidator.Display         = ValidatorDisplay.Dynamic;
            maxLatitudeValidator.Type            = ValidationDataType.Double;
            maxLatitudeValidator.ValidationGroup = "1";

            ph.Controls.Add(maxLatitudeValidator);

            CompareValidator minLatitudeValidator = new CompareValidator();

            minLatitudeValidator.ID = this.Name + "_minLatitudeValidator";
            minLatitudeValidator.ControlToValidate = vem.ID + "$latitude";;
            minLatitudeValidator.Type            = ValidationDataType.Integer;
            minLatitudeValidator.ValueToCompare  = "-90";
            minLatitudeValidator.Operator        = ValidationCompareOperator.GreaterThanEqual;
            minLatitudeValidator.ErrorMessage    = "The value has to be greater than or equal to -90";
            minLatitudeValidator.Text            = minLatitudeValidator.ErrorMessage;
            minLatitudeValidator.Display         = ValidatorDisplay.Dynamic;
            minLatitudeValidator.Type            = ValidationDataType.Double;
            minLatitudeValidator.ValidationGroup = "1";
            ph.Controls.Add(minLatitudeValidator);

            CompareValidator maxLongitudeValidator = new CompareValidator();

            maxLongitudeValidator.ID = this.Name + "_maxLongitudeValidator";
            maxLongitudeValidator.ControlToValidate = vem.ID + "$longitude";;
            maxLongitudeValidator.Type            = ValidationDataType.Integer;
            maxLongitudeValidator.ValueToCompare  = "180";
            maxLongitudeValidator.Operator        = ValidationCompareOperator.LessThanEqual;
            maxLongitudeValidator.ErrorMessage    = "The value has to be lower than or equal to 180";
            maxLongitudeValidator.Text            = maxLongitudeValidator.ErrorMessage;
            maxLongitudeValidator.Display         = ValidatorDisplay.Dynamic;
            maxLongitudeValidator.Type            = ValidationDataType.Double;
            maxLongitudeValidator.ValidationGroup = "1";
            ph.Controls.Add(maxLongitudeValidator);

            CompareValidator minLongitudeValidator = new CompareValidator();

            minLongitudeValidator.ID = this.Name + "_minLongitudeValidator";
            minLongitudeValidator.ControlToValidate = vem.ID + "$longitude";;
            minLongitudeValidator.Type            = ValidationDataType.Integer;
            minLongitudeValidator.ValueToCompare  = "-180";
            minLongitudeValidator.Operator        = ValidationCompareOperator.GreaterThanEqual;
            minLongitudeValidator.ErrorMessage    = "The value has to be greater than or equal to -180";
            minLongitudeValidator.Text            = minLongitudeValidator.ErrorMessage;
            minLongitudeValidator.Display         = ValidatorDisplay.Dynamic;
            minLongitudeValidator.Type            = ValidationDataType.Double;
            minLongitudeValidator.ValidationGroup = "1";
            ph.Controls.Add(minLongitudeValidator);

            // setting up latitude constraints
            if (((XmlSchemaSimpleType)baseSchemaElements[0].SchemaType) != null)
            {
                XmlSchemaObjectCollection latConstrColl =
                    ((XmlSchemaSimpleTypeRestriction)
                     ((XmlSchemaSimpleType)
                      baseSchemaElements[0]
                      .SchemaType).Content).Facets;

                foreach (XmlSchemaFacet facet in latConstrColl)
                {
                    // TODO
                    // No Contraints yet :D
                }
            }

            // setting up longitude constraints
            if (((XmlSchemaSimpleType)baseSchemaElements[1].SchemaType) != null)
            {
                XmlSchemaObjectCollection longConstrColl =
                    ((XmlSchemaSimpleTypeRestriction)
                     ((XmlSchemaSimpleType)
                      baseSchemaElements[1]
                      .SchemaType).Content).Facets;

                foreach (XmlSchemaFacet facet in longConstrColl)
                {
                    // TODO
                    // No Contraints yet :D
                }
            }

            // setting up custom constraints (close your eyes =)
            XmlSchemaComplexContentExtension cce = (XmlSchemaComplexContentExtension)((XmlSchemaComplexContent)(((XmlSchemaComplexType)baseSchema.Items[0])).ContentModel).Content;

            if (cce.Annotation != null)
            {
                foreach (XmlSchemaDocumentation sd in cce.Annotation.Items)
                {
                    XmlNode node = sd.Markup[0];
                    if (node.Name == "maxDistanceFrom")
                    {
                        double km, lat, lon;
                        if (double.TryParse(node.ChildNodes[0].InnerText, out km) &&
                            double.TryParse(node.ChildNodes[1].InnerText, out lat) &&
                            double.TryParse(node.ChildNodes[2].InnerText, out lon))
                        {
                            if (maxDistancesFrom == null)
                            {
                                maxDistancesFrom = new List <List <double> >();
                                ph.Controls.Add(getMaxDistanceValidator(vem.ID));
                            }
                            List <double> newDist = new List <double>();
                            newDist.Add(km);
                            newDist.Add(lat);
                            newDist.Add(lon);
                            maxDistancesFrom.Add(newDist);
                        }
                    }
                }
            }

            return(ph);
        }
Exemple #44
0
    protected void buildInventoryDetails_Graphics(string listName, SqlXml sqlXMLValue, PlaceHolder placeHolderName, int listNumber)
    {

        
        Literal invtabLI = new Literal();
        invtabLI.Text = "<li><a href='#UpdatePanel" + listNumber + "'><span>" + CommonFunctions.CvtNullSpaces(listName) + "</span></a></li> ";
        placeHolderInvContainer.Controls.Add(invtabLI);


        string HtmlCode = "<table class='invtab'> <tr> <th style='height: 20px ; width:75% ;text-align:middle; '>" + listName + "</th>  ";
        //HtmlCode += "<th style='height: 20px ; width:75%  >'</th></tr>";
        bool xmlswitch = false;
        
        if (!sqlXMLValue.IsNull)
        {
            XmlReader xmlreader = sqlXMLValue.CreateReader();
            while (xmlreader.Read())
            {
                if (xmlreader.MoveToContent() == XmlNodeType.Element && xmlreader.Name == "item")
                {
                    xmlswitch = false;
                    string itemContent = xmlreader.ReadString();
                    if (string.IsNullOrEmpty(itemContent))
                    {
                        continue;
                    }
                    else
                    {
                        xmlswitch = true;
                        HtmlCode += "<tr><td>";
                        HtmlCode +=
                            ("<dt>" + itemContent + "</dt>");
                    }
                }
                
                if (xmlreader.MoveToContent() == XmlNodeType.Element && xmlreader.Name == "desc" && xmlswitch )
                {
                    HtmlCode +="<div>" +
                        (xmlreader.ReadString()) + "</div></td>";
                }

                if (xmlreader.MoveToContent() == XmlNodeType.Element && xmlreader.Name == "cost" && xmlswitch)
                {
                    string xmlcost = xmlreader.ReadString();
                    HtmlCode += "<td><div >";
                    if (!string.IsNullOrEmpty(xmlcost))
                    {
                        HtmlCode += "$" + xmlcost;
                        
                    }
                    HtmlCode += "</div></td></tr>";
                }
                
                
            }

            xmlreader.Close();
            HtmlCode += "</table>";
            LiteralControl defListend = new LiteralControl(HtmlCode);
            placeHolderName.Controls.Add(defListend);
            

        }


    }
        /// <summary> Adds the controls for this result viewer to the place holder on the main form </summary>
        /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns>
        public override void Add_HTML(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Custom_Thumbnail_ResultsViewer.Add_HTML", "Rendering results in thumbnail view");
            }

            // If results are null, or no results, return empty string
            if ((PagedResults == null) || (ResultsStats == null) || (ResultsStats.Total_Items <= 0))
            {
                return;
            }

            // Get the text search redirect stem and (writer-adjusted) base url
            string textRedirectStem = Text_Redirect_Stem;
            string base_url         = RequestSpecificValues.Current_Mode.Base_URL;

            if (RequestSpecificValues.Current_Mode.Writer_Type == Writer_Type_Enum.HTML_LoggedIn)
            {
                base_url = RequestSpecificValues.Current_Mode.Base_URL + "l/";
            }

            // Should the publication date be shown?
            bool showDate = RequestSpecificValues.Current_Mode.Sort >= 10;

            // Start this table
            StringBuilder resultsBldr = new StringBuilder(5000);

            //Add the necessary JavaScript, CSS files
            resultsBldr.AppendLine("  <script type=\"text/javascript\" src=\"" + Static_Resources_Gateway.Sobekcm_Thumb_Results_Js + "\"></script>");


            // Start this table
            resultsBldr.AppendLine("<table align=\"center\" width=\"60%\" cellspacing=\"15px\">");
            resultsBldr.AppendLine("\t<tr>");
            resultsBldr.AppendLine("\t\t<td width=\"50%\">&nbsp;</td>");
            resultsBldr.AppendLine("\t\t<td width=\"50%\">&nbsp;</td>");
            resultsBldr.AppendLine("\t</tr>");
            resultsBldr.AppendLine("\t<tr valign=\"top\">");

            // Step through all the results
            int col         = 0;
            int title_count = 0;

            foreach (iSearch_Title_Result titleResult in PagedResults)
            {
                title_count++;
                // Should a new row be started
                if (col == 2)
                {
                    col = 0;
                    resultsBldr.AppendLine("\t</tr>");
                    // Horizontal Line
                    resultsBldr.AppendLine("\t<tr><td bgcolor=\"#e7e7e7\" colspan=\"2\"></td></tr>");
                    resultsBldr.AppendLine("\t<tr valign=\"top\">");
                }

                bool multiple_title = titleResult.Item_Count > 1;

                // Always get the first item for things like the main link and thumbnail
                iSearch_Item_Result firstItemResult = titleResult.Get_Item(0);

                // Determine the internal link to the first (possibly only) item
                string internal_link = base_url + titleResult.BibID + "/" + firstItemResult.VID + textRedirectStem;

                // For browses, just point to the title
                if ((RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Aggregation) && (RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Browse_Info))
                {
                    internal_link = base_url + titleResult.BibID + textRedirectStem;
                }

                resultsBldr.AppendLine("\t\t<td align=\"center\" onmouseover=\"this.className='tableRowHighlight'\" onmouseout=\"this.className='tableRowNormal'\" onclick=\"window.location.href='" + internal_link + "';\" >");

                string title;
                if (multiple_title)
                {
                    // Determine term to use
                    string multi_term = "volume";
                    if (titleResult.MaterialType.ToUpper() == "NEWSPAPER")
                    {
                        multi_term = titleResult.Item_Count > 1 ? "issues" : "issue";
                    }
                    else
                    {
                        if (titleResult.Item_Count > 1)
                        {
                            multi_term = "volumes";
                        }
                    }

                    if ((showDate))
                    {
                        if (firstItemResult.PubDate.Length > 0)
                        {
                            title = "[" + firstItemResult.PubDate + "] " + titleResult.GroupTitle;
                        }
                        else
                        {
                            title = titleResult.GroupTitle;
                        }
                    }
                    else
                    {
                        title = titleResult.GroupTitle + "<br />( " + titleResult.Item_Count + " " + multi_term + " )";
                    }
                }
                else
                {
                    if (showDate)
                    {
                        if (firstItemResult.PubDate.Length > 0)
                        {
                            title = "[" + firstItemResult.PubDate + "] " + firstItemResult.Title;
                        }
                        else
                        {
                            title = firstItemResult.Title;
                        }
                    }
                    else
                    {
                        title = firstItemResult.Title;
                    }
                }

                // Start the HTML for this item
                resultsBldr.AppendLine("<table width=\"150px\">");

                //// Is this restricted?
                bool restricted_by_ip = false;
                if ((titleResult.Item_Count == 1) && (firstItemResult.IP_Restriction_Mask > 0))
                {
                    int comparison = firstItemResult.IP_Restriction_Mask & CurrentUserMask;
                    if (comparison == 0)
                    {
                        restricted_by_ip = true;
                    }
                }

                // Calculate the thumbnail

                // Add the thumbnail
                if ((firstItemResult.MainThumbnail.ToUpper().IndexOf(".JPG") < 0) && (firstItemResult.MainThumbnail.ToUpper().IndexOf(".GIF") < 0))
                {
                    resultsBldr.AppendLine("<tr><td><span id=\"sbkThumbnailSpan" + title_count + "\"><a href=\"" + internal_link + "\"><img id=\"sbkThumbnailImg" + title_count + "\" src=\"" + Static_Resources_Gateway.Nothumb_Jpg + "\" alt=\"MISSING THUMBNAIL\" /></a></span></td></tr>");
                }
                else
                {
                    string thumb = UI_ApplicationCache_Gateway.Settings.Servers.Image_URL + titleResult.BibID.Substring(0, 2) + "/" + titleResult.BibID.Substring(2, 2) + "/" + titleResult.BibID.Substring(4, 2) + "/" + titleResult.BibID.Substring(6, 2) + "/" + titleResult.BibID.Substring(8) + "/" + firstItemResult.VID + "/" + (firstItemResult.MainThumbnail).Replace("\\", "/").Replace("//", "/");
                    resultsBldr.AppendLine("<tr><td><span id=\"sbkThumbnailSpan" + title_count + "\"><a href=\"" + internal_link + "\"><img id=\"sbkThumbnailImg" + title_count + "\"src=\"" + thumb + "\" alt=\"" + title.Replace("\"", "") + "\" /></a></span></td></tr>");
                }

                #region Add the div displayed as a tooltip for this thumbnail on hover

                const string VARIES_STRING = "<span style=\"color:Gray\">( varies )</span>";
                //Add the hidden item values for display in the tooltip
                resultsBldr.AppendLine("<tr style=\"display:none;\"><td colspan=\"100%\"><div  id=\"descThumbnail" + title_count + "\" >");
                // Add each element to this table
                resultsBldr.AppendLine("\t\t\t<table cellspacing=\"0px\">");

                if (multiple_title)
                {
                    //<a href=\"" + internal_link + "\">
                    resultsBldr.AppendLine("\t\t\t\t<tr style=\"height:40px;\" valign=\"middle\"><td colspan=\"3\"><span class=\"qtip_BriefTitle\" style=\"color: #a5a5a5;font-weight: bold;font-size:13px;\">" + titleResult.GroupTitle.Replace("<", "&lt;").Replace(">", "&gt;") + "</span> &nbsp; </td></tr>");
                    resultsBldr.AppendLine("<tr><td colspan=\"100%\"><br/></td></tr>");
                }
                else
                {
                    resultsBldr.AppendLine(
                        "\t\t\t\t<tr style=\"height:40px;\" valign=\"middle\"><td colspan=\"3\"><span class=\"qtip_BriefTitle\" style=\"color: #a5a5a5;font-weight: bold;font-size:13px;\">" + firstItemResult.Title.Replace("<", "&lt;").Replace(">", "&gt;") +
                        "</span> &nbsp; </td></tr><br/>");
                    resultsBldr.AppendLine("<tr><td colspan=\"100%\"><br/></td></tr>");
                }

                if ((!String.IsNullOrEmpty(titleResult.Primary_Identifier_Type)) && (!String.IsNullOrEmpty(titleResult.Primary_Identifier)))
                {
                    resultsBldr.AppendLine("\t\t\t\t<tr><td>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(titleResult.Primary_Identifier_Type, RequestSpecificValues.Current_Mode.Language) + ":</td><td>&nbsp;</td><td>" + HttpUtility.HtmlDecode(titleResult.Primary_Identifier) + "</td></tr>");
                }

                if ((RequestSpecificValues.Current_User != null) && (RequestSpecificValues.Current_User.LoggedOn) && (RequestSpecificValues.Current_User.Is_Internal_User))
                {
                    resultsBldr.AppendLine("\t\t\t\t<tr><td>BibID:</td><td>&nbsp;</td><td>" + titleResult.BibID + "</td></tr>");

                    if (titleResult.OPAC_Number > 1)
                    {
                        resultsBldr.AppendLine("\t\t\t\t<tr><td>OPAC:</td><td>&nbsp;</td><td>" + titleResult.OPAC_Number + "</td></tr>");
                    }

                    if (titleResult.OCLC_Number > 1)
                    {
                        resultsBldr.AppendLine("\t\t\t\t<tr><td>OCLC:</td><td>&nbsp;</td><td>" + titleResult.OCLC_Number + "</td></tr>");
                    }
                }

                for (int i = 0; i < ResultsStats.Metadata_Labels.Count; i++)
                {
                    string field = ResultsStats.Metadata_Labels[i];

                    // Somehow the metadata for this item did not fully save in the database.  Break out, rather than
                    // throw the exception
                    if ((titleResult.Metadata_Display_Values == null) || (titleResult.Metadata_Display_Values.Length <= i))
                    {
                        break;
                    }

                    string value = titleResult.Metadata_Display_Values[i];
                    Metadata_Search_Field thisField = UI_ApplicationCache_Gateway.Settings.Metadata_Search_Field_By_Name(field);
                    string display_field            = string.Empty;
                    if (thisField != null)
                    {
                        display_field = thisField.Display_Term;
                    }
                    if (display_field.Length == 0)
                    {
                        display_field = field.Replace("_", " ");
                    }

                    if (value == "*")
                    {
                        resultsBldr.AppendLine("\t\t\t\t<tr><td>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(display_field, RequestSpecificValues.Current_Mode.Language) + ":</td><td>&nbsp;</td><td>" + HttpUtility.HtmlDecode(VARIES_STRING) + "</td></tr>");
                    }
                    else if (value.Trim().Length > 0)
                    {
                        if (value.IndexOf("|") > 0)
                        {
                            bool     value_found = false;
                            string[] value_split = value.Split("|".ToCharArray());

                            foreach (string thisValue in value_split)
                            {
                                if (thisValue.Trim().Trim().Length > 0)
                                {
                                    if (!value_found)
                                    {
                                        resultsBldr.AppendLine("\t\t\t\t<tr valign=\"top\"><td>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(display_field, RequestSpecificValues.Current_Mode.Language) + ":</td><td>&nbsp;</td><td>");
                                        value_found = true;
                                    }
                                    resultsBldr.Append(HttpUtility.HtmlDecode(thisValue) + "<br />");
                                }
                            }

                            if (value_found)
                            {
                                resultsBldr.AppendLine("</td></tr>");
                            }
                        }
                        else
                        {
                            resultsBldr.AppendLine("\t\t\t\t<tr><td>" + UI_ApplicationCache_Gateway.Translation.Get_Translation(display_field, RequestSpecificValues.Current_Mode.Language) + ":</td><td>&nbsp;</td><td>" + HttpUtility.HtmlDecode(value) + "</td></tr>");
                        }
                    }
                }


                if (!String.IsNullOrEmpty(titleResult.Snippet))
                {
                    resultsBldr.AppendLine("\t\t\t\t<tr><td colspan=\"3\"><br />&ldquo;..." + titleResult.Snippet.Replace("<em>", "<span class=\"texthighlight\">").Replace("</em>", "</span>") + "...&rdquo;</td></tr>");
                }

                resultsBldr.AppendLine("\t\t\t</table>");

                resultsBldr.AppendLine("</div></td></tr>");


                #endregion


                // Add the title
                resultsBldr.AppendLine("<tr><td align=\"center\"><span class=\"SobekThumbnailText\">" + title + "</span></td></tr>");

                // If this was access restricted, add that
                if (restricted_by_ip)
                {
                    resultsBldr.AppendLine("<tr><td align=\"center\"><span class=\"RestrictedItemText\">Access Restricted</span></td></tr>");
                }

                // Finish this one thumbnail
                resultsBldr.AppendLine("</table></td>");
                col++;
            }

            // Finish this row out
            while (col < 2)
            {
                resultsBldr.AppendLine("\t\t<td>&nbsp;</td>");
                col++;
            }

            // End this table
            resultsBldr.AppendLine("\t</tr>");
            resultsBldr.AppendLine("</table>");

            // Add this to the html table
            Literal mainLiteral = new Literal {
                Text = resultsBldr.ToString()
            };
            MainPlaceHolder.Controls.Add(mainLiteral);
        }
Exemple #46
0
    /// <summary>
    /// Returns the HTML markup for a control, invoking any properties on the control.
    /// </summary>
    public static string RenderControl(this HtmlHelper helper, Control control, IEnumerable<KeyValuePair<string, object>> properties)
    {
        try
        {
            if (string.IsNullOrWhiteSpace(control.ID))
            {
                control.ID = string.Format("control_{0}", Guid.NewGuid());
            }

            if (properties != null && properties.Count() > 0)
            {
                var type = control.GetType();

                foreach (KeyValuePair<string, object> prop in properties)
                {
                    var property = type.GetProperty(prop.Key);
                    property.SetValue(
                        control,
                        Convert.ChangeType(prop.Value, property.PropertyType, CultureInfo.InvariantCulture),
                        null);
                }
            }

            // To ensure all the events in the lifecycle fire (Init, Load, etc), put
            // this control into a page and run that page to get the final control markup.
            System.Web.UI.Page page = new System.Web.UI.Page();
            page.EnableViewState = false;
            HtmlForm form = new HtmlForm();
            PlaceHolder ph = new PlaceHolder();
            const string delimiterStart = "-|-|-|-|-|-|-|-|- control start -|-|-|-|-|-|-|-|-";
            const string delimiterEnd = "-|-|-|-|-|-|-|-|- control start -|-|-|-|-|-|-|-|-";
            ph.Controls.Add(new LiteralControl(delimiterStart));
            ph.Controls.Add(control);
            ph.Controls.Add(new LiteralControl(delimiterEnd));
            form.Controls.Add(ph);
            page.Controls.Add(form);

            StringWriter output = new StringWriter();
            HttpContext.Current.Server.Execute(page, output, false);
            string markup = output.ToString();

            Match m = new Regex(string.Format("{0}(.*?){1}", Regex.Escape(delimiterStart), Regex.Escape(delimiterEnd)), RegexOptions.IgnoreCase | RegexOptions.Singleline).Match(markup);
            if (m.Success)
            {
                return m.Groups[1].Value;
            }

            return string.Empty;
        }
        catch (Exception ex)
        {
            Utils.Log(string.Format("Unable to load control: {0}", control.GetType().ToString()), ex);
        }

        return HttpUtility.HtmlEncode(string.Format("ERROR - UNABLE TO LOAD CONTROL : {0}", control.GetType().ToString()));
    }
Exemple #47
0
        public void RenderAsControl(Option baseOption, PlaceHolder ph, string prefix = null)
        {
            var result = new LiteralControl(baseOption.TextSettings.GetSettingOrEmpty("html"));

            ph.Controls.Add(result);
        }
        public static void GetTable(PlaceHolder container, List <HtmlInputText> data, bool showdates, int weekdays, int weekindex, List <DateTime> dates, string[] shifttimes, string theme, bool isFullDay)
        {
            Table          table = new Table();
            TableHeaderRow hrow  = new TableHeaderRow();

            TableRow brow = new TableRow();

            int start = weekdays * weekindex;
            int end   = (start + weekdays) > dates.Count ? (dates.Count - start) + start : (start + weekdays);

            //Shift Days
            for (int i = start; i < end; i++)
            {
                TableHeaderCell th = new TableHeaderCell();
                th.Text       = dates.ElementAt(i).ToString("dddd");
                th.ColumnSpan = isFullDay ? 1 : 2;
                th.CssClass   = "border-collapse";
                th.Style.Add("text-align", "center");
                hrow.Cells.Add(th);
            }
            table.Rows.Add(hrow);

            //Shift Dates
            if (showdates)
            {
                brow = new TableRow();

                for (int i = start; i < end; i++)
                {
                    TableCell td = new TableCell();
                    td.Text       = dates.ElementAt(i).ToShortDateString();
                    td.ColumnSpan = isFullDay ? 1 : 2;
                    td.CssClass   = "td-size border-collapse";
                    td.Style.Add("text-align", "center");
                    brow.Cells.Add(td);
                }
                table.Rows.Add(brow);
            }

            //Shift Type
            brow = new TableRow();

            string[] times = new string[] { "Morning", "Afternoon" };

            for (int i = (isFullDay ? start : start * 2); i < (isFullDay ? end : end * 2); i++)
            {
                TableCell td = new TableCell();
                td.Text       = isFullDay ? times[0] : times[i % 2];
                td.ColumnSpan = 1;
                td.CssClass   = "td-size border-collapse";
                td.Style.Add("text-align", "center");
                brow.Cells.Add(td);
            }
            table.Rows.Add(brow);

            //Shift Times
            brow = new TableRow();

            for (int i = (isFullDay ? start : start * 2); i < (isFullDay ? end : end * 2); i++)
            {
                TableCell td = new TableCell();
                td.Text       = isFullDay ? shifttimes[0] : shifttimes[i % 2];
                td.ColumnSpan = 1;
                td.CssClass   = "td-xsize border-collapse";
                td.Style.Add("text-align", "center");
                brow.Cells.Add(td);
            }
            table.Rows.Add(brow);

            //Employees
            brow = new TableRow();

            for (int i = 0; i < data.Count; i++)
            {
                TableCell td = new TableCell();
                td.Text     = data.ElementAt(i).Value;
                td.RowSpan  = isFullDay ? 1 : 2;
                td.CssClass = "td-xsize border-collapse";
                td.Style.Add("text-align", "center");
                brow.Cells.Add(td);
            }
            table.Rows.Add(brow);

            brow           = new TableRow();
            table.CssClass = "table " + (theme.Equals("0") ? "table-dark " : "thead-light ") + "table-striped table-hover border-collapse";

            container.Controls.Add(table);
        }
Exemple #49
0
        //public void SelectedMultipleDisplay(List<int> EDP_LIST, PlaceHolder placeholder1)
        //{
        //    // save is an arraylist that contains EDP #
        //    placeholder1.Controls.Clear();
        //    for (int i = 0; i < EDP_LIST.Count; i++)
        //    {
        //        #region Naming , Creation of LAbel
        //        Label label_ProductName = new Label();
        //        label_ProductName.ID = "label_ProductName" + i;
        //        Label label_Store = new Label();
        //        label_Store.ID = "label_Store" + i;
        //        Label label_Description = new Label();
        //        label_Description.ID = "label_Description" + i;
        //        Label label_Price = new Label();
        //        label_Price.ID = "label_Price" + i;
        //        Image Image_url = new Image();
        //        Image_url.ID = "Image_ID" + i;
        //        Label label_Manufacturer = new Label();
        //        label_Manufacturer.ID = "label_Manufacturer" + i;
        //        Label label_Availability = new Label();
        //        label_Availability.ID = "label_Availability" + i;
        //        PlaceHolder ph = new PlaceHolder();
        //        ph.ID = "placeHold" + i;
        //        #endregion Naming , Creation of LAbel
        //        getDetails(Convert.ToString(EDP_LIST[i]), label_Store, label_ProductName, label_Description, label_Price, Image_url, label_Manufacturer, label_Availability);

        //        #region  IMPLEMENTATION
        //        Image_url.Height = 500;
        //        Image_url.Width = 500;
        //        Image_url.CssClass = "img-responsive ";
        //        Image_url.AlternateText = "No Image";
        //        //<----------  IMPLEMENT ----------->
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(Image_url);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("Price: "));
        //        ph.Controls.Add(label_Price);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("Name: "));
        //        ph.Controls.Add(label_ProductName);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("Store: "));
        //        ph.Controls.Add(label_Store);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("Description: "));
        //        ph.Controls.Add(label_Description);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("Manufacturer: "));
        //        ph.Controls.Add(label_Manufacturer);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        ph.Controls.Add(new LiteralControl("<label style='color:red'>Availability: </label>"));
        //        ph.Controls.Add(label_Availability);
        //        ph.Controls.Add(new LiteralControl("</br>"));
        //        #endregion IMPLEMENTATION
        //        placeholder1.Controls.Add(ph);
        //    }
        //}
        ////Effective For Search ProductDetails
        //public  void getDetails(String inputEdp, Label label_store, Label label_productName, Label label_productdescription,
        //  Label label_Price, Image imageSourceUrl, Label label_Manufacturer, Label label_availabilityDescription) // VERSION 3
        //{
        //    String inputurl = ("http://afs-sl-pservice01.afservice.org:8080/productservice2/getProductInfo/pcmall?edplist=" + inputEdp + "&ignoreCatalog=true");
        //    System.Xml.XmlTextReader reader = new XmlTextReader(inputurl);
        //    while (reader.Read())
        //    {

        //        reader.ReadToFollowing("productDetails");
        //        while (reader.ReadToFollowing("manufacturer"))
        //        {
        //            label_Manufacturer.Text = reader.ReadElementString("manufacturer");
        //            reader.ReadToFollowing("storeSpecific");
        //            reader.ReadToFollowing("store");
        //            label_store.Text = reader.ReadElementString("store");
        //            label_productName.Text = reader.ReadElementString("name");
        //            while (reader.Read())
        //            {
        //                label_productdescription.Text = reader.Value;
        //                break;
        //            }
        //            while (reader.ReadToFollowing("finalPrice"))
        //            {
        //                label_Price.Text = reader.ReadElementString("finalPrice"); break;
        //            }
        //            reader.ReadToFollowing("availabilityDescription");
        //            if (reader.Name == "availabilityDescription") //
        //            {
        //                label_availabilityDescription.Text = reader.ReadElementString("availabilityDescription");
        //            }
        //            reader.ReadToFollowing("image");
        //            reader.ReadToFollowing("xlg");
        //            if (reader.Name == "xlg") //
        //            {
        //                imageSourceUrl.ImageUrl = reader.ReadElementString("xlg"); break;
        //            }
        //        }
        //    }
        //    reader.Dispose();
        //}

        #endregion
        #region new  used   GET AND DISPLAY
        public void SelectedMultipleDisplay2(PlaceHolder placeholder1)
        {
            // save is an arraylist that contains EDP #


            placeholder1.Controls.Clear();
            for (int i = 0; i < productName.Count; i++)
            {
                #region Naming , Creation of LAbel
                Label label_ProductName = new Label();
                label_ProductName.ID = "label_ProductName" + i;
                Label label_Store = new Label();
                label_Store.ID = "label_Store" + i;
                Label label_Description = new Label();
                label_Description.ID = "label_Description" + i;
                Label label_Price = new Label();
                label_Price.ID = "label_Price" + i;
                Image Image_url = new Image();
                Image_url.ID = "Image_ID" + i;
                Label label_Manufacturer = new Label();
                label_Manufacturer.ID = "label_Manufacturer" + i;
                Label label_Availability = new Label();
                label_Availability.ID = "label_Availability" + i;
                PlaceHolder ph = new PlaceHolder();
                ph.ID = "placeHold" + i;
                #endregion Naming , Creation of LAbel

                #region  IMPLEMENTATION
                Image_url.Height        = 200;
                Image_url.Width         = 200;
                Image_url.CssClass      = "img-responsive ";
                Image_url.AlternateText = "No Image";
                //<----------  IMPLEMENT ----------->
                Image_url.ImageUrl      = imageurl[i];
                label_ProductName.Text  = productName[i];
                label_Store.Text        = store[i];
                label_Description.Text  = productDescription[i];
                label_Price.Text        = price[i];
                label_Manufacturer.Text = Manufacturer[i];
                label_Availability.Text = availability[i];
                ph.Controls.Add(new LiteralControl("<label style = color:blue'></br>"));
                ph.Controls.Add(new LiteralControl("</br>"));
                ph.Controls.Add(new LiteralControl("</br>"));
                if (Image_url.ImageUrl == "NO IMAGE")
                {
                    Image_url.ImageUrl = "https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg";
                }
                ph.Controls.Add(Image_url);
                ph.Controls.Add(new LiteralControl("</br>"));
                ph.Controls.Add(new LiteralControl("<label style='color: blue'> Price: "));
                label_Price.ForeColor = System.Drawing.Color.Red;
                ph.Controls.Add(label_Price);
                ph.Controls.Add(new LiteralControl("</label></br>"));

                ph.Controls.Add(new LiteralControl("<label style='color: blue'> Name:</label> "));
                ph.Controls.Add(label_ProductName);

                ph.Controls.Add(new LiteralControl("</br>"));
                ph.Controls.Add(new LiteralControl("<label style='color: blue'> Store:</label> "));
                ph.Controls.Add(label_Store);
                ph.Controls.Add(new LiteralControl("</br>"));
                ph.Controls.Add(new LiteralControl("<label style='color: blue'> Description:</label> "));
                if (label_Description.Text == "N")
                {
                    label_Description.Text      = " No Description";
                    label_Description.ForeColor = System.Drawing.Color.DarkOrange;
                }
                ph.Controls.Add(label_Description);
                ph.Controls.Add(new LiteralControl("</br>"));
                ph.Controls.Add(new LiteralControl("<label style='color: blue'> Manufacturer:</label> "));
                ph.Controls.Add(label_Manufacturer);
                ph.Controls.Add(new LiteralControl("</br>"));
                ph.Controls.Add(new LiteralControl("<label style='color: blue'>Availability: "));
                #region Availability Condition
                if (label_Availability.Text == "Temporarily out of stock. Order today and we'll deliver when available.")
                {
                    label_Availability.ForeColor = System.Drawing.Color.DarkOrange;
                }
                else if (label_Availability.Text == "In stock. Usually ships next business day.")
                {
                    label_Availability.ForeColor = System.Drawing.Color.ForestGreen;
                }
                else if (label_Availability.Text == "Sold Out")
                {
                    label_Availability.ForeColor = System.Drawing.Color.Red;
                }
                #endregion
                ph.Controls.Add(label_Availability);
                ph.Controls.Add(new LiteralControl("</label></br>"));
                ph.Controls.Add(new LiteralControl("</br></label>"));
                #endregion IMPLEMENTATION
                placeholder1.Controls.Add(ph);
            }
        }
        /// <summary> Adds the controls for this result viewer to the place holder on the main form </summary>
        /// <param name="placeHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the the bulk of the result viewer's output is displayed</param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Sorted tree with the results in hierarchical structure with volumes and issues under the titles and sorted by serial hierarchy </returns>
        public override void Add_HTML(PlaceHolder placeHolder, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Full_ResultsWriter.Add_HTML", "Loading item information");
            }

            //// If results are null, or no results, return empty string
            //if ((resultTable == null) || (resultTable.Title_Count == 0))
            //{
            //    return null;
            //}

            //// Start the results
            //StringBuilder resultsBldr = new StringBuilder();
            //resultsBldr.Append("<table width=\"100%\">\n");

            //// Determine which rows to display
            //int lastRow = base.LastRow;
            //int startRow = base.StartRow(lastRow);

            //// First, show the items WITH a value in the sort field
            //int withValue = resultTable.Filter_NonEmpties();

            //// Step through all the rows
            ////	int currRowIndex = -1;
            //bool empties = false;
            //int adjust = 0;
            //SobekCM_Item_Collection.SobekCM_Item_Group_Row titleRow = null;
            //List<SobekCM_Item_Collection.SobekCM_Item_Row> itemRows = new List<SobekCM_Item_Collection.SobekCM_Item_Row>();
            ////int i = currentMode.Page - 1;
            //int i = startRow;

            //// Readjust and filter empties next, if appropriate
            //if ((!empties) && (i >= withValue))
            //{
            //    empties = true;
            //    resultTable.Filter_Empties();
            //    adjust = withValue;
            //}

            //// Get the data rows for this
            //if (resultTable.Current_Sort.IndexOf("SortDate") >= 0)
            //{
            //    itemRows.Add(resultTable.GetItem(i - adjust));
            //    titleRow = itemRows[0].Parent_Row;
            //}
            //else
            //{
            //    titleRow = resultTable.GetRow(i - adjust);
            //    itemRows = titleRow.Child_Rows;
            //}

            //// Get the item from the all list
            //SobekCM_Item_Collection.SobekCM_Item_Row firstItemRow = ((SobekCM_Item_Collection.SobekCM_Item_Row)itemRows[0]);

            //// Pull the value from the table for the first item
            //Application_State.Single_Item dbItem = allItems.Item_By_Bib_VID(titleRow.BibID.ToUpper(), firstItemRow.VID, Tracer);
            //Application_State.Multiple_Volume_Item dbTitle = allItems.Title_By_Bib(titleRow.BibID.ToUpper());

            //// Read this item information
            //Item.SobekCM_METS_Based_ItemBuilder builder = new SobekCM.Library.Items.SobekCM_METS_Based_ItemBuilder();
            //string mets_location = SobekCM_Library_Settings.Image_URL + dbTitle.File_Root + "/" + dbItem.VID_String;
            //SobekCM.Resource_Object.SobekCM_Item thisItem = builder.Build_Brief_Item(mets_location, Tracer);

            //if (thisItem != null)
            //{
            //    // Pull values from the database
            //    thisItem.Behaviors.GroupTitle = dbTitle.GroupTitle;
            //    thisItem.Web.AssocFilePath = dbTitle.File_Root + "/" + dbItem.VID_String;
            //    thisItem.Web.File_Root = String.Empty;
            //    thisItem.Behaviors.Image_Root = SobekCM_Library_Settings.Image_URL;
            //    thisItem.Behaviors.IP_Restriction_Membership = dbItem.IP_Range_Membership;

            //    string preview_citation = "PREVIEW CITATION";
            //    string preview_image = "PREVIEW IMAGE";
            //    string full_item = "FULL ITEM";
            //    string map_it = "MAP IT!";
            //    string full_item_link = base.currentMode.Base_URL + thisItem.BibID + "/" + thisItem.VID + base.Image_Redirect_Stem;

            //    // Is this restricted?
            //    bool restricted_by_ip = false;
            //    string restricted_message = String.Empty;
            //    if (dbItem.IP_Range_Membership > 0)
            //    {
            //        int comparison = dbItem.IP_Range_Membership & base.current_user_mask;
            //        if (comparison == 0)
            //        {
            //            restricted_by_ip = true;
            //            restricted_message = ipRestrictions[0].Item_Restricted_Statement;
            //            preview_image = "RESTRICTED";
            //        }
            //    }

            //    resultsBldr.AppendLine("<br />");
            //    resultsBldr.AppendLine("<table class=\"SobekDocumentDisplay\" cellpadding=\"2px\" cellspacing=\"0px\" width=\"630px\" align=\"center\" >");
            //    resultsBldr.AppendLine("  <tr>");
            //    resultsBldr.AppendLine("    <td>");
            //    resultsBldr.AppendLine("      <div class=\"SobekDocumentHeader\">");
            //    resultsBldr.AppendLine("        <table cellspacing=\"6px\">");

            //    string mainTitleCompare = thisItem.Bib_Info.Main_Title.ToString().ToUpper().Replace(".", "").Replace("&QUOT;", "").Replace("&AMP;", "").Replace("&", "").Replace("\"", "").Replace(">","").Replace("<","").Trim();
            //    string groupTitleCompare = thisItem.Behaviors.GroupTitle.ToUpper().Replace(".", "").Replace("&QUOT;", "").Replace("&AMP;", "").Replace("&", "").Replace("\"", "").Replace(">", "").Replace("<", "").Trim();
            //    if (mainTitleCompare != groupTitleCompare)
            //    {
            //        resultsBldr.AppendLine("          <tr valign=\"top\">");
            //        resultsBldr.AppendLine("            <td width=\"30px\"> </td>");
            //        resultsBldr.AppendLine("            <td><b>Group Title: </b></td>");
            //        resultsBldr.AppendLine("            <td align=\"left\">" + thisItem.Behaviors.GroupTitle.Replace("<","&lt;").Replace(">","&gt;") + "</td>");
            //        resultsBldr.AppendLine("          </tr>");
            //    }

            //    resultsBldr.AppendLine("          <tr valign=\"top\">");
            //    resultsBldr.AppendLine("            <td width=\"30px\"> </td>");
            //    resultsBldr.AppendLine("            <td><b>Title: </b></td>");
            //    resultsBldr.AppendLine("            <td align=\"left\">" + thisItem.Bib_Info.Main_Title.ToString() + "</td>");
            //    resultsBldr.AppendLine("          </tr>");

            //    resultsBldr.AppendLine("          <tr valign=\"top\">");
            //    resultsBldr.AppendLine("            <td width=\"30px\"> </td>");
            //    resultsBldr.AppendLine("            <td><b>Full Item: </b></td>");
            //    resultsBldr.AppendLine("            <td align=\"left\"><a href=\"" + full_item_link + "\">Click for full item</a></td>");
            //    resultsBldr.AppendLine("          </tr>");

            //    resultsBldr.AppendLine("        </table>");
            //    resultsBldr.AppendLine("      </div>");

            //    // If this is for an image, but it doesn't exist, skip it
            //    bool skip_image = false;
            //    if (thisItem.Behaviors.Main_Page.FileName.Length == 0)
            //    {
            //        skip_image = true;
            //    }

            //    resultsBldr.AppendLine("      <div class=\"SobekViewSelectRow\">");

            //    if ((currentMode.Result_Display_Type == SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Citation) || ( skip_image ))
            //    {
            //        resultsBldr.AppendLine("        <img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cL_s.gif\" /><span class=\"tab_s\"> " + preview_citation + " </span><img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cR_s.gif\" />");
            //    }
            //    else
            //    {
            //        currentMode.Result_Display_Type = SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Citation;
            //        resultsBldr.AppendLine("        <a href=\"" + currentMode.Redirect_URL() + "#image\"> <img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cL.gif\" /><span class=\"tab\"> " + preview_citation + " </span><img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cR.gif\" /> </a>");
            //        currentMode.Result_Display_Type = SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Image;
            //    }

            //    if (!skip_image)
            //    {
            //        if (currentMode.Result_Display_Type == SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Image)
            //        {
            //            resultsBldr.AppendLine("        <img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cL_s.gif\" /><span class=\"tab_s\"> " + preview_image + " </span><img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cR_s.gif\" />");
            //        }
            //        else
            //        {
            //            currentMode.Result_Display_Type = SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Image;
            //            resultsBldr.AppendLine("        <a href=\"" + currentMode.Redirect_URL() + "#image\"> <img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cL.gif\" /><span class=\"tab\"> " + preview_image + " </span><img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cR.gif\" /> </a>");
            //            currentMode.Result_Display_Type = SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Citation;
            //        }
            //    }
            //    resultsBldr.AppendLine("        <a href=\"" + full_item_link + "\"> <img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cL.gif\" /><span class=\"tab\"> " + full_item + " </span><img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cR.gif\" /> </a>");

            //    if ((( thisItem.Bib_Info.hasCoordinateInformation ) && ((thisItem.Bib_Info.Coordinates.Point_Count > 0) || (thisItem.Bib_Info.Coordinates.Polygon_Count > 0)))
            //        || (( dbItem.Spatial_KML != null ) && ( dbItem.Spatial_KML.Length > 0 )))
            //    {
            //        if ( !restricted_by_ip )
            //            resultsBldr.AppendLine("        <a href=\"" + full_item_link + "\"> <img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cL.gif\" /><span class=\"tab\"> " + map_it + " </span><img src=\"" + currentMode.Base_URL + "design/skins/" + currentMode.Base_Skin + "/tabs/cR.gif\" /> </a>");
            //    }

            //    resultsBldr.AppendLine("      </div>");
            //    resultsBldr.AppendLine("    </td>");
            //    resultsBldr.AppendLine("  </tr>");

            //    resultsBldr.AppendLine("  <tr>");

            //    if ((currentMode.Result_Display_Type == SobekCM.Library.Navigation.Result_Display_Type_Enum.Full_Image) && ( !skip_image ))
            //    {
            //        if (restricted_by_ip)
            //        {
            //            resultsBldr.AppendLine("    <td align=\"left\" colspan=\"3\">");
            //            resultsBldr.AppendLine("       " + restricted_message);
            //            resultsBldr.AppendLine("    </td>");
            //        }
            //        else
            //        {
            //            resultsBldr.AppendLine("    <td align=\"center\" colspan=\"3\">");
            //            string image_link = SobekCM_Library_Settings.Image_URL + thisItem.Web.AssocFilePath + "/" + thisItem.Behaviors.Main_Page.FileName;
            //            resultsBldr.AppendLine("      <a href=\"" + full_item_link + "\"><img border=\"0\" src=\"" + image_link + "\" /></a>");
            //            resultsBldr.AppendLine("    </td>");
            //        }
            //    }
            //    else
            //    {
            //        resultsBldr.AppendLine("    <td class=\"SobekCitationDisplay\">");
            //        resultsBldr.AppendLine("      <div class=\"SobekCitation\">");
            //        ItemViewer.Viewers.Citation_ItemViewer citationViewer = new SobekCM.Library.ItemViewer.Viewers.Citation_ItemViewer(languageSupport, null, false);
            //        citationViewer.CurrentItem = thisItem;
            //        citationViewer.CurrentMode = currentMode;
            //        resultsBldr.AppendLine(citationViewer.Standard_Citation_String(false, Tracer));
            //        resultsBldr.AppendLine("      </div>");
            //        resultsBldr.AppendLine("    </td>");

            //    }
            //    resultsBldr.AppendLine("  </tr>");

            //    resultsBldr.AppendLine("</table>");
            //    resultsBldr.AppendLine("<br />");

            //    System.Web.UI.LiteralControl newLiteral = new System.Web.UI.LiteralControl();
            //    newLiteral.Text = resultsBldr.ToString();
            //    placeHolder.Controls.Add(newLiteral);
            //}
            //else
            //{
            //    StringBuilder errorBldr = new StringBuilder();

            //    errorBldr.Append("<br /><br />");
            //    errorBldr.Append("<b>An error was encountered while opening this digital resource.</b>");
            //    errorBldr.Append("<br /><br />");

            //    System.Web.UI.LiteralControl errorLiteral = new System.Web.UI.LiteralControl();
            //    errorLiteral.Text = errorBldr.ToString();
            //    placeHolder.Controls.Add(errorLiteral);
            //}
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        SetBrowserClass();
        AddNoCacheTag();
        HideMessages();

        MainTextResString = "LogonForm.LogOn";

        // Ensure the refresh script
        const string defaultCondition = "((top.frames['cmsdesktop'] != null) || (top.frames['propheader'] != null))";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "TopWindow", ScriptHelper.GetScript(" if " + defaultCondition + " { try {top.window.location.reload();} catch(err){} }"));

        // Enable caps lock check
        if (ValidationHelper.GetBoolean(Service.Resolve <IAppSettingsService>()["CMSUseCapsLockNotification"], true))
        {
            RegisterCAPSLOCKScript();
            TextBox txtPassword = (TextBox)Login1.FindControl("Password");
            if (txtPassword != null)
            {
                txtPassword.Attributes.Add("onkeypress", "CheckCapsLock(event)");
            }
        }

        LocalizedLabel lblItem = (LocalizedLabel)Login1.FindControl("lblUserName");

        if (lblItem != null)
        {
            lblItem.Text = "{$LogonForm.UserName$}";
        }
        lblItem = (LocalizedLabel)Login1.FindControl("lblPassword");
        if (lblItem != null)
        {
            lblItem.Text = "{$LogonForm.Password$}";
        }

        // Display culture link due to value of the key stored in the web.config file
        bool showCultureSelector = ValidationHelper.GetBoolean(Service.Resolve <IAppSettingsService>()["CMSShowLogonCultureSelector"], true);

        if (showCultureSelector)
        {
            LocalizedLinkButton lnkLanguage = (LocalizedLinkButton)Login1.FindControl("lnkLanguage");
            if (lnkLanguage != null)
            {
                lnkLanguage.Visible = true;

                // Ensure language selection panel functionality
                HtmlGenericControl pnlLanguage = (HtmlGenericControl)Login1.FindControl("pnlLanguage");
                if (pnlLanguage != null)
                {
                    ltlScript.Text = ScriptHelper.GetScript("function ShowLanguage(id){var panel=document.getElementById(id);if(panel!=null){panel.style.display=(panel.style.display == 'block')?'none':'block';}}");
                    lnkLanguage.Attributes.Add("onclick", "ShowLanguage('" + pnlLanguage.ClientID + "'); return false;");
                }
            }
        }

        // Set up forgotten password link
        if (ShowForgottenPassword)
        {
            LocalizedLinkButton lnkPassword = (LocalizedLinkButton)Login1.FindControl("lnkPassword");
            if (lnkPassword != null)
            {
                lnkPassword.Visible = true;
                lnkPassword.Click  += lnkPassword_Click;
            }
        }

        PlaceHolder plcRememberMe = (PlaceHolder)Login1.FindControl("plcRememberMe");

        if ((MFAuthenticationHelper.IsMultiFactorAuthEnabled) && (plcRememberMe != null))
        {
            plcRememberMe.Visible = false;
        }


        LocalizedButton btnItem = (LocalizedButton)Login1.FindControl("LoginButton");

        if (btnItem != null)
        {
            btnItem.Text   = "{$LogonForm.LogOnButton$}";
            btnItem.Click += btnItem_Click;
        }

        // Load UI cultures for the dropdown list
        if (!RequestHelper.IsPostBack())
        {
            LoadCultures();
        }

        Login1.LoggingIn    += Login1_LoggingIn;
        Login1.LoggedIn     += Login1_LoggedIn;
        Login1.LoginError   += Login1_LoginError;
        Login1.Authenticate += Login1_Authenticate;

        if (!RequestHelper.IsPostBack())
        {
            Login1.UserName = QueryHelper.GetString("username", String.Empty);
        }

        // Ensure username textbox focus
        CMSTextBox txtUserName = (CMSTextBox)Login1.FindControl("UserName");

        if (txtUserName != null)
        {
            ScriptHelper.RegisterStartupScript(this, GetType(), "SetFocus", ScriptHelper.GetScript("var txt=document.getElementById('" + txtUserName.ClientID + "');if(txt!=null){txt.focus();}"));
            txtUserName.EnableAutoComplete = SecurityHelper.IsAutoCompleteEnabledForLogin(SiteContext.CurrentSiteName);
        }

        if (QueryHelper.GetBoolean("forgottenpassword", false))
        {
            SetForgottenPasswordMode();
        }

        // Register script to update logon error message
        StringBuilder sbScript = new StringBuilder();

        sbScript.Append(@"
var failedText_", ClientID, "= document.getElementById('", FailureLabel.ClientID, @"');

function UpdateLabel_", ClientID, @"(content, context) {
    var lbl = document.getElementById(context);   
    if(lbl)
    {
        lbl.innerHTML = content;
        lbl.className = """";
    }
}");
        ScriptHelper.RegisterClientScriptBlock(this, GetType(), "InvalidLogonAttempts_" + ClientID, sbScript.ToString(), true);
    }
        private void BindModuleControls()
        {
            string          preFix       = string.Empty;
            string          paneName     = string.Empty;
            string          ControlSrc   = string.Empty;
            string          phdContainer = string.Empty;
            string          PageSEOName  = string.Empty;
            SageUserControl suc          = new SageUserControl();

            suc.PagePath = PagePath;
            if (Request.QueryString["pgnm"] != null)
            {
                PageSEOName = Request.QueryString["pgnm"].ToString();
            }
            else
            {
                PageSEOName = "ManagePages";
            }
            PageSEOName = "ManagePages";
            string redirecPath = string.Empty;

            if (PageSEOName != string.Empty)
            {
                DataSet         dsPageSettings = new DataSet();
                SageFrameConfig sfConfig       = new SageFrameConfig();
                dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername);
                if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true)
                {    //checking IsPageAccessible true or false
                    if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true)
                    {
                        // Get ModuleControls data table
                        DataTable dtPages = dsPageSettings.Tables[1];
                        if (dtPages != null && dtPages.Rows.Count > 0)
                        {
                            OverridePageInfo(dtPages);
                        }

                        // Get ModuleDefinitions data table
                        DataTable dtPageModule = dsPageSettings.Tables[2];
                        if (dtPageModule != null && dtPageModule.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtPageModule.Rows.Count; i++)
                            {
                                paneName = dtPageModule.Rows[i]["PaneName"].ToString();
                                if (string.IsNullOrEmpty(paneName))
                                {
                                    paneName = "ContentPane";
                                }
                                string strUserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString();
                                ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString();
                                string      SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString();
                                PlaceHolder phdPlaceHolder           = (PlaceHolder)this.FindControl(paneName);
                                if (phdPlaceHolder != null)
                                {
                                    phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, strUserModuleID);
                                }
                                // AddModuleCssToPage(ControlSrc, false);
                            }
                        }
                    }
                    else
                    {
                        if (IsUseFriendlyUrls)
                        {
                            if (GetPortalID > 1)
                            {
                                redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx");
                            }
                            else
                            {
                                redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx");
                            }
                        }
                        else
                        {
                            redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible));
                        }
                        Response.Redirect(redirecPath);
                    }
                }
                else
                {
                    if (IsUseFriendlyUrls)
                    {
                        if (GetPortalID > 1)
                        {
                            redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx");
                        }
                        else
                        {
                            redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx");
                        }
                    }
                    else
                    {
                        redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound));
                    }
                    Response.Redirect(redirecPath);
                }
            }

            HttpContext.Current.Session["ModuleCss"] = null;
            HttpContext.Current.Session["ModuleJs"]  = null;
        }
    /// <summary>
    /// UniGrid external data bound.
    /// </summary>
    protected object GridOnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLower())
        {
            case "update":
                PlaceHolder plcUpd = new PlaceHolder();
                plcUpd.ID = "plcUdateAction";

                // Add disabled image
                ImageButton imgUpdate = new ImageButton();
                imgUpdate.ID = "imgUpdate";

                if (!this.Enabled || !this.EnableUpdate)
                {
                    imgUpdate.ImageUrl = ResolveUrl(GetImageUrl("Design/Controls/DirectUploader/uploaddisabled.png", IsLiveSite));
                    imgUpdate.Style.Add("cursor", "default");
                    imgUpdate.Enabled = false;
                }
                else
                {
                    imgUpdate.Visible = false;
                }

                plcUpd.Controls.Add(imgUpdate);

                // Dynamically load uploader control
                DirectFileUploader dfuElem = Page.LoadControl("~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploader.ascx") as DirectFileUploader;

                // Set uploader's properties
                if (dfuElem != null)
                {
                    if (this.Enabled && this.EnableUpdate)
                    {
                        dfuElem.ID = "dfuElem" + this.LibraryID;
                        dfuElem.DisplayInline = true;
                        dfuElem.SourceType = MediaSourceEnum.MediaLibraries;
                        dfuElem.MediaFileID = this.MediaFileID;
                        dfuElem.LibraryID = this.LibraryID;
                        dfuElem.LibraryFolderPath = this.LibraryFolderPath;
                        dfuElem.ParentElemID = this.ClientID;
                        dfuElem.IsMediaThumbnail = this.IsMediaThumbnail;
                        dfuElem.ImageUrl = ResolveUrl(GetImageUrl("Design/Controls/DirectUploader/upload.png", IsLiveSite));
                        dfuElem.ImageHeight = 16;
                        dfuElem.ImageWidth = 16;
                        dfuElem.InsertMode = false;
                        dfuElem.ForceLoad = true;
                        dfuElem.IsLiveSite = IsLiveSite;
                        // New settings added
                        dfuElem.UploadMode = MultifileUploaderModeEnum.DirectSingle;
                        dfuElem.Height = 16;
                        dfuElem.Width = 16;
                        dfuElem.MaxNumberToUpload = 1;
                    }
                    else
                    {
                        dfuElem.Visible = false;
                    }

                    plcUpd.Controls.Add(dfuElem);
                }
                return plcUpd;

            case "edit":
                // Get file extension
                if ((this.FileInfo != null) && (this.LibraryInfo != null))
                {
                    ImageButton img = (ImageButton)sender;

                    if (CMSContext.CurrentUser.IsAuthenticated())
                    {
                        string fileExt = (this.IsMediaThumbnail ? previewExt : this.FileInfo.FileExtension);

                        // If the file is not an image don't allow image editing
                        if (!ImageHelper.IsSupportedByImageEditor(fileExt) || !this.Enabled)
                        {
                            // Disable edit icon in case that attachment is not an image
                            img.ImageUrl = ResolveUrl(GetImageUrl("Design/editdisabled.png", IsLiveSite));
                            img.Enabled = false;
                            img.Style.Add("cursor", "default");
                        }
                        else
                        {
                            string query = string.Format("?refresh=1&siteid={0}&MediaFileGUID={1}{2}", LibraryInfo.LibrarySiteID, FileInfo.FileGUID, (IsMediaThumbnail ? "&isPreview=1" : ""));
                            query = URLHelper.AddUrlParameter(query, "hash", QueryHelper.GetHash(query));
                            img.OnClientClick = "EditThumbnailImage('" + query + "'); return false;";
                        }
                        img.AlternateText = GetString("general.edit");
                    }
                    else
                    {
                        img.Visible = false;
                    }
                }
                break;

            case "delete":
                ImageButton imgDelete = (ImageButton)sender;

                if (!this.Enabled)
                {
                    // Disable delete icon in case that editing is not allowed
                    imgDelete.ImageUrl = ResolveUrl(GetImageUrl("Design/deletedisabled.png", IsLiveSite));
                    imgDelete.Enabled = false;
                    imgDelete.Style.Add("cursor", "default");
                }
                else
                {
                    // Turn off validation
                    imgDelete.CausesValidation = false;

                    // Explicitly initialize confirmation
                    imgDelete.OnClientClick = "if (DeleteConfirmation() == false) { return false; }";
                }

                break;

            case "filename":
                if ((this.LibraryInfo != null) && (this.FileInfo != null))
                {
                    string fileUrl = "";
                    string fileExt = "";
                    string fileName = "";

                    // Get file extension
                    if (this.IsMediaThumbnail)
                    {
                        fileName = previewName;
                        fileExt = previewExt;
                        fileUrl = ResolveUrl("~/CMSPages/GetMediaFile.aspx?preview=1&fileguid=" + this.FileInfo.FileGUID.ToString());
                    }
                    else
                    {
                        fileExt = this.FileInfo.FileExtension;
                        fileName = this.FileInfo.FileName;
                        fileUrl = MediaFileInfoProvider.GetMediaFileAbsoluteUrl(this.FileInfo.FileGUID, this.FileInfo.FileName);
                    }
                    fileUrl = URLHelper.UpdateParameterInUrl(fileUrl, "chset", Guid.NewGuid().ToString());

                    string tooltip = null;
                    string iconUrl = GetFileIconUrl(fileExt, "List");
                    bool isImage = ImageHelper.IsImage(fileExt);

                    if (isImage)
                    {
                        tooltip = "";

                        if (File.Exists(previewPath))
                        {
                            FileStream file = FileStream.New(previewPath, FileMode.Open, FileAccess.Read);
                            System.Drawing.Image img = System.Drawing.Image.FromStream(file.SystemStream);
                            file.Close();
                            if (img != null)
                            {
                                int[] imgDims = ImageHelper.EnsureImageDimensions(0, 0, 150, img.Width, img.Height);
                                string setRTL = (CultureHelper.IsUICultureRTL() ? ", LEFT, true" : "");
                                tooltip = "onmouseout=\"UnTip()\" onmouseover=\"Tip('<div style=\\'width:" + imgDims[0] + "px; text-align:center;\\'><img src=\\'" + URLHelper.AddParameterToUrl(fileUrl, "maxsidesize", "150") + "\\' alt=\\'" + fileName + "\\' /></div>'" + setRTL + ")\"";
                                // Dispose image
                                img.Dispose();
                            }
                        }
                    }

                    string imageTag = "<img class=\"Icon\" src=\"" + iconUrl + "\" alt=\"" + fileName + "\" />";
                    if (isImage)
                    {
                        return "<a href=\"#\" onclick=\"javascript: window.open('" + fileUrl + "'); return false;\"><span " + tooltip + ">" + imageTag + fileName + "</span></a>";
                    }
                    else
                    {
                        return "<a href=\"" + fileUrl + "\">" + imageTag + fileName + "</a>";
                    }
                }

                return "";

            case "filesize":
                return DataHelper.GetSizeString(ValidationHelper.GetLong(parameter, 0));
        }

        return parameter;
    }
Exemple #54
0
        private void AddSettingsControls(BlockCache block, PlaceHolder pnlLayoutItem)
        {
            var additionalSettings = block.AdditionalSettings.FromJsonOrNull <AdditionalBlockSettings>() ?? new AdditionalBlockSettings();

            var markup = new StringBuilder();

            if (additionalSettings.ProcessLavaOnServer && additionalSettings.ProcessLavaOnClient)
            {
                markup.Append("<i class='fa fa-fire-alt margin-r-sm color-danger' data-toggle='tooltip' data-placement='top' title='Lava will run on both the server and then again on the client.'></i>");
            }
            else if (additionalSettings.ProcessLavaOnServer)
            {
                markup.Append("<i class='fa fa-fire-alt margin-r-sm color-info color-primary' data-toggle='tooltip' data-placement='top' title='Lava will run on server.'></i>");
            }
            else if (additionalSettings.ProcessLavaOnClient)
            {
                markup.Append("<i class='fa fa-fire-alt margin-r-sm color-success' data-toggle='tooltip' data-placement='top' title='Lava will run on client.'></i>");
            }

            if (additionalSettings.CacheDuration != 0)
            {
                markup.Append(string.Format("<i class='fa fa-memory margin-r-sm' data-toggle='tooltip' data-placement='top' title='Cache is set to {0} seconds.'></i> ", additionalSettings.CacheDuration));
            }
            else
            {
                markup.Append("<i class='fa fa-memory margin-r-sm o-30' data-toggle='tooltip' data-placement='top' title='Cache not set.'></i> ");
            }

            // Show on phone
            if (additionalSettings.ShowOnPhone)
            {
                markup.Append("<i class='fa fa-mobile-alt margin-r-sm' data-toggle='tooltip' data-placement='top' title='Will show on phones.'></i> ");
            }
            else
            {
                markup.Append("<i class='fa fa-mobile-alt margin-r-sm o-30' data-toggle='tooltip' data-placement='top' title='Will not show on phones.'></i> ");
            }

            // Show on tablet
            if (additionalSettings.ShowOnTablet)
            {
                markup.Append("<i class='fa fa-tablet-alt margin-r-sm' data-toggle='tooltip' data-placement='top' title='Will show on tablets.'></i> ");
            }
            else
            {
                markup.Append("<i class='fa fa-mobile-alt margin-r-sm o-30' data-toggle='tooltip' data-placement='top' title='Will not show on tablet.'></i> ");
            }

            // Requires Internet
            if (additionalSettings.RequiresNetwork)
            {
                if (additionalSettings.NoNetworkContent.IsNullOrWhiteSpace())
                {
                    markup.Append("<i class='fa fa-wifi margin-r-sm color-warning' data-toggle='tooltip' data-placement='top' title='Requires internet, but no warning content is provided.'></i> ");
                }
                else
                {
                    markup.Append(string.Format("<i class='fa fa-wifi margin-r-sm' data-toggle='tooltip' data-placement='top' title='Requires internet. Content: {0}...'></i> ", additionalSettings.NoNetworkContent.Left(250)));
                }
            }
            else
            {
                markup.Append("<i class='fa fa-wifi margin-r-sm o-30' data-toggle='tooltip' data-placement='top' title='Does not require internet.'></i> ");
            }

            pnlLayoutItem.Controls.Add(new Literal {
                Text = markup.ToString()
            });
        }
Exemple #55
0
    protected void buildInventoryDetails_Graphicsold(string listName, SqlXml sqlXMLValue, PlaceHolder placeHolderName,int listNumber) 
    
    {

       
        Literal invtabLI = new Literal();
        invtabLI.Text = "<li><a href='#UpdatePanel" + listNumber + "'><span>" + CommonFunctions.CvtNullSpaces(listName) + "</span></a></li> ";
        placeHolderInvContainer.Controls.Add(invtabLI);  

        int i = 0;
        int row = 0;

        if (!sqlXMLValue.IsNull)
        {
            XmlReader xmlreader = sqlXMLValue.CreateReader();
            LiteralControl defListStart = new LiteralControl ( "<dl>");
            placeHolderName.Controls.Add(defListStart);
            while (xmlreader.Read())
            {
                if (xmlreader.MoveToContent() == XmlNodeType.Element && xmlreader.Name == "item")
                {
                    LiteralControl itemLitrealControl = new LiteralControl 
                        ("<dt>" + xmlreader.ReadString() + "</dt>");
                    placeHolderName.Controls.Add(itemLitrealControl);
                    i += 1;
                    row += 1;
                }
                LiteralControl externalstaLitrealControl = new LiteralControl("<dd>");
                placeHolderName.Controls.Add(externalstaLitrealControl);
                if (xmlreader.MoveToContent() == XmlNodeType.Element && xmlreader.Name == "desc")
                {
                    i += 1;
                    LiteralControl itemLitrealControl = new LiteralControl
                        (xmlreader.ReadString() );
                    placeHolderName.Controls.Add(itemLitrealControl);
                }
                if (xmlreader.MoveToContent() == XmlNodeType.Element && xmlreader.Name == "cost")
                {
                    i += 1;
                    string xmlcost = xmlreader.ReadString();
                    if (string.IsNullOrEmpty(xmlcost))
                    {
                        LiteralControl itemLitrealControl = new LiteralControl
                            (xmlcost);
                        placeHolderName.Controls.Add(itemLitrealControl);
                    }
                }
                LiteralControl externalEndLitrealControl = new LiteralControl("</dd>");
                placeHolderName.Controls.Add(externalEndLitrealControl);
            }

            xmlreader.Close();
            LiteralControl defListend = new LiteralControl("</dl>");
            placeHolderName.Controls.Add(defListend);

        }


    }
Exemple #56
0
        /// <summary>
        /// Adds the admin controls.
        /// </summary>
        /// <param name="block">The block.</param>
        /// <param name="pnlLayoutItem">The PNL layout item.</param>
        private void AddAdminControls(BlockCache block, PlaceHolder pnlLayoutItem)
        {
            Panel pnlAdminButtons = new Panel {
                ID = "pnlBlockConfigButtons", CssClass = "pull-right actions"
            };

            // Block Properties
            var btnBlockProperties = new Literal
            {
                Text = string.Format(@"<a title='Block Properties' class='btn btn-sm btn-default btn-square properties' href='javascript: Rock.controls.modal.show($(this), ""/BlockProperties/{0}?t=Block Properties"")' height='500px'><i class='fa fa-cog'></i></a>", block.Id)
            };

            pnlAdminButtons.Controls.Add(btnBlockProperties);

            // Block Security
            int entityTypeBlockId = EntityTypeCache.Get <Rock.Model.Block>().Id;
            var btnBlockSecurity  = new SecurityButton
            {
                ID           = "btnBlockSecurity",
                EntityTypeId = entityTypeBlockId,
                EntityId     = block.Id,
                Title        = "Edit Security"
            };

            btnBlockSecurity.AddCssClass("btn btn-sm btn-square btn-security");
            pnlAdminButtons.Controls.Add(btnBlockSecurity);

            // Delete Block
            LinkButton btnDeleteBlock = new LinkButton
            {
                ID              = string.Format("btnDeleteBlock_{0}", block.Id),
                CommandName     = "Delete",
                CommandArgument = block.Id.ToString(),
                CssClass        = "btn btn-sm btn-square btn-danger",
                Text            = "<i class='fa fa-times'></i>",
                ToolTip         = "Delete Block"
            };

            btnDeleteBlock.Attributes["onclick"] = string.Format("javascript: return Rock.dialogs.confirmDelete(event, '{0}');", Block.FriendlyTypeName);

            pnlAdminButtons.Controls.Add(btnDeleteBlock);

            pnlLayoutItem.Controls.Add(pnlAdminButtons);

            RockBlock blockControl = null;
            IEnumerable <WebControl> customAdminControls = new List <WebControl>();

            try
            {
                if (!string.IsNullOrWhiteSpace(block.BlockType.Path))
                {
                    blockControl = TemplateControl.LoadControl(block.BlockType.Path) as RockBlock;
                }
                else if (block.BlockType.EntityTypeId.HasValue)
                {
                    var blockEntity = Activator.CreateInstance(block.BlockType.EntityType.GetEntityType());

                    var wrapper = new RockBlockTypeWrapper
                    {
                        Page  = RockPage,
                        Block = (Rock.Blocks.IRockBlockType)blockEntity
                    };

                    wrapper.InitializeAsUserControl(RockPage);
                    wrapper.AppRelativeTemplateSourceDirectory = "~";

                    blockControl = wrapper;
                }

                blockControl.SetBlock(block.Page, block, true, true);
                var      adminControls           = blockControl.GetAdministrateControls(true, true);
                string[] baseAdminControlClasses = new string[4] {
                    "properties", "security", "block-move", "block-delete"
                };
                customAdminControls = adminControls.OfType <WebControl>().Where(a => !baseAdminControlClasses.Any(b => a.CssClass.Contains(b)));
            }
            catch (Exception ex)
            {
                // if the block doesn't compile, just ignore it since we are just trying to get the admin controls
                Literal lblBlockError = new Literal();
                lblBlockError.Text = string.Format("<span class='label label-danger'>ERROR: {0}</span>", ex.Message);
                pnlLayoutItem.Controls.Add(lblBlockError);
            }

            foreach (var customAdminControl in customAdminControls)
            {
                if (customAdminControl is LinkButton)
                {
                    LinkButton btn = customAdminControl as LinkButton;
                    if (btn != null)
                    {
                        // ensure custom link button looks like a button
                        btn.AddCssClass("btn");
                        btn.AddCssClass("btn-sm");
                        btn.AddCssClass("btn-default");
                        btn.AddCssClass("btn-square");

                        // some admincontrols will toggle the BlockConfig bar, but this isn't a block config bar, so remove the javascript
                        if (btn.Attributes["onclick"] != null)
                        {
                            btn.Attributes["onclick"] = btn.Attributes["onclick"].Replace("Rock.admin.pageAdmin.showBlockConfig()", string.Empty);
                        }
                    }
                }

                pnlLayoutItem.Controls.Add(customAdminControl);
            }

            if (customAdminControls.Any() && blockControl != null)
            {
                pnlBlocksHolder.Controls.Add(blockControl);
            }
        }
 /// <summary>
 ///     Looks for the respective Option in the supplied Placeholder control, and returns a list of IDs for the selected
 ///     items in the Option.
 /// </summary>
 /// <param name="ph">The Placeholder object to look through for this Option and it's items.</param>
 /// <param name="prefix">
 ///     (optional) When supplied, this value is used to help identify the Option control in the
 ///     placeholder.
 /// </param>
 /// <returns>A listing of the items selected in the Option.</returns>
 public OptionSelection ParseFromPlaceholder(PlaceHolder ph, string prefix = null)
 {
     return(Processor.ParseFromPlaceholder(this, ph, prefix));
 }
Exemple #58
0
 /// <summary> Allows controls to be added directory to a place holder, rather than just writing to the output HTML stream </summary>
 /// <param name="MainPlaceHolder"> Main place holder ( &quot;mainPlaceHolder&quot; ) in the itemNavForm form into which the bulk of the item viewer's output is displayed</param>
 /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
 /// <remarks> This method does nothing, since nothing is added to the place holder as a control for this item viewer </remarks>
 public override void Add_Main_Viewer_Section(PlaceHolder MainPlaceHolder, Custom_Tracer Tracer)
 {
     // Do nothing
 }
    /// <summary>
    /// UniGrid data bound.
    /// </summary>
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        CMSAccessibleButton btn = null;

        DataRowView drv = parameter as DataRowView;
        switch (sourceName.ToLowerCSafe())
        {
            // Display delete button
            case "delete":
                btn = (CMSGridActionButton)sender;
                btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                                  ClientID,
                                                  btn.CommandArgument,
                                                  Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "Delete", null));

                // Display delete button only for users with appropriate permission
                if (SiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
                {
                    drv = ((GridViewRow)parameter).DataItem as DataRowView;
                    if (ValidationHelper.GetInteger(drv["AccountSiteID"], 0) > 0)
                    {
                        btn.Enabled = modifySite;
                    }
                    else
                    {
                        btn.Enabled = modifyGlobal;
                    }
                }
                else
                {
                    btn.Enabled = modifyPermission;
                }
                if (!btn.Enabled)
                {
                    btn.Enabled = false;
                }
                break;

            // Display information if account is merged
            case "accountmergedwithaccountid":
                int mergedIntoSite = ValidationHelper.GetInteger(drv["AccountMergedWithAccountID"], 0);
                int mergedIntoGlobal = ValidationHelper.GetInteger(drv["AccountGlobalAccountID"], 0);
                int siteID = ValidationHelper.GetInteger(drv["AccountSiteID"], 0);
                if (((siteID > 0) && (mergedIntoSite > 0)) || ((siteID == 0) && (mergedIntoGlobal > 0)))
                {
                    return GetString("general.yes");
                }
                return null;

            case "primarycontactname":
                string name = ValidationHelper.GetString(drv["PrimaryContactFullName"], "");
                if (!string.IsNullOrEmpty(name.Trim()))
                {
                    string contactDetailsDialogURL = UIContextHelper.GetElementDialogUrl(ModuleName.ONLINEMARKETING, "EditContact", ValidationHelper.GetInteger(drv["AccountPrimaryContactID"], 0));

                    var placeholder = new PlaceHolder();
                    placeholder.Controls.Add(new Label
                    {
                        Text = HTMLHelper.HTMLEncode(name),
                        CssClass = "contactmanagement-accountlist-primarycontact"
                    });

                    placeholder.Controls.Add(new CMSGridActionButton
                    {
                        IconCssClass = "icon-edit",
                        OnClientClick = ScriptHelper.GetModalDialogScript(contactDetailsDialogURL, "ContactDetail"),
                        ToolTip = GetString("om.contact.viewdetail")
                    });

                    return placeholder;
                }
                return null;
        }
        return null;
    }
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
            // Load dashboard content
            if (helper.Request("app") != "")
            {
                _section = helper.Request("app");
            }
            else if (getUser().Applications.Length > 0)
            {
                _section = "default";
            }
            else
            {
                _section = getUser().Applications[0].alias;
            }

            XmlDocument dashBoardXml = new XmlDocument();

            dashBoardXml.Load(IOHelper.MapPath(SystemFiles.DashboardConfig));

            // test for new tab interface
            foreach (XmlNode section in dashBoardXml.DocumentElement.SelectNodes("//section [areas/area = '" + _section.ToLower() + "']"))
            {
                if (section != null && validateAccess(section))
                {
                    Panel2.Visible        = false;
                    dashboardTabs.Visible = true;

                    foreach (XmlNode entry in section.SelectNodes("./tab"))
                    {
                        if (validateAccess(entry))
                        {
                            TabPage tab = dashboardTabs.NewTabPage(entry.Attributes.GetNamedItem("caption").Value);
                            tab.HasMenu = true;
                            tab.Style.Add("padding", "0 10px");

                            foreach (XmlNode uc in entry.SelectNodes("./control"))
                            {
                                if (validateAccess(uc))
                                {
                                    string control = getFirstText(uc).Trim(' ', '\r', '\n');
                                    string path    = IOHelper.FindFile(control);


                                    try
                                    {
                                        Control c = LoadControl(path);

                                        // set properties
                                        Type type = c.GetType();
                                        if (type != null)
                                        {
                                            foreach (XmlAttribute att in uc.Attributes)
                                            {
                                                string attributeName  = att.Name;
                                                string attributeValue = parseControlValues(att.Value).ToString();
                                                // parse special type of values


                                                PropertyInfo prop = type.GetProperty(attributeName);
                                                if (prop == null)
                                                {
                                                    continue;
                                                }

                                                prop.SetValue(c, Convert.ChangeType(attributeValue, prop.PropertyType),
                                                              null);
                                            }
                                        }

                                        //resolving files from dashboard config which probably does not map to a virtual fi
                                        tab.Controls.Add(AddPanel(uc, c));
                                    }
                                    catch (Exception ee)
                                    {
                                        tab.Controls.Add(
                                            new LiteralControl(
                                                "<p class=\"umbracoErrorMessage\">Could not load control: '" + path +
                                                "'. <br/><span class=\"guiDialogTiny\"><strong>Error message:</strong> " +
                                                ee.ToString() + "</span></p>"));
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (
                        XmlNode entry in dashBoardXml.SelectNodes("//entry [@section='" + _section.ToLower() + "']"))
                    {
                        PlaceHolder placeHolder = new PlaceHolder();
                        if (entry == null || entry.FirstChild == null)
                        {
                            placeHolder.Controls.Add(
                                CreateDashBoardWrapperControl(new LiteralControl("Error loading DashBoard Content")));
                        }
                        else
                        {
                            string path = IOHelper.FindFile(entry.FirstChild.Value);

                            try
                            {
                                placeHolder.Controls.Add(CreateDashBoardWrapperControl(LoadControl(path)));
                            }
                            catch (Exception err)
                            {
                                Trace.Warn("Dashboard", string.Format("error loading control '{0}'",
                                                                      path), err);
                                placeHolder.Controls.Clear();
                                placeHolder.Controls.Add(CreateDashBoardWrapperControl(new LiteralControl(string.Format(
                                                                                                              "Error loading DashBoard Content '{0}'; {1}", path,
                                                                                                              err.Message))));
                            }
                        }
                        dashBoardContent.Controls.Add(placeHolder);
                    }
                }
            }
        }