public virtual XVar setAsCurrMenuElem(dynamic xt_packed) { #region packeted values XTempl xt = XVar.UnPackXTempl(xt_packed); #endregion xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_current")), new XVar("current")); if (XVar.Pack(isBootstrap())) { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_current")), new XVar("active")); } return(null); }
public virtual XVar assignGroupOnly(dynamic xt_packed) { #region packeted values XTempl xt = XVar.UnPackXTempl(xt_packed); #endregion dynamic attrForAssign = null; xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_title")), (XVar)(this.title)); attrForAssign = XVar.Clone(MVCFunctions.Concat(" id=\"itemlink", this.id, "\" itemtitle=\"", this.title, "\" ", (XVar.Pack(this.style) ? XVar.Pack(MVCFunctions.Concat(" style=\"cursor:default;text-decoration:none; ", this.style, "\"")) : XVar.Pack("")))); xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_menulink_attrs")), (XVar)(attrForAssign)); xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_optionattrs")), new XVar("disabled")); return(null); }
public virtual XVar prepareWelcomeMenuItem(dynamic xt_packed) { #region packeted values XTempl xt = XVar.UnPackXTempl(xt_packed); #endregion if (XVar.Pack(!(XVar)(isWelcome()))) { return(null); } if (this.color != "") { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_menulink_style")), (XVar)(MVCFunctions.Concat("style=\"background-color:", this.color, "\""))); } if (XVar.Pack(MVCFunctions.strlen((XVar)(this.comments)))) { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_comments")), new XVar(true)); xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_comments_text")), (XVar)(this.comments)); } return(null); }
public virtual XVar setCurrMenuElem(dynamic xt_packed) { #region packeted values XTempl xt = XVar.UnPackXTempl(xt_packed); #endregion dynamic i = null; if ((XVar)(this.pageObject.tName == this.table) && (XVar)((XVar)(this.pageType == "AdminArea") || (XVar)(this.id != 0))) { if ((XVar)(XSession.Session.KeyExists("menuItemId")) && (XVar)(1 < this.menuTableMap[this.table][MVCFunctions.strtolower((XVar)(this.pageType))])) { if (XSession.Session["menuItemId"] == this.id) { setAsCurrMenuElem((XVar)(xt)); return(true); } } else { if (this.pageObject.getPageType() == MVCFunctions.strtolower((XVar)(this.pageType))) { setAsCurrMenuElem((XVar)(xt)); return(true); } else { if ((XVar)(!(XVar)(isSetParentElem())) && (XVar)(!(XVar)(isThisPageInMenu()))) { setAsCurrMenuElem((XVar)(xt)); return(true); } } } } i = new XVar(0); for (; i < MVCFunctions.count(this.children); i++) { if (XVar.Pack(this.children[i].setCurrMenuElem((XVar)(xt)))) { if (XVar.Pack(isBootstrap())) { xt.assign((XVar)(MVCFunctions.Concat("submenu", this.id, "_class")), new XVar("in")); } else { setAsCurrMenuElem((XVar)(xt)); } return(true); } } return(false); }
public virtual XVar assignPageVar(dynamic recordData, dynamic _param_xt_packed, dynamic _param_name, dynamic _param_value) { #region packeted values XTempl _param_xt = XVar.UnPackXTempl(_param_xt_packed); #endregion #region pass-by-value parameters XTempl xt = XVar.Clone(_param_xt); dynamic name = XVar.Clone(_param_name); dynamic value = XVar.Clone(_param_value); #endregion if (XVar.Equals(XVar.Pack(recordData), XVar.Pack(null))) { xt.assign((XVar)(name), (XVar)(value)); } else { recordData.InitAndSetArrayItem(value, name); } return(null); }
public virtual XVar assignLinks(dynamic xt_packed, dynamic _param_showSubmenu = null) { #region packeted values XTempl xt = XVar.UnPackXTempl(xt_packed); #endregion #region default values if (_param_showSubmenu as Object == null) { _param_showSubmenu = new XVar(true); } #endregion #region pass-by-value parameters dynamic showSubmenu = XVar.Clone(_param_showSubmenu); #endregion dynamic attrs = XVar.Array(), groupOnlyAttrs = XVar.Array(), groupOnlyMode = null, link_attrs = null, option_attrs = null, title = null; title = XVar.Clone(this.title); if ((XVar)((XVar)(isBootstrap()) && (XVar)(isShowAsGroup())) && (XVar)(!(XVar)(isWelcome()))) { if (XVar.Pack(!(XVar)(isTreelike()))) { if (XVar.Pack(showSubmenu)) { title = MVCFunctions.Concat(title, "<span class=\"caret\"></span>"); } else { title = XVar.Clone(MVCFunctions.Concat("<span class=\"glyphicon glyphicon-triangle-right\"></span>", title)); } } else { title = XVar.Clone(MVCFunctions.Concat("<span class=\"menu-triangle glyphicon glyphicon-triangle-right\"></span>", title)); } } title = XVar.Clone(MVCFunctions.Concat(getIconHTML(), " ", title)); xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_title")), (XVar)(title)); attrs = XVar.Clone(getMenuItemAttributes((XVar)(showSubmenu))); groupOnlyAttrs = XVar.Clone(XVar.Array()); groupOnlyAttrs.InitAndSetArrayItem(true, "id"); groupOnlyAttrs.InitAndSetArrayItem(true, "title"); groupOnlyAttrs.InitAndSetArrayItem(true, "style"); groupOnlyAttrs.InitAndSetArrayItem(true, "class"); groupOnlyAttrs.InitAndSetArrayItem(true, "data-toggle"); groupOnlyAttrs.InitAndSetArrayItem(true, "data-target"); groupOnlyAttrs.InitAndSetArrayItem(true, "aria-haspopup"); groupOnlyAttrs.InitAndSetArrayItem(true, "aria-expanded"); groupOnlyMode = XVar.Clone((XVar)(!(XVar)(isShowAsLink())) && (XVar)(isShowAsGroup())); if ((XVar)((XVar)(isBootstrap()) && (XVar)(groupOnlyMode)) && (XVar)(!(XVar)(isTreelike()))) { dynamic childWithLink = null; childWithLink = XVar.Clone(getFirstChildWithLink()); if (XVar.Pack(childWithLink)) { dynamic linkChildAttrs = XVar.Array(); groupOnlyAttrs.InitAndSetArrayItem(true, "href"); linkChildAttrs = XVar.Clone(childWithLink.getMenuItemAttributes()); attrs.InitAndSetArrayItem(linkChildAttrs["href"], "href"); } } option_attrs = new XVar(""); link_attrs = new XVar(""); foreach (KeyValuePair <XVar, dynamic> value in attrs.GetEnumerator()) { if ((XVar)(groupOnlyMode) && (XVar)(!(XVar)(groupOnlyAttrs[value.Key]))) { continue; } if (XVar.Pack(!(XVar)(value.Value))) { continue; } if ((XVar)(value.Key == "value") || (XVar)(value.Key == "link")) { option_attrs = MVCFunctions.Concat(option_attrs, " ", value.Key, "=\"", value.Value, "\""); } else { link_attrs = MVCFunctions.Concat(link_attrs, " ", value.Key, "=\"", value.Value, "\""); } } if (XVar.Pack(groupOnlyMode)) { option_attrs = new XVar("disabled"); } xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_menulink_attrs")), (XVar)(link_attrs)); xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_optionattrs")), (XVar)(option_attrs)); return(null); }
public virtual XVar assignMenuAttrsToTempl(dynamic xt_packed, dynamic _param_visibleElementIds = null) { #region packeted values XTempl xt = XVar.UnPackXTempl(xt_packed); #endregion #region default values if (_param_visibleElementIds as Object == null) { _param_visibleElementIds = new XVar(XVar.Array()); } #endregion #region pass-by-value parameters dynamic visibleElementIds = XVar.Clone(_param_visibleElementIds); #endregion dynamic displayElement = null, i = null, showSubmenu = null; prepareWelcomeMenuItem((XVar)(xt)); if (XVar.Pack(isSeparator())) { if (this.name == "-------") { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_separator")), new XVar("<hr>")); } else { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_separator")), (XVar)(MVCFunctions.Concat("<a class=\"rnr-menu-usrsep\" style=\"", this.style, "\">", this.name, "</a>"))); } xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_optionattrs")), new XVar("disabled")); } if ((XVar)((XVar)((XVar)(!(XVar)(isShowAsGroup())) && (XVar)(!(XVar)(isShowAsLink()))) && (XVar)(!(XVar)(isSeparator()))) && (XVar)(this.id != 0)) { return(null); } if (XVar.Pack(isShowAsGroup())) { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_groupimage")), new XVar(true)); xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_groupclass")), new XVar("group")); } displayElement = new XVar(true); showSubmenu = new XVar(true); if (XVar.Pack(visibleElementIds)) { displayElement = XVar.Clone(visibleElementIds[this.id]); if (XVar.Pack(!(XVar)(this.parentItem))) { showSubmenu = new XVar(true); } else { showSubmenu = XVar.Clone(!(XVar)(visibleElementIds.KeyExists(this.parentItem.id))); } } if (XVar.Pack(displayElement)) { xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_menulink")), new XVar(true)); } xt.assign((XVar)(MVCFunctions.Concat("item", this.id, "_nbsps")), (XVar)(makeOffset((XVar)(this.depth)))); if ((XVar)(isShowAsLink()) || (XVar)(isShowAsGroup())) { assignLinks((XVar)(xt), (XVar)(showSubmenu)); } i = new XVar(0); for (; i < MVCFunctions.count(this.children); i++) { this.children[i].assignMenuAttrsToTempl((XVar)(xt), (XVar)(visibleElementIds)); } return(null); }
public virtual XVar prepareGrid(dynamic _param_xt_packed, dynamic _param_itemsToHide, dynamic _param_recordItemsToHide, dynamic cellMap, dynamic _param_location, dynamic _param_pageObject) { #region packeted values XTempl _param_xt = XVar.UnPackXTempl(_param_xt_packed); #endregion #region pass-by-value parameters XTempl xt = XVar.Clone(_param_xt); dynamic itemsToHide = XVar.Clone(_param_itemsToHide); dynamic recordItemsToHide = XVar.Clone(_param_recordItemsToHide); dynamic location = XVar.Clone(_param_location); dynamic pageObject = XVar.Clone(_param_pageObject); #endregion dynamic checkRecordItems = null, hiddenColsRows = XVar.Array(), hidingMap = null, recordsToCheck = XVar.Array(), removedColsRows = XVar.Array(), visibleWidth = null; checkRecordItems = XVar.Clone(!(XVar)(!(XVar)(MVCFunctions.count(recordItemsToHide)))); recordsToCheck = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> dummy in cellMap.cells.GetEnumerator()) { dynamic cMapRef = XVar.Array(), hidden = null, var_empty = null, visibleItems = XVar.Array(); cMapRef = cellMap.cells[dummy.Key]; if (XVar.Pack(cMapRef["fixedAtClient"])) { continue; } var_empty = new XVar(false); if (XVar.Pack(!(XVar)(cMapRef["fixedAtServer"]))) { var_empty = new XVar(true); foreach (KeyValuePair <XVar, dynamic> item in cMapRef["tags"].GetEnumerator()) { if (XVar.Pack(xt.getVar((XVar)(item.Value)))) { var_empty = new XVar(false); break; } } } hidden = new XVar(true); visibleItems = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> item in cMapRef["items"].GetEnumerator()) { if (XVar.Pack(!(XVar)(itemsToHide[item.Value]))) { hidden = new XVar(false); if (XVar.Pack(checkRecordItems)) { visibleItems.InitAndSetArrayItem(true, item.Value); } else { break; } } } if ((XVar)((XVar)((XVar)(checkRecordItems) && (XVar)(!(XVar)(hidden))) && (XVar)(!(XVar)(var_empty))) && (XVar)(visibleItems)) { cMapRef.InitAndSetArrayItem(findHiddenRecords((XVar)(visibleItems), (XVar)(recordItemsToHide)), "hiddenRecords"); recordsToCheck = XVar.Clone(CommonFunctions.addToAssocArray((XVar)(recordsToCheck), (XVar)(cMapRef["hiddenRecords"]))); } if (XVar.Pack(var_empty)) { cMapRef.InitAndSetArrayItem(true, "removable"); } if (XVar.Pack(hidden)) { cMapRef.InitAndSetArrayItem(true, "hidable"); } } removedColsRows = XVar.Clone(cellMap.removeRowsColumns(new XVar("removable"))); hidingMap = XVar.Clone(cellMap.makeClone()); hiddenColsRows = XVar.Clone(hidingMap.removeRowsColumns(new XVar("hidable"))); visibleWidth = XVar.Clone(cellMap.width - MVCFunctions.count(hiddenColsRows["cols"])); xt.assign((XVar)(MVCFunctions.Concat("formwidth_", location)), (XVar)(visibleWidth)); if (XVar.Pack(!(XVar)(pageObject.pdfJsonMode()))) { foreach (KeyValuePair <XVar, dynamic> row in removedColsRows["rows"].GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("row_", location, "_", row.Value)), new XVar("data-hidden")); } foreach (KeyValuePair <XVar, dynamic> row in hiddenColsRows["rows"].GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("row_", location, "_", row.Value)), new XVar("data-hidden")); } } else { dynamic col = null, row = null; row = new XVar(0); for (; row < cellMap.height; ++(row)) { xt.assign((XVar)(MVCFunctions.Concat("row_", location, "_", row)), new XVar(true)); } foreach (KeyValuePair <XVar, dynamic> _row in removedColsRows["rows"].GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("row_", location, "_", _row.Value)), new XVar(false)); } foreach (KeyValuePair <XVar, dynamic> _row in hiddenColsRows["rows"].GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("row_", location, "_", _row.Value)), new XVar(false)); } col = new XVar(0); for (; col < cellMap.width; ++(col)) { xt.assign((XVar)(MVCFunctions.Concat("col_", location, "_", col)), new XVar(true)); } foreach (KeyValuePair <XVar, dynamic> _col in removedColsRows["cols"].GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("col_", location, "_", _col.Value)), new XVar(false)); } foreach (KeyValuePair <XVar, dynamic> _col in hiddenColsRows["cols"].GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("col_", location, "_", _col.Value)), new XVar(false)); } } foreach (KeyValuePair <XVar, dynamic> cMap in cellMap.cells.GetEnumerator()) { dynamic dummyData = null; if ((XVar)(0 == MVCFunctions.count(cMap.Value["rows"])) || (XVar)(0 == MVCFunctions.count(cMap.Value["cols"]))) { continue; } xt.assign((XVar)(MVCFunctions.Concat("cellblock_", location, "_", cMap.Key)), new XVar(true)); dummyData = new XVar(null); assignCellAttrs((XVar)(hidingMap), (XVar)(cMap.Key), (XVar)(location), (XVar)(pageObject), (XVar)(xt), (XVar)(dummyData)); } if (XVar.Pack(checkRecordItems)) { foreach (KeyValuePair <XVar, dynamic> dummy in recordsToCheck.GetEnumerator()) { dynamic hiddenRecordRows = XVar.Array(), recordData = XVar.Array(), recordHidingMap = null; recordHidingMap = XVar.Clone(hidingMap.makeClone()); recordHidingMap.setRecordId((XVar)(dummy.Key)); hiddenRecordRows = XVar.Clone(recordHidingMap.removeRowsColumns(new XVar("hidable"), new XVar(true))); recordData = pageObject.findRecordAssigns((XVar)(dummy.Key)); if (XVar.Pack(!(XVar)(pageObject.pdfJsonMode()))) { foreach (KeyValuePair <XVar, dynamic> row in hiddenRecordRows["rows"].GetEnumerator()) { recordData.InitAndSetArrayItem("data-hidden", MVCFunctions.Concat("row_", location, "_", row.Value)); } } else { foreach (KeyValuePair <XVar, dynamic> row in hiddenRecordRows["rows"].GetEnumerator()) { recordData.InitAndSetArrayItem(false, MVCFunctions.Concat("row_", location, "_", row.Value)); } } foreach (KeyValuePair <XVar, dynamic> cMap in cellMap.cells.GetEnumerator()) { if ((XVar)(0 == MVCFunctions.count(cMap.Value["rows"])) || (XVar)(0 == MVCFunctions.count(cMap.Value["cols"]))) { continue; } assignCellAttrs((XVar)(recordHidingMap), (XVar)(cMap.Key), (XVar)(location), (XVar)(pageObject), (XVar)(xt), (XVar)(recordData), new XVar(true)); } } } return(hidingMap); }
public virtual XVar prepareForms(dynamic _param_xt_packed, dynamic _param_itemsToHide, dynamic _param_recordItemsToHide, dynamic _param_pageObject) { #region packeted values XTempl _param_xt = XVar.UnPackXTempl(_param_xt_packed); #endregion #region pass-by-value parameters XTempl xt = XVar.Clone(_param_xt); dynamic itemsToHide = XVar.Clone(_param_itemsToHide); dynamic recordItemsToHide = XVar.Clone(_param_recordItemsToHide); dynamic pageObject = XVar.Clone(_param_pageObject); #endregion dynamic cellMaps = XVar.Array(), formItems = XVar.Array(), formTags = XVar.Array(), helper = XVar.Array(), invisibleItems = XVar.Array(), present = null, ps = null, visibleCellsMap = XVar.Array(); if (XVar.Pack(pageObject)) { ps = XVar.Clone(pageObject.pSet); } else { ps = XVar.Clone(new ProjectSettings((XVar)(CommonFunctions.GetTableByShort((XVar)(this.table))), (XVar)(this.page["type"]), (XVar)(this.page["id"]))); } helper = ps.helperFormItems(); invisibleItems = XVar.Clone(itemsToHide); GlobalVars.mediaType = XVar.Clone((XVar.Pack(pageObject.pdfJsonMode()) ? XVar.Pack(Constants.MEDIA_DESKTOP) : XVar.Pack(CommonFunctions.getMediaType()))); foreach (KeyValuePair <XVar, dynamic> visibility in helper["itemVisiblity"].GetEnumerator()) { if (XVar.Pack(!(XVar)(visibleOnMedia((XVar)(GlobalVars.mediaType), (XVar)(visibility.Value))))) { invisibleItems.InitAndSetArrayItem(true, visibility.Key); } } visibleCellsMap = XVar.Clone(XVar.Array()); cellMaps = ps.helperCellMaps(); foreach (KeyValuePair <XVar, dynamic> loc in MVCFunctions.array_keys((XVar)(cellMaps)).GetEnumerator()) { dynamic formRecordItemsToHide = XVar.Array(), hMap = null; formRecordItemsToHide = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> itemRecords in recordItemsToHide.GetEnumerator()) { if (helper["itemForms"][itemRecords.Key] == loc.Value) { formRecordItemsToHide.InitAndSetArrayItem(MVCFunctions.array_keys((XVar)(itemRecords.Value)), itemRecords.Key); } } hMap = prepareGrid((XVar)(xt), (XVar)(invisibleItems), (XVar)(formRecordItemsToHide), (XVar)(new CellMapPD((XVar)(cellMaps[loc.Value]))), (XVar)(loc.Value), (XVar)(pageObject)); if (XVar.Pack(pageObject)) { visibleCellsMap.InitAndSetArrayItem(prepareClientCellMap((XVar)(cellMaps[loc.Value]), (XVar)(hMap)), loc.Value); } } if (XVar.Pack(pageObject)) { pageObject.setPageData(new XVar("cellMaps"), (XVar)(visibleCellsMap)); } if (XVar.Pack(!(XVar)(pageObject.pdfJsonMode()))) { foreach (KeyValuePair <XVar, dynamic> item in MVCFunctions.array_keys((XVar)(invisibleItems)).GetEnumerator()) { if (XVar.Pack(itemsToHide[item.Value])) { xt.assign((XVar)(MVCFunctions.Concat("item_", item.Value)), new XVar("data-hidden")); } else { xt.assign((XVar)(MVCFunctions.Concat("item_", item.Value)), new XVar("data-media-hidden")); } } } else { foreach (KeyValuePair <XVar, dynamic> item in MVCFunctions.array_keys((XVar)(invisibleItems)).GetEnumerator()) { xt.assign((XVar)(MVCFunctions.Concat("item_hide_", item.Value)), new XVar("1")); } } if (XVar.Pack(pageObject)) { foreach (KeyValuePair <XVar, dynamic> itemRecords in recordItemsToHide.GetEnumerator()) { foreach (KeyValuePair <XVar, dynamic> recordId in MVCFunctions.array_keys((XVar)(itemRecords.Value)).GetEnumerator()) { pageObject.hideRecordItem((XVar)(itemRecords.Key), (XVar)(recordId.Value)); } } } xt.assign(new XVar("firstAboveGridCell"), new XVar(true)); formTags = helper["formXtTags"]; foreach (KeyValuePair <XVar, dynamic> loc in MVCFunctions.array_keys((XVar)(formTags)).GetEnumerator()) { present = new XVar(false); foreach (KeyValuePair <XVar, dynamic> tag in formTags[loc.Value].GetEnumerator()) { if (XVar.Pack(xt.getVar((XVar)(tag.Value)))) { present = new XVar(true); break; } } if (XVar.Pack(!(XVar)(present))) { xt.assign((XVar)(MVCFunctions.Concat(loc.Value, "_block")), new XVar(false)); } } formItems = helper["formItems"]; foreach (KeyValuePair <XVar, dynamic> loc in MVCFunctions.array_keys((XVar)(formItems)).GetEnumerator()) { present = new XVar(false); foreach (KeyValuePair <XVar, dynamic> item in formItems[loc.Value].GetEnumerator()) { if (XVar.Pack(!(XVar)(invisibleItems.KeyExists(item.Value)))) { present = new XVar(true); break; } } if (XVar.Pack(!(XVar)(present))) { xt.assign((XVar)(MVCFunctions.Concat("form_", loc.Value)), new XVar("data-hidden")); } } return(null); }