/// <summary> /// Mode for templating right block. /// </summary> /// <param name="middleBlock">XmlTag class containing xml details.</param> /// <returns>Mode</returns> public static int RightBlockMode(XmlTag middleBlock) { int status = 0; if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 1; } else if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 2; } else if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 3; } else if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 4; } else if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 5; } else if (!Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 6; } else if (!Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 7; } else if (!Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 8; } else if (!Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 10; } else if (!Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 9; } else if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 11; } else if (!Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) && Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { status = 12; } return(status); }
/// <summary> /// Calculate wrapper width. /// </summary> /// <param name="positionArr">Array of string of position.</param> /// <param name="arrWidth">>Array of string of width.</param> /// <param name="wrapPositions">Array of string of wrapper position.</param> /// <param name="mode">Wrapper mode.</param> /// <param name="lstPositionWidth">List of position width.</param> /// <returns>Wrapper width.</returns> public static int CalculateWrapperWidth(string[] positionArr, string[] arrWidth, string[] wrapPositions, string mode, out List <KeyValue> lstPositionWidth) { float wrapperwidth = 0; List <KeyValue> lstWidths = new List <KeyValue>(); switch (mode) { case "fixed": int blockwidth = 100 / positionArr.Length; wrapperwidth = blockwidth * wrapPositions.Length; lstWidths.Add(new KeyValue("", "")); break; case "normal": for (int i = 0; i < positionArr.Length; i++) { if (arrWidth.Length > i) { if (Decide.Contains(positionArr, wrapPositions)) { lstWidths.Add(new KeyValue(positionArr[i], arrWidth[i])); } } else if (i == arrWidth.Length) { wrapperwidth += float.Parse(GetRemainingWidth(arrWidth).ToString()); lstWidths.Add(new KeyValue(positionArr[i], wrapperwidth.ToString())); } else { lstWidths.Add(new KeyValue(positionArr[i], "100")); } } wrapperwidth = 0; foreach (KeyValue kvp in lstWidths) { if (wrapPositions.Contains(kvp.Key)) { wrapperwidth += float.Parse(kvp.Value); } } break; } if (wrapperwidth > 100) { wrapperwidth = 100; } lstPositionWidth = lstWidths; return(int.Parse(wrapperwidth.ToString())); }
/// <summary> /// Load assigne preset for associate page. /// </summary> /// <param name="TemplateName">Template name.</param> /// <param name="PageName">Page name.</param> /// <returns>Preset path.</returns> public static string LoadActivePresetForPage(string TemplateName, string PageName) { string presetPath = TemplateName.ToLower().Equals("default")?Utils.GetPresetPath_DefaultTemplate(TemplateName):Utils.GetPresetPath(TemplateName); List <PresetInfo> lstActivePresets = new List <PresetInfo>(); string pagepreset = presetPath + "/" + TemplateConstants.PagePresetFile; List <string> lstAllPages = new List <string>(); if (File.Exists(pagepreset)) { if (!CacheHelper.Get("PresetList", out lstActivePresets)) { lstActivePresets = PresetHelper.ParsePreset(pagepreset, "pagepreset/layout/preset", out lstAllPages); CacheHelper.Add(lstActivePresets, "PresetList"); } } else { lstActivePresets.Add(PresetInfo.GetPresetPages("default", "*")); } string pagepresetactive = string.Empty; string defaultpreset = "layout.ascx"; foreach (PresetInfo preset in lstActivePresets) { if (preset.IsDefault) { defaultpreset = string.Format("{0}.ascx", preset.PresetName);; } else { string presetPathFull = string.Empty; foreach (string page in preset.LSTPages) { if (page.ToLower().Equals(PageName.ToLower())) { pagepresetactive = string.Format("{0}.ascx", preset.PresetName);; break; } } } } if (pagepresetactive == string.Empty) { pagepresetactive = defaultpreset; } pagepresetactive = Decide.IsTemplateDefault(TemplateName)?string.Format("~/Core/Template/{1}", TemplateName, pagepresetactive):string.Format("~/Templates/{0}/{1}", TemplateName, pagepresetactive); return(pagepresetactive); }
public static string GetMiddleCustomMarkup(XmlTag middleBlock, List <CustomWrapper> lstWrapper, int Mode) { List <KeyValue> widths = Calculator.CalculateMiddleBlockWidth(middleBlock); StringBuilder sb = new StringBuilder(); sb.Append(HtmlBuilder.GetMiddleWrappersBegin()); if (Decide.HasBlock(Placeholders.FULLTOPSPAN, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.FULLTOPSPAN, middleBlock, lstWrapper, Mode)); } //Check for Left Blocks foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.Start == "left") { string style = ""; for (int i = 1; i <= start.Depth; i++) { if (i == 1) { style = start.Depth > 1 ? string.Format("sfBlockwrap {0}", start.Class) : string.Format("sfBlockwrap {0} clearfix", start.Class); sb.Append("<div class='" + style + "'>"); } else { style = start.Depth == i?string.Format("sfBlockwrap {0} sf{1} clearfix", start.Class, i) : string.Format("sfBlockwrap {0} sf{1}", start.Class, i); sb.Append("<div class='" + style + "'>"); } } } } if (Decide.HasBlock(Placeholders.LEFTTOP, middleBlock) || Decide.HasBlock(Placeholders.LEFTBOTTOM, middleBlock) || (Decide.HasBlock(Placeholders.LEFTA, middleBlock) && Decide.HasBlock(Placeholders.LEFTB, middleBlock))) { if (Decide.HasBlock(Placeholders.LEFTTOP, middleBlock) && Decide.HasBlock(Placeholders.LEFTBOTTOM, middleBlock)) { if ((Decide.HasBlock(Placeholders.LEFTA, middleBlock) && Decide.HasBlock(Placeholders.LEFTB, middleBlock))) { //Every block is present on the left side sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftTop(Mode)); sb.Append(HtmlBuilder.GetLeftColsWrap(widths[1].Value, widths[2].Value, widths[0].Value, Mode)); sb.Append(HtmlBuilder.GetLeftBottom(Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } else if (Decide.HasBlock(Placeholders.LEFTA, middleBlock) && !Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftTop(Mode)); sb.Append(HtmlBuilder.GetLeftA(widths[1].Value, Mode)); sb.Append(HtmlBuilder.GetLeftBottom(Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } else if (!Decide.HasBlock(Placeholders.LEFTA, middleBlock) && Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftTop(Mode)); sb.Append(HtmlBuilder.GetLeftB(widths[2].Value, Mode)); sb.Append(HtmlBuilder.GetLeftBottom(Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } } else { //Left Content Mass Blocks are not present sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftColsWrap(widths[1].Value, widths[2].Value, widths[0].Value, Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } } else if (Decide.HasBlock(Placeholders.LEFTA, middleBlock)) { if (Decide.HasBlock(Placeholders.LEFTTOP, middleBlock) && Decide.HasBlock(Placeholders.LEFTBOTTOM, middleBlock)) { //Every block is present on the left side sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftTop(Mode)); sb.Append(HtmlBuilder.GetLeftA(widths[1].Value, Mode)); sb.Append(HtmlBuilder.GetLeftBottom(Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } else { sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftA(widths[1].Value, Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } } else if (Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { if (Decide.HasBlock(Placeholders.LEFTTOP, middleBlock) && Decide.HasBlock(Placeholders.LEFTBOTTOM, middleBlock)) { //Every block is present on the left side sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftTop(Mode)); sb.Append(HtmlBuilder.GetLeftB(widths[2].Value, Mode)); sb.Append(HtmlBuilder.GetLeftBottom(Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } else { sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftB(widths[2].Value, Mode)); sb.Append(HtmlBuilder.GetLeftEnd()); } } foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "left") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } //Check for Right Blocks foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.Start == "right") { string style = ""; for (int i = 1; i <= start.Depth; i++) { if (i == 1) { style = start.Depth > 1 ? string.Format("sfBlockwrap {0}", start.Class) : string.Format("sfBlockwrap {0} clearfix", start.Class); sb.Append("<div class='" + style + "'>"); } else { style = start.Depth == i?string.Format("sfBlockwrap {0} sf{1} clearfix", start.Class, i) : string.Format("sfBlockwrap {0} sf{1}", start.Class, i); sb.Append("<div class='" + style + "'>"); } } } } if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) || Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) || (Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock))) { if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock)) { if (Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { //Every block is present on the left side sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightTop(Mode)); sb.Append(HtmlBuilder.GetRightColsWrap(widths[4].Value, widths[5].Value, widths[3].Value, Mode)); sb.Append(HtmlBuilder.GetRightBottom(Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } else if (Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightTop(Mode)); sb.Append(HtmlBuilder.GetRightA(widths[4].Value, Mode)); sb.Append(HtmlBuilder.GetRightBottom(Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } else if (!Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightTop(Mode)); sb.Append(HtmlBuilder.GetRightB(widths[5].Value, Mode)); sb.Append(HtmlBuilder.GetRightBottom(Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } } else { //Left Content Mass Blocks are not present sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightColsWrap(widths[4].Value, widths[5].Value, widths[3].Value, Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } } else if (Decide.HasBlock(Placeholders.RIGHTA, middleBlock)) { if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock)) { //Every block is present on the Right side sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightTop(Mode)); sb.Append(HtmlBuilder.GetRightA(widths[4].Value, Mode)); sb.Append(HtmlBuilder.GetRightBottom(Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } else { sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightA(widths[4].Value, Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } } else if (Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) && Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock)) { //Every block is present on the Right side sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightTop(Mode)); sb.Append(HtmlBuilder.GetRightB(widths[5].Value, Mode)); sb.Append(HtmlBuilder.GetRightBottom(Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } else { sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightA(widths[5].Value, Mode)); sb.Append(HtmlBuilder.GetRightEnd()); } } foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "right") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } //Create the default Middle Block foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.Start == "middle") { string style = ""; for (int i = 1; i <= start.Depth; i++) { if (i == 1) { style = start.Depth > 1 ? string.Format("sfBlockwrap {0}", start.Class) : string.Format("sfBlockwrap {0} clearfix", start.Class); sb.Append("<div class='" + style + "'>"); } else { style = start.Depth == i?string.Format("sfBlockwrap {0} sf{1} clearfix", start.Class, i) : string.Format("sfBlockwrap {0} sf{1}", start.Class, i); sb.Append("<div class='" + style + "'>"); } } } } sb.Append(HtmlBuilder.GetMiddleWrapperBegin(widths[6].Value)); if (Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) || Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock) || 1 == 1) { if (Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { //Has outer top and bottom sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLETOP, middleBlock, lstWrapper, Mode)); sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLETOP, middleBlock, lstWrapper, Mode)); sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); } else if (!Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); } foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "middle") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } } else { //Generate Default Middle Block sb.Append(HtmlBuilder.GetMiddleDefaultBlock(widths[6].Value, Mode)); foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "middle") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } } sb.Append(HtmlBuilder.GetMiddleWrapperEnd()); if (Decide.HasBlock(Placeholders.FULLBOTTOMSPAN, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.FULLBOTTOMSPAN, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.EndSingleDiv()); sb.Append(HtmlBuilder.EndSingleDiv()); return(sb.ToString()); }
/// <summary> /// Calculate middle block width. /// </summary> /// <param name="middleBlock">XmlTag class containing xml details.</param> /// <returns></returns> public static List <KeyValue> CalculateMiddleBlockWidth(XmlTag middleBlock) { double left = 0.0, leftA = 0.0, leftB = 0.0; if (Decide.HasBlock(Placeholders.LEFTTOP, middleBlock) || Decide.HasBlock(Placeholders.LEFTBOTTOM, middleBlock) || (Decide.HasBlock(Placeholders.LEFTA, middleBlock) && Decide.HasBlock(Placeholders.LEFTB, middleBlock))) { if (Decide.HasBlock(Placeholders.LEFTA, middleBlock) && Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { left = 2; leftA = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.LEFTA)); leftB = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.LEFTB)); } else if (Decide.HasBlock(Placeholders.LEFTA, middleBlock) && !Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { left = 1; leftA = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.LEFTA)); } else if (!Decide.HasBlock(Placeholders.LEFTA, middleBlock) && Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { left = 1; leftB = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.LEFTB)); } } else if (Decide.HasBlock(Placeholders.LEFTA, middleBlock)) { left = 1; leftA = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.LEFTA)); } else if (Decide.HasBlock(Placeholders.LEFTB, middleBlock)) { left = 1; leftB = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.LEFTB)); } double totalleft = left > 0 ? (leftA + leftB) / left : 0; double right = 0.0, rightA = 0.0, rightB = 0.0; if (Decide.HasBlock(Placeholders.RIGHTTOP, middleBlock) || Decide.HasBlock(Placeholders.RIGHTBOTTOM, middleBlock) || (Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock))) { if (Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { right = 2; rightA = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.RIGHTA)); rightB = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.RIGHTB)); } else if (Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && !Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { right = 1; rightA = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.RIGHTA)); } else if (!Decide.HasBlock(Placeholders.RIGHTA, middleBlock) && Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { right = 1; rightB = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.RIGHTB)); } } else if (Decide.HasBlock(Placeholders.RIGHTA, middleBlock)) { right = 1; rightA = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.RIGHTA)); } else if (Decide.HasBlock(Placeholders.RIGHTB, middleBlock)) { right = 1; rightB = double.Parse(Calculator.CalculateColumnWidth(middleBlock, Placeholders.RIGHTB)); } double totalright = right > 0 ? (rightA + rightB) / right : 0; double totalWidth = 100; rightA = (rightA * 100) / (totalright * right); rightA = rightA.ToString() == "NaN" ? 0 : rightA; rightB = totalWidth - rightA; rightB = rightB.ToString() == "NaN" ? 0 : rightB; double middle = totalWidth - totalright; middle = totalWidth - totalleft - totalright; leftA = (leftA * 100) / (totalleft * left); leftA = leftA.ToString() == "NaN" ? 0 : leftA; leftB = totalWidth - leftA; leftB = leftB.ToString() == "NaN" ? 0 : leftB; middle = totalWidth - totalleft - totalright; List <KeyValue> widthsKvp = new List <KeyValue>(); widthsKvp.Add(new KeyValue("Left", totalleft.ToString())); widthsKvp.Add(new KeyValue("LeftA", leftA.ToString())); widthsKvp.Add(new KeyValue("LeftB", leftB.ToString())); widthsKvp.Add(new KeyValue("Right", totalright.ToString())); widthsKvp.Add(new KeyValue("RightA", rightA.ToString())); widthsKvp.Add(new KeyValue("RightB", rightB.ToString())); widthsKvp.Add(new KeyValue("Center", middle.ToString())); DecreaseWidthForAdjustment(ref widthsKvp); return(widthsKvp); }
/// <summary> /// Load device type 3. /// </summary> /// <param name="TemplateName">Template name.</param> /// <returns>Preset path.</returns> public static string LoadDeviceType3(string TemplateName) { return(Decide.IsTemplateDefault(TemplateName) ? "~/Core/Template/handheld.ascx" : string.Format("~/Templates/{0}/devicetype3.ascx", TemplateName)); }
/// <summary> /// Load handheld controls. /// </summary> /// <param name="TemplateName">Templates name.</param> /// <returns>Preset path.</returns> public static string LoadHandheldControl(string TemplateName) { return(Decide.IsTemplateDefault(TemplateName) ? "~/Core/Template/handheld.ascx" : string.Format("~/Templates/{0}/handheld.ascx", TemplateName)); }
/// <summary> /// Obtain customize middleblock markup. /// </summary> /// <param name="middleBlock">Object of XmlTag class.</param> /// <param name="lstWrapper">List of CustomWrapper class.</param> /// <param name="Mode">Mode</param> /// <returns>String format of customized middleblock markup.</returns> public static string GetMiddleCustomMarkup(XmlTag middleBlock, List <CustomWrapper> lstWrapper, int Mode) { List <KeyValue> widths = Calculator.CalculateMiddleBlockWidth(middleBlock); StringBuilder sb = new StringBuilder(); sb.Append(HtmlBuilder.GetMiddleWrappersBegin()); if (Decide.HasBlock(Placeholders.FULLTOPSPAN, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.FULLTOPSPAN, middleBlock, lstWrapper, Mode)); } //Check for Left Blocks //add a wrapper to wrap left middle and right blocks sb.Append("<div class='sfMoreblocks clearfix'>"); foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.Start == "left") { string style = ""; for (int i = 1; i <= start.Depth; i++) { if (i == 1) { style = start.Depth > 1 ? string.Format("sfBlockwrap {0}", start.Class) : string.Format("sfBlockwrap {0} clearfix", start.Class); sb.Append("<div class='" + style + "'>"); } else { style = start.Depth == i?string.Format("sfBlockwrap {0} sf{1} clearfix", start.Class, i) : string.Format("sfBlockwrap {0} sf{1}", start.Class, i); sb.Append("<div class='" + style + "'>"); } } } } //Build Left Block switch (Decide.LeftBlockMode(middleBlock)) { case 0: break; case 1: ///All the blocks sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); //sb.Append(HtmlBuilder.GetLeftTop(Mode, Utils.GetTagInnerHtml(Placeholders.LEFTTOP, middleBlock))); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTTOP)); sb.Append(HtmlBuilder.GetLeftColsWrap(widths[1].Value, widths[2].Value, widths[0].Value, Mode, Utils.GetTagInnerHtml(Placeholders.LEFTA, middleBlock), Utils.GetTagInnerHtml(Placeholders.LEFTB, middleBlock), lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTBOTTOM)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 3: ///All the blocks without leftA sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[1].Value, Mode, Placeholders.LEFTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTBOTTOM)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 2: ///All the blocks without leftB sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[1].Value, Mode, Placeholders.LEFTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTBOTTOM)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 4: ///All the blocks without leftA sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[1].Value, Mode, Placeholders.LEFTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 5: ///All the blocks without leftA sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[2].Value, Mode, Placeholders.LEFTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 6: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[2].Value, Mode, Placeholders.LEFTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTBOTTOM)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 7: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[1].Value, Mode, Placeholders.LEFTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTBOTTOM)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 8: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftColsWrap(widths[1].Value, widths[2].Value, widths[0].Value, Mode, Utils.GetTagInnerHtml(Placeholders.LEFTA, middleBlock), Utils.GetTagInnerHtml(Placeholders.LEFTB, middleBlock), lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 9: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[2].Value, Mode, Placeholders.LEFTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 10: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[1].Value, Mode, Placeholders.LEFTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 11: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTTOP)); sb.Append(HtmlBuilder.GetLeftColsWrap(widths[1].Value, widths[2].Value, widths[0].Value, Mode, Utils.GetTagInnerHtml(Placeholders.LEFTA, middleBlock), Utils.GetTagInnerHtml(Placeholders.LEFTB, middleBlock), lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftEnd()); break; case 12: sb.Append(HtmlBuilder.GetLeftBegin(widths[0].Value)); sb.Append(HtmlBuilder.GetLeftColsWrap(widths[1].Value, widths[2].Value, widths[0].Value, Mode, Utils.GetTagInnerHtml(Placeholders.LEFTA, middleBlock), Utils.GetTagInnerHtml(Placeholders.LEFTB, middleBlock), lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.LEFTBOTTOM)); sb.Append(HtmlBuilder.GetLeftEnd()); break; } foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "left") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } //Create the default Middle Block foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.Start == "middle") { string style = ""; for (int i = 1; i <= start.Depth; i++) { if (i == 1) { style = start.Depth > 1 ? string.Format("sfBlockwrap {0}", start.Class) : string.Format("sfBlockwrap {0} clearfix", start.Class); sb.Append("<div class='" + style + "'>"); } else { style = start.Depth == i?string.Format("sfBlockwrap {0} sf{1} clearfix", start.Class, i) : string.Format("sfBlockwrap {0} sf{1}", start.Class, i); sb.Append("<div class='" + style + "'>"); } } } } sb.Append(HtmlBuilder.GetMiddleWrapperBegin(widths[6].Value)); if (Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) || Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock) || 1 == 1) { if (Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { //Has outer top and bottom sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLETOP, middleBlock, lstWrapper, Mode)); sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLETOP, middleBlock, lstWrapper, Mode)); sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); } else if (!Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLETOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEBOTTOM, middleBlock)) { sb.Append(HtmlBuilder.GetMiddleMainContentBegin()); if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINTOP, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINBOTTOM, middleBlock, lstWrapper, Mode)); } else if (!Decide.HasBlock(Placeholders.MIDDLEMAINTOP, middleBlock) && !Decide.HasBlock(Placeholders.MIDDLEMAINBOTTOM, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.MIDDLEMAINCURRENT, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.GetMiddleMainContentEnd()); } foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "middle") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } } else { //Generate Default Middle Block sb.Append(HtmlBuilder.GetMiddleDefaultBlock(widths[6].Value, Mode)); foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "middle") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } } sb.Append(HtmlBuilder.GetMiddleWrapperEnd()); //Check for Right Blocks foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.Start == "right") { string style = ""; for (int i = 1; i <= start.Depth; i++) { if (i == 1) { style = start.Depth > 1 ? string.Format("sfBlockwrap {0}", start.Class) : string.Format("sfBlockwrap {0} clearfix", start.Class); sb.Append("<div class='" + style + "'>"); } else { style = start.Depth == i?string.Format("sfBlockwrap {0} sf{1} clearfix", start.Class, i) : string.Format("sfBlockwrap {0} sf{1}", start.Class, i); sb.Append("<div class='" + style + "'>"); } } } } //Build Right Block switch (Decide.RightBlockMode(middleBlock)) { case 0: break; case 1: ///All the blocks sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTTOP)); sb.Append(HtmlBuilder.GetRightColsWrap(widths[4].Value, widths[5].Value, widths[3].Value, Mode, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTBOTTOM)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 3: ///All the blocks without leftA sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[5].Value, Mode, Placeholders.RIGHTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTBOTTOM)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 2: ///All the blocks without leftB sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTTOP)); sb.Append(HtmlBuilder.GetRightA(widths[4].Value, Mode, Utils.GetTagInnerHtml(Placeholders.RIGHTA, middleBlock))); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTBOTTOM)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 4: ///All the blocks without leftA sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[4].Value, Mode, Placeholders.RIGHTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 5: ///All the blocks without leftA sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTTOP)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[5].Value, Mode, Placeholders.RIGHTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 6: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[5].Value, Mode, Placeholders.RIGHTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTBOTTOM)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 7: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[4].Value, Mode, Placeholders.RIGHTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTBOTTOM)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 8: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightColsWrap(widths[4].Value, widths[5].Value, widths[3].Value, Mode, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 9: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[5].Value, Mode, Placeholders.RIGHTB, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 10: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightCol(widths[4].Value, Mode, Placeholders.RIGHTA, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 11: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTTOP)); sb.Append(HtmlBuilder.GetRightColsWrap(widths[4].Value, widths[5].Value, widths[3].Value, Mode, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetRightEnd()); break; case 12: sb.Append(HtmlBuilder.GetRightBegin(widths[3].Value)); sb.Append(HtmlBuilder.GetRightColsWrap(widths[4].Value, widths[5].Value, widths[3].Value, Mode, lstWrapper, middleBlock)); sb.Append(HtmlBuilder.GetLeftRightTopBottom(Mode, lstWrapper, middleBlock, Placeholders.RIGHTBOTTOM)); sb.Append(HtmlBuilder.GetRightEnd()); break; } foreach (CustomWrapper start in lstWrapper) { if (start.Type == "placeholder" && start.End == "right") { for (int i = 1; i <= start.Depth; i++) { sb.Append("</div>"); } } } sb.Append("</div>"); if (Decide.HasBlock(Placeholders.FULLBOTTOMSPAN, middleBlock)) { sb.Append(BlockParser.ProcessMiddlePlaceholders(Placeholders.FULLBOTTOMSPAN, middleBlock, lstWrapper, Mode)); } sb.Append(HtmlBuilder.EndSingleDiv()); sb.Append(HtmlBuilder.EndSingleDiv()); return(sb.ToString()); }