public XVar ug_group() { try { dynamic cbxNames = null, data = XVar.Array(), groupId = null, i = null, nonAdminTablesArr = XVar.Array(), realUsers = XVar.Array(), sql = null, state = XVar.Array(), ug_connection = null, var_error = null, wGroupTableName = null, wMemebersTableName = null; MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); if (XVar.Pack(!(XVar)(CommonFunctions.isLogged()))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(!(XVar)(CommonFunctions.IsAdmin()))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } nonAdminTablesArr = XVar.Clone(XVar.Array()); nonAdminTablesArr.InitAndSetArrayItem("dbo.DEPARTAMENTO", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.EMPLEADO", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.ESTADO_COMPESADO", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.ESTADO_PERSONALES", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.HORARIOS", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.Permisos2", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.PERMISOSGRUPOS", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.Preferencias", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.REGISTRO_HORAS_COMPESADAS", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.TIPOEMPLEADO", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.TIPOPERMISO", null); nonAdminTablesArr.InitAndSetArrayItem("APROBAR_PERMISOS", null); nonAdminTablesArr.InitAndSetArrayItem("VISTOBUENO_JEFEINMEDIATO", null); nonAdminTablesArr.InitAndSetArrayItem("VISTOBUENO_JEFEDEPARTAMENTO", null); nonAdminTablesArr.InitAndSetArrayItem("VER_PERMISOS", null); nonAdminTablesArr.InitAndSetArrayItem("Saldo_Horas_Empleado", null); nonAdminTablesArr.InitAndSetArrayItem("VER_COMPESADOS", null); nonAdminTablesArr.InitAndSetArrayItem("APROBACION_COMPESADOS_JEFEINMEDIATO", null); nonAdminTablesArr.InitAndSetArrayItem("APROBACION_COMPESADOS_JEFEDEPARTAMENTO", null); nonAdminTablesArr.InitAndSetArrayItem("APROBAR_COMPESADOS", null); nonAdminTablesArr.InitAndSetArrayItem("INGRESAR PERMISO", null); nonAdminTablesArr.InitAndSetArrayItem("INGRESAR_COMPESADO", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.GRUPOS", null); nonAdminTablesArr.InitAndSetArrayItem("dbo.acceso_ugmembers", null); nonAdminTablesArr.InitAndSetArrayItem("Licencias_sin_goce_sueldo", null); ug_connection = XVar.Clone(GlobalVars.cman.getForUserGroups()); cbxNames = XVar.Clone(new XVar("add", new XVar("mask", "A", "rightName", "add"), "edt", new XVar("mask", "E", "rightName", "edit"), "del", new XVar("mask", "D", "rightName", "delete"), "lst", new XVar("mask", "S", "rightName", "list"), "exp", new XVar("mask", "P", "rightName", "export"), "imp", new XVar("mask", "I", "rightName", "import"), "adm", new XVar("mask", "M"))); wGroupTableName = XVar.Clone(ug_connection.addTableWrappers(new XVar("dbo.acceso_uggroups"))); switch (((XVar)MVCFunctions.postvalue(new XVar("a"))).ToString()) { case "add": sql = XVar.Clone(MVCFunctions.Concat("insert into ", wGroupTableName, " (", ug_connection.addFieldWrappers(new XVar("Label")), ")", " values (", ug_connection.prepareString((XVar)(MVCFunctions.postvalue(new XVar("name")))), ")")); ug_connection.exec((XVar)(sql)); sql = XVar.Clone(MVCFunctions.Concat("select max(", ug_connection.addFieldWrappers(new XVar("GroupID")), ") from ", wGroupTableName)); data = XVar.Clone(ug_connection.query((XVar)(sql)).fetchNumeric()); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true, "id", data[0])))); break; case "del": sql = XVar.Clone(MVCFunctions.Concat("delete from ", wGroupTableName, " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id")))); ug_connection.exec((XVar)(sql)); sql = XVar.Clone(MVCFunctions.Concat("delete from ", ug_connection.addTableWrappers(new XVar("dbo.acceso_ugrights")), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id")))); ug_connection.exec((XVar)(sql)); sql = XVar.Clone(MVCFunctions.Concat("delete from ", ug_connection.addTableWrappers(new XVar("dbo.acceso_ugmembers")), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id")))); ug_connection.exec((XVar)(sql)); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true)))); break; case "rename": sql = XVar.Clone(MVCFunctions.Concat("update ", wGroupTableName, " set ", ug_connection.addFieldWrappers(new XVar("Label")), "=", ug_connection.prepareString((XVar)(MVCFunctions.postvalue(new XVar("name")))), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id")))); ug_connection.exec((XVar)(sql)); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true)))); break; case "saveRights": var_error = new XVar(""); if (XVar.Pack(MVCFunctions.postvalue(new XVar("state")))) { dynamic allRights = XVar.Array(), delGroupId = null, qResult = null, realTables = XVar.Array(), rightsRow = null, wRightsTableName = null; allRights = XVar.Clone(XVar.Array()); sql = XVar.Clone(MVCFunctions.Concat("select ", ug_connection.addFieldWrappers(new XVar("GroupID")), ", ", ug_connection.addFieldWrappers(new XVar("TableName")), ", ", ug_connection.addFieldWrappers(new XVar("AccessMask")), " from ", wGroupTableName)); qResult = XVar.Clone(ug_connection.query((XVar)(sql))); while (XVar.Pack(rightsRow = XVar.Clone(qResult.fetchNumeric()))) { allRights.InitAndSetArrayItem(rightsRow, null); } wRightsTableName = XVar.Clone(ug_connection.addTableWrappers(new XVar("dbo.acceso_ugrights"))); delGroupId = new XVar(0); state = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("state"))))); foreach (KeyValuePair <XVar, dynamic> rightValue in allRights.GetEnumerator()) { dynamic groupIDInt = null; groupIDInt = XVar.Clone((int)rightValue.Value[0]); if (groupIDInt == delGroupId) { continue; } if (XVar.Pack(!(XVar)(state.KeyExists(groupIDInt)))) { sql = XVar.Clone(MVCFunctions.Concat("delete from ", wRightsTableName, " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", groupIDInt)); ug_connection.exec((XVar)(sql)); } else { if (XVar.Pack(!(XVar)(state[groupIDInt].KeyExists(GetTableId((XVar)(data[1])))))) { sql = XVar.Clone(MVCFunctions.Concat("delete from ", wRightsTableName, " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", groupIDInt, " and ", ug_connection.addFieldWrappers(new XVar("TableName")), "=", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(data[1])))))); ug_connection.exec((XVar)(sql)); } } } realTables = XVar.Clone(GetRealValues()); foreach (KeyValuePair <XVar, dynamic> groupRights in state.GetEnumerator()) { foreach (KeyValuePair <XVar, dynamic> mask in groupRights.Value.GetEnumerator()) { dynamic ins = null; if (XVar.Pack(!(XVar)(realTables.KeyExists(mask.Key)))) { continue; } ins = new XVar(true); foreach (KeyValuePair <XVar, dynamic> rightValue in allRights.GetEnumerator()) { if ((XVar)(rightValue.Value[0] == groupRights.Key) && (XVar)(rightValue.Value[1] == realTables[mask.Key])) { ins = new XVar(false); if (data[2] != mask.Value) { sql = XVar.Clone(MVCFunctions.Concat("update", wRightsTableName, " set ", ug_connection.addFieldWrappers(new XVar("AccessMask")), "=", ug_connection.prepareString((XVar)(mask.Value)), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", groupRights.Key, " and ", ug_connection.addFieldWrappers(new XVar("TableName")), "=", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realTables[mask.Key])))))); ug_connection.exec((XVar)(sql)); } } } if (XVar.Pack(ins)) { sql = XVar.Clone(MVCFunctions.Concat("insert into ", wRightsTableName, " (", ug_connection.addFieldWrappers(new XVar("TableName")), ", ", ug_connection.addFieldWrappers(new XVar("GroupID")), ", ", ug_connection.addFieldWrappers(new XVar("AccessMask")), ") ", "values (", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realTables[mask.Key])))), ", ", groupRights.Key, ", ", ug_connection.prepareString((XVar)(mask.Value)), ")")); ug_connection.exec((XVar)(sql)); } var_error = XVar.Clone(ug_connection.lastError()); } } } getJSONResult((XVar)(var_error)); break; case "saveMembership": var_error = new XVar(""); groupId = XVar.Clone(MVCFunctions.postvalue(new XVar("group"))); realUsers = XVar.Clone(GetRealValues()); wMemebersTableName = XVar.Clone(ug_connection.addTableWrappers(new XVar("dbo.acceso_ugmembers"))); i = new XVar(0); for (; i < MVCFunctions.count(realUsers); i++) { if (realUsers[i] != XSession.Session["UserID"]) { sql = XVar.Clone(MVCFunctions.Concat("delete from ", wMemebersTableName, " where ", ug_connection.addFieldWrappers(new XVar("UserName")), "=%s")); } else { sql = XVar.Clone(MVCFunctions.Concat("delete from ", wMemebersTableName, " where ", ug_connection.addFieldWrappers(new XVar("UserName")), "=%s ", "and ", ug_connection.addFieldWrappers(new XVar("GroupID")), "<>-1")); } ug_connection.exec((XVar)(MVCFunctions.mysprintf((XVar)(sql), (XVar)(new XVar(0, ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realUsers[i]))))))))); } if (XVar.Pack(MVCFunctions.postvalue(new XVar("state")))) { state = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("state"))))); foreach (KeyValuePair <XVar, dynamic> users in state.GetEnumerator()) { foreach (KeyValuePair <XVar, dynamic> user in users.Value.GetEnumerator()) { if (XVar.Pack(!(XVar)(realUsers.KeyExists(user.Value)))) { continue; } sql = XVar.Clone(MVCFunctions.Concat("insert into ", wMemebersTableName, " (", ug_connection.addFieldWrappers(new XVar("UserName")), ", ", ug_connection.addFieldWrappers(new XVar("GroupID")), ") values (", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realUsers[user.Value])))), ", ", users.Key, ")")); ug_connection.exec((XVar)(sql)); var_error = XVar.Clone(ug_connection.lastError()); } } } getJSONResult((XVar)(var_error)); break; } return(MVCFunctions.GetBuferContentAndClearBufer()); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }
public override XVar fillGridData() { dynamic data = XVar.Array(), displayUserName = null, emailUser = null, groups_sate = XVar.Array(), i = null, member_indexes = XVar.Array(), row = XVar.Array(), rowInfo = XVar.Array(), rowgroups = XVar.Array(), smartyGroups = XVar.Array(), userid = null, username = null; rowInfo = XVar.Clone(XVar.Array()); data = XVar.Clone(beforeProccessRow()); while (XVar.Pack(data)) { row = XVar.Clone(XVar.Array()); userid = XVar.Clone(this.recNo); row.InitAndSetArrayItem(XVar.Array(), "grid_record"); row.InitAndSetArrayItem(XVar.Array(), "grid_record", "data"); username = XVar.Clone(data["username"]); groups_sate = XVar.Clone(XVar.Array()); member_indexes = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> m in this.members.GetEnumerator()) { if (m.Value[1] == username) { member_indexes.InitAndSetArrayItem(m.Key, null); } } rowgroups = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> g in this.groups.GetEnumerator()) { dynamic smarty_group = XVar.Array(), var_checked = null; var_checked = new XVar(0); smarty_group = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> _i in member_indexes.GetEnumerator()) { if (this.members[_i.Value][0] == g.Value[0]) { var_checked = new XVar(1); break; } } if (XVar.Pack(!(XVar)((XVar)(XSession.Session["UserID"] != username) || (XVar)(g.Value[0] != -1)))) { var_checked = new XVar(3); } smarty_group.InitAndSetArrayItem(g.Value[0], "group"); groups_sate.InitAndSetArrayItem(var_checked, smarty_group["group"]); smarty_group.InitAndSetArrayItem(MVCFunctions.Concat("data-checked=\"", var_checked, "\" id=\"box", smarty_group["group"], userid, "\" data-userid=\"", userid, "\" data-group=\"", smarty_group["group"], "\""), "groupbox_attrs"); rowgroups.InitAndSetArrayItem(new XVar("usergroup_box", new XVar("data", new XVar(0, smarty_group)), "groupcellbox_attrs", MVCFunctions.Concat("id=\"cell", smarty_group["group"], userid, "\" data-col=\"", smarty_group["group"], "\"")), null); } rowgroups.InitAndSetArrayItem("rnr-edge", MVCFunctions.count(rowgroups) - 1, "rnredgeclass"); row.InitAndSetArrayItem(new XVar("data", rowgroups), "usergroup_boxes"); row.InitAndSetArrayItem(MVCFunctions.Concat("data-userid=\"userid\" id=\"cellusername", MVCFunctions.runner_htmlspecialchars((XVar)(userid)), "\""), "usernamecell_attrs"); row.InitAndSetArrayItem(MVCFunctions.Concat("id=\"usernamerow", MVCFunctions.runner_htmlspecialchars((XVar)(userid)), "\""), "usernamerow_attrs"); row.InitAndSetArrayItem(MVCFunctions.Concat("data-userid=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userid)), "\" data-checked=\"0\" id=\"rowbox", MVCFunctions.runner_htmlspecialchars((XVar)(userid)), "\""), "usernamebox_attrs"); row.InitAndSetArrayItem(MVCFunctions.runner_htmlspecialchars((XVar)(username)), "username"); emailUser = XVar.Clone(data[""]); row.InitAndSetArrayItem(MVCFunctions.runner_htmlspecialchars((XVar)(emailUser)), "emailuser"); row.InitAndSetArrayItem(MVCFunctions.Concat("id=\"cellEmail", MVCFunctions.runner_htmlspecialchars((XVar)(userid)), "\""), "emailuser_attrs"); this.users.InitAndSetArrayItem(emailUser, userid, "emailUser"); this.users.InitAndSetArrayItem(username, userid, "userName"); this.users.InitAndSetArrayItem(groups_sate, userid, "groups"); this.users.InitAndSetArrayItem(true, userid, "visible"); row.InitAndSetArrayItem(this.recNo, "recNo"); this.recNo++; row.InitAndSetArrayItem(true, "grid_rowspace"); row.InitAndSetArrayItem(new XVar("data", XVar.Array()), "grid_recordspace"); i = new XVar(0); for (; i < this.colsOnPage * 2 - 1; i++) { row.InitAndSetArrayItem(true, "grid_recordspace", "data", null); } if (XVar.Pack(eventExists(new XVar("BeforeMoveNextList")))) { dynamic record = null; this.eventsObject.BeforeMoveNextList((XVar)(data), (XVar)(row), (XVar)(record), this); } rowInfo.InitAndSetArrayItem(row, null); data = XVar.Clone(beforeProccessRow()); } foreach (KeyValuePair <XVar, dynamic> g in this.groups.GetEnumerator()) { smartyGroups.InitAndSetArrayItem(new XVar("groupname", MVCFunctions.runner_htmlspecialchars((XVar)(g.Value[1])), "groupheadersort_attrs", MVCFunctions.Concat("data-group=\"", g.Value[0], "\" id=\"colsort", g.Value[0], "\" href=\"#\""), "groupheadertdsort_attrs", MVCFunctions.Concat("id=\"tdsort", g.Value[0], "\""), "groupheaderbox_attrs", MVCFunctions.Concat("data-group=\"", g.Value[0], "\" data-checked=\"0\" id=\"colbox", g.Value[0], "\""), "groupheadertdbox_attrs", MVCFunctions.Concat("id=\"tdbox", g.Value[0], "\"")), null); } this.xt.assign(new XVar("displayuserheadersort_attrs"), new XVar("id=\"displayNameSort\" href=\"#\"")); this.xt.assign(new XVar("displayuserheadertdsort_attrs"), new XVar("id=\"tdsortDisplayName\" href=\"#\"")); this.xt.assign(new XVar("displayuserheadertdbox_attrs"), new XVar("id=\"tdboxDisplayName\" href=\"#\"")); this.xt.assign(new XVar("emailuserheadersort_attrs"), new XVar("id=\"EmailSort\" href=\"#\"")); this.xt.assign(new XVar("emailuserheadertdsort_attrs"), new XVar("id=\"tdsortEmail\" href=\"#\"")); this.xt.assign(new XVar("emailuserheadertdbox_attrs"), new XVar("id=\"tdboxEmail\" href=\"#\"")); this.xt.assign(new XVar("usernameheadersort_attrs"), new XVar("id=\"userNameSort\" href=\"#\"")); this.xt.assign(new XVar("choosecolumnsbutton_attrs"), new XVar("id=\"chooseColumnsButton\" href=\"#\"")); this.xt.assign_loopsection(new XVar("grid_row"), (XVar)(rowInfo)); smartyGroups.InitAndSetArrayItem("rnr-edge", MVCFunctions.count(smartyGroups) - 1, "rnredgeclass"); this.xt.assign_loopsection(new XVar("usergroup_header"), (XVar)(smartyGroups)); if (XVar.Pack(MVCFunctions.count(rowInfo))) { this.addSaveButtons = new XVar(true); } return(null); }
public virtual XVar assignSearchBlocks() { dynamic defaultValue = null, notAddedFileds = XVar.Array(), otherFieldsBlocks = XVar.Array(), recId = null, searchPanelFieldsBlocks = XVar.Array(), srchCtrlBlocksNumber = null; searchPanelFieldsBlocks = XVar.Clone(XVar.Array()); otherFieldsBlocks = XVar.Clone(XVar.Array()); notAddedFileds = XVar.Clone(XVar.Array()); srchCtrlBlocksNumber = new XVar(0); recId = XVar.Clone(this.pageObj.genId()); foreach (KeyValuePair <XVar, dynamic> searchField in this.allSearchFields.GetEnumerator()) { dynamic isSrchPanelField = null, srchFields = XVar.Array(); this.pageObj.fillFieldToolTips((XVar)(searchField.Value)); srchFields = XVar.Clone(this.searchClauseObj.getSearchCtrlParams((XVar)(searchField.Value))); isSrchPanelField = XVar.Clone(MVCFunctions.in_array((XVar)(searchField.Value), (XVar)(this.panelSearchFields))); if (XVar.Pack(!(XVar)(MVCFunctions.count(srchFields)))) { defaultValue = XVar.Clone(this.pSet.getDefaultValue((XVar)(searchField.Value))); if (XVar.Pack(isSrchPanelField)) { dynamic opt = null; opt = new XVar(""); if (XVar.Pack(!(XVar)(this.isFlexibleSearch))) { opt = XVar.Clone(this.searchOptions[searchField.Value]); } srchFields.InitAndSetArrayItem(new XVar("opt", opt, "not", "", "value1", defaultValue, "value2", ""), null); } } if (XVar.Pack(MVCFunctions.count(srchFields))) { if (XVar.Pack(isSrchPanelField)) { srchFields.InitAndSetArrayItem(true, MVCFunctions.count(srchFields) - 1, "immutable"); } foreach (KeyValuePair <XVar, dynamic> srchField in srchFields.GetEnumerator()) { dynamic block = null; block = XVar.Clone(this.searchControlBuilder.buildSearchCtrlBlockArr((XVar)(recId), (XVar)(searchField.Value), new XVar(0), (XVar)(srchField.Value["opt"]), (XVar)(srchField.Value["not"]), new XVar(false), (XVar)(srchField.Value["value1"]), (XVar)(srchField.Value["value2"]), (XVar)(isSrchPanelField), (XVar)(this.isFlexibleSearch), (XVar)(srchField.Value["immutable"]))); if (XVar.Pack(isSrchPanelField)) { searchPanelFieldsBlocks.InitAndSetArrayItem(block, searchField.Value, null); } else { otherFieldsBlocks.InitAndSetArrayItem(block, null); } srchCtrlBlocksNumber++; addSearchFieldToControlsMap((XVar)(searchField.Value), ref recId); } } else { notAddedFileds.InitAndSetArrayItem(searchField.Value, null); } } foreach (KeyValuePair <XVar, dynamic> namedBlocks in searchPanelFieldsBlocks.GetEnumerator()) { this.xt.assign_loopsection_byValue((XVar)(MVCFunctions.Concat("searchCtrlBlock_", MVCFunctions.GoodFieldName((XVar)(namedBlocks.Key)))), (XVar)(namedBlocks.Value)); } if (XVar.Pack(!(XVar)(this.isFlexibleSearch))) { return(null); } if ((XVar)(XVar.Pack(0) < srchCtrlBlocksNumber) && (XVar)(srchCtrlBlocksNumber < GlobalVars.gLoadSearchControls)) { dynamic otherSearchControlsMaxNumber = null; otherSearchControlsMaxNumber = XVar.Clone((GlobalVars.gLoadSearchControls - srchCtrlBlocksNumber) + MVCFunctions.count(otherFieldsBlocks)); foreach (KeyValuePair <XVar, dynamic> searchField in notAddedFileds.GetEnumerator()) { defaultValue = XVar.Clone(this.pSet.getDefaultValue((XVar)(searchField.Value))); otherFieldsBlocks.InitAndSetArrayItem(this.searchControlBuilder.buildSearchCtrlBlockArr((XVar)(recId), (XVar)(searchField.Value), new XVar(0), new XVar(""), new XVar(false), new XVar(true), (XVar)(defaultValue), new XVar("")), null); addSearchFieldToControlsMap((XVar)(searchField.Value), ref recId); if (otherSearchControlsMaxNumber <= MVCFunctions.count(otherFieldsBlocks)) { break; } } } this.xt.assign_loopsection(new XVar("searchCtrlBlock"), (XVar)(otherFieldsBlocks)); return(null); }
public XVar searchsuggest() { try { dynamic _connection = null, allSearchFields = null, dashSearchFields = XVar.Array(), dashSettings = null, detailKeys = XVar.Array(), forDashboardSimpleSearch = null, numberOfSuggests = null, pSetList = null, pageType = null, result = XVar.Array(), returnJSON = XVar.Array(), searchClauseObj = null, searchField = null, searchFor = null, searchOpt = null, table = null, whereClauses = XVar.Array(); ProjectSettings pSet; CommonFunctions.add_nocache_headers(); table = XVar.Clone(MVCFunctions.postvalue(new XVar("table"))); GlobalVars.strTableName = XVar.Clone(CommonFunctions.GetTableByShort((XVar)(table))); if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(table))))) { MVCFunctions.Echo(new XVar(0)); return(MVCFunctions.GetBuferContentAndClearBufer()); } Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", table, ""), "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null); if (XVar.Pack(!(XVar)(CommonFunctions.isLogged()))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search"))))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } searchFor = XVar.Clone(MVCFunctions.trim((XVar)(MVCFunctions.postvalue(new XVar("searchFor"))))); if (searchFor == XVar.Pack("")) { MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true, "result", "")))); return(MVCFunctions.GetBuferContentAndClearBufer()); } searchOpt = XVar.Clone((XVar.Pack(MVCFunctions.postvalue(new XVar("start"))) ? XVar.Pack("Starts with") : XVar.Pack("Contains"))); searchField = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(MVCFunctions.postvalue(new XVar("searchField"))))); numberOfSuggests = XVar.Clone(CommonFunctions.GetGlobalData(new XVar("searchSuggestsNumber"), new XVar(10))); whereClauses = XVar.Clone(XVar.Array()); pageType = XVar.Clone(MVCFunctions.postvalue(new XVar("pageType"))); if (XVar.Pack(!(XVar)(pageType))) { pageType = new XVar(Constants.PAGE_LIST); } forDashboardSimpleSearch = XVar.Clone((XVar)(!(XVar)(searchField)) && (XVar)(pageType == Constants.PAGE_DASHBOARD)); if (XVar.Pack(forDashboardSimpleSearch)) { dynamic dashGoogleLikeFields = XVar.Array(), sfdata = XVar.Array(); dashSettings = XVar.Clone(new ProjectSettings((XVar)(GlobalVars.strTableName), new XVar(Constants.PAGE_DASHBOARD))); dashGoogleLikeFields = XVar.Clone(dashSettings.getGoogleLikeFields()); dashSearchFields = XVar.Clone(dashSettings.getDashboardSearchFields()); sfdata = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> g in dashGoogleLikeFields.GetEnumerator()) { foreach (KeyValuePair <XVar, dynamic> data in dashSearchFields[g.Value].GetEnumerator()) { sfdata.InitAndSetArrayItem(data.Value["field"], data.Value["table"], null); } } foreach (KeyValuePair <XVar, dynamic> fields in sfdata.GetEnumerator()) { dynamic _result = XVar.Array(); if (numberOfSuggests <= MVCFunctions.count(result)) { break; } if (XVar.Pack(!(XVar)(MVCFunctions.count(result)))) { result = XVar.Clone(XVar.Array()); } _result = XVar.Clone(CommonFunctions.getListOfSuggests((XVar)(fields.Value), (XVar)(fields.Key), (XVar)(whereClauses), (XVar)(numberOfSuggests - MVCFunctions.count(result)), (XVar)(searchOpt), (XVar)(searchFor))); foreach (KeyValuePair <XVar, dynamic> _data in _result.GetEnumerator()) { dynamic found = null; found = new XVar(false); foreach (KeyValuePair <XVar, dynamic> data in result.GetEnumerator()) { if (data.Value["realValue"] == _data.Value["realValue"]) { found = new XVar(true); break; } } if (XVar.Pack(!(XVar)(found))) { result.InitAndSetArrayItem(_data.Value, null); } } } MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true, "result", result)))); MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } if (pageType == Constants.PAGE_DASHBOARD) { dynamic sfData = XVar.Array(); dashSettings = XVar.Clone(new ProjectSettings((XVar)(GlobalVars.strTableName), new XVar(Constants.PAGE_DASHBOARD))); dashSearchFields = XVar.Clone(dashSettings.getDashboardSearchFields()); sfData = XVar.Clone(dashSearchFields[searchField][0]); searchField = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(sfData["field"]))); table = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(sfData["table"]))); if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(table))))) { MVCFunctions.Echo(new XVar(0)); return(MVCFunctions.GetBuferContentAndClearBufer()); } GlobalVars.strTableName = XVar.Clone(CommonFunctions.GetTableByShort((XVar)(table))); Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", table, ""), "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null); foreach (KeyValuePair <XVar, dynamic> elem in dashSettings.getDashboardElements().GetEnumerator()) { if (elem.Value["table"] == GlobalVars.strTableName) { pageType = new XVar(Constants.PAGE_LIST); if (elem.Value["type"] == Constants.DASHBOARD_CHART) { pageType = new XVar(Constants.PAGE_CHART); } else { if (elem.Value["type"] == Constants.DASHBOARD_REPORT) { pageType = new XVar(Constants.PAGE_REPORT); } } break; } } } pSetList = XVar.Clone(new ProjectSettings((XVar)(GlobalVars.strTableName), (XVar)(pageType))); if (searchField == XVar.Pack("")) { allSearchFields = XVar.Clone(pSetList.getGoogleLikeFields()); } else { allSearchFields = XVar.Clone(pSetList.getAllSearchFields()); } pSet = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(GlobalVars.strTableName), new XVar(Constants.PAGE_SEARCH))); GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName))); _connection = XVar.Clone(GlobalVars.cman.byTable((XVar)(GlobalVars.strTableName))); detailKeys = XVar.Clone(XVar.Array()); if (XSession.Session[MVCFunctions.Concat(GlobalVars.strTableName, "_mastertable")] != "") { dynamic i = null, j = null, masterTablesInfoArr = XVar.Array(), masterWhere = null, mastervalue = null; masterWhere = new XVar(""); masterTablesInfoArr = XVar.Clone(pSet.getMasterTablesArr((XVar)(GlobalVars.strTableName))); i = new XVar(0); for (; i < MVCFunctions.count(masterTablesInfoArr); i++) { if (XSession.Session[MVCFunctions.Concat(GlobalVars.strTableName, "_mastertable")] != masterTablesInfoArr[i]["mDataSourceTable"]) { continue; } detailKeys = XVar.Clone(masterTablesInfoArr[i]["detailKeys"]); j = new XVar(0); for (; j < MVCFunctions.count(detailKeys); j++) { mastervalue = XVar.Clone(GlobalVars.cipherer.MakeDBValue((XVar)(detailKeys[j]), (XVar)(XSession.Session[MVCFunctions.Concat(GlobalVars.strTableName, "_masterkey", j + 1)]), new XVar(""), new XVar(true))); if (mastervalue == "null") { masterWhere = MVCFunctions.Concat(masterWhere, RunnerPage._getFieldSQL((XVar)(detailKeys[j]), (XVar)(_connection), (XVar)(pSet)), " is NULL "); } else { masterWhere = MVCFunctions.Concat(masterWhere, RunnerPage._getFieldSQLDecrypt((XVar)(detailKeys[j]), (XVar)(_connection), (XVar)(pSet), (XVar)(GlobalVars.cipherer)), "=", mastervalue); } } break; } whereClauses.InitAndSetArrayItem(masterWhere, null); } searchClauseObj = XVar.Clone(SearchClause.getSearchObject((XVar)(GlobalVars.strTableName), new XVar(""), (XVar)(GlobalVars.strTableName), (XVar)(GlobalVars.cipherer))); searchClauseObj.processFiltersWhere((XVar)(_connection)); foreach (KeyValuePair <XVar, dynamic> filteredField in searchClauseObj.filteredFields.GetEnumerator()) { whereClauses.InitAndSetArrayItem(filteredField.Value["where"], null); } result = XVar.Clone(CommonFunctions.getListOfSuggests((XVar)(allSearchFields), (XVar)(GlobalVars.strTableName), (XVar)(whereClauses), (XVar)(numberOfSuggests), (XVar)(searchOpt), (XVar)(searchFor), (XVar)(searchField), (XVar)(detailKeys))); returnJSON = XVar.Clone(XVar.Array()); returnJSON.InitAndSetArrayItem(true, "success"); returnJSON.InitAndSetArrayItem(result, "result"); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON))); MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }
public virtual XVar removeRowsColumns(dynamic _param_cellRemoveFlag, dynamic _param_rowsOnly = null) { #region default values if (_param_rowsOnly as Object == null) { _param_rowsOnly = new XVar(false); } #endregion #region pass-by-value parameters dynamic cellRemoveFlag = XVar.Clone(_param_cellRemoveFlag); dynamic rowsOnly = XVar.Clone(_param_rowsOnly); #endregion dynamic canDeleteRow = null, cell = null, i = null, ret = XVar.Array(), row = null, rowCells = XVar.Array(), rowIdx = null, rowsArr = null; ret = XVar.Clone(new XVar("cols", XVar.Array(), "rows", XVar.Array())); if (XVar.Pack(!(XVar)(rowsOnly))) { dynamic canDeleteCol = null, col = null, colCells = XVar.Array(), colIdx = null, colsArr = null; col = new XVar(0); for (; col < this.width; ++(col)) { colCells = XVar.Clone(getColumnCells((XVar)(col))); canDeleteCol = new XVar(true); foreach (KeyValuePair <XVar, dynamic> _cell in colCells.GetEnumerator()) { if ((XVar)(!(XVar)(this.cells[_cell.Value][cellRemoveFlag])) && (XVar)(MVCFunctions.count(this.cells[_cell.Value]["cols"]) == 1)) { canDeleteCol = new XVar(false); break; } } if (XVar.Pack(!(XVar)(canDeleteCol))) { continue; } i = new XVar(0); for (; i < MVCFunctions.count(colCells); ++(i)) { cell = XVar.Clone(colCells[i]); colIdx = XVar.Clone(MVCFunctions.array_search((XVar)(col), (XVar)(this.cells[cell]["cols"]))); MVCFunctions.array_splice((XVar)(this.cells[cell]["cols"]), (XVar)(colIdx), new XVar(1)); colsArr = this.cells[cell]["cols"]; MVCFunctions.array_splice((XVar)(colsArr), (XVar)(colIdx), new XVar(1)); this.cells.InitAndSetArrayItem(colsArr, cell, "cols"); } ret.InitAndSetArrayItem(col, "cols", null); } } row = XVar.Clone(this.height - 1); for (; XVar.Pack(0) <= row; --(row)) { rowCells = XVar.Clone(getRowCells((XVar)(row))); canDeleteRow = new XVar(true); foreach (KeyValuePair <XVar, dynamic> _cell in rowCells.GetEnumerator()) { if ((XVar)(!(XVar)(this.cells[_cell.Value][cellRemoveFlag])) && (XVar)((XVar)(MVCFunctions.count(this.cells[_cell.Value]["rows"]) == 1) || (XVar)(XVar.Equals(XVar.Pack(this.cells[_cell.Value]["rows"][0]), XVar.Pack(row))))) { canDeleteRow = new XVar(false); break; } } if (XVar.Pack(!(XVar)(canDeleteRow))) { continue; } i = new XVar(0); for (; i < MVCFunctions.count(rowCells); ++(i)) { cell = XVar.Clone(rowCells[i]); rowIdx = XVar.Clone(MVCFunctions.array_search((XVar)(row), (XVar)(this.cells[cell]["rows"]))); rowsArr = XVar.Clone(this.cells[cell]["rows"]); MVCFunctions.array_splice((XVar)(rowsArr), (XVar)(rowIdx), new XVar(1)); this.cells.InitAndSetArrayItem(rowsArr, cell, "rows"); } ret.InitAndSetArrayItem(row, "rows", null); } return(ret); }
public static XVar Update(dynamic _param_table, dynamic _param_data, dynamic _param_userConditions) { #region pass-by-value parameters dynamic table = XVar.Clone(_param_table); dynamic data = XVar.Clone(_param_data); dynamic userConditions = XVar.Clone(_param_userConditions); #endregion dynamic blobs = XVar.Array(), result = null, tableInfo = XVar.Array(), updateValues = XVar.Array(), whereSql = null; result = new XVar(false); tableInfo = XVar.Clone(_getTableInfo((XVar)(table))); if (XVar.Pack(!(XVar)(tableInfo))) { return(false); } whereSql = XVar.Clone(_getWhereSql((XVar)(userConditions), (XVar)(tableInfo["fields"]))); if (whereSql == XVar.Pack("")) { return(false); } updateValues = XVar.Clone(XVar.Array()); blobs = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> value in data.GetEnumerator()) { dynamic field = XVar.Array(), prepareFieldName = null, prepareValue = null; field = XVar.Clone(CommonFunctions.getArrayElementNC((XVar)(tableInfo["fields"]), (XVar)(value.Key))); if (XVar.Pack(field == null)) { continue; } prepareFieldName = XVar.Clone(CurrentConnection().addFieldWrappers((XVar)(field["name"]))); prepareValue = XVar.Clone(_prepareValue((XVar)(value.Value), (XVar)(field["type"]))); updateValues.InitAndSetArrayItem(MVCFunctions.Concat(prepareFieldName, "=", prepareValue), null); if ((XVar)((XVar)(CurrentConnection().dbType == Constants.nDATABASE_Oracle) || (XVar)(CurrentConnection().dbType == Constants.nDATABASE_DB2)) || (XVar)(CurrentConnection().dbType == Constants.nDATABASE_Informix)) { if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(field["type"])))) { blobs.InitAndSetArrayItem(value.Value, field["name"]); } if ((XVar)(CurrentConnection().dbType == Constants.nDATABASE_Informix) && (XVar)(CommonFunctions.IsTextType((XVar)(field["type"])))) { blobs.InitAndSetArrayItem(value.Value, field["name"]); } } } if (0 < MVCFunctions.count(updateValues)) { dynamic sql = null, updateSQL = null; updateSQL = XVar.Clone(MVCFunctions.implode(new XVar(","), (XVar)(updateValues))); sql = XVar.Clone(MVCFunctions.Concat("UPDATE ", CurrentConnection().addTableWrappers((XVar)(tableInfo["fullName"])), " SET ", updateSQL, whereSql)); if (0 < MVCFunctions.count(blobs)) { result = XVar.Clone(_execSilentWithBlobProcessing((XVar)(blobs), (XVar)(sql), (XVar)(tableInfo["fields"]))); } else { result = XVar.Clone(CurrentConnection().execSilent((XVar)(sql))); } } return(result); }
protected override XVar prepareFields() { foreach (KeyValuePair <XVar, dynamic> fdata in this.pSet.getDashboardSearchFields().GetEnumerator()) { dynamic ctrlBlockArr = XVar.Array(), ctrlInd = null, fSet = null, field = null, firstFieldParams = XVar.Array(), isFieldNeedSecCtrl = null, lookupTable = null, srchFields = XVar.Array(), srchTypeFull = null, table = null; field = XVar.Clone(fdata.Value[0]["field"]); table = XVar.Clone(fdata.Value[0]["table"]); fSet = XVar.Clone(getTableSettings((XVar)(table))); lookupTable = XVar.Clone(fSet.getLookupTable((XVar)(field))); if (XVar.Pack(lookupTable)) { this.settingsMap.InitAndSetArrayItem(CommonFunctions.GetTableURL((XVar)(lookupTable)), "globalSettings", "shortTNames", lookupTable); } fillFieldToolTips((XVar)(fdata.Key)); srchFields = XVar.Clone(this.searchClauseObj.getSearchCtrlParams((XVar)(fdata.Key))); firstFieldParams = XVar.Clone(XVar.Array()); if (XVar.Pack(MVCFunctions.count(srchFields))) { firstFieldParams = XVar.Clone(srchFields[0]); } else { firstFieldParams.InitAndSetArrayItem(fdata.Key, "fName"); firstFieldParams.InitAndSetArrayItem("", "eType"); firstFieldParams.InitAndSetArrayItem(this.pSet.getDefaultValue((XVar)(field), (XVar)(table)), "value1"); firstFieldParams.InitAndSetArrayItem("", "value2"); firstFieldParams.InitAndSetArrayItem(false, "not"); firstFieldParams.InitAndSetArrayItem(this.pSet.getDefaultSearchOption((XVar)(fdata.Key)), "opt"); firstFieldParams.InitAndSetArrayItem(false, "not"); if (MVCFunctions.substr((XVar)(firstFieldParams["opt"]), new XVar(0), new XVar(4)) == "NOT ") { firstFieldParams.InitAndSetArrayItem(MVCFunctions.substr((XVar)(firstFieldParams["opt"]), new XVar(4)), "opt"); firstFieldParams.InitAndSetArrayItem(true, "not"); } } ctrlBlockArr = XVar.Clone(this.searchControlBuilder.buildSearchCtrlBlockArr((XVar)(this.id), (XVar)(firstFieldParams["fName"]), new XVar(0), (XVar)(firstFieldParams["opt"]), (XVar)(firstFieldParams["not"]), new XVar(false), (XVar)(firstFieldParams["value1"]), (XVar)(firstFieldParams["value2"]))); if (firstFieldParams["opt"] == "") { firstFieldParams.InitAndSetArrayItem(this.pSet.getDefaultSearchOption((XVar)(firstFieldParams["fName"])), "opt"); } srchTypeFull = XVar.Clone(this.searchControlBuilder.getCtrlSearchType((XVar)(firstFieldParams["fName"]), (XVar)(this.id), new XVar(0), (XVar)(firstFieldParams["opt"]), (XVar)(firstFieldParams["not"]), new XVar(true), new XVar(true))); if (XVar.Pack(CommonFunctions.isEnableSection508())) { this.xt.assign_section((XVar)(MVCFunctions.Concat(fdata.Key, "_label")), (XVar)(MVCFunctions.Concat("<label for=\"", getInputElementId((XVar)(field), (XVar)(fSet)), "\">")), new XVar("</label>")); } else { this.xt.assign((XVar)(MVCFunctions.Concat(fdata.Key, "_label")), new XVar(true)); } this.xt.assign((XVar)(MVCFunctions.Concat(fdata.Key, "_fieldblock")), new XVar(true)); this.xt.assignbyref((XVar)(MVCFunctions.Concat(fdata.Key, "_editcontrol")), (XVar)(ctrlBlockArr["searchcontrol"])); this.xt.assign((XVar)(MVCFunctions.Concat(fdata.Key, "_notbox")), (XVar)(ctrlBlockArr["notbox"])); this.xt.assignbyref((XVar)(MVCFunctions.Concat(fdata.Key, "_editcontrol1")), (XVar)(ctrlBlockArr["searchcontrol1"])); this.xt.assign((XVar)(MVCFunctions.Concat("searchtype_", fdata.Key)), (XVar)(ctrlBlockArr["searchtype"])); this.xt.assign((XVar)(MVCFunctions.Concat("searchtypefull_", fdata.Key)), (XVar)(srchTypeFull)); isFieldNeedSecCtrl = XVar.Clone(this.searchControlBuilder.isNeedSecondCtrl((XVar)(fdata.Key))); ctrlInd = new XVar(0); if (XVar.Pack(isFieldNeedSecCtrl)) { this.controlsMap.InitAndSetArrayItem(new XVar("fName", fdata.Key, "recId", this.id, "ctrlsMap", new XVar(0, ctrlInd, 1, ctrlInd + 1)), "search", "searchBlocks", null); ctrlInd += 2; } else { this.controlsMap.InitAndSetArrayItem(new XVar("fName", fdata.Key, "recId", this.id, "ctrlsMap", new XVar(0, ctrlInd)), "search", "searchBlocks", null); ctrlInd++; } } return(null); }
public override XVar buildControl(dynamic _param_value, dynamic _param_mode, dynamic _param_fieldNum, dynamic _param_validate, dynamic _param_additionalCtrlParams, dynamic _param_data) { #region pass-by-value parameters dynamic value = XVar.Clone(_param_value); dynamic mode = XVar.Clone(_param_mode); dynamic fieldNum = XVar.Clone(_param_fieldNum); dynamic validate = XVar.Clone(_param_validate); dynamic additionalCtrlParams = XVar.Clone(_param_additionalCtrlParams); dynamic data = XVar.Clone(_param_data); #endregion dynamic alt = null, classString = null, controlWidth = null, dateEditType = null, dayStyle = null, dp = null, fmt = null, hasImgCal = null, initDayOpt = null, initMonthOpt = null, initYearOpt = null, monthStyle = null, ovalue = null, ovalue1 = null, ret = null, retday = null, retmonth = null, retyear = null, setHiddenElem = null, showTime = null, space = null, time = XVar.Array(), tvalue = null, yearStyle = null; ProjectSettings pSet; base.buildControl((XVar)(value), (XVar)(mode), (XVar)(fieldNum), (XVar)(validate), (XVar)(additionalCtrlParams), (XVar)(data)); if (XVar.Pack(fieldNum)) { this.cfield = XVar.Clone(MVCFunctions.Concat("value", fieldNum, "_", MVCFunctions.GoodFieldName((XVar)(this.field)), "_", this.id)); } pSet = XVar.UnPackProjectSettings(getProjectSettings()); dateEditType = XVar.Clone(getDateEditType((XVar)(pSet))); MVCFunctions.Echo(MVCFunctions.Concat("<input id=\"", this.ctype, "\" type=\"hidden\" name=\"", this.ctype, "\" value=\"date", dateEditType, "\">")); tvalue = XVar.Clone(value); time = XVar.Clone(CommonFunctions.db2time((XVar)(tvalue))); if (XVar.Pack(!(XVar)(MVCFunctions.count(time)))) { time = XVar.Clone(new XVar(0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0)); } classString = new XVar(""); if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { classString = new XVar(" form-control"); } dp = new XVar(0); hasImgCal = new XVar(true); showTime = XVar.Clone(pSet.dateEditShowTime((XVar)(this.field))); switch (((XVar)dateEditType).ToInt()) { case Constants.EDIT_DATE_SIMPLE_INLINE: case Constants.EDIT_DATE_SIMPLE_DP: if (dateEditType == Constants.EDIT_DATE_SIMPLE_INLINE) { hasImgCal = new XVar(false); } ovalue = XVar.Clone(value); if (GlobalVars.locale_info["LOCALE_IDATE"] == 1) { fmt = XVar.Clone(MVCFunctions.Concat("dd", GlobalVars.locale_info["LOCALE_SDATE"], "MM", GlobalVars.locale_info["LOCALE_SDATE"], "yyyy")); } else { if (GlobalVars.locale_info["LOCALE_IDATE"] == 0) { fmt = XVar.Clone(MVCFunctions.Concat("MM", GlobalVars.locale_info["LOCALE_SDATE"], "dd", GlobalVars.locale_info["LOCALE_SDATE"], "yyyy")); } else { fmt = XVar.Clone(MVCFunctions.Concat("yyyy", GlobalVars.locale_info["LOCALE_SDATE"], "MM", GlobalVars.locale_info["LOCALE_SDATE"], "dd")); } } if ((XVar)((XVar)((XVar)(showTime) || (XVar)(time[3])) || (XVar)(time[4])) || (XVar)(time[5])) { dynamic timeAttrs = null; timeAttrs = XVar.Clone(this.pageObject.pSetEdit.getFormatTimeAttrs((XVar)(this.field))); fmt = MVCFunctions.Concat(fmt, " ", GlobalVars.locale_info["LOCALE_STIMEFORMAT"]); } if (XVar.Pack(time[0])) { ovalue = XVar.Clone(CommonFunctions.format_datetime_custom((XVar)(time), (XVar)(fmt))); } ovalue1 = XVar.Clone(MVCFunctions.Concat(time[2], "-", time[1], "-", time[0])); if ((XVar)((XVar)((XVar)(showTime) || (XVar)(time[3])) || (XVar)(time[4])) || (XVar)(time[5])) { ovalue1 = MVCFunctions.Concat(ovalue1, " ", time[3], ":", time[4], ":", time[5]); } ret = XVar.Clone(MVCFunctions.Concat("<input ", getPlaceholderAttr(), " id=\"", this.cfield, "\" ", this.inputStyle, " class=\"", classString, "\" type=\"Text\" name=\"", this.cfield, "\" value=\"", ovalue, "\">")); ret = MVCFunctions.Concat(ret, "<input id=\"ts", this.cfield, "\" type=\"Hidden\" name=\"ts", this.cfield, "\" value=\"", ovalue1, "\">"); if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { ret = MVCFunctions.Concat(ret, "<span class=\"input-group-addon\" id=\"imgCal_", this.cfield, "\"><span class=\"glyphicon glyphicon-calendar\"></span></span>"); } else { if (XVar.Pack(hasImgCal)) { ret = MVCFunctions.Concat(ret, "<a href=\"#\" id=\"imgCal_", this.cfield, "\" data-icon=\"calendar\" title=\"Click Here to Pick up the date\"></a>"); } } if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { if (XVar.Pack(CommonFunctions.isRTL())) { ret = MVCFunctions.Concat(ret, "<span></span>"); } ret = XVar.Clone(MVCFunctions.Concat("<div class=\"input-group date\">", ret, "</div>")); } MVCFunctions.Echo(ret); break; case Constants.EDIT_DATE_DD_INLINE: case Constants.EDIT_DATE_DD_DP: case Constants.EDIT_DATE_DD: if ((dateEditType == Constants.EDIT_DATE_DD_INLINE) || (dateEditType == Constants.EDIT_DATE_DD_DP)) { dp = new XVar(1); } controlWidth = XVar.Clone(pSet.getControlWidth((XVar)(this.field))); if (XVar.Pack(0) < controlWidth) { dynamic dayWidth = null, mothWidth = null, yearWidth = null; controlWidth -= 10; yearWidth = XVar.Clone((XVar)Math.Floor((double)(controlWidth * 0.300000))); yearStyle = XVar.Clone(MVCFunctions.Concat("style=\"min-width: ", yearWidth, "px;margin-right:5px;\" ")); dayWidth = XVar.Clone((XVar)Math.Floor((double)(controlWidth * 0.200000))); dayStyle = XVar.Clone(MVCFunctions.Concat("style=\"min-width: ", dayWidth, "px; margin-right:5px;\" ")); mothWidth = XVar.Clone((controlWidth - yearWidth) - dayWidth); monthStyle = XVar.Clone(MVCFunctions.Concat("style=\"min-width: ", mothWidth, "px; margin-right:5px;\" ")); } else { dayStyle = new XVar(""); monthStyle = new XVar(""); yearStyle = new XVar(""); } alt = XVar.Clone(MVCFunctions.Concat("alt=\"", this.strLabel, "\" ")); initMonthOpt = new XVar("<option> </option>"); if (XVar.Pack(time[1])) { dynamic months = XVar.Array(); months = XVar.Clone(CommonFunctions.getMountNames()); initMonthOpt = XVar.Clone(MVCFunctions.Concat("<option>", months[time[1]], "</option>")); } initMonthOpt = MVCFunctions.Concat(initMonthOpt, "<option>", maxLengthMonth(), "</option>"); initDayOpt = XVar.Clone(MVCFunctions.Concat("<option>", (XVar.Pack(time[2]) ? XVar.Pack(time[2]) : XVar.Pack(" ")), " </option><option>22</option>")); initYearOpt = XVar.Clone(MVCFunctions.Concat("<option>", (XVar.Pack(time[0]) ? XVar.Pack(time[0]) : XVar.Pack(" ")), "</option><option>2000</option>")); retday = XVar.Clone(MVCFunctions.Concat("<select class=\"", classString, "\" id=\"day", this.cfield, "\" ", dayStyle, alt, "name=\"day", this.cfield, "\" >", initDayOpt, "</select>")); retmonth = XVar.Clone(MVCFunctions.Concat("<select class=\"", classString, "\" id=\"month", this.cfield, "\" ", monthStyle, alt, "name=\"month", this.cfield, "\" >", initMonthOpt, "</option></select>")); retyear = XVar.Clone(MVCFunctions.Concat("<select class=\"", classString, "\" id=\"year", this.cfield, "\" ", yearStyle, alt, "name=\"year", this.cfield, "\" >", initYearOpt, "</select>")); space = XVar.Clone((XVar.Pack(XVar.Pack(0) < controlWidth) ? XVar.Pack("") : XVar.Pack(" "))); if (GlobalVars.locale_info["LOCALE_ILONGDATE"] == 1) { ret = XVar.Clone(MVCFunctions.Concat(retday, space, retmonth, space, retyear)); } else { if (GlobalVars.locale_info["LOCALE_ILONGDATE"] == 0) { ret = XVar.Clone(MVCFunctions.Concat(retmonth, space, retday, space, retyear)); } else { ret = XVar.Clone(MVCFunctions.Concat(retyear, space, retmonth, space, retday)); } } setHiddenElem = new XVar("type=hidden"); if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { setHiddenElem = XVar.Clone(MVCFunctions.Concat("class=\"", classString, " hiddenPickerElement\"")); } if ((XVar)((XVar)(time[0]) && (XVar)(time[1])) && (XVar)(time[2])) { ret = MVCFunctions.Concat(ret, "<input id=\"", this.cfield, "\" ", setHiddenElem, " name=\"", this.cfield, "\" value=\"", time[0], "-", time[1], "-", time[2], "\">"); } else { ret = MVCFunctions.Concat(ret, "<input id=\"", this.cfield, "\" ", setHiddenElem, " name=\"", this.cfield, "\" value=\"\">"); } if (XVar.Pack(dp)) { if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { ret = MVCFunctions.Concat(ret, "<button class=\"btn btn-default\" id=\"imgCal_", this.cfield, "\" aria-hidden=true><span class=\"glyphicon glyphicon-calendar\" ></span></button>"); } else { ret = MVCFunctions.Concat(ret, "<a href=\"#\" id=\"imgCal_", this.cfield, "\" data-icon=\"calendar\" title=\"Click Here to Pick up the date\"></a>"); ret = MVCFunctions.Concat(ret, "<input id=\"ts", this.cfield, "\" type=hidden name=\"ts", this.cfield, "\" value=\"", time[2], "-", time[1], "-", time[0], "\">"); } } if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { ret = XVar.Clone(MVCFunctions.Concat("<span class=\"bs-date-control form-inline\">", ret, "</span>")); } MVCFunctions.Echo(ret); break; default: ovalue = XVar.Clone(value); if (XVar.Pack(time[0])) { if ((XVar)((XVar)((XVar)(showTime) || (XVar)(time[3])) || (XVar)(time[4])) || (XVar)(time[5])) { ovalue = XVar.Clone(CommonFunctions.str_format_datetime((XVar)(time))); } else { ovalue = XVar.Clone(CommonFunctions.format_shortdate((XVar)(time))); } } MVCFunctions.Echo(MVCFunctions.Concat("<input ", getPlaceholderAttr(), " id=\"", this.cfield, "\" type=text class=\"", classString, "\" name=\"", this.cfield, "\" ", this.inputStyle, " value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(ovalue)), "\">")); break; } buildControlEnd((XVar)(validate), (XVar)(mode)); return(null); }
public XVar lookupsuggest() { try { dynamic LookupSQL = null, LookupSQLTable = null, LookupType = null, contextParams = XVar.Array(), data = XVar.Array(), displayFieldIndex = null, displayFieldName = null, displayedValue = null, field = null, isExistParent = null, likeConditionField = null, likeField = null, likeWheres = XVar.Array(), linkAndDisplaySame = null, linkFieldIndex = null, linkFieldName = null, lookupCipherer = null, lookupConnection = null, lookupField = null, lookupIndices = XVar.Array(), lookupOrderBy = null, lookupPSet = null, lookupQueryObj = null, lookupTable = null, lwDisplayField = null, masterTable = null, multiselect = null, pageType = null, parentCtrlsData = XVar.Array(), qResult = null, respObj = null, searchByLinkField = null, strLookupWhere = null, strUniqueOrderBy = null, table = null, value = null, values = XVar.Array(), var_response = XVar.Array(), viewContainer = null; MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); table = XVar.Clone(MVCFunctions.postvalue(new XVar("table"))); if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(table))))) { MVCFunctions.Echo(new XVar(0)); return(MVCFunctions.GetBuferContentAndClearBufer()); } Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", table, ""), "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null); pageType = XVar.Clone(MVCFunctions.postvalue(new XVar("pageType"))); GlobalVars.strTableName = XVar.Clone(CommonFunctions.GetTableByShort((XVar)(table))); GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName))); GlobalVars.gSettings = XVar.Clone(new ProjectSettings((XVar)(GlobalVars.strTableName), (XVar)(pageType), (XVar)(MVCFunctions.postvalue(new XVar("page"))))); field = XVar.Clone(MVCFunctions.postvalue(new XVar("searchField"))); if (GlobalVars.gSettings.getEntityType() == Constants.titDASHBOARD) { dynamic dashFields = XVar.Array(); dashFields = XVar.Clone(GlobalVars.gSettings.getDashboardSearchFields()); table = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(dashFields[field][0]["table"]))); GlobalVars.strTableName = XVar.Clone(CommonFunctions.GetTableByShort((XVar)(table))); field = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(dashFields[field][0]["field"]))); if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(table))))) { MVCFunctions.Echo(new XVar(0)); return(MVCFunctions.GetBuferContentAndClearBufer()); } Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", table, ""), "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null); GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName))); GlobalVars.gSettings = XVar.Clone(new ProjectSettings((XVar)(GlobalVars.strTableName), (XVar)(pageType))); } masterTable = XVar.Clone(MVCFunctions.postvalue(new XVar("masterTable"))); if ((XVar)(masterTable != XVar.Pack("")) && (XVar)(XSession.Session.KeyExists(MVCFunctions.Concat(masterTable, "_masterRecordData")))) { contextParams.InitAndSetArrayItem(XSession.Session[MVCFunctions.Concat(masterTable, "_masterRecordData")], "masterData"); } contextParams.InitAndSetArrayItem(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("data")))), "data"); RunnerContext.push((XVar)(new RunnerContextItem((XVar)(pageType), (XVar)(contextParams)))); if (GlobalVars.strTableName != "dbo.EMPLEADO") { if (XVar.Pack(!(XVar)(CommonFunctions.isLogged()))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } if ((XVar)((XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Edit")))) && (XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Add"))))) && (XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search"))))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } } else { dynamic checkResult = null, registerFields = null; checkResult = new XVar(true); registerFields = XVar.Clone((XVar.Pack(pageType == "register") ? XVar.Pack(GlobalVars.gSettings.getPageFields()) : XVar.Pack(XVar.Array()))); if (!XVar.Equals(XVar.Pack(MVCFunctions.array_search((XVar)(field), (XVar)(registerFields))), XVar.Pack(false))) { checkResult = new XVar(false); } if (XVar.Pack(checkResult)) { if (XVar.Pack(!(XVar)(CommonFunctions.isLogged()))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } if ((XVar)((XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Edit")))) && (XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Add"))))) && (XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search"))))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } } } isExistParent = XVar.Clone(MVCFunctions.postvalue(new XVar("isExistParent"))); searchByLinkField = XVar.Clone(MVCFunctions.postvalue(new XVar("searchByLinkField"))); parentCtrlsData = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("parentCtrlsData"))))); value = XVar.Clone(MVCFunctions.postvalue(new XVar("searchFor"))); values = XVar.Clone((XVar.Pack(MVCFunctions.postvalue(new XVar("multiselection"))) ? XVar.Pack(CommonFunctions.splitvalues((XVar)(value))) : XVar.Pack(new XVar(0, value)))); lookupField = new XVar(""); foreach (KeyValuePair <XVar, dynamic> f in GlobalVars.gSettings.getFieldsList().GetEnumerator()) { if ((XVar)(MVCFunctions.GoodFieldName((XVar)(f.Value)) == field) && (XVar)(GlobalVars.gSettings.getEditFormat((XVar)(f.Value)) == Constants.EDIT_FORMAT_LOOKUP_WIZARD)) { LookupType = XVar.Clone(GlobalVars.gSettings.getLookupType((XVar)(f.Value))); if ((XVar)(LookupType == Constants.LT_LOOKUPTABLE) || (XVar)(LookupType == Constants.LT_QUERY)) { lookupField = XVar.Clone(f.Value); break; } } } if (XVar.Pack(!(XVar)(lookupField))) { respObj = XVar.Clone(new XVar("success", false, "data", XVar.Array())); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(respObj))); MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } lookupTable = XVar.Clone(GlobalVars.gSettings.getLookupTable((XVar)(lookupField))); linkFieldName = XVar.Clone(GlobalVars.gSettings.getLinkField((XVar)(lookupField))); displayFieldName = XVar.Clone(GlobalVars.gSettings.getDisplayField((XVar)(lookupField))); linkAndDisplaySame = XVar.Clone(displayFieldName == linkFieldName); if (LookupType == Constants.LT_QUERY) { lookupConnection = XVar.Clone(GlobalVars.cman.byTable((XVar)(lookupTable))); } else { dynamic connId = null; connId = XVar.Clone(GlobalVars.gSettings.getNotProjectLookupTableConnId((XVar)(lookupField))); lookupConnection = XVar.Clone((XVar.Pack(MVCFunctions.strlen((XVar)(connId))) ? XVar.Pack(GlobalVars.cman.byId((XVar)(connId))) : XVar.Pack(GlobalVars.cman.getDefault()))); } lookupOrderBy = XVar.Clone(GlobalVars.gSettings.getLookupOrderBy((XVar)(lookupField))); if (lookupConnection.dbType == Constants.nDATABASE_MSSQLServer) { strUniqueOrderBy = XVar.Clone(lookupOrderBy); } if (LookupType == Constants.LT_QUERY) { lookupPSet = XVar.Clone(new ProjectSettings((XVar)(lookupTable), (XVar)(pageType))); lookupCipherer = XVar.Clone(new RunnerCipherer((XVar)(lookupTable))); lookupQueryObj = XVar.Clone(lookupPSet.getSQLQuery()); if (XVar.Pack(GlobalVars.gSettings.getCustomDisplay((XVar)(lookupField)))) { lookupQueryObj.AddCustomExpression((XVar)(displayFieldName), (XVar)(lookupPSet), (XVar)(GlobalVars.strTableName), (XVar)(lookupField)); } lookupQueryObj.ReplaceFieldsWithDummies((XVar)(lookupPSet.getBinaryFieldsIndices())); } else { dynamic lwLinkField = null; LookupSQLTable = new XVar("SELECT "); lwLinkField = XVar.Clone(lookupConnection.addFieldWrappers((XVar)(GlobalVars.gSettings.getLinkField((XVar)(lookupField))))); if (XVar.Pack(GlobalVars.gSettings.isLookupUnique((XVar)(lookupField)))) { LookupSQLTable = MVCFunctions.Concat(LookupSQLTable, "DISTINCT "); } LookupSQLTable = MVCFunctions.Concat(LookupSQLTable, GlobalVars.cipherer.GetLookupFieldName((XVar)(lwLinkField), (XVar)(lookupField), new XVar(null), new XVar(true))); if (lookupConnection.dbType == Constants.nDATABASE_MSSQLServer) { if ((XVar)(strUniqueOrderBy) && (XVar)(GlobalVars.gSettings.isLookupUnique((XVar)(lookupField)))) { LookupSQLTable = MVCFunctions.Concat(LookupSQLTable, ",", lookupConnection.addFieldWrappers((XVar)(strUniqueOrderBy))); } } lwDisplayField = XVar.Clone(RunnerPage.sqlFormattedDisplayField((XVar)(lookupField), (XVar)(lookupConnection), (XVar)(GlobalVars.gSettings))); if (XVar.Pack(!(XVar)(linkAndDisplaySame))) { LookupSQLTable = MVCFunctions.Concat(LookupSQLTable, ",", (XVar.Pack(lwDisplayField == lwLinkField) ? XVar.Pack(GlobalVars.cipherer.GetFieldName((XVar)(lwDisplayField), (XVar)(lookupField), new XVar(true))) : XVar.Pack(lwDisplayField))); } LookupSQLTable = MVCFunctions.Concat(LookupSQLTable, " FROM ", lookupConnection.addTableWrappers((XVar)(lookupTable)), " "); } strLookupWhere = XVar.Clone(CommonFunctions.prepareLookupWhere((XVar)(lookupField), (XVar)(GlobalVars.gSettings))); if (LookupType == Constants.LT_QUERY) { dynamic secOpt = null; secOpt = XVar.Clone(lookupPSet.getAdvancedSecurityType()); if (secOpt == Constants.ADVSECURITY_VIEW_OWN) { strLookupWhere = XVar.Clone(CommonFunctions.whereAdd((XVar)(strLookupWhere), (XVar)(CommonFunctions.SecuritySQL(new XVar("Search"), (XVar)(lookupTable))))); } } if (XVar.Pack(strLookupWhere)) { strLookupWhere = XVar.Clone(MVCFunctions.Concat(" (", strLookupWhere, ") AND ")); } if (LookupType == Constants.LT_QUERY) { if (XVar.Pack(GlobalVars.gSettings.getCustomDisplay((XVar)(lookupField)))) { likeField = XVar.Clone((XVar.Pack(searchByLinkField) ? XVar.Pack(linkFieldName) : XVar.Pack(displayFieldName))); } else { likeField = XVar.Clone(RunnerPage._getFieldSQLDecrypt((XVar)((XVar.Pack(searchByLinkField) ? XVar.Pack(linkFieldName) : XVar.Pack(displayFieldName))), (XVar)(lookupConnection), (XVar)(lookupPSet), (XVar)(GlobalVars.cipherer))); } } else { likeField = XVar.Clone(GlobalVars.cipherer.GetFieldName((XVar)(lwDisplayField), (XVar)(lookupField))); } if (XVar.Pack(searchByLinkField)) { likeConditionField = XVar.Clone((XVar.Pack(LookupType == Constants.LT_QUERY) ? XVar.Pack(linkFieldName) : XVar.Pack(lookupField))); } else { likeConditionField = XVar.Clone((XVar.Pack(LookupType == Constants.LT_QUERY) ? XVar.Pack(displayFieldName) : XVar.Pack(lookupField))); } likeWheres = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> fieldValue in values.GetEnumerator()) { if (fieldValue.Value == XVar.Pack("")) { continue; } if (LookupType == Constants.LT_QUERY) { likeWheres.InitAndSetArrayItem(MVCFunctions.Concat(likeField, lookupCipherer.GetLikeClause((XVar)(likeConditionField), (XVar)(fieldValue.Value))), null); } else { likeWheres.InitAndSetArrayItem(MVCFunctions.Concat(likeField, GlobalVars.cipherer.GetLikeClause((XVar)(likeConditionField), (XVar)(fieldValue.Value))), null); } } if (XVar.Pack(!(XVar)(MVCFunctions.count(likeWheres)))) { likeWheres.InitAndSetArrayItem("1=0", null); } strLookupWhere = MVCFunctions.Concat(strLookupWhere, MVCFunctions.implode(new XVar(" OR "), (XVar)(likeWheres))); if ((XVar)(isExistParent) && (XVar)(GlobalVars.gSettings.useCategory((XVar)(lookupField)))) { dynamic parentWhereParts = XVar.Array(); parentWhereParts = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> cData in GlobalVars.gSettings.getParentFieldsData((XVar)(lookupField)).GetEnumerator()) { dynamic arLookupWhere = XVar.Array(), category = null, lookupCategory = XVar.Array(); arLookupWhere = XVar.Clone(XVar.Array()); category = XVar.Clone(parentCtrlsData[cData.Value["main"]]); lookupCategory = XVar.Clone((XVar.Pack(category == XVar.Pack("")) ? XVar.Pack(XVar.Array()) : XVar.Pack(CommonFunctions.splitvalues((XVar)(category))))); foreach (KeyValuePair <XVar, dynamic> arLookupCategory in lookupCategory.GetEnumerator()) { dynamic catField = null, cvalue = null; cvalue = XVar.Clone(CommonFunctions.make_db_value((XVar)(cData.Value["main"]), (XVar)(arLookupCategory.Value))); if (XVar.Pack(lookupPSet)) { catField = XVar.Clone(RunnerPage._getFieldSQLDecrypt((XVar)(cData.Value["lookup"]), (XVar)(lookupConnection), (XVar)(lookupPSet), (XVar)(GlobalVars.cipherer))); } else { catField = XVar.Clone(lookupConnection.addFieldWrappers((XVar)(cData.Value["lookup"]))); } arLookupWhere.InitAndSetArrayItem(MVCFunctions.Concat(catField, "=", cvalue), null); } if (XVar.Pack(MVCFunctions.count(arLookupWhere))) { parentWhereParts.InitAndSetArrayItem(MVCFunctions.Concat("(", MVCFunctions.implode(new XVar(" OR "), (XVar)(arLookupWhere)), ")"), null); } } if (MVCFunctions.count(parentWhereParts) == MVCFunctions.count(GlobalVars.gSettings.getParentFieldsData((XVar)(lookupField)))) { strLookupWhere = XVar.Clone(CommonFunctions.whereAdd((XVar)(strLookupWhere), (XVar)(MVCFunctions.Concat("(", MVCFunctions.implode(new XVar(" AND "), (XVar)(parentWhereParts)), ")")))); } else { respObj = XVar.Clone(new XVar("success", false, "data", XVar.Array())); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(respObj))); MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } } if (XVar.Pack(MVCFunctions.strlen((XVar)(lookupOrderBy)))) { lookupOrderBy = XVar.Clone(lookupConnection.addFieldWrappers((XVar)(lookupOrderBy))); if (XVar.Pack(GlobalVars.gSettings.isLookupDesc((XVar)(lookupField)))) { lookupOrderBy = MVCFunctions.Concat(lookupOrderBy, " DESC"); } } if (LookupType == Constants.LT_QUERY) { LookupSQL = XVar.Clone(lookupQueryObj.buildSQL_default((XVar)(strLookupWhere))); if (XVar.Pack(MVCFunctions.strlen((XVar)(lookupOrderBy)))) { LookupSQL = MVCFunctions.Concat(LookupSQL, " ORDER BY ", lookupOrderBy); } else { LookupSQL = MVCFunctions.Concat(LookupSQL, lookupQueryObj.OrderByToSql()); } } else { LookupSQL = XVar.Clone(MVCFunctions.Concat(LookupSQLTable, " where ", strLookupWhere)); if ((XVar)(!(XVar)(GlobalVars.gSettings.isLookupUnique((XVar)(lookupField)))) || (XVar)(Constants.nDATABASE_Access != lookupConnection.dbType)) { if (XVar.Pack(lookupOrderBy)) { LookupSQL = MVCFunctions.Concat(LookupSQL, " ORDER BY ", lookupOrderBy); } } } lookupIndices = XVar.Clone(CommonFunctions.GetLookupFieldsIndexes((XVar)(GlobalVars.gSettings), (XVar)(lookupField))); linkFieldIndex = XVar.Clone(lookupIndices["linkFieldIndex"]); displayFieldIndex = XVar.Clone(lookupIndices["displayFieldIndex"]); viewContainer = XVar.Clone(new ViewControlsContainer((XVar)(GlobalVars.gSettings), new XVar(Constants.PAGE_LIST), new XVar(null))); var_response = XVar.Clone(XVar.Array()); qResult = XVar.Clone(lookupConnection.query((XVar)(LookupSQL))); multiselect = XVar.Clone(GlobalVars.gSettings.multiSelect((XVar)(lookupField))); while (XVar.Pack(data = XVar.Clone(qResult.fetchNumeric()))) { if ((XVar)(LookupType == Constants.LT_QUERY) && (XVar)(GlobalVars.gSettings.isLookupUnique((XVar)(lookupField)))) { dynamic uniqueArray = XVar.Array(); if (XVar.Pack(!(XVar)(uniqueArray as object != null))) { uniqueArray = XVar.Clone(XVar.Array()); } if (XVar.Pack(MVCFunctions.in_array((XVar)(data[displayFieldIndex]), (XVar)(uniqueArray)))) { continue; } uniqueArray.InitAndSetArrayItem(data[displayFieldIndex], null); } data.InitAndSetArrayItem(GlobalVars.cipherer.DecryptField((XVar)(lookupField), (XVar)(data[linkFieldIndex])), linkFieldIndex); if (LookupType == Constants.LT_QUERY) { data.InitAndSetArrayItem(GlobalVars.cipherer.DecryptField((XVar)(displayFieldName), (XVar)(data[displayFieldIndex])), displayFieldIndex); } displayedValue = XVar.Clone(data[displayFieldIndex]); if (XVar.Pack(MVCFunctions.in_array((XVar)(GlobalVars.gSettings.getViewFormat((XVar)(lookupField))), (XVar)(new XVar(0, Constants.FORMAT_DATE_SHORT, 1, Constants.FORMAT_DATE_LONG, 2, Constants.FORMAT_DATE_TIME))))) { dynamic ctrlData = XVar.Array(); ctrlData = XVar.Clone(XVar.Array()); ctrlData.InitAndSetArrayItem(data[linkFieldIndex], lookupField); displayedValue = XVar.Clone(viewContainer.getControl((XVar)(lookupField)).getTextValue((XVar)(ctrlData))); } var_response.InitAndSetArrayItem(data[linkFieldIndex], null); var_response.InitAndSetArrayItem(displayedValue, null); } respObj = XVar.Clone(new XVar("success", true, "data", MVCFunctions.array_slice((XVar)(var_response), new XVar(0), new XVar(40)))); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(respObj))); MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }
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 isSetParentElem() { dynamic pageTypes = null, pageTypesInLowCase = null; if (XVar.Pack(!(XVar)(this.menuTableMap.KeyExists(this.table)))) { return(false); } pageTypes = XVar.Clone(new XVar(0, "list", 1, "chart", 2, "report", 3, "search", 4, "add", 5, "print")); pageTypesInLowCase = XVar.Clone(MVCFunctions.array_keys((XVar)(this.menuTableMap[this.table]))); switch (((XVar)MVCFunctions.strtolower((XVar)(this.pageType))).ToString()) { case "list": return(false); break; case "chart": if (XVar.Pack(MVCFunctions.count(MVCFunctions.array_intersect((XVar)(MVCFunctions.array_slice((XVar)(pageTypes), new XVar(0), new XVar(1))), (XVar)(pageTypesInLowCase))))) { return(true); } else { return(false); } break; case "report": if (XVar.Pack(MVCFunctions.count(MVCFunctions.array_intersect((XVar)(MVCFunctions.array_slice((XVar)(pageTypes), new XVar(0), new XVar(2))), (XVar)(pageTypesInLowCase))))) { return(true); } else { return(false); } break; case "search": if (XVar.Pack(MVCFunctions.count(MVCFunctions.array_intersect((XVar)(MVCFunctions.array_slice((XVar)(pageTypes), new XVar(0), new XVar(3))), (XVar)(pageTypesInLowCase))))) { return(true); } else { return(false); } break; case "add": if (XVar.Pack(MVCFunctions.count(MVCFunctions.array_intersect((XVar)(MVCFunctions.array_slice((XVar)(pageTypes), new XVar(0), new XVar(4))), (XVar)(pageTypesInLowCase))))) { return(true); } else { return(false); } break; case "print": if (XVar.Pack(MVCFunctions.count(MVCFunctions.array_intersect((XVar)(MVCFunctions.array_slice((XVar)(pageTypes), new XVar(0), new XVar(5))), (XVar)(pageTypesInLowCase))))) { return(true); } else { return(false); } break; default: break; } return(null); }
public override XVar getValueHighlighted(dynamic _param_value, dynamic _param_highlightData) { #region pass-by-value parameters dynamic value = XVar.Clone(_param_value); dynamic highlightData = XVar.Clone(_param_highlightData); #endregion dynamic flags = null, prefix = null, searchOpt = null, tagPattern = null; searchOpt = XVar.Clone(highlightData["searchOpt"]); if (searchOpt == "Equals") { return(addHighlightingSpan((XVar)(value))); } flags = XVar.Clone((XVar.Pack(this.useUTF8) ? XVar.Pack("iu") : XVar.Pack("i"))); prefix = XVar.Clone((XVar.Pack(searchOpt == "Starts with") ? XVar.Pack("^") : XVar.Pack(""))); tagPattern = XVar.Clone(MVCFunctions.Concat("/(<[^=>]+\\s*(?:(?:[^=>]+=\\s*'[^']+'\\s*)|", "(?:[^=>]+=\\s*\"[^\"]+\"\\s*)", ")*>)/iU")); foreach (KeyValuePair <XVar, dynamic> searchWord in highlightData["searchWords"].GetEnumerator()) { dynamic pattern = null, searchWordParts = XVar.Array(); searchWordParts = XVar.Clone(MVCFunctions.preg_split((XVar)(tagPattern), (XVar)(searchWord.Value))); if (MVCFunctions.count(searchWordParts) == 1) { dynamic newSearchWord = null, replaced = null, res = null, valueArr = XVar.Array(); res = new XVar(""); replaced = new XVar(false); newSearchWord = XVar.Clone(MVCFunctions.preg_replace(new XVar("/^.*>|<.*$/U"), new XVar(""), (XVar)(searchWord.Value))); pattern = XVar.Clone(MVCFunctions.Concat("/", prefix, "(", MVCFunctions.preg_quote((XVar)(newSearchWord), new XVar("/")), ")/", flags)); valueArr = XVar.Clone(getSplitStringWithCapturedDelimiters((XVar)(tagPattern), (XVar)(value))); foreach (KeyValuePair <XVar, dynamic> item in valueArr.GetEnumerator()) { dynamic replacedItem = null; if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(item.Value))))) { continue; } if ((XVar)((XVar)(item.Value[0] == "<") || (XVar)(item.Value[MVCFunctions.strlen((XVar)(item.Value)) - 1] == ">")) || (XVar)(replaced)) { res = MVCFunctions.Concat(res, item.Value); continue; } if (XVar.Pack(!(XVar)(hasHTMLEntities((XVar)(item.Value))))) { replacedItem = XVar.Clone(MVCFunctions.preg_replace((XVar)(pattern), (XVar)(addHighlightingSpan(new XVar("$1"))), (XVar)(item.Value))); } else { replacedItem = XVar.Clone(highlightValueWithHTMLEntities((XVar)(item.Value), (XVar)(pattern))); } if ((XVar)(searchOpt == "Starts with") && (XVar)(item.Value != replacedItem)) { replaced = new XVar(true); } res = MVCFunctions.Concat(res, replacedItem); } value = XVar.Clone(res); continue; } foreach (KeyValuePair <XVar, dynamic> item in searchWordParts.GetEnumerator()) { if (XVar.Pack(MVCFunctions.trim((XVar)(item.Value)))) { if ((XVar)(item.Value[0] != "<") && (XVar)(item.Value[MVCFunctions.strlen((XVar)(item.Value)) - 1] != ">")) { dynamic itemPattern = null, newItem = null; newItem = XVar.Clone(MVCFunctions.preg_replace(new XVar("/^.*>|<.*$/"), new XVar(""), (XVar)(item.Value))); itemPattern = XVar.Clone(MVCFunctions.preg_quote((XVar)(newItem), new XVar("/"))); pattern = XVar.Clone(MVCFunctions.Concat("/(>[^>]*)(", itemPattern, ")([^<]*<)|^([^<>]*)(", itemPattern, ")(<)|(>)(", itemPattern, ")([^<>]*$)/U")); value = XVar.Clone(MVCFunctions.preg_replace((XVar)(pattern), (XVar)(MVCFunctions.Concat("$1", addHighlightingSpan(new XVar("$2")), "$3")), (XVar)(value))); } } } } return(value); }
public override XVar readWebValue(dynamic avalues, dynamic blobfields, dynamic _param_legacy1, dynamic _param_legacy2, dynamic filename_values) { #region pass-by-value parameters dynamic legacy1 = XVar.Clone(_param_legacy1); dynamic legacy2 = XVar.Clone(_param_legacy2); #endregion dynamic filename = null; filename = new XVar(""); getPostValueAndType(); if (XVar.Pack(MVCFunctions.FieldSubmitted((XVar)(MVCFunctions.Concat(this.goodFieldName, "_", this.id))))) { dynamic fileNameForPrepareFunc = null, prepearedFile = XVar.Array(); fileNameForPrepareFunc = XVar.Clone(CommonFunctions.securityCheckFileName((XVar)(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("filename_", this.goodFieldName, "_", this.id)))))); if (this.pageObject.pageType != Constants.PAGE_EDIT) { prepearedFile = XVar.Clone(MVCFunctions.prepare_file((XVar)(this.webValue), (XVar)(this.field), new XVar("file2"), (XVar)(fileNameForPrepareFunc), (XVar)(this.id))); if (!XVar.Equals(XVar.Pack(prepearedFile), XVar.Pack(false))) { this.webValue = XVar.Clone(prepearedFile["value"]); filename = XVar.Clone(prepearedFile["filename"]); } else { this.webValue = new XVar(false); } } else { if (MVCFunctions.substr((XVar)(this.webType), new XVar(0), new XVar(4)) == "file") { prepearedFile = XVar.Clone(MVCFunctions.prepare_file((XVar)(this.webValue), (XVar)(this.field), (XVar)(this.webType), (XVar)(fileNameForPrepareFunc), (XVar)(this.id))); if (!XVar.Equals(XVar.Pack(prepearedFile), XVar.Pack(false))) { this.webValue = XVar.Clone(prepearedFile["value"]); filename = XVar.Clone(prepearedFile["filename"]); } else { this.webValue = new XVar(false); } } else { if (MVCFunctions.substr((XVar)(this.webType), new XVar(0), new XVar(6)) == "upload") { if (this.webType == "upload1") { dynamic oldValues = XVar.Array(); oldValues = XVar.Clone(this.pageObject.getOldRecordData()); fileNameForPrepareFunc = XVar.Clone(oldValues[this.field]); } this.webValue = XVar.Clone(MVCFunctions.prepare_upload((XVar)(this.field), (XVar)(this.webType), (XVar)(fileNameForPrepareFunc), (XVar)(this.webValue), new XVar(""), (XVar)(this.id), (XVar)(this.pageObject))); } else { this.webValue = new XVar(false); } } } } else { this.webValue = new XVar(false); } if (XVar.Pack(!(XVar)(XVar.Equals(XVar.Pack(this.webValue), XVar.Pack(false))))) { if (XVar.Pack(this.webValue)) { dynamic ext = null; if (XVar.Pack(this.pageObject.pSetEdit.getCreateThumbnail((XVar)(this.field)))) { dynamic thumb = null; ext = XVar.Clone(CommonFunctions.CheckImageExtension((XVar)(MVCFunctions.GetUploadedFileName((XVar)(MVCFunctions.Concat("value_", this.goodFieldName, "_", this.id)))))); thumb = XVar.Clone(MVCFunctions.CreateThumbnail((XVar)(this.webValue), (XVar)(this.pageObject.pSetEdit.getThumbnailSize((XVar)(this.field))), (XVar)(ext))); blobfields.InitAndSetArrayItem(this.pageObject.pSetEdit.getStrThumbnail((XVar)(this.field)), null); avalues.InitAndSetArrayItem(thumb, blobfields[MVCFunctions.count(blobfields) - 1]); } if (XVar.Pack(this.pageObject.pSetEdit.getResizeOnUpload((XVar)(this.field)))) { ext = XVar.Clone(CommonFunctions.CheckImageExtension((XVar)(MVCFunctions.GetUploadedFileName((XVar)(MVCFunctions.Concat("value_", this.goodFieldName, "_", this.id)))))); this.webValue = XVar.Clone(MVCFunctions.CreateThumbnail((XVar)(this.webValue), (XVar)(this.pageObject.pSetEdit.getNewImageSize((XVar)(this.field))), (XVar)(ext))); } } else { if ((XVar)(this.pageObject.pageType == Constants.PAGE_EDIT) && (XVar)(this.pageObject.pSetEdit.getCreateThumbnail((XVar)(this.field)))) { blobfields.InitAndSetArrayItem(this.pageObject.pSetEdit.getStrThumbnail((XVar)(this.field)), null); avalues.InitAndSetArrayItem("", blobfields[MVCFunctions.count(blobfields) - 1]); } } blobfields.InitAndSetArrayItem(this.field, null); avalues.InitAndSetArrayItem(this.webValue, this.field); } if ((XVar)(filename) && (XVar)(this.pageObject.pSetEdit.getStrFilename((XVar)(this.field)))) { filename_values.InitAndSetArrayItem(filename, this.pageObject.pSetEdit.getStrFilename((XVar)(this.field))); } return(null); }
public override XVar buildControl(dynamic _param_value, dynamic _param_mode, dynamic _param_fieldNum, dynamic _param_validate, dynamic _param_additionalCtrlParams, dynamic _param_data) { #region pass-by-value parameters dynamic value = XVar.Clone(_param_value); dynamic mode = XVar.Clone(_param_mode); dynamic fieldNum = XVar.Clone(_param_fieldNum); dynamic validate = XVar.Clone(_param_validate); dynamic additionalCtrlParams = XVar.Clone(_param_additionalCtrlParams); dynamic data = XVar.Clone(_param_data); #endregion dynamic disp = null, filename_size = null, strfilename = null, strtype = null; base.buildControl((XVar)(value), (XVar)(mode), (XVar)(fieldNum), (XVar)(validate), (XVar)(additionalCtrlParams), (XVar)(data)); if ((XVar)(this.pageObject.pageType == Constants.PAGE_SEARCH) || (XVar)(this.pageObject.pageType == Constants.PAGE_LIST)) { dynamic classString = null; classString = new XVar(""); if (XVar.Pack(this.pageObject.isBootstrap())) { classString = new XVar(" class=\"form-control\""); } MVCFunctions.Echo(MVCFunctions.Concat("<input id=\"", this.cfield, "\" ", classString, this.inputStyle, " type=\"text\" ", (XVar.Pack(mode == Constants.MODE_SEARCH) ? XVar.Pack("autocomplete=\"off\" ") : XVar.Pack("")), (XVar.Pack((XVar)((XVar)(mode == Constants.MODE_INLINE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_ADD)) && (XVar)(this.is508 == true)) ? XVar.Pack(MVCFunctions.Concat("alt=\"", this.strLabel, "\" ")) : XVar.Pack("")), "name=\"", this.cfield, "\" ", this.pageObject.pSetEdit.getEditParams((XVar)(this.field)), " value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(value)), "\">")); buildControlEnd((XVar)(validate), (XVar)(mode)); return(null); } if (mode == Constants.MODE_SEARCH) { this.format = new XVar(""); } disp = new XVar(""); strfilename = new XVar(""); filename_size = new XVar(30); if (XVar.Pack(this.pageObject.pSetEdit.isUseTimestamp((XVar)(this.field)))) { filename_size = new XVar(50); } if ((XVar)(mode == Constants.MODE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_EDIT)) { dynamic fileData = XVar.Array(), fileName = null, newUploaderFilesData = XVar.Array(), newUploaderWasUsed = null, viewFormat = null; newUploaderFilesData = XVar.Clone(MVCFunctions.my_json_decode((XVar)(value))); newUploaderWasUsed = XVar.Clone((XVar)(MVCFunctions.is_array((XVar)(newUploaderFilesData))) && (XVar)(0 < MVCFunctions.count(newUploaderFilesData))); fileData = XVar.Clone((XVar.Pack(newUploaderWasUsed) ? XVar.Pack(newUploaderFilesData[0]) : XVar.Pack(XVar.Array()))); fileName = XVar.Clone((XVar.Pack(newUploaderWasUsed) ? XVar.Pack(fileData["usrName"]) : XVar.Pack(value))); viewFormat = XVar.Clone(this.pageObject.pSetEdit.getViewFormat((XVar)(this.field))); if ((XVar)(viewFormat == Constants.FORMAT_FILE) || (XVar)(viewFormat == Constants.FORMAT_FILE_IMAGE)) { disp = XVar.Clone(MVCFunctions.Concat(getFileOrImageMarkup((XVar)(value), (XVar)(fileName), (XVar)(newUploaderWasUsed), (XVar)(fileData)), "<br />")); } strfilename = XVar.Clone(MVCFunctions.Concat("<input type=hidden name=\"filenameHidden_", this.cfieldname, "\" value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(fileName)), "\"><br>", "Nombre de archivo", " <input type=\"text\" style=\"background-color:gainsboro\" disabled id=\"filename_", this.cfieldname, "\" name=\"filename_", this.cfieldname, "\" size=\"", filename_size, "\" maxlength=\"100\" value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(fileName)), "\">")); strtype = XVar.Clone(MVCFunctions.Concat("<br><input id=\"", this.ctype, "_keep\" type=\"Radio\" name=\"", this.ctype, "\" value=\"upload0\" checked class=\"rnr-uploadtype\">", "Guardar")); if ((XVar)((XVar)(MVCFunctions.strlen((XVar)(value))) || (XVar)(mode == Constants.MODE_INLINE_EDIT)) && (XVar)(!(XVar)(this.pageObject.pSetEdit.isRequired((XVar)(this.field))))) { strtype = MVCFunctions.Concat(strtype, "<input id=\"", this.ctype, "_delete\" type=\"Radio\" name=\"", this.ctype, "\" value=\"upload1\" class=\"rnr-uploadtype\">", "Borrar artículos seleccionados"); } strtype = MVCFunctions.Concat(strtype, "<input id=\"", this.ctype, "_update\" type=\"Radio\" name=\"", this.ctype, "\" value=\"upload2\" class=\"rnr-uploadtype\">", "Actualizar"); } else { strtype = XVar.Clone(MVCFunctions.Concat("<input id=\"", this.ctype, "\" type=\"hidden\" name=\"", this.ctype, "\" value=\"upload2\">")); strfilename = XVar.Clone(MVCFunctions.Concat("<br>", "Nombre de archivo", " <input type=\"text\" id=\"filename_", this.cfieldname, "\" name=\"filename_", this.cfieldname, "\" size=\"", filename_size, "\" maxlength=\"100\">")); } MVCFunctions.Echo(MVCFunctions.Concat(disp, strtype)); if ((XVar)(mode == Constants.MODE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_EDIT)) { MVCFunctions.Echo("<br>"); } MVCFunctions.Echo(MVCFunctions.Concat("<input type=\"File\" id=\"", this.cfield, "\" ", (XVar.Pack((XVar)((XVar)(mode == Constants.MODE_INLINE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_ADD)) && (XVar)(this.is508 == true)) ? XVar.Pack(MVCFunctions.Concat("alt=\"", this.strLabel, "\" ")) : XVar.Pack("")), " name=\"", this.cfield, "\" >", strfilename)); MVCFunctions.Echo(MVCFunctions.Concat("<input type=\"Hidden\" id=\"notempty_", this.cfieldname, "\" value=\"", (XVar.Pack(MVCFunctions.strlen((XVar)(value))) ? XVar.Pack(1) : XVar.Pack(0)), "\">")); buildControlEnd((XVar)(validate), (XVar)(mode)); return(null); }
public XVar searchsuggest() { try { dynamic _connection = null, allSearchFields = XVar.Array(), controls = null, detailKeys = XVar.Array(), numberOfSuggests = null, query = null, result = XVar.Array(), returnJSON = XVar.Array(), searchClauseObj = null, searchField = null, searchFor = null, searchOpt = null, table = null, var_response = XVar.Array(), whereClauses = XVar.Array(); ProjectSettings pSet; CommonFunctions.add_nocache_headers(); table = XVar.Clone(MVCFunctions.postvalue(new XVar("table"))); GlobalVars.strTableName = XVar.Clone(CommonFunctions.GetTableByShort((XVar)(table))); if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(table))))) { MVCFunctions.Echo(new XVar(0)); return(MVCFunctions.GetBuferContentAndClearBufer()); } Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", table, ""), "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null); if (XVar.Pack(!(XVar)(CommonFunctions.isLogged()))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search"))))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } searchFor = XVar.Clone(MVCFunctions.trim((XVar)(MVCFunctions.postvalue(new XVar("searchFor"))))); if (searchFor == XVar.Pack("")) { MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true, "result", "")))); return(MVCFunctions.GetBuferContentAndClearBufer()); } _connection = XVar.Clone(GlobalVars.cman.byTable((XVar)(GlobalVars.strTableName))); var_response = XVar.Clone(XVar.Array()); searchOpt = XVar.Clone((XVar.Pack(MVCFunctions.postvalue(new XVar("start"))) ? XVar.Pack("Starts with") : XVar.Pack("Contains"))); searchField = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(MVCFunctions.postvalue(new XVar("searchField"))))); numberOfSuggests = XVar.Clone(CommonFunctions.GetGlobalData(new XVar("searchSuggestsNumber"), new XVar(10))); pSet = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(GlobalVars.strTableName), new XVar(Constants.PAGE_SEARCH))); query = XVar.Clone(pSet.getSQLQuery()); if (searchField == XVar.Pack("")) { allSearchFields = XVar.Clone(pSet.getGoogleLikeFields()); } else { allSearchFields = XVar.Clone(pSet.getAllSearchFields()); } detailKeys = XVar.Clone(XVar.Array()); whereClauses = XVar.Clone(XVar.Array()); whereClauses.InitAndSetArrayItem(CommonFunctions.SecuritySQL(new XVar("Search"), (XVar)(GlobalVars.strTableName)), null); GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName))); controls = XVar.Clone(new EditControlsContainer(new XVar(null), (XVar)(pSet), new XVar(Constants.PAGE_LIST), (XVar)(GlobalVars.cipherer))); if (XSession.Session[MVCFunctions.Concat(GlobalVars.strTableName, "_mastertable")] != "") { dynamic i = null, j = null, masterTablesInfoArr = XVar.Array(), masterWhere = null, mastervalue = null; masterWhere = new XVar(""); masterTablesInfoArr = XVar.Clone(pSet.getMasterTablesArr((XVar)(GlobalVars.strTableName))); i = new XVar(0); for (; i < MVCFunctions.count(masterTablesInfoArr); i++) { if (XSession.Session[MVCFunctions.Concat(GlobalVars.strTableName, "_mastertable")] != masterTablesInfoArr[i]["mDataSourceTable"]) { continue; } detailKeys = XVar.Clone(masterTablesInfoArr[i]["detailKeys"]); j = new XVar(0); for (; j < MVCFunctions.count(detailKeys); j++) { mastervalue = XVar.Clone(GlobalVars.cipherer.MakeDBValue((XVar)(detailKeys[j]), (XVar)(XSession.Session[MVCFunctions.Concat(GlobalVars.strTableName, "_masterkey", j + 1)]), new XVar(""), new XVar(true))); if (mastervalue == "null") { masterWhere = MVCFunctions.Concat(masterWhere, RunnerPage._getFieldSQL((XVar)(detailKeys[j]), (XVar)(_connection), (XVar)(pSet)), " is NULL "); } else { masterWhere = MVCFunctions.Concat(masterWhere, RunnerPage._getFieldSQLDecrypt((XVar)(detailKeys[j]), (XVar)(_connection), (XVar)(pSet), (XVar)(GlobalVars.cipherer)), "=", mastervalue); } } break; } whereClauses.InitAndSetArrayItem(masterWhere, null); } searchClauseObj = XVar.Clone(SearchClause.getSearchObject((XVar)(GlobalVars.strTableName), new XVar(""), (XVar)(GlobalVars.strTableName), (XVar)(GlobalVars.cipherer))); searchClauseObj.processFiltersWhere((XVar)(_connection)); foreach (KeyValuePair <XVar, dynamic> filteredField in searchClauseObj.filteredFields.GetEnumerator()) { whereClauses.InitAndSetArrayItem(filteredField.Value["where"], null); } result = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> f in allSearchFields.GetEnumerator()) { dynamic clausesData = XVar.Array(), distinct = null, fType = null, fieldControl = null, having = null, isAggregateField = null, qResult = null, row = XVar.Array(), sql = XVar.Array(), subQuery = null, val = null, where = null; fType = XVar.Clone(pSet.getFieldType((XVar)(f.Value))); if ((XVar)((XVar)((XVar)(!(XVar)(CommonFunctions.IsCharType((XVar)(fType)))) && (XVar)(!(XVar)(CommonFunctions.IsNumberType((XVar)(fType))))) && (XVar)(!(XVar)(CommonFunctions.IsGuid((XVar)(fType))))) || (XVar)(MVCFunctions.in_array((XVar)(f.Value), (XVar)(detailKeys)))) { continue; } if ((XVar)(_connection.dbType == Constants.nDATABASE_Oracle) && (XVar)(CommonFunctions.IsTextType((XVar)(fType)))) { continue; } if ((XVar)((XVar)(searchField != XVar.Pack("")) && (XVar)(searchField != MVCFunctions.GoodFieldName((XVar)(f.Value)))) || (XVar)(!(XVar)(pSet.checkFieldPermissions((XVar)(f.Value))))) { continue; } fieldControl = XVar.Clone(controls.getControl((XVar)(f.Value))); isAggregateField = XVar.Clone(pSet.isAggregateField((XVar)(f.Value))); where = XVar.Clone(fieldControl.getSuggestWhere((XVar)(searchOpt), (XVar)(searchFor), (XVar)(isAggregateField))); having = XVar.Clone(fieldControl.getSuggestHaving((XVar)(searchOpt), (XVar)(searchFor), (XVar)(isAggregateField))); if ((XVar)(!(XVar)(MVCFunctions.strlen((XVar)(where)))) && (XVar)(!(XVar)(MVCFunctions.strlen((XVar)(having))))) { continue; } distinct = new XVar("DISTINCT"); if ((XVar)(_connection.dbType == Constants.nDATABASE_MSSQLServer) || (XVar)(_connection.dbType == Constants.nDATABASE_Access)) { if (XVar.Pack(CommonFunctions.IsTextType((XVar)(fType)))) { distinct = new XVar(""); } } sql = XVar.Clone(query.getSqlComponents()); clausesData = XVar.Clone(fieldControl.getSelectColumnsAndJoinFromPart((XVar)(searchFor), (XVar)(searchOpt), new XVar(true))); if (0 == MVCFunctions.strlen((XVar)(clausesData["joinFromPart"]))) { subQuery = XVar.Clone(SQLQuery.buildSQL((XVar)(sql), (XVar)(whereClauses), (XVar)(XVar.Array()), (XVar)(new XVar(0, where)), (XVar)(new XVar(0, having)))); GlobalVars.strSQL = XVar.Clone(MVCFunctions.Concat("SELECT ", distinct, " st.", _connection.addFieldWrappers((XVar)(f.Value)), " from (", subQuery, ") st")); } else { sql["from"] = MVCFunctions.Concat(sql["from"], clausesData["joinFromPart"]); sql.InitAndSetArrayItem(MVCFunctions.Concat("SELECT ", distinct, " ", clausesData["selectColumns"], " as ", _connection.addFieldWrappers(new XVar("_srchfld_"))), "head"); subQuery = XVar.Clone(SQLQuery.buildSQL((XVar)(sql), (XVar)(whereClauses), (XVar)(XVar.Array()), (XVar)(new XVar(0, where)), (XVar)(new XVar(0, having)))); GlobalVars.strSQL = XVar.Clone(MVCFunctions.Concat("SELECT ", _connection.addFieldWrappers(new XVar("_srchfld_")), " from (", subQuery, ") st")); } qResult = XVar.Clone(_connection.queryPage((XVar)(GlobalVars.strSQL), new XVar(1), (XVar)(numberOfSuggests), new XVar(true))); while ((XVar)(row = XVar.Clone(qResult.fetchNumeric())) && (XVar)(MVCFunctions.count(var_response) < numberOfSuggests)) { val = XVar.Clone(GlobalVars.cipherer.DecryptField((XVar)(f.Value), (XVar)(row[0]))); if (XVar.Pack(CommonFunctions.IsGuid((XVar)(fType)))) { val = XVar.Clone(MVCFunctions.substr((XVar)(val), new XVar(1), new XVar(-1))); } fieldControl.suggestValue((XVar)(MVCFunctions.Concat("_", val)), (XVar)(searchFor), (XVar)(var_response), (XVar)(row)); } } _connection.close(); MVCFunctions.ksort(ref var_response, new XVar(Constants.SORT_STRING)); foreach (KeyValuePair <XVar, dynamic> realValue in var_response.GetEnumerator()) { dynamic pos = null, strRealValue = null, strValue = null; if (numberOfSuggests < MVCFunctions.count(result)) { break; } strValue = XVar.Clone((XVar.Pack(realValue.Key[0] == "_") ? XVar.Pack(MVCFunctions.substr((XVar)(realValue.Key), new XVar(1))) : XVar.Pack(realValue.Key))); strRealValue = XVar.Clone((XVar.Pack(realValue.Value[0] == "_") ? XVar.Pack(MVCFunctions.substr((XVar)(realValue.Value), new XVar(1))) : XVar.Pack(realValue.Value))); pos = XVar.Clone(CommonFunctions.my_stripos((XVar)(strValue), (XVar)(searchFor), new XVar(0))); if (XVar.Equals(XVar.Pack(pos), XVar.Pack(false))) { result.InitAndSetArrayItem(new XVar("value", MVCFunctions.runner_htmlspecialchars((XVar)(strValue)), "realValue", strRealValue), null); } else { dynamic highlightedValue = null; highlightedValue = XVar.Clone(MVCFunctions.Concat(MVCFunctions.runner_htmlspecialchars((XVar)(MVCFunctions.substr((XVar)(strValue), new XVar(0), (XVar)(pos)))), "<b>", MVCFunctions.runner_htmlspecialchars((XVar)(MVCFunctions.substr((XVar)(strValue), (XVar)(pos), (XVar)(MVCFunctions.strlen((XVar)(searchFor)))))), "</b>", MVCFunctions.runner_htmlspecialchars((XVar)(MVCFunctions.substr((XVar)(strValue), (XVar)(pos + MVCFunctions.strlen((XVar)(searchFor)))))))); result.InitAndSetArrayItem(new XVar("value", highlightedValue, "realValue", strRealValue), null); } } returnJSON = XVar.Clone(XVar.Array()); returnJSON.InitAndSetArrayItem(true, "success"); returnJSON.InitAndSetArrayItem(result, "result"); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON))); MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }
public virtual XVar sortTables() { dynamic addedTables = XVar.Array(), allTables = null, arr = XVar.Array(), groupsMap = XVar.Array(), menu = XVar.Array(); this.sortedTables = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> _tbl in this.tables.GetEnumerator()) { this.sortedTables.InitAndSetArrayItem(new XVar(0, _tbl.Key, 1, _tbl.Value[1]), null); } MVCFunctions.usort((XVar)(this.sortedTables), new XVar("rightsSortFunc")); this.alphaOrderedTables = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> t in this.sortedTables.GetEnumerator()) { this.alphaOrderedTables.InitAndSetArrayItem(t.Value[0], null); } this.menuOrderedTables = XVar.Clone(XVar.Array()); menu = XVar.Clone(getMenuNodes()); addedTables = XVar.Clone(XVar.Array()); groupsMap = XVar.Clone(XVar.Array()); allTables = XVar.Clone(CommonFunctions.GetTablesListWithoutSecurity()); foreach (KeyValuePair <XVar, dynamic> m in menu.GetEnumerator()) { arr = XVar.Clone(XVar.Array()); if ((XVar)(m.Value["pageType"] == "WebReports") || (XVar)(m.Value["type"] == "Separator")) { continue; } if ((XVar)((XVar)(m.Value["table"]) && (XVar)(!(XVar)(addedTables[m.Value["table"]]))) && (XVar)(!XVar.Equals(XVar.Pack(MVCFunctions.array_search((XVar)(m.Value["table"]), (XVar)(allTables))), XVar.Pack(false)))) { addedTables.InitAndSetArrayItem(true, m.Value["table"]); arr.InitAndSetArrayItem(m.Value["table"], "table"); } if (XVar.Pack(m.Value["parent"])) { arr.InitAndSetArrayItem(groupsMap[m.Value["parent"]], "parent"); this.menuOrderedTables.InitAndSetArrayItem(MVCFunctions.count(this.menuOrderedTables), arr["parent"], "items", null); } if ((XVar)(true) || (XVar)(m.Value["type"] == "Group")) { groupsMap.InitAndSetArrayItem(MVCFunctions.count(this.menuOrderedTables), m.Value["id"]); arr.InitAndSetArrayItem(m.Value["title"], "title"); arr.InitAndSetArrayItem(XVar.Array(), "items"); arr.InitAndSetArrayItem(true, "collapsed"); } this.menuOrderedTables.InitAndSetArrayItem(arr, null); } if (MVCFunctions.count(addedTables) < MVCFunctions.count(this.alphaOrderedTables)) { dynamic unlistedId = null; unlistedId = XVar.Clone(MVCFunctions.count(this.menuOrderedTables)); arr = XVar.Clone(XVar.Array()); arr.InitAndSetArrayItem(true, "collapsed"); arr.InitAndSetArrayItem("Unlisted tables", "title"); arr.InitAndSetArrayItem(XVar.Array(), "items"); this.menuOrderedTables.InitAndSetArrayItem(arr, null); foreach (KeyValuePair <XVar, dynamic> table in this.alphaOrderedTables.GetEnumerator()) { if (XVar.Pack(!(XVar)(addedTables[table.Value]))) { this.menuOrderedTables.InitAndSetArrayItem(MVCFunctions.count(this.menuOrderedTables), unlistedId, "items", null); this.menuOrderedTables.InitAndSetArrayItem(new XVar("table", table.Value, "parent", unlistedId), null); } } } return(null); }
static public void Apply() { SettingsMap arrAddTabs = SettingsMap.GetArray(), arrEditTabs = SettingsMap.GetArray(), arrGPP = SettingsMap.GetArray(), arrGridTabs = SettingsMap.GetArray(), arrRPP = SettingsMap.GetArray(), arrRegisterTabs = SettingsMap.GetArray(), arrViewTabs = SettingsMap.GetArray(), dIndex = null, detailsParam = SettingsMap.GetArray(), edata = SettingsMap.GetArray(), eventsData = SettingsMap.GetArray(), fdata = SettingsMap.GetArray(), fieldLabelsArray = new XVar(), fieldToolTipsArray = new XVar(), hours = null, intervalData = SettingsMap.GetArray(), masterParams = SettingsMap.GetArray(), pageTitlesArray = new XVar(), placeHoldersArray = new XVar(), popupPagesLayoutNames = SettingsMap.GetArray(), query = null, queryData_Array = new XVar(), reportGroupFields = SettingsMap.GetArray(), rgroupField = SettingsMap.GetArray(), strOriginalDetailsTable = null, tabFields = SettingsMap.GetArray(), table = null, tableKeysArray = new XVar(), tdataArray = new XVar(), tstrOrderBy = null, vdata = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".truncateText"] = true; tdataArray["dbo__ABCSecurity"][".NumberOfChars"] = 80; tdataArray["dbo__ABCSecurity"][".ShortName"] = "dbo__ABCSecurity"; tdataArray["dbo__ABCSecurity"][".OwnerID"] = ""; tdataArray["dbo__ABCSecurity"][".OriginalTable"] = "dbo._ABCSecurity"; fieldLabelsArray["dbo__ABCSecurity"] = SettingsMap.GetArray(); fieldToolTipsArray["dbo__ABCSecurity"] = SettingsMap.GetArray(); pageTitlesArray["dbo__ABCSecurity"] = SettingsMap.GetArray(); placeHoldersArray["dbo__ABCSecurity"] = SettingsMap.GetArray(); if (CommonFunctions.mlang_getcurrentlang() == "English") { fieldLabelsArray["dbo__ABCSecurity"]["English"] = SettingsMap.GetArray(); fieldToolTipsArray["dbo__ABCSecurity"]["English"] = SettingsMap.GetArray(); placeHoldersArray["dbo__ABCSecurity"]["English"] = SettingsMap.GetArray(); pageTitlesArray["dbo__ABCSecurity"]["English"] = SettingsMap.GetArray(); fieldLabelsArray["dbo__ABCSecurity"]["English"]["ID"] = "ID"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["ID"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["ID"] = ""; fieldLabelsArray["dbo__ABCSecurity"]["English"]["username"] = "******"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["username"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["username"] = ""; fieldLabelsArray["dbo__ABCSecurity"]["English"]["password"] = "******"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["password"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["password"] = ""; fieldLabelsArray["dbo__ABCSecurity"]["English"]["admin"] = "Admin"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["admin"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["admin"] = ""; fieldLabelsArray["dbo__ABCSecurity"]["English"]["byear"] = "Begin Term"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["byear"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["byear"] = ""; fieldLabelsArray["dbo__ABCSecurity"]["English"]["eyear"] = "End Term"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["eyear"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["eyear"] = ""; fieldLabelsArray["dbo__ABCSecurity"]["English"]["role"] = "Role"; fieldToolTipsArray["dbo__ABCSecurity"]["English"]["role"] = ""; placeHoldersArray["dbo__ABCSecurity"]["English"]["role"] = ""; if (XVar.Pack(MVCFunctions.count(fieldToolTipsArray["dbo__ABCSecurity"]["English"]))) { tdataArray["dbo__ABCSecurity"][".isUseToolTips"] = true; } } if (CommonFunctions.mlang_getcurrentlang() == "") { fieldLabelsArray["dbo__ABCSecurity"][""] = SettingsMap.GetArray(); fieldToolTipsArray["dbo__ABCSecurity"][""] = SettingsMap.GetArray(); placeHoldersArray["dbo__ABCSecurity"][""] = SettingsMap.GetArray(); pageTitlesArray["dbo__ABCSecurity"][""] = SettingsMap.GetArray(); if (XVar.Pack(MVCFunctions.count(fieldToolTipsArray["dbo__ABCSecurity"][""]))) { tdataArray["dbo__ABCSecurity"][".isUseToolTips"] = true; } } tdataArray["dbo__ABCSecurity"][".NCSearch"] = true; tdataArray["dbo__ABCSecurity"][".shortTableName"] = "dbo__ABCSecurity"; tdataArray["dbo__ABCSecurity"][".nSecOptions"] = 0; tdataArray["dbo__ABCSecurity"][".recsPerRowPrint"] = 1; tdataArray["dbo__ABCSecurity"][".mainTableOwnerID"] = ""; tdataArray["dbo__ABCSecurity"][".moveNext"] = 1; tdataArray["dbo__ABCSecurity"][".entityType"] = 0; tdataArray["dbo__ABCSecurity"][".strOriginalTableName"] = "dbo._ABCSecurity"; tdataArray["dbo__ABCSecurity"][".showAddInPopup"] = false; tdataArray["dbo__ABCSecurity"][".showEditInPopup"] = false; tdataArray["dbo__ABCSecurity"][".showViewInPopup"] = false; popupPagesLayoutNames = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".popupPagesLayoutNames"] = popupPagesLayoutNames; tdataArray["dbo__ABCSecurity"][".fieldsForRegister"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".listAjax"] = false; tdataArray["dbo__ABCSecurity"][".audit"] = false; tdataArray["dbo__ABCSecurity"][".locking"] = false; tdataArray["dbo__ABCSecurity"][".edit"] = true; tdataArray["dbo__ABCSecurity"][".afterEditAction"] = 1; tdataArray["dbo__ABCSecurity"][".closePopupAfterEdit"] = 1; tdataArray["dbo__ABCSecurity"][".afterEditActionDetTable"] = ""; tdataArray["dbo__ABCSecurity"][".add"] = true; tdataArray["dbo__ABCSecurity"][".afterAddAction"] = 1; tdataArray["dbo__ABCSecurity"][".closePopupAfterAdd"] = 1; tdataArray["dbo__ABCSecurity"][".afterAddActionDetTable"] = ""; tdataArray["dbo__ABCSecurity"][".list"] = true; tdataArray["dbo__ABCSecurity"][".inlineEdit"] = true; tdataArray["dbo__ABCSecurity"][".reorderRecordsByHeader"] = true; tdataArray["dbo__ABCSecurity"][".exportFormatting"] = 2; tdataArray["dbo__ABCSecurity"][".exportDelimiter"] = ","; tdataArray["dbo__ABCSecurity"][".inlineAdd"] = true; tdataArray["dbo__ABCSecurity"][".view"] = true; tdataArray["dbo__ABCSecurity"][".import"] = true; tdataArray["dbo__ABCSecurity"][".exportTo"] = true; tdataArray["dbo__ABCSecurity"][".printFriendly"] = true; tdataArray["dbo__ABCSecurity"][".delete"] = true; tdataArray["dbo__ABCSecurity"][".showSimpleSearchOptions"] = false; tdataArray["dbo__ABCSecurity"][".allowShowHideFields"] = false; tdataArray["dbo__ABCSecurity"][".allowFieldsReordering"] = false; tdataArray["dbo__ABCSecurity"][".searchSaving"] = false; tdataArray["dbo__ABCSecurity"][".showSearchPanel"] = true; tdataArray["dbo__ABCSecurity"][".flexibleSearch"] = true; tdataArray["dbo__ABCSecurity"][".isUseAjaxSuggest"] = true; tdataArray["dbo__ABCSecurity"][".rowHighlite"] = true; tdataArray["dbo__ABCSecurity"][".ajaxCodeSnippetAdded"] = false; tdataArray["dbo__ABCSecurity"][".buttonsAdded"] = false; tdataArray["dbo__ABCSecurity"][".addPageEvents"] = false; tdataArray["dbo__ABCSecurity"][".isUseTimeForSearch"] = false; tdataArray["dbo__ABCSecurity"][".badgeColor"] = "5F9EA0"; tdataArray["dbo__ABCSecurity"][".allSearchFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".filterFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".requiredSearchFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".allSearchFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".allSearchFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".allSearchFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".allSearchFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".allSearchFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("ID"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("admin"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".googleLikeFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".advSearchFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".advSearchFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".advSearchFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".advSearchFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".advSearchFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".advSearchFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".tableType"] = "list"; tdataArray["dbo__ABCSecurity"][".printerPageOrientation"] = 0; tdataArray["dbo__ABCSecurity"][".nPrinterPageScale"] = 100; tdataArray["dbo__ABCSecurity"][".nPrinterSplitRecords"] = 40; tdataArray["dbo__ABCSecurity"][".nPrinterPDFSplitRecords"] = 40; tdataArray["dbo__ABCSecurity"][".geocodingEnabled"] = false; tdataArray["dbo__ABCSecurity"][".listGridLayout"] = 3; tdataArray["dbo__ABCSecurity"][".pageSize"] = 20; tdataArray["dbo__ABCSecurity"][".warnLeavingPages"] = true; tstrOrderBy = ""; if (MVCFunctions.strlen(tstrOrderBy) && MVCFunctions.strtolower(MVCFunctions.substr(tstrOrderBy, new XVar(0), new XVar(8))) != "order by") { tstrOrderBy = MVCFunctions.Concat("order by ", tstrOrderBy); } tdataArray["dbo__ABCSecurity"][".strOrderBy"] = tstrOrderBy; tdataArray["dbo__ABCSecurity"][".orderindexes"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".sqlHead"] = "SELECT ID, username, password, [admin], byear, eyear, [role]"; tdataArray["dbo__ABCSecurity"][".sqlFrom"] = "FROM dbo.[_ABCSecurity]"; tdataArray["dbo__ABCSecurity"][".sqlWhereExpr"] = ""; tdataArray["dbo__ABCSecurity"][".sqlTail"] = ""; arrRPP = SettingsMap.GetArray(); arrRPP.Add(10); arrRPP.Add(20); arrRPP.Add(30); arrRPP.Add(50); arrRPP.Add(100); arrRPP.Add(500); arrRPP.Add(-1); tdataArray["dbo__ABCSecurity"][".arrRecsPerPage"] = arrRPP; arrGPP = SettingsMap.GetArray(); arrGPP.Add(1); arrGPP.Add(3); arrGPP.Add(5); arrGPP.Add(10); arrGPP.Add(50); arrGPP.Add(100); arrGPP.Add(-1); tdataArray["dbo__ABCSecurity"][".arrGroupsPerPage"] = arrGPP; tdataArray["dbo__ABCSecurity"][".highlightSearchResults"] = true; tableKeysArray["dbo__ABCSecurity"] = SettingsMap.GetArray(); tableKeysArray["dbo__ABCSecurity"].Add("ID"); tdataArray["dbo__ABCSecurity"][".Keys"] = tableKeysArray["dbo__ABCSecurity"]; tdataArray["dbo__ABCSecurity"][".listFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".listFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".listFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".listFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".listFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".listFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".hideMobileList"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".viewFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".viewFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".viewFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".viewFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".viewFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".viewFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".addFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".addFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".addFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".addFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".addFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".addFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".masterListFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("ID"); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("admin"); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".masterListFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".inlineAddFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".inlineAddFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".inlineAddFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".inlineAddFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".inlineAddFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".inlineAddFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".editFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".editFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".editFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".editFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".editFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".editFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".inlineEditFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".inlineEditFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".inlineEditFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".inlineEditFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".inlineEditFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".inlineEditFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".updateSelectedFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".updateSelectedFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".updateSelectedFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".updateSelectedFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".updateSelectedFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".updateSelectedFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".exportFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".exportFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".exportFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".exportFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".exportFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".exportFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".importFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".importFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".importFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".importFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".importFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".importFields"].Add("role"); tdataArray["dbo__ABCSecurity"][".printFields"] = SettingsMap.GetArray(); tdataArray["dbo__ABCSecurity"][".printFields"].Add("username"); tdataArray["dbo__ABCSecurity"][".printFields"].Add("password"); tdataArray["dbo__ABCSecurity"][".printFields"].Add("byear"); tdataArray["dbo__ABCSecurity"][".printFields"].Add("eyear"); tdataArray["dbo__ABCSecurity"][".printFields"].Add("role"); fdata = SettingsMap.GetArray(); fdata["Index"] = 1; fdata["strName"] = "ID"; fdata["GoodName"] = "ID"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "ID"); fdata["FieldType"] = 3; fdata["strField"] = "ID"; fdata["isSQLExpression"] = true; fdata["FullName"] = "ID"; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["IsRequired"] = true; edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "number"; edata["EditParams"] = ""; edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"].Add(CommonFunctions.getJsValidatorName(new XVar("Number"))); edata["validateAs"]["basicValidate"].Add("IsRequired"); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; tdataArray["dbo__ABCSecurity"]["ID"] = fdata; fdata = SettingsMap.GetArray(); fdata["Index"] = 2; fdata["strName"] = "username"; fdata["GoodName"] = "username"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "username"); fdata["FieldType"] = 202; fdata["bListPage"] = true; fdata["bAddPage"] = true; fdata["bInlineAdd"] = true; fdata["bEditPage"] = true; fdata["bInlineEdit"] = true; fdata["bUpdateSelected"] = true; fdata["bViewPage"] = true; fdata["bAdvancedSearch"] = true; fdata["bPrinterPage"] = true; fdata["bExportPage"] = true; fdata["strField"] = "username"; fdata["isSQLExpression"] = true; fdata["FullName"] = "username"; fdata["FieldPermissions"] = true; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "text"; edata["EditParams"] = ""; edata["EditParams"] = MVCFunctions.Concat(edata["EditParams"], " maxlength=255"); edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); tdataArray["dbo__ABCSecurity"]["username"] = fdata; fdata = SettingsMap.GetArray(); fdata["Index"] = 3; fdata["strName"] = "password"; fdata["GoodName"] = "password"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "password"); fdata["FieldType"] = 202; fdata["bListPage"] = true; fdata["bAddPage"] = true; fdata["bInlineAdd"] = true; fdata["bEditPage"] = true; fdata["bInlineEdit"] = true; fdata["bUpdateSelected"] = true; fdata["bViewPage"] = true; fdata["bAdvancedSearch"] = true; fdata["bPrinterPage"] = true; fdata["bExportPage"] = true; fdata["strField"] = "password"; fdata["isSQLExpression"] = true; fdata["FullName"] = "password"; fdata["FieldPermissions"] = true; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "text"; edata["EditParams"] = ""; edata["EditParams"] = MVCFunctions.Concat(edata["EditParams"], " maxlength=255"); edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); tdataArray["dbo__ABCSecurity"]["password"] = fdata; fdata = SettingsMap.GetArray(); fdata["Index"] = 4; fdata["strName"] = "admin"; fdata["GoodName"] = "admin"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "admin"); fdata["FieldType"] = 11; fdata["strField"] = "admin"; fdata["isSQLExpression"] = true; fdata["FullName"] = "[admin]"; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", "Checkbox"); fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Checkbox"); edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; tdataArray["dbo__ABCSecurity"]["admin"] = fdata; fdata = SettingsMap.GetArray(); fdata["Index"] = 5; fdata["strName"] = "byear"; fdata["GoodName"] = "byear"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "byear"); fdata["FieldType"] = 3; fdata["bListPage"] = true; fdata["bAddPage"] = true; fdata["bInlineAdd"] = true; fdata["bEditPage"] = true; fdata["bInlineEdit"] = true; fdata["bUpdateSelected"] = true; fdata["bViewPage"] = true; fdata["bAdvancedSearch"] = true; fdata["bPrinterPage"] = true; fdata["bExportPage"] = true; fdata["strField"] = "byear"; fdata["isSQLExpression"] = true; fdata["FullName"] = "byear"; fdata["FieldPermissions"] = true; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "number"; edata["EditParams"] = ""; edata["controlWidth"] = 50; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"].Add(CommonFunctions.getJsValidatorName(new XVar("Number"))); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); tdataArray["dbo__ABCSecurity"]["byear"] = fdata; fdata = SettingsMap.GetArray(); fdata["Index"] = 6; fdata["strName"] = "eyear"; fdata["GoodName"] = "eyear"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "eyear"); fdata["FieldType"] = 3; fdata["bListPage"] = true; fdata["bAddPage"] = true; fdata["bInlineAdd"] = true; fdata["bEditPage"] = true; fdata["bInlineEdit"] = true; fdata["bUpdateSelected"] = true; fdata["bViewPage"] = true; fdata["bAdvancedSearch"] = true; fdata["bPrinterPage"] = true; fdata["bExportPage"] = true; fdata["strField"] = "eyear"; fdata["isSQLExpression"] = true; fdata["FullName"] = "eyear"; fdata["FieldPermissions"] = true; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "number"; edata["EditParams"] = ""; edata["controlWidth"] = 50; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"].Add(CommonFunctions.getJsValidatorName(new XVar("Number"))); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); tdataArray["dbo__ABCSecurity"]["eyear"] = fdata; fdata = SettingsMap.GetArray(); fdata["Index"] = 7; fdata["strName"] = "role"; fdata["GoodName"] = "role"; fdata["ownerTable"] = "dbo._ABCSecurity"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo__ABCSecurity", "role"); fdata["FieldType"] = 202; fdata["bListPage"] = true; fdata["bAddPage"] = true; fdata["bInlineAdd"] = true; fdata["bEditPage"] = true; fdata["bInlineEdit"] = true; fdata["bUpdateSelected"] = true; fdata["bViewPage"] = true; fdata["bAdvancedSearch"] = true; fdata["bPrinterPage"] = true; fdata["bExportPage"] = true; fdata["strField"] = "role"; fdata["isSQLExpression"] = true; fdata["FullName"] = "[role]"; fdata["FieldPermissions"] = true; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Lookup wizard"); edata["LookupType"] = 0; edata["autoCompleteFieldsOnEdit"] = 0; edata["autoCompleteFields"] = SettingsMap.GetArray(); edata["LCType"] = 0; edata["LookupValues"] = SettingsMap.GetArray(); edata["LookupValues"].Add("admin"); edata["LookupValues"].Add("readonly"); edata["LookupValues"].Add("member"); edata["SelectSize"] = 1; edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["defaultSearchOption"] = "Equals"; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); tdataArray["dbo__ABCSecurity"]["role"] = fdata; GlobalVars.tables_data["dbo._ABCSecurity"] = tdataArray["dbo__ABCSecurity"]; GlobalVars.field_labels["dbo__ABCSecurity"] = fieldLabelsArray["dbo__ABCSecurity"]; GlobalVars.fieldToolTips["dbo__ABCSecurity"] = fieldToolTipsArray["dbo__ABCSecurity"]; GlobalVars.placeHolders["dbo__ABCSecurity"] = placeHoldersArray["dbo__ABCSecurity"]; GlobalVars.page_titles["dbo__ABCSecurity"] = pageTitlesArray["dbo__ABCSecurity"]; GlobalVars.detailsTablesData["dbo._ABCSecurity"] = SettingsMap.GetArray(); GlobalVars.masterTablesData["dbo._ABCSecurity"] = SettingsMap.GetArray(); strOriginalDetailsTable = "dbo._ABCVotes"; masterParams = SettingsMap.GetArray(); masterParams["mDataSourceTable"] = "dbo._ABCVotes"; masterParams["mOriginalTable"] = strOriginalDetailsTable; masterParams["mShortTable"] = "dbo__ABCVotes"; masterParams["masterKeys"] = SettingsMap.GetArray(); masterParams["detailKeys"] = SettingsMap.GetArray(); masterParams["dispChildCount"] = 0; masterParams["hideChild"] = 0; masterParams["dispMasterInfo"] = SettingsMap.GetArray(); masterParams["previewOnList"] = 2; masterParams["previewOnAdd"] = 0; masterParams["previewOnEdit"] = 0; masterParams["previewOnView"] = 0; masterParams["proceedLink"] = 1; masterParams["type"] = Constants.PAGE_LIST; GlobalVars.masterTablesData["dbo._ABCSecurity"][0] = masterParams; GlobalVars.masterTablesData["dbo._ABCSecurity"][0]["masterKeys"] = SettingsMap.GetArray(); GlobalVars.masterTablesData["dbo._ABCSecurity"][0]["masterKeys"].Add("committee_member"); GlobalVars.masterTablesData["dbo._ABCSecurity"][0]["detailKeys"] = SettingsMap.GetArray(); GlobalVars.masterTablesData["dbo._ABCSecurity"][0]["detailKeys"].Add("username"); SQLEntity obj = null; var protoArray = SettingsMap.GetArray(); protoArray["0"] = SettingsMap.GetArray(); protoArray["0"]["m_strHead"] = "SELECT"; protoArray["0"]["m_strFieldList"] = "ID, username, password, [admin], byear, eyear, [role]"; protoArray["0"]["m_strFrom"] = "FROM dbo.[_ABCSecurity]"; protoArray["0"]["m_strWhere"] = ""; protoArray["0"]["m_strOrderBy"] = ""; protoArray["0"]["cipherer"] = null; protoArray["2"] = SettingsMap.GetArray(); protoArray["2"]["m_sql"] = ""; protoArray["2"]["m_uniontype"] = "SQLL_UNKNOWN"; obj = new SQLNonParsed(new XVar("m_sql", "")); protoArray["2"]["m_column"] = obj; protoArray["2"]["m_contained"] = SettingsMap.GetArray(); protoArray["2"]["m_strCase"] = ""; protoArray["2"]["m_havingmode"] = false; protoArray["2"]["m_inBrackets"] = false; protoArray["2"]["m_useAlias"] = false; obj = new SQLLogicalExpr(protoArray["2"]); protoArray["0"]["m_where"] = obj; protoArray["4"] = SettingsMap.GetArray(); protoArray["4"]["m_sql"] = ""; protoArray["4"]["m_uniontype"] = "SQLL_UNKNOWN"; obj = new SQLNonParsed(new XVar("m_sql", "")); protoArray["4"]["m_column"] = obj; protoArray["4"]["m_contained"] = SettingsMap.GetArray(); protoArray["4"]["m_strCase"] = ""; protoArray["4"]["m_havingmode"] = false; protoArray["4"]["m_inBrackets"] = false; protoArray["4"]["m_useAlias"] = false; obj = new SQLLogicalExpr(protoArray["4"]); protoArray["0"]["m_having"] = obj; protoArray["0"]["m_fieldlist"] = SettingsMap.GetArray(); protoArray["6"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "ID", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["6"]["m_sql"] = "ID"; protoArray["6"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["6"]["m_expr"] = obj; protoArray["6"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["6"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["8"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "username", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["8"]["m_sql"] = "username"; protoArray["8"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["8"]["m_expr"] = obj; protoArray["8"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["8"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["10"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "password", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["10"]["m_sql"] = "password"; protoArray["10"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["10"]["m_expr"] = obj; protoArray["10"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["10"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["12"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "admin", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["12"]["m_sql"] = "[admin]"; protoArray["12"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["12"]["m_expr"] = obj; protoArray["12"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["12"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["14"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "byear", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["14"]["m_sql"] = "byear"; protoArray["14"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["14"]["m_expr"] = obj; protoArray["14"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["14"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["16"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "eyear", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["16"]["m_sql"] = "eyear"; protoArray["16"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["16"]["m_expr"] = obj; protoArray["16"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["16"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["18"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "role", "m_strTable", "dbo._ABCSecurity", "m_srcTableName", "dbo._ABCSecurity")); protoArray["18"]["m_sql"] = "[role]"; protoArray["18"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["18"]["m_expr"] = obj; protoArray["18"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["18"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["0"]["m_fromlist"] = SettingsMap.GetArray(); protoArray["20"] = SettingsMap.GetArray(); protoArray["20"]["m_link"] = "SQLL_MAIN"; protoArray["21"] = SettingsMap.GetArray(); protoArray["21"]["m_strName"] = "dbo._ABCSecurity"; protoArray["21"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["21"]["m_columns"] = SettingsMap.GetArray(); protoArray["21"]["m_columns"].Add("ID"); protoArray["21"]["m_columns"].Add("username"); protoArray["21"]["m_columns"].Add("password"); protoArray["21"]["m_columns"].Add("admin"); protoArray["21"]["m_columns"].Add("byear"); protoArray["21"]["m_columns"].Add("eyear"); protoArray["21"]["m_columns"].Add("role"); obj = new SQLTable(protoArray["21"]); protoArray["20"]["m_table"] = obj; protoArray["20"]["m_sql"] = "dbo.[_ABCSecurity]"; protoArray["20"]["m_alias"] = ""; protoArray["20"]["m_srcTableName"] = "dbo._ABCSecurity"; protoArray["22"] = SettingsMap.GetArray(); protoArray["22"]["m_sql"] = ""; protoArray["22"]["m_uniontype"] = "SQLL_UNKNOWN"; obj = new SQLNonParsed(new XVar("m_sql", "")); protoArray["22"]["m_column"] = obj; protoArray["22"]["m_contained"] = SettingsMap.GetArray(); protoArray["22"]["m_strCase"] = ""; protoArray["22"]["m_havingmode"] = false; protoArray["22"]["m_inBrackets"] = false; protoArray["22"]["m_useAlias"] = false; obj = new SQLLogicalExpr(protoArray["22"]); protoArray["20"]["m_joinon"] = obj; obj = new SQLFromListItem(protoArray["20"]); protoArray["0"]["m_fromlist"].Add(obj); protoArray["0"]["m_groupby"] = SettingsMap.GetArray(); protoArray["0"]["m_orderby"] = SettingsMap.GetArray(); protoArray["0"]["m_srcTableName"] = "dbo._ABCSecurity"; obj = new SQLQuery(protoArray["0"]); queryData_Array["dbo__ABCSecurity"] = obj; tdataArray["dbo__ABCSecurity"][".sqlquery"] = queryData_Array["dbo__ABCSecurity"]; GlobalVars.tableEvents["dbo._ABCSecurity"] = new eventsBase(); tdataArray["dbo__ABCSecurity"][".hasEvents"] = false; GlobalVars.tables_data["dbo__ABCSecurity"] = tdataArray["dbo__ABCSecurity"]; }
public virtual XVar fillTablesGrid(dynamic rowInfoArr) { dynamic copylink = null, editlink = null, parentStack = XVar.Array(), recNo = null, rowClass = null; rowClass = new XVar(false); recNo = new XVar(1); editlink = new XVar(""); copylink = new XVar(""); parentStack = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> _tbl in this.menuOrderedTables.GetEnumerator()) { dynamic childrenCount = null, parent = null, row = XVar.Array(), table = null; table = XVar.Clone(_tbl.Value["table"]); parent = XVar.Clone(_tbl.Value["parent"]); if (XVar.Pack(MVCFunctions.strlen((XVar)(table)))) { dynamic caption = null, mask = null, shortTable = null; caption = XVar.Clone(this.tables[table][1]); shortTable = XVar.Clone(this.tables[table][0]); row = XVar.Clone(XVar.Array()); if (caption == table) { row.InitAndSetArrayItem(MVCFunctions.runner_htmlspecialchars((XVar)(table)), "tablename"); } else { row.InitAndSetArrayItem(MVCFunctions.Concat("<span dir='LTR'>", MVCFunctions.runner_htmlspecialchars((XVar)(caption)), " (", MVCFunctions.runner_htmlspecialchars((XVar)(table)), ")</span>"), "tablename"); } row.InitAndSetArrayItem(MVCFunctions.Concat(" id=\"row_", shortTable, "\""), "tablerowattrs"); row.InitAndSetArrayItem(MVCFunctions.Concat("id=\"rowbox", shortTable, "\" data-table=\"", shortTable, "\" data-checked=0"), "tablecheckbox_attrs"); row.InitAndSetArrayItem(MVCFunctions.Concat(" id=\"tblcell", shortTable, "\""), "tbl_cell"); mask = XVar.Clone(this.pageMasks[table]); foreach (KeyValuePair <XVar, dynamic> x in this.permissionNames.GetEnumerator()) { if (XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(mask), (XVar)(x.Key))), XVar.Pack(false))) { continue; } row.InitAndSetArrayItem(true, MVCFunctions.Concat(x.Key, "_group")); row.InitAndSetArrayItem(MVCFunctions.Concat(" id=\"box", x.Key, shortTable, "\" data-checked=0"), MVCFunctions.Concat(x.Key, "_checkbox")); row.InitAndSetArrayItem(MVCFunctions.Concat(" id=\"cell", x.Key, shortTable, "\""), MVCFunctions.Concat(x.Key, "_cell")); } } else { dynamic title = null; title = XVar.Clone(_tbl.Value["title"]); row = XVar.Clone(XVar.Array()); row.InitAndSetArrayItem(MVCFunctions.runner_htmlspecialchars((XVar)(title)), "tablename"); row.InitAndSetArrayItem(" data-checked=-2", "tablecheckbox_attrs"); row.InitAndSetArrayItem(MVCFunctions.Concat(" id=\"grouprow_", _tbl.Key, "\""), "tablerowattrs"); } if (XVar.Pack(!(XVar)(parent as object != null))) { parentStack = XVar.Clone(XVar.Array()); } else { dynamic stackPos = null; stackPos = XVar.Clone(MVCFunctions.array_search((XVar)(parent), (XVar)(parentStack))); if (XVar.Equals(XVar.Pack(stackPos), XVar.Pack(false))) { parentStack.InitAndSetArrayItem(parent, null); } else { parentStack = XVar.Clone(MVCFunctions.array_slice((XVar)(parentStack), new XVar(0), (XVar)(stackPos + 1))); } row["tblrowclass"] = MVCFunctions.Concat(row["tblrowclass"], "rightsindent", MVCFunctions.count(parentStack)); } childrenCount = XVar.Clone(getItemsCount((XVar)(_tbl.Key))); if ((XVar)(_tbl.Value.KeyExists("items")) && (XVar)(childrenCount)) { row["tablename"] = MVCFunctions.Concat(row["tablename"], "<span class='tablecount' dir='LTR'> (", getItemsCount((XVar)(_tbl.Key)), ")</span>"); row["tablerowattrs"] = MVCFunctions.Concat(row["tablerowattrs"], " data-groupid=\"", _tbl.Key, "\""); row.InitAndSetArrayItem(true, "groupControl"); row.InitAndSetArrayItem(" data-state='closed'", "groupControlState"); row.InitAndSetArrayItem(" data-state='closed'", "groupControlClass"); row["tblrowclass"] = MVCFunctions.Concat(row["tblrowclass"], " menugroup"); if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(table))))) { row["tblrowclass"] = MVCFunctions.Concat(row["tblrowclass"], " menugrouponly"); } } else { if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(table))))) { continue; } } if (XVar.Pack(parent)) { row["tablerowattrs"] = MVCFunctions.Concat(row["tablerowattrs"], " style='display:none;'"); } rowInfoArr.InitAndSetArrayItem(row, null); } return(null); }
public override XVar addFieldsSettings(dynamic _param_arrFields, dynamic _param_pSet_packed, dynamic _param_pageBased, dynamic _param_pageType) { #region packeted values ProjectSettings _param_pSet = XVar.UnPackProjectSettings(_param_pSet_packed); #endregion #region pass-by-value parameters dynamic arrFields = XVar.Clone(_param_arrFields); ProjectSettings pSet = XVar.Clone(_param_pSet); dynamic pageBased = XVar.Clone(_param_pageBased); dynamic pageType = XVar.Clone(_param_pageType); #endregion dynamic dashSearchFields = XVar.Array(), tableSettingsFilled = XVar.Array(); dashSearchFields = XVar.Clone(this.pSet.getDashboardSearchFields()); tableSettingsFilled = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> fieldName in arrFields.GetEnumerator()) { dynamic lookupTableName = null, tableFieldName = null, tableName = null; tableName = XVar.Clone(dashSearchFields[fieldName.Value][0]["table"]); pSet = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(tableName), (XVar)(pageType))); tableFieldName = XVar.Clone(dashSearchFields[fieldName.Value][0]["field"]); if (XVar.Pack(!(XVar)(tableSettingsFilled[tableName]))) { fillTableSettings((XVar)(tableName), (XVar)(pSet)); tableSettingsFilled.InitAndSetArrayItem(true, tableName); } if (XVar.Pack(!(XVar)(this.jsSettings["tableSettings"][this.tName]["fieldSettings"].KeyExists(fieldName.Value)))) { this.jsSettings.InitAndSetArrayItem(XVar.Array(), "tableSettings", this.tName, "fieldSettings", fieldName.Value); } if (XVar.Pack(!(XVar)(this.jsSettings["tableSettings"][this.tName]["fieldSettings"][fieldName.Value].KeyExists(pageType)))) { this.jsSettings.InitAndSetArrayItem(XVar.Array(), "tableSettings", this.tName, "fieldSettings", fieldName.Value, pageType); } foreach (KeyValuePair <XVar, dynamic> val in this.settingsMap["fieldSettings"].GetEnumerator()) { dynamic fData = XVar.Array(), isDefault = null; fData = XVar.Clone(pSet.getFieldData((XVar)(tableFieldName), (XVar)(val.Key))); if (val.Key == "validateAs") { if ((XVar)((XVar)(pageType == Constants.PAGE_ADD) || (XVar)(pageType == Constants.PAGE_EDIT)) || (XVar)(pageType == Constants.PAGE_REGISTER)) { fillValidation((XVar)(fData), (XVar)(val.Value), (XVar)(this.jsSettings["tableSettings"][this.tName]["fieldSettings"][fieldName.Value][pageType])); } continue; } if (val.Key == "RTEType") { fData = XVar.Clone(pSet.getRTEType((XVar)(tableFieldName))); if (fData == "RTECK") { this.isUseCK = new XVar(true); this.jsSettings.InitAndSetArrayItem(pSet.getNCols((XVar)(tableFieldName)), "tableSettings", this.tName, "fieldSettings", fieldName.Value, pageType, "nWidth"); this.jsSettings.InitAndSetArrayItem(pSet.getNRows((XVar)(tableFieldName)), "tableSettings", this.tName, "fieldSettings", fieldName.Value, pageType, "nHeight"); } } else { if (val.Key == "autoCompleteFields") { fData = XVar.Clone(pSet.getAutoCompleteFields((XVar)(tableFieldName))); } else { if (val.Key == "parentFields") { fData = XVar.Clone(pSet.getLookupParentFNames((XVar)(tableFieldName))); foreach (KeyValuePair <XVar, dynamic> parentField in fData.GetEnumerator()) { fData.InitAndSetArrayItem(locateDashFieldByOriginal((XVar)(tableName), (XVar)(parentField.Value)), parentField.Key); } } } } isDefault = new XVar(false); if (XVar.Pack(MVCFunctions.is_array((XVar)(fData)))) { isDefault = XVar.Clone(!(XVar)(MVCFunctions.count(fData))); } else { if (XVar.Pack(!(XVar)(MVCFunctions.is_array((XVar)(val.Value["default"]))))) { isDefault = XVar.Clone(XVar.Equals(XVar.Pack(fData), XVar.Pack(val.Value["default"]))); } } if (XVar.Pack(!(XVar)(isDefault))) { this.jsSettings.InitAndSetArrayItem(fData, "tableSettings", this.tName, "fieldSettings", fieldName.Value, pageType, val.Value["jsName"]); } } this.jsSettings.InitAndSetArrayItem(tableName, "tableSettings", this.tName, "fieldSettings", fieldName.Value, pageType, "originalTable"); this.jsSettings.InitAndSetArrayItem(tableFieldName, "tableSettings", this.tName, "fieldSettings", fieldName.Value, pageType, "originalField"); this.jsSettings.InitAndSetArrayItem(this.isUseCK, "tableSettings", this.tName, "isUseCK"); if ((XVar)(MVCFunctions.count(this.googleMapCfg) != 0) && (XVar)(this.googleMapCfg["isUseGoogleMap"])) { this.jsSettings.InitAndSetArrayItem(true, "tableSettings", this.tName, "isUseGoogleMap"); this.jsSettings.InitAndSetArrayItem(this.googleMapCfg, "tableSettings", this.tName, "googleMapCfg"); } lookupTableName = XVar.Clone(pSet.getLookupTable((XVar)(tableFieldName))); if (XVar.Pack(lookupTableName)) { this.jsSettings.InitAndSetArrayItem(CommonFunctions.GetTableURL((XVar)(lookupTableName)), "global", "shortTNames", lookupTableName); } if (pSet.getEditFormat((XVar)(tableFieldName)) == "Time") { fillTimePickSettings((XVar)(tableFieldName), new XVar(""), (XVar)(pSet), (XVar)(pageType)); } } return(null); }
public XVar mfhandler() { try { dynamic _connection = null, field = null, fileName = null, formStamp = null, fsFileName = null, fsize = null, ftype = null, havePermission = null, iconShowed = null, isDBFile = null, isPDF = null, outputAsAttachment = null, pageType = null, pdf = null, requestAction = null, sessionFile = XVar.Array(), upload_handler = null, value = null, var_params = XVar.Array(); ProjectSettings pSet; isPDF = new XVar(false); if (XVar.Pack(isPDF)) { GlobalVars.strTableName = XVar.Clone(var_params["table"]); field = XVar.Clone(var_params["field"]); pageType = XVar.Clone(var_params["pageType"]); outputAsAttachment = new XVar(false); } else { GlobalVars.strTableName = XVar.Clone(MVCFunctions.postvalue(new XVar("table"))); field = XVar.Clone(MVCFunctions.postvalue(new XVar("field"))); pageType = XVar.Clone(MVCFunctions.postvalue(new XVar("pageType"))); outputAsAttachment = XVar.Clone(MVCFunctions.postvalue(new XVar("nodisp")) != 1); } if (GlobalVars.strTableName == XVar.Pack("")) { if (XVar.Pack(!(XVar)(isPDF))) { MVCFunctions.Echo("<p>No table name received</p>"); } return(MVCFunctions.GetBuferContentAndClearBufer()); } if (field == XVar.Pack("")) { if (XVar.Pack(!(XVar)(isPDF))) { MVCFunctions.Echo("<p>No field name received</p>"); } return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(!(XVar)(CommonFunctions.GetTableURL((XVar)(GlobalVars.strTableName))))) { MVCFunctions.Echo(new XVar(0)); return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(isPDF)) { requestAction = new XVar("GET"); } else { requestAction = XVar.Clone(MVCFunctions.postvalue("_action")); } _connection = XVar.Clone(GlobalVars.cman.byTable((XVar)(GlobalVars.strTableName))); pSet = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(GlobalVars.strTableName), (XVar)(pageType))); if (XVar.Pack(!(XVar)(isPDF))) { CommonFunctions.add_nocache_headers(); } Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", CommonFunctions.GetTableURL((XVar)(GlobalVars.strTableName)), ""), "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null); if (requestAction == "POST") { havePermission = XVar.Clone((XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Add"))) || (XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Edit")))); } else { havePermission = XVar.Clone((XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search"))) || (XVar)(MVCFunctions.postvalue(new XVar("fkey")))); } if ((XVar)((XVar)(!(XVar)(CommonFunctions.isLogged())) && (XVar)(pageType != Constants.PAGE_REGISTER)) || (XVar)(!(XVar)(havePermission))) { MVCFunctions.HeaderRedirect(new XVar("login"), new XVar(""), new XVar("message=expired")); return(MVCFunctions.GetBuferContentAndClearBufer()); } upload_handler = XVar.Clone(new UploadHandler((XVar)(CommonFunctions.getOptionsForMultiUpload((XVar)(pSet), (XVar)(field))))); upload_handler.pSet = XVar.Clone(pSet); upload_handler.field = XVar.Clone(field); upload_handler.table = XVar.Clone(GlobalVars.strTableName); upload_handler.pageType = XVar.Clone(pageType); switch (((XVar)requestAction).ToString()) { case "DELETE": CommonFunctions.printMFHandlerHeaders(); formStamp = XVar.Clone(MVCFunctions.postvalue(new XVar("formStamp"))); if (formStamp != XVar.Pack("")) { upload_handler.formStamp = XVar.Clone(formStamp); upload_handler.delete(); } break; case "POST": CommonFunctions.printMFHandlerHeaders(); formStamp = XVar.Clone(MVCFunctions.postvalue(new XVar("formStamp"))); if (formStamp != XVar.Pack("")) { upload_handler.formStamp = XVar.Clone(formStamp); upload_handler.post(); } break; case "GET": default: if (XVar.Pack(isPDF)) { isDBFile = XVar.Clone(var_params.KeyExists("filename")); fileName = XVar.Clone((XVar.Pack(var_params.KeyExists("file")) ? XVar.Pack(var_params["file"]) : XVar.Pack(var_params["filename"]))); } else { isDBFile = XVar.Clone(MVCFunctions.postvalue(new XVar("filename")) != ""); fileName = XVar.Clone((XVar.Pack(MVCFunctions.postvalue(new XVar("file")) != "") ? XVar.Pack(MVCFunctions.postvalue(new XVar("file"))) : XVar.Pack(MVCFunctions.postvalue(new XVar("filename"))))); formStamp = XVar.Clone(MVCFunctions.postvalue(new XVar("fkey"))); } if (fileName == XVar.Pack("")) { MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } sessionFile = new XVar(null); fsFileName = new XVar(""); if ((XVar)(!(XVar)(isDBFile)) && (XVar)(formStamp != XVar.Pack(""))) { sessionFile = XVar.Clone(XSession.Session[MVCFunctions.Concat("mupload_", formStamp)][fileName]["file"]); } else { dynamic i = null, keys = XVar.Array(), qResult = null, queryObj = null, strWhereClause = null, tKeys = XVar.Array(); keys = XVar.Clone(XVar.Array()); tKeys = XVar.Clone(pSet.getTableKeys()); i = new XVar(0); for (; i < MVCFunctions.count(tKeys); i++) { if (XVar.Pack(isPDF)) { keys.InitAndSetArrayItem(var_params[MVCFunctions.Concat("key", i + 1)], tKeys[i]); } else { keys.InitAndSetArrayItem(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("key", i + 1))), tKeys[i]); } } strWhereClause = XVar.Clone(CommonFunctions.KeyWhere((XVar)(keys))); if (pSet.getAdvancedSecurityType() != Constants.ADVSECURITY_ALL) { strWhereClause = XVar.Clone(CommonFunctions.whereAdd((XVar)(strWhereClause), (XVar)(CommonFunctions.SecuritySQL(new XVar("Search"))))); } queryObj = XVar.Clone(pSet.getSQLQuery().CloneObject()); if (XVar.Pack(!(XVar)(queryObj.HasGroupBy()))) { queryObj.RemoveAllFieldsExcept((XVar)(pSet.getFieldIndex((XVar)(field)))); } qResult = XVar.Clone(_connection.query((XVar)(queryObj.gSQLWhere((XVar)(strWhereClause))))); if (XVar.Pack(isDBFile)) { if (XVar.Pack(qResult)) { dynamic data = XVar.Array(); data = XVar.Clone(qResult.fetchAssoc()); if (XVar.Pack(data)) { value = XVar.Clone(_connection.stripSlashesBinary((XVar)(data[field]))); } } } else { dynamic row = XVar.Array(); GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName), (XVar)(pSet))); row = XVar.Clone(GlobalVars.cipherer.DecryptFetchedArray((XVar)(qResult.fetchAssoc()))); if (XVar.Pack(row)) { dynamic filesArray = XVar.Array(); filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(row[field]))); if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0)) { if (row[field] == "") { filesArray = XVar.Clone(XVar.Array()); } else { dynamic uploadedFile = XVar.Array(); uploadedFile = XVar.Clone(upload_handler.get_file_object((XVar)(row[field]))); if (XVar.Pack(uploadedFile == null)) { filesArray = XVar.Clone(XVar.Array()); } else { filesArray = XVar.Clone(new XVar(0, MVCFunctions.my_json_decode((XVar)(MVCFunctions.my_json_encode((XVar)(uploadedFile)))))); } } } foreach (KeyValuePair <XVar, dynamic> uploadedFile in filesArray.GetEnumerator()) { if (uploadedFile.Value["usrName"] == fileName) { sessionFile = XVar.Clone(uploadedFile.Value); break; } } } } } iconShowed = new XVar(false); if (XVar.Pack(isDBFile)) { ftype = new XVar(""); if (pSet.getViewFormat((XVar)(field)) == Constants.FORMAT_DATABASE_IMAGE) { if (XVar.Pack(!(XVar)(value))) { value = XVar.Clone(MVCFunctions.myfile_get_contents(new XVar("images/no_image.gif"))); } ftype = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(value))); } if (XVar.Pack(!(XVar)(ftype))) { ftype = XVar.Clone(CommonFunctions.getContentTypeByExtension((XVar)(MVCFunctions.substr((XVar)(fileName), (XVar)(MVCFunctions.strrpos((XVar)(fileName), new XVar("."))))))); } fsize = XVar.Clone(MVCFunctions.strlen_bin((XVar)(value))); } else { if (sessionFile != null) { dynamic isSRC = null, isThumbnail = null; isThumbnail = new XVar(false); isSRC = new XVar(false); if (XVar.Pack(isPDF)) { isThumbnail = XVar.Clone(var_params.KeyExists("thumbnail")); isSRC = XVar.Clone(var_params.KeyExists("src")); } else { isThumbnail = XVar.Clone(MVCFunctions.postvalue(new XVar("thumbnail")) != ""); isSRC = XVar.Clone(MVCFunctions.postvalue(new XVar("src")) == 1); } if (MVCFunctions.postvalue(new XVar("icon")) != "") { fsFileName = XVar.Clone(MVCFunctions.Concat("images/icons/", CommonFunctions.getIconByFileType((XVar)(sessionFile["type"]), (XVar)(sessionFile["name"])))); fsize = XVar.Clone(MVCFunctions.filesize((XVar)(MVCFunctions.getabspath((XVar)(fsFileName))))); ftype = new XVar("image/png"); } else { if ((XVar)((XVar)(isThumbnail) && (XVar)(sessionFile["thumbnail"])) && (XVar)(MVCFunctions.GDExist())) { fsFileName = XVar.Clone(sessionFile["thumbnail"]); fsize = XVar.Clone(sessionFile["thumbnail_size"]); ftype = XVar.Clone(sessionFile["thumbnail_type"]); } else { if ((XVar)((XVar)(false) && (XVar)((XVar)(pageType == Constants.PAGE_EDIT) || (XVar)(pageType == Constants.PAGE_ADD))) && (XVar)(isSRC)) { iconShowed = new XVar(true); fsFileName = XVar.Clone(MVCFunctions.Concat("images/icons/", CommonFunctions.getIconByFileType((XVar)(sessionFile["type"]), (XVar)(sessionFile["name"])))); fsize = XVar.Clone(MVCFunctions.filesize((XVar)(MVCFunctions.getabspath((XVar)(fsFileName))))); ftype = new XVar("image/png"); } else { fsFileName = XVar.Clone(sessionFile["name"]); fsize = XVar.Clone(sessionFile["size"]); ftype = XVar.Clone(sessionFile["type"]); } } } } } if ((XVar)((XVar)(isDBFile) && (XVar)(value)) || (XVar)(fsFileName != XVar.Pack(""))) { dynamic norange = null; if (XVar.Pack(!(XVar)(isDBFile))) { if ((XVar)((XVar)(!(XVar)(pSet.isAbsolute((XVar)(field)))) && (XVar)(!(XVar)(MVCFunctions.isAbsolutePath((XVar)(fsFileName))))) || (XVar)(iconShowed)) { fsFileName = XVar.Clone(MVCFunctions.getabspath((XVar)(fsFileName))); } if (XVar.Pack(!(XVar)(MVCFunctions.myfile_exists((XVar)(fsFileName))))) { fsFileName = XVar.Clone(MVCFunctions.getabspath(new XVar("images/no_image.gif"))); fsize = XVar.Clone(MVCFunctions.filesize((XVar)(fsFileName))); ftype = new XVar("image/gif"); } } if (XVar.Pack(isPDF)) { dynamic file = null; if (XVar.Pack(isDBFile)) { file = XVar.Clone(value); } else { file = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(fsFileName))); } return(MVCFunctions.GetBuferContentAndClearBufer()); } norange = XVar.Clone(MVCFunctions.postvalue(new XVar("norange")) == 1); if (MVCFunctions.postvalue(new XVar("norange")) == 1) { MVCFunctions.Header("Accept-Ranges", "none"); MVCFunctions.Header("Cache-Control", "private"); MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Type: ", ftype))); MVCFunctions.Header("Access-Control-Allow-Methods", "HEAD, GET, POST"); if (XVar.Pack(outputAsAttachment)) { MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=\"", fileName, "\""))); } MVCFunctions.SendContentLength((XVar)(fsize)); if (MVCFunctions.GetServerVariable("REQUEST_METHOD") == "HEAD") { MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(isDBFile)) { MVCFunctions.echoBinary((XVar)(value)); } else { MVCFunctions.printfile((XVar)(fsFileName)); } } else { dynamic httpRange = null, printContentLength = null, range = null, range_orig = null, seek_end = null, seek_start = null, size_unit = null, tmparr = XVar.Array(); size_unit = new XVar(""); range_orig = new XVar(""); httpRange = XVar.Clone(MVCFunctions.GetHttpRange()); if (XVar.Pack(MVCFunctions.preg_match(new XVar("/^bytes=((\\d*-\\d*,? ?)+)$/"), (XVar)(httpRange)))) { tmparr = XVar.Clone(MVCFunctions.explode(new XVar("="), (XVar)(httpRange))); size_unit = XVar.Clone(tmparr[0]); range_orig = XVar.Clone(tmparr[1]); } if (size_unit == "bytes") { if (!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(range_orig), new XVar(","))), XVar.Pack(false))) { dynamic extra_ranges = null; tmparr = XVar.Clone(MVCFunctions.explode(new XVar(","), (XVar)(range_orig))); range = XVar.Clone(tmparr[0]); extra_ranges = XVar.Clone(tmparr[1]); } else { range = XVar.Clone(range_orig); } } else { range = new XVar("-"); } tmparr = XVar.Clone(MVCFunctions.explode(new XVar("-"), (XVar)(range))); seek_start = XVar.Clone(tmparr[0]); seek_end = XVar.Clone(tmparr[1]); seek_end = XVar.Clone((XVar.Pack(MVCFunctions.strlen((XVar)(seek_end)) == 0) ? XVar.Pack(fsize - 1) : XVar.Pack(MVCFunctions.min((XVar)(MVCFunctions.abs((XVar)(MVCFunctions.intval((XVar)(seek_end))))), (XVar)(fsize - 1))))); seek_start = XVar.Clone((XVar.Pack((XVar)(MVCFunctions.strlen((XVar)(seek_start)) == 0) || (XVar)(seek_end < MVCFunctions.abs((XVar)(MVCFunctions.intval((XVar)(seek_start)))))) ? XVar.Pack(0) : XVar.Pack(MVCFunctions.max((XVar)(MVCFunctions.abs((XVar)(MVCFunctions.intval((XVar)(seek_start))))), new XVar(0))))); if ((XVar)(XVar.Pack(0) < seek_start) || (XVar)(seek_end < fsize - 1)) { MVCFunctions.Header(new XVar("HTTP/1.1 206 Partial Content")); } MVCFunctions.Header("Accept-Ranges", "bytes"); MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Range: bytes ", seek_start, "-", seek_end, "/", fsize))); if (XVar.Pack(outputAsAttachment)) { MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=\"", fileName, "\""))); } printContentLength = new XVar(true); if (XVar.Pack(printContentLength)) { MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Length: ", (seek_end - seek_start) + 1))); } MVCFunctions.Header("Cache-Control", "cache, must-revalidate"); MVCFunctions.Header("Pragma", "public"); MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Type: ", ftype))); if (MVCFunctions.GetServerVariable("REQUEST_METHOD") == "HEAD") { MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } if (XVar.Pack(isDBFile)) { MVCFunctions.echoBinaryPartial((XVar)(value), (XVar)(seek_start), (XVar)(seek_end)); } else { MVCFunctions.printfileByRange((XVar)(fsFileName), (XVar)(seek_start), (XVar)(seek_end)); } } } break; } MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }
public override XVar commonAssign() { dynamic i = null, permis = null; base.commonAssign(); this.xt.assign(new XVar("left_block"), new XVar(false)); if ((XVar)((XVar)(this.masterPageType == Constants.PAGE_ADD) || (XVar)(this.masterPageType == Constants.PAGE_VIEW)) || (XVar)(this.mode == Constants.LIST_DASHDETAILS)) { this.xt.assign(new XVar("selectall_link"), new XVar(false)); this.xt.assign(new XVar("checkbox_column"), new XVar(false)); this.xt.assign(new XVar("checkbox_header"), new XVar(false)); this.xt.assign(new XVar("editselected_link"), new XVar(false)); this.xt.assign(new XVar("delete_link"), new XVar(false)); this.xt.assign(new XVar("saveall_link"), new XVar(false)); this.xt.assign(new XVar("withSelectedClass"), new XVar("rnr-hiddenelem")); if (this.masterPageType == Constants.PAGE_VIEW) { this.xt.assign(new XVar("record_controls_block"), new XVar(false)); } } else { selectAllLinkAttrs(); if (XVar.Pack(!(XVar)(mobileTemplateMode()))) { checkboxColumnAttrs(); } editSelectedLinkAttrs(); saveAllLinkAttrs(); deleteSelectedLink(); if (this.masterPageType != Constants.PAGE_EDIT) { dynamic searchPermis = null; searchPermis = XVar.Clone(this.permis[this.tName]["search"]); this.xt.assign(new XVar("record_controls_block"), (XVar)((XVar)((XVar)(this.permis[this.tName]["edit"]) && (XVar)(this.pSet.hasInlineEdit())) || (XVar)((XVar)(this.permis[this.tName]["delete"]) && (XVar)(this.pSet.hasDelete())))); this.xt.assign(new XVar("details_block"), (XVar)((XVar)(searchPermis) && (XVar)(this.rowsFound))); this.xt.assign(new XVar("details_attrs"), (XVar)(MVCFunctions.Concat("id=\"detFound", this.id, "\" name=\"detFound", this.id, "\""))); this.xt.assign(new XVar("pages_block"), (XVar)((XVar)(searchPermis) && (XVar)(this.rowsFound))); } } this.xt.assign(new XVar("withSelected"), (XVar)((XVar)((XVar)(this.permis[this.tName]["export"]) || (XVar)(this.permis[this.tName]["edit"])) || (XVar)(this.permis[this.tName]["delete"]))); if (this.numRowsFromSQL == 0) { this.xt.displayBrickHidden(new XVar("recordcontrol")); } if (this.masterPageType != Constants.PAGE_VIEW) { this.xt.assign(new XVar("inlineedit_column"), (XVar)((XVar)(inlineEditAvailable()) && (XVar)(this.permis[this.tName]["edit"]))); assignListIconsColumn(); cancelAllLinkAttrs(); } i = new XVar(0); for (; i < MVCFunctions.count(this.allDetailsTablesArr); i++) { permis = XVar.Clone((XVar)((XVar)(this.isGroupSecurity) && (XVar)((XVar)(this.permis[this.allDetailsTablesArr[i]["dDataSourceTable"]]["add"]) || (XVar)(this.permis[this.allDetailsTablesArr[i]["dDataSourceTable"]]["search"]))) || (XVar)(!(XVar)(this.isGroupSecurity))); if (XVar.Pack(permis)) { this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(this.tName)), "_dtable_column")), (XVar)(permis)); break; } } return(null); }
public override XVar readWebValue(dynamic avalues, dynamic blobfields, dynamic _param_legacy1, dynamic _param_legacy2, dynamic filename_values) { #region pass-by-value parameters dynamic legacy1 = XVar.Clone(_param_legacy1); dynamic legacy2 = XVar.Clone(_param_legacy2); #endregion getPostValueAndType(); this.formStamp = XVar.Clone(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("formStamp_", this.goodFieldName, "_", this.id)))); if ((XVar)(MVCFunctions.FieldSubmitted((XVar)(MVCFunctions.Concat(this.goodFieldName, "_", this.id)))) && (XVar)(this.formStamp != "")) { dynamic filesArray = XVar.Array(); filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(this.webValue))); if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0)) { this.webValue = new XVar(""); } else { dynamic result = XVar.Array(), searchStr = null, uploadDir = null; if (0 < MVCFunctions.count(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)])) { foreach (KeyValuePair <XVar, dynamic> fileArray in XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].GetEnumerator()) { fileArray.Value.InitAndSetArrayItem(true, "deleted"); } } result = XVar.Clone(XVar.Array()); uploadDir = XVar.Clone(this.pageObject.pSetEdit.getLinkPrefix((XVar)(this.field))); searchStr = new XVar(""); foreach (KeyValuePair <XVar, dynamic> file in filesArray.GetEnumerator()) { if (XVar.Pack(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].KeyExists(file.Value["name"]))) { dynamic sessionFile = XVar.Array(); sessionFile = XVar.Clone(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)][file.Value["name"]]["file"]); searchStr = MVCFunctions.Concat(searchStr, file.Value["name"], ",!"); result.InitAndSetArrayItem(new XVar("name", sessionFile["name"], "usrName", file.Value["name"], "size", sessionFile["size"], "type", sessionFile["type"]), null); if ((XVar)(this.pageObject.pSetEdit.getCreateThumbnail((XVar)(this.field))) && (XVar)(sessionFile["thumbnail"] != "")) { dynamic lastIndex = null; lastIndex = XVar.Clone(MVCFunctions.count(result) - 1); result.InitAndSetArrayItem(sessionFile["thumbnail"], lastIndex, "thumbnail"); result.InitAndSetArrayItem(sessionFile["thumbnail_type"], lastIndex, "thumbnail_type"); result.InitAndSetArrayItem(sessionFile["thumbnail_size"], lastIndex, "thumbnail_size"); } XSession.Session.InitAndSetArrayItem(false, MVCFunctions.Concat("mupload_", this.formStamp), file.Value["name"], "deleted"); } } if (0 < MVCFunctions.count(result)) { result.InitAndSetArrayItem(MVCFunctions.Concat(searchStr, ":sStrEnd"), 0, "searchStr"); this.webValue = XVar.Clone(MVCFunctions.my_json_encode_unescaped_unicode((XVar)(result))); } else { this.webValue = new XVar(""); } } } else { this.webValue = new XVar(false); } if (XVar.Pack(!(XVar)(XVar.Equals(XVar.Pack(this.webValue), XVar.Pack(false))))) { if (this.connection.dbType == Constants.nDATABASE_Informix) { if (XVar.Pack(CommonFunctions.IsTextType((XVar)(this.pageObject.pSetEdit.getFieldType((XVar)(this.field)))))) { blobfields.InitAndSetArrayItem(this.field, null); } } avalues.InitAndSetArrayItem(this.webValue, this.field); } return(null); }
public virtual XVar assignCellAttrs(dynamic cellMap, dynamic _param_cell, dynamic _param_location, dynamic _param_pageObject, dynamic _param_xt_packed, dynamic recordData, dynamic _param_forceCellSpans = null) { #region packeted values XTempl _param_xt = XVar.UnPackXTempl(_param_xt_packed); #endregion #region default values if (_param_forceCellSpans as Object == null) { _param_forceCellSpans = new XVar(false); } #endregion #region pass-by-value parameters dynamic cell = XVar.Clone(_param_cell); dynamic location = XVar.Clone(_param_location); dynamic pageObject = XVar.Clone(_param_pageObject); XTempl xt = XVar.Clone(_param_xt); dynamic forceCellSpans = XVar.Clone(_param_forceCellSpans); #endregion dynamic cellAttrs = XVar.Array(), hCell = XVar.Array(); cellAttrs = XVar.Clone(XVar.Array()); hCell = cellMap.cells[cell]; if (XVar.Pack(!(XVar)(pageObject.pdfJsonMode()))) { if ((XVar)(0 == MVCFunctions.count(hCell["rows"])) || (XVar)(0 == MVCFunctions.count(hCell["cols"]))) { cellAttrs.InitAndSetArrayItem("data-hidden", null); } if ((XVar)(forceCellSpans) || (XVar)(1 < MVCFunctions.count(hCell["cols"]))) { cellAttrs.InitAndSetArrayItem(MVCFunctions.Concat("colspan=\"", MVCFunctions.count(hCell["cols"]), "\""), null); } if ((XVar)(forceCellSpans) || (XVar)(1 < MVCFunctions.count(hCell["rows"]))) { cellAttrs.InitAndSetArrayItem(MVCFunctions.Concat("rowspan=\"", MVCFunctions.count(hCell["rows"]), "\""), null); } if (XVar.Pack(MVCFunctions.count(cellAttrs))) { assignPageVar((XVar)(recordData), (XVar)(xt), (XVar)(MVCFunctions.Concat("cell_", location, "_", cell)), (XVar)(MVCFunctions.implode(new XVar(" "), (XVar)(cellAttrs)))); } } else { if ((XVar)(0 == MVCFunctions.count(hCell["rows"])) || (XVar)(0 == MVCFunctions.count(hCell["cols"]))) { assignPageVar((XVar)(recordData), (XVar)(xt), (XVar)(MVCFunctions.Concat("cellblock_", location, "_", cell)), new XVar(false)); } if ((XVar)(forceCellSpans) || (XVar)(1 < MVCFunctions.count(hCell["cols"]))) { assignPageVar((XVar)(recordData), (XVar)(xt), (XVar)(MVCFunctions.Concat("colspan_", location, "_", cell)), (XVar)(MVCFunctions.count(hCell["cols"]))); } if ((XVar)(forceCellSpans) || (XVar)(1 < MVCFunctions.count(hCell["rows"]))) { assignPageVar((XVar)(recordData), (XVar)(xt), (XVar)(MVCFunctions.Concat("rowspan_", location, "_", cell)), (XVar)(MVCFunctions.count(hCell["rows"]))); } } return(null); }
public virtual XVar showDBValue(dynamic _param_value, dynamic _param_keyLink) { #region pass-by-value parameters dynamic value = XVar.Clone(_param_value); dynamic keyLink = XVar.Clone(_param_keyLink); #endregion dynamic filesArray = XVar.Array(), imageValue = null, keylink = null; imageValue = new XVar(""); initUploadHandler(); this.upload_handler.tkeys = XVar.Clone(keylink); filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(value))); if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0)) { if (value == XVar.Pack("")) { filesArray = XVar.Clone(XVar.Array()); } else { dynamic uploadedFile = null; uploadedFile = XVar.Clone(this.upload_handler.get_file_object((XVar)(value))); if (XVar.Pack(uploadedFile == null)) { filesArray = XVar.Clone(XVar.Array()); } else { filesArray = XVar.Clone(new XVar(0, uploadedFile)); } } } foreach (KeyValuePair <XVar, dynamic> imageFile in filesArray.GetEnumerator()) { dynamic userFile = XVar.Array(); userFile = XVar.Clone(this.upload_handler.buildUserFile((XVar)(imageFile.Value))); if (this.pageObject.pSetEdit.getViewFormat((XVar)(this.field)) == Constants.FORMAT_FILE) { imageValue = MVCFunctions.Concat(imageValue, (XVar.Pack(imageValue != XVar.Pack("")) ? XVar.Pack("<br>") : XVar.Pack(""))); imageValue = MVCFunctions.Concat(imageValue, "<a href=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"])), "\">", MVCFunctions.runner_htmlspecialchars((XVar)((XVar.Pack(imageFile.Value["usrName"] != "") ? XVar.Pack(imageFile.Value["usrName"]) : XVar.Pack(imageFile.Value["name"])))), "</a>"); } else { if (XVar.Pack(CommonFunctions.CheckImageExtension((XVar)(imageFile.Value["name"])))) { dynamic imgHeight = null, imgWidth = null; imageValue = MVCFunctions.Concat(imageValue, (XVar.Pack(imageValue != XVar.Pack("")) ? XVar.Pack("<br>") : XVar.Pack(""))); if (XVar.Pack(this.pageObject.pSetEdit.showThumbnail((XVar)(this.field)))) { dynamic thumbname = null; thumbname = XVar.Clone(userFile["thumbnail_url"]); imageValue = MVCFunctions.Concat(imageValue, "<a target=_blank"); imageValue = MVCFunctions.Concat(imageValue, " href=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"])), "\" class='zoombox'>"); imageValue = MVCFunctions.Concat(imageValue, "<img"); if ((XVar)(thumbname == XVar.Pack("")) || (XVar)(imageFile.Value["name"] == imageFile.Value["thumbnail"])) { imgWidth = XVar.Clone(this.pageObject.pSetEdit.getImageWidth((XVar)(this.field))); imageValue = MVCFunctions.Concat(imageValue, (XVar.Pack(imgWidth) ? XVar.Pack(MVCFunctions.Concat(" width=", imgWidth)) : XVar.Pack(""))); imgHeight = XVar.Clone(this.pageObject.pSetEdit.getImageHeight((XVar)(this.field))); imageValue = MVCFunctions.Concat(imageValue, (XVar.Pack(imgHeight) ? XVar.Pack(MVCFunctions.Concat(" height=", imgHeight)) : XVar.Pack(""))); } imageValue = MVCFunctions.Concat(imageValue, " border=0"); if (XVar.Pack(this.is508)) { imageValue = MVCFunctions.Concat(imageValue, " alt=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["name"])), "\""); } imageValue = MVCFunctions.Concat(imageValue, " src=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["thumbnail_url"])), "\"></a>"); } else { imageValue = MVCFunctions.Concat(imageValue, "<img"); imgWidth = XVar.Clone(this.pageObject.pSetEdit.getImageWidth((XVar)(this.field))); imageValue = MVCFunctions.Concat(imageValue, (XVar.Pack(imgWidth) ? XVar.Pack(MVCFunctions.Concat(" width=", imgWidth)) : XVar.Pack(""))); imgHeight = XVar.Clone(this.pageObject.pSetEdit.getImageHeight((XVar)(this.field))); imageValue = MVCFunctions.Concat(imageValue, (XVar.Pack(imgHeight) ? XVar.Pack(MVCFunctions.Concat(" height=", imgHeight)) : XVar.Pack(""))); imageValue = MVCFunctions.Concat(imageValue, " border=0"); if (XVar.Pack(this.is508)) { imageValue = MVCFunctions.Concat(imageValue, " alt=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["name"])), "\""); } imageValue = MVCFunctions.Concat(imageValue, " src=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"])), "\">"); } } } } return(imageValue); }
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 override XVar buildControl(dynamic _param_value, dynamic _param_mode, dynamic _param_fieldNum, dynamic _param_validate, dynamic _param_additionalCtrlParams, dynamic _param_data) { #region pass-by-value parameters dynamic value = XVar.Clone(_param_value); dynamic mode = XVar.Clone(_param_mode); dynamic fieldNum = XVar.Clone(_param_fieldNum); dynamic validate = XVar.Clone(_param_validate); dynamic additionalCtrlParams = XVar.Clone(_param_additionalCtrlParams); dynamic data = XVar.Clone(_param_data); #endregion dynamic filesArray = XVar.Array(), jsonValue = null, multiple = null, userFilesArray = XVar.Array(); base.buildControl((XVar)(value), (XVar)(mode), (XVar)(fieldNum), (XVar)(validate), (XVar)(additionalCtrlParams), (XVar)(data)); if ((XVar)(this.pageObject.pageType == Constants.PAGE_SEARCH) || (XVar)(this.pageObject.pageType == Constants.PAGE_LIST)) { dynamic classString = null; classString = new XVar(""); if (this.pageObject.getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { classString = new XVar(" class=\"form-control\""); } MVCFunctions.Echo(MVCFunctions.Concat("<input id=\"", this.cfield, "\" ", classString, this.inputStyle, " type=\"text\" ", (XVar.Pack(mode == Constants.MODE_SEARCH) ? XVar.Pack("autocomplete=\"off\" ") : XVar.Pack("")), (XVar.Pack((XVar)((XVar)(mode == Constants.MODE_INLINE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_ADD)) && (XVar)(this.is508 == true)) ? XVar.Pack(MVCFunctions.Concat("alt=\"", this.strLabel, "\" ")) : XVar.Pack("")), "name=\"", this.cfield, "\" ", this.pageObject.pSetEdit.getEditParams((XVar)(this.field)), " value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(value)), "\">")); buildControlEnd((XVar)(validate), (XVar)(mode)); return(null); } if (mode == Constants.MODE_SEARCH) { this.format = new XVar(""); } this.formStamp = XVar.Clone(CommonFunctions.generatePassword(new XVar(15))); initUploadHandler(); this.upload_handler.formStamp = XVar.Clone(this.formStamp); filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(value))); if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0)) { if (XVar.Pack(!(XVar)(value))) { jsonValue = new XVar("[]"); } else { dynamic uploadedFile = null; uploadedFile = XVar.Clone(this.upload_handler.get_file_object((XVar)(value))); if (XVar.Pack(uploadedFile == null)) { filesArray = XVar.Clone(XVar.Array()); } else { filesArray = XVar.Clone(new XVar(0, MVCFunctions.my_json_decode((XVar)(MVCFunctions.my_json_encode((XVar)(uploadedFile)))))); } } } if (this.pageObject.pageType == Constants.PAGE_EDIT) { if (0 < MVCFunctions.count(this.pageObject.keys)) { dynamic i = null; i = new XVar(1); foreach (KeyValuePair <XVar, dynamic> keyValue in this.pageObject.keys.GetEnumerator()) { this.upload_handler.tkeys = MVCFunctions.Concat(this.upload_handler.tkeys, "&key", i, "=", MVCFunctions.RawUrlEncode((XVar)(keyValue.Value))); i++; } } } XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)] = XVar.Array(); userFilesArray = XVar.Clone(XVar.Array()); if (XVar.Pack(MVCFunctions.is_array((XVar)(filesArray)))) { foreach (KeyValuePair <XVar, dynamic> file in filesArray.GetEnumerator()) { dynamic sessionArray = XVar.Array(), userFile = XVar.Array(); sessionArray = XVar.Clone(XVar.Array()); sessionArray.InitAndSetArrayItem(file.Value, "file"); sessionArray.InitAndSetArrayItem(true, "fromDB"); sessionArray.InitAndSetArrayItem(false, "deleted"); XSession.Session.InitAndSetArrayItem(sessionArray, MVCFunctions.Concat("mupload_", this.formStamp), file.Value["usrName"]); userFile = XVar.Clone(this.upload_handler.buildUserFile((XVar)(file.Value))); if (XVar.Pack(!(XVar)(userFile["isImg"]))) { userFile.InitAndSetArrayItem(true, "isImg"); userFile.InitAndSetArrayItem(true, "isIco"); userFile.InitAndSetArrayItem(MVCFunctions.Concat(userFile["url"], "&icon=1"), "thumbnail_url"); } userFilesArray.InitAndSetArrayItem(userFile, null); } } jsonValue = XVar.Clone(MVCFunctions.my_json_encode((XVar)(userFilesArray))); multiple = new XVar(""); if ((XVar)(!(XVar)(CommonFunctions.isIOS())) && (XVar)(this.pageObject.pSetEdit.getMaxNumberOfFiles((XVar)(this.field)) != 1)) { multiple = new XVar("multiple "); } MVCFunctions.Echo(MVCFunctions.Concat("\r\n <!-- The file upload form used as target for the file upload widget -->\r\n <form id=\"fileupload_", this.cfieldname, "\" action=\"", MVCFunctions.GetTableLink(new XVar("mfhandler")), "\" method=\"POST\" enctype=\"multipart/form-data\">\r\n \r\n <input type=\"hidden\" name=\"formStamp_", this.cfieldname, "\" id=\"formStamp_", this.cfieldname, "\" value=\"", this.formStamp, "\" />\r\n <input type=\"hidden\" name=\"_action\" value=\"POST\" />\r\n <input type=\"hidden\" id=\"value_", this.cfieldname, "\" name=\"value_", this.cfieldname, "\" value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(jsonValue)), "\" />\r\n \r\n <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->\r\n <div class=\"fileupload-buttonbar\">\r\n <div class=\"span7\">\r\n <!-- The fileinput-button span is used to style the file input field as button -->\r\n \t\t\t\t<SPAN class=\"btn btn-primary btn-sm fileinput-button\">\r\n\t\t\t\t\t<A class=\"rnr-button filesUpload button\" href=\"#\" ><input class=\"fileinput-button-input\" type=\"file\" name=\"files[]\" value=\"", "Add files", "\" ", multiple, " />", "Add files", "</A>\r\n\t\t\t\t</SPAN>", "\r\n \r\n </div>\r\n <!-- The global progress information -->\r\n <div class=\"fileupload-progress fade\">\r\n <!-- The global progress bar -->\r\n <div class=\"progress\" role=\"progressbar\" aria-valuemin=\"0\" aria-valuenow=\"0\" aria-valuemax=\"100\">\r\n <div style=\"width:0;\" class=\"bar progress-bar progress-bar-info progress-bar-striped active\" ></div>\r\n </div>\r\n <!-- The extended global progress information -->\r\n <div class=\"progress-extended\"> </div>\r\n </div>\r\n </div>\r\n <!-- The loading indicator is shown during file processing -->\r\n <div class=\"fileupload-loading\"></div>\r\n <!-- The table listing the files available for upload/download -->\r\n <table class=\"mupload-files\"><tbody class=\"files\"></tbody></table>\r\n </form>\r\n ")); if (XVar.Pack(!(XVar)(this.container.globalVals.KeyExists("muploadTemplateIncluded")))) { MVCFunctions.Echo(MVCFunctions.Concat("<script type=\"text/x-tmpl\" id=\"template-download\">{% for (var i=0, file; file=o.files[i]; i++) { %}\r\n <tr class=\"template-download fade\">\r\n {% if (file.error) { %}\r\n <td></td>\r\n <td class=\"name\"><span class=\"text-muted\">{%=file.name%}</span></td>\r\n <td class=\"size\"><span class=\"text-muted\" dir=\"LTR\">{%=o.formatFileSize(file.size)%}</span></td>\r\n <td colspan=2 class=\"error\"><span class=\"text-danger rnr-error\">", "", " {%=locale.fileupload.errors[file.error] || file.error%}</span></td>\r\n {% } else { %}\r\n <td class=\"preview\">{% if (file.thumbnail_url) { %}\r\n <a href=\"{%=file.url%}\" title=\"{%=file.name%}\" rel=\"gallery\" download=\"{%=file.name%}\" \r\n \t{% if (!file.isIco) { %} class=\"zoombox zgallery\" {% } %} \r\n \t><img class=\"mupload-preview-img\" src=\"{%=file.thumbnail_url%}&src=1\"></a>\r\n {% } else { %}\r\n \t{% if (file.isImg) { %}\r\n \t\t<a href=\"{%=file.url%}&nodisp=1\" title=\"{%=file.name%}\" rel=\"gallery\" download=\"{%=file.name%}\" class=\"zoombox zgallery\"><img class=\"mupload-preview-img\" src=\"{%=file.url%}&src=1\"></a>\r\n \t{% } %}\r\n {% } %}</td>\r\n <td class=\"name\">\r\n <a href=\"{%=file.url%}\" title=\"{%=file.name%}\" rel=\"{%=file.thumbnail_url&&'gallery'%}\" download=\"{%=file.name%}\">{%=file.name%}</a>\r\n </td>\r\n <td class=\"size\"><span dir=\"LTR\">{%=o.formatFileSize(file.size)%}</span></td>\r\n\t\t\t<td></td>\r\n\t\t\t<td class=\"delete\">\r\n\t\t\t\t{% if (!file.error) { %}\r\n\t\t\t\t<SPAN class=\"btn btn-xs btn-default delete\" data-type=\"{%=file.delete_type%}\" data-url=\"{%=file.delete_url%}\" data-name=\"{%=file.name%}\">\r\n\t\t\t\t\t<A href=\"#\" >", "Delete", "</A>\r\n\t\t\t\t\t</SPAN>\r\n\t\t\t\t{% } %}\r\n\t\t\t</td>\r\n {% } %}\r\n </tr>\r\n{% } %}\r\n</script>\r\n<script type=\"text/x-tmpl\" id=\"template-upload\">{% for (var i=0, file; file=o.files[i]; i++) { %}\r\n <tr class=\"template-upload fade\">\r\n <td class=\"preview\"><span class=\"fade\"></span></td>\r\n {% if (file.error) { %}\r\n\t\t\t<td class=\"name\"><span class=\"text-muted\">{%=file.name%}</span></td>\r\n\t\t\t<td class=\"size\"><span class=\"text-muted\">{%=o.formatFileSize(file.size)%}</span></td>\r\n <td class=\"error\" colspan=\"2\"><span class=\"text-danger rnr-error\">", "", " {%=locale.fileupload.errors[file.error] || file.error%}</span></td>\r\n {% } else if (o.files.valid && !i) { %}\r\n\t\t\t<td class=\"name\"><span>{%=file.name%}</span></td>\r\n\t\t\t<td class=\"size\"><span>{%=o.formatFileSize(file.size)%}</span></td>\r\n <td>\r\n <div class=\"progress progress-success progress-striped active\" role=\"progressbar\" aria-valuemin=\"0\" \r\n \taria-valuemax=\"100\" aria-valuenow=\"0\"><div class=\"progress-bar bar\" style=\"width:0;\"></div></div>\r\n </td>\r\n {% } else { %}\r\n <td></td>\r\n {% } %}\r\n <td class=\"cancel\">{% if (!i) { %}\r\n \t{% if (!file.error) { %}\r\n \t<SPAN class=\"btn btn-default btn-xs\">\r\n\t\t\t\t<A href=\"#\" >", "Cancel", "</A>\r\n\t\t\t\t</SPAN>\r\n\t\t\t{% } %}\r\n {% } %}</td>\r\n </tr>\r\n{% } %}</script>")); this.container.globalVals.InitAndSetArrayItem(true, "muploadTemplateIncluded"); } buildControlEnd((XVar)(validate), (XVar)(mode)); return(null); }
public static XVar ExportToExcel(dynamic _param_rs, dynamic _param_nPageSize, dynamic _param_eventObj, dynamic _param_cipherer, dynamic _param_pageObj) { #region pass-by-value parameters dynamic rs = XVar.Clone(_param_rs); dynamic nPageSize = XVar.Clone(_param_nPageSize); dynamic eventObj = XVar.Clone(_param_eventObj); dynamic cipherer = XVar.Clone(_param_cipherer); dynamic pageObj = XVar.Clone(_param_pageObj); #endregion dynamic arrColumnWidth = XVar.Array(), arrFields = XVar.Array(), arrLabel = XVar.Array(), arrTmpTotal = XVar.Array(), arrTotal = XVar.Array(), arrTotalMessage = XVar.Array(), eventRes = null, iNumberOfRows = null, objPHPExcel = null, row = XVar.Array(), totals = XVar.Array(), totalsFields = XVar.Array(), values = XVar.Array(); if (XVar.Pack(eventObj.exists(new XVar("ListFetchArray")))) { row = XVar.Clone(eventObj.ListFetchArray((XVar)(rs), (XVar)(pageObj))); } else { row = XVar.Clone(cipherer.DecryptFetchedArray((XVar)(pageObj.connection.fetch_array((XVar)(rs))))); } totals = XVar.Clone(XVar.Array()); arrLabel = XVar.Clone(XVar.Array()); arrTotal = XVar.Clone(XVar.Array()); arrFields = XVar.Clone(XVar.Array()); arrColumnWidth = XVar.Clone(XVar.Array()); arrTotalMessage = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> field in pageObj.selectedFields.GetEnumerator()) { if (XVar.Pack(pageObj.pSet.appearOnExportPage((XVar)(field.Value)))) { arrFields.InitAndSetArrayItem(field.Value, null); } } arrTmpTotal = XVar.Clone(pageObj.pSet.getTotalsFields()); pageObj.viewControls.setForExportVar(new XVar("excel")); foreach (KeyValuePair <XVar, dynamic> field in arrFields.GetEnumerator()) { arrLabel.InitAndSetArrayItem(CommonFunctions.GetFieldLabel((XVar)(MVCFunctions.GoodFieldName((XVar)(pageObj.tName))), (XVar)(MVCFunctions.GoodFieldName((XVar)(field.Value)))), field.Value); arrColumnWidth.InitAndSetArrayItem(10, field.Value); totals.InitAndSetArrayItem(new XVar("value", 0, "numRows", 0), field.Value); foreach (KeyValuePair <XVar, dynamic> tvalue in arrTmpTotal.GetEnumerator()) { if (tvalue.Value["fName"] == field.Value) { totalsFields.InitAndSetArrayItem(new XVar("fName", field.Value, "totalsType", tvalue.Value["totalsType"], "viewFormat", pageObj.pSet.getViewFormat((XVar)(field.Value))), null); } } } iNumberOfRows = new XVar(0); objPHPExcel = XVar.Clone(ExportFunctions.ExportExcelInit((XVar)(arrLabel), (XVar)(arrColumnWidth))); while ((XVar)((XVar)(!(XVar)(nPageSize)) || (XVar)(iNumberOfRows < nPageSize)) && (XVar)(row)) { CommonFunctions.countTotals((XVar)(totals), (XVar)(totalsFields), (XVar)(row)); values = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> field in arrFields.GetEnumerator()) { if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(pageObj.pSet.getFieldType((XVar)(field.Value)))))) { values.InitAndSetArrayItem(row[field.Value], field.Value); } else { values.InitAndSetArrayItem(pageObj.getFormattedFieldValue((XVar)(field.Value), (XVar)(row)), field.Value); } } eventRes = new XVar(true); if (XVar.Pack(eventObj.exists(new XVar("BeforeOut")))) { eventRes = XVar.Clone(eventObj.BeforeOut((XVar)(row), (XVar)(values), (XVar)(pageObj))); } if (XVar.Pack(eventRes)) { dynamic arrData = XVar.Array(), arrDataType = XVar.Array(), i = null; arrData = XVar.Clone(XVar.Array()); arrDataType = XVar.Clone(XVar.Array()); iNumberOfRows++; i = new XVar(0); foreach (KeyValuePair <XVar, dynamic> field in arrFields.GetEnumerator()) { dynamic vFormat = null; vFormat = XVar.Clone(pageObj.pSet.getViewFormat((XVar)(field.Value))); if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(pageObj.pSet.getFieldType((XVar)(field.Value)))))) { arrDataType.InitAndSetArrayItem("binary", field.Value); } else { if ((XVar)((XVar)(vFormat == Constants.FORMAT_DATE_SHORT) || (XVar)(vFormat == Constants.FORMAT_DATE_LONG)) || (XVar)(vFormat == Constants.FORMAT_DATE_TIME)) { arrDataType.InitAndSetArrayItem("date", field.Value); } else { if (vFormat == Constants.FORMAT_FILE_IMAGE) { arrDataType.InitAndSetArrayItem("file", field.Value); } else { arrDataType.InitAndSetArrayItem("", field.Value); } } } arrData.InitAndSetArrayItem(values[field.Value], field.Value); } ExportFunctions.ExportExcelRecord((XVar)(arrData), (XVar)(arrDataType), (XVar)(iNumberOfRows), (XVar)(objPHPExcel), (XVar)(pageObj)); } if (XVar.Pack(eventObj.exists(new XVar("ListFetchArray")))) { row = XVar.Clone(eventObj.ListFetchArray((XVar)(rs), (XVar)(pageObj))); } else { row = XVar.Clone(cipherer.DecryptFetchedArray((XVar)(pageObj.connection.fetch_array((XVar)(rs))))); } } if (XVar.Pack(MVCFunctions.count(arrTmpTotal))) { foreach (KeyValuePair <XVar, dynamic> fName in arrFields.GetEnumerator()) { dynamic total = null, totalMess = null, value = XVar.Array(); value = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> tvalue in arrTmpTotal.GetEnumerator()) { if (tvalue.Value["fName"] == fName.Value) { value = XVar.Clone(tvalue.Value); } } total = new XVar(""); totalMess = new XVar(""); if (XVar.Pack(value["totalsType"])) { if (value["totalsType"] == "COUNT") { totalMess = XVar.Clone(MVCFunctions.Concat("Count", ": ")); } else { if (value["totalsType"] == "TOTAL") { totalMess = XVar.Clone(MVCFunctions.Concat("Total", ": ")); } else { if (value["totalsType"] == "AVERAGE") { totalMess = XVar.Clone(MVCFunctions.Concat("Average", ": ")); } } } total = XVar.Clone(CommonFunctions.GetTotals((XVar)(fName.Value), (XVar)(totals[fName.Value]["value"]), (XVar)(value["totalsType"]), (XVar)(totals[fName.Value]["numRows"]), (XVar)(value["viewFormat"]), new XVar("export"), (XVar)(pageObj.pSet), (XVar)(pageObj.useRawValues), (XVar)(pageObj))); } arrTotal.InitAndSetArrayItem(total, fName.Value); arrTotalMessage.InitAndSetArrayItem(totalMess, fName.Value); } } ExportFunctions.ExportExcelTotals((XVar)(arrTotal), (XVar)(arrTotalMessage), (XVar)(++(iNumberOfRows)), (XVar)(objPHPExcel)); ExportFunctions.ExportExcelSave((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(pageObj.tName)), ".xlsx")), new XVar("Excel2007"), (XVar)(objPHPExcel)); return(null); }
public static XVar current() { return(GlobalVars.contextStack.stack[MVCFunctions.count(GlobalVars.contextStack.stack) - 1]); }
static public void Apply() { SettingsMap arrGPP = SettingsMap.GetArray(), arrGridTabs = SettingsMap.GetArray(), arrRPP = SettingsMap.GetArray(), dIndex = null, detailsParam = SettingsMap.GetArray(), edata = SettingsMap.GetArray(), eventsData = SettingsMap.GetArray(), fdata = SettingsMap.GetArray(), fieldLabelsArray = new XVar(), fieldToolTipsArray = new XVar(), hours = null, intervalData = SettingsMap.GetArray(), masterParams = SettingsMap.GetArray(), pageTitlesArray = new XVar(), placeHoldersArray = new XVar(), popupPagesLayoutNames = SettingsMap.GetArray(), query = null, queryData_Array = new XVar(), reportGroupFields = SettingsMap.GetArray(), rgroupField = SettingsMap.GetArray(), strOriginalDetailsTable = null, table = null, tableKeysArray = new XVar(), tdataArray = new XVar(), tstrOrderBy = null, vdata = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".searchableFields"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".truncateText"] = true; tdataArray["dbo_TIPOEMPLEADO"][".NumberOfChars"] = 80; tdataArray["dbo_TIPOEMPLEADO"][".ShortName"] = "dbo_TIPOEMPLEADO"; tdataArray["dbo_TIPOEMPLEADO"][".OwnerID"] = ""; tdataArray["dbo_TIPOEMPLEADO"][".OriginalTable"] = "dbo.TIPOEMPLEADO"; GlobalVars.defaultPages = MVCFunctions.my_json_decode(new XVar("{\"add\":\"add\",\"edit\":\"edit\",\"export\":\"export\",\"list\":\"list\",\"masterlist\":\"masterlist\",\"masterprint\":\"masterprint\",\"search\":\"search\"}")); tdataArray["dbo_TIPOEMPLEADO"][".pages"] = CommonFunctions.types2pages(MVCFunctions.my_json_decode(new XVar("{\"add\":[\"add\"],\"edit\":[\"edit\"],\"export\":[\"export\"],\"list\":[\"list\"],\"masterlist\":[\"masterlist\"],\"masterprint\":[\"masterprint\"],\"search\":[\"search\"]}"))); tdataArray["dbo_TIPOEMPLEADO"][".defaultPages"] = GlobalVars.defaultPages; fieldLabelsArray["dbo_TIPOEMPLEADO"] = SettingsMap.GetArray(); fieldToolTipsArray["dbo_TIPOEMPLEADO"] = SettingsMap.GetArray(); pageTitlesArray["dbo_TIPOEMPLEADO"] = SettingsMap.GetArray(); placeHoldersArray["dbo_TIPOEMPLEADO"] = SettingsMap.GetArray(); if (CommonFunctions.mlang_getcurrentlang() == "Spanish") { fieldLabelsArray["dbo_TIPOEMPLEADO"]["Spanish"] = SettingsMap.GetArray(); fieldToolTipsArray["dbo_TIPOEMPLEADO"]["Spanish"] = SettingsMap.GetArray(); placeHoldersArray["dbo_TIPOEMPLEADO"]["Spanish"] = SettingsMap.GetArray(); pageTitlesArray["dbo_TIPOEMPLEADO"]["Spanish"] = SettingsMap.GetArray(); fieldLabelsArray["dbo_TIPOEMPLEADO"]["Spanish"]["id_tipo"] = "ID"; fieldToolTipsArray["dbo_TIPOEMPLEADO"]["Spanish"]["id_tipo"] = ""; placeHoldersArray["dbo_TIPOEMPLEADO"]["Spanish"]["id_tipo"] = ""; fieldLabelsArray["dbo_TIPOEMPLEADO"]["Spanish"]["tipo_empleado"] = "Tipo Empleado"; fieldToolTipsArray["dbo_TIPOEMPLEADO"]["Spanish"]["tipo_empleado"] = ""; placeHoldersArray["dbo_TIPOEMPLEADO"]["Spanish"]["tipo_empleado"] = ""; if (XVar.Pack(MVCFunctions.count(fieldToolTipsArray["dbo_TIPOEMPLEADO"]["Spanish"]))) { tdataArray["dbo_TIPOEMPLEADO"][".isUseToolTips"] = true; } } tdataArray["dbo_TIPOEMPLEADO"][".NCSearch"] = true; tdataArray["dbo_TIPOEMPLEADO"][".shortTableName"] = "dbo_TIPOEMPLEADO"; tdataArray["dbo_TIPOEMPLEADO"][".nSecOptions"] = 0; tdataArray["dbo_TIPOEMPLEADO"][".mainTableOwnerID"] = ""; tdataArray["dbo_TIPOEMPLEADO"][".entityType"] = 0; tdataArray["dbo_TIPOEMPLEADO"][".strOriginalTableName"] = "dbo.TIPOEMPLEADO"; tdataArray["dbo_TIPOEMPLEADO"][".showAddInPopup"] = false; tdataArray["dbo_TIPOEMPLEADO"][".showEditInPopup"] = false; tdataArray["dbo_TIPOEMPLEADO"][".showViewInPopup"] = false; popupPagesLayoutNames = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".popupPagesLayoutNames"] = popupPagesLayoutNames; tdataArray["dbo_TIPOEMPLEADO"][".listAjax"] = false; tdataArray["dbo_TIPOEMPLEADO"][".listAjax"] = false; tdataArray["dbo_TIPOEMPLEADO"][".audit"] = true; tdataArray["dbo_TIPOEMPLEADO"][".locking"] = false; GlobalVars.pages = tdataArray["dbo_TIPOEMPLEADO"][".pages"]; if (XVar.Pack(GlobalVars.pages[Constants.PAGE_EDIT])) { tdataArray["dbo_TIPOEMPLEADO"][".edit"] = true; tdataArray["dbo_TIPOEMPLEADO"][".afterEditAction"] = 1; tdataArray["dbo_TIPOEMPLEADO"][".closePopupAfterEdit"] = 1; tdataArray["dbo_TIPOEMPLEADO"][".afterEditActionDetTable"] = ""; } if (XVar.Pack(GlobalVars.pages[Constants.PAGE_ADD])) { tdataArray["dbo_TIPOEMPLEADO"][".add"] = true; tdataArray["dbo_TIPOEMPLEADO"][".afterAddAction"] = 1; tdataArray["dbo_TIPOEMPLEADO"][".closePopupAfterAdd"] = 1; tdataArray["dbo_TIPOEMPLEADO"][".afterAddActionDetTable"] = ""; } if (XVar.Pack(GlobalVars.pages[Constants.PAGE_LIST])) { tdataArray["dbo_TIPOEMPLEADO"][".list"] = true; } tdataArray["dbo_TIPOEMPLEADO"][".strSortControlSettingsJSON"] = ""; if (XVar.Pack(GlobalVars.pages[Constants.PAGE_VIEW])) { tdataArray["dbo_TIPOEMPLEADO"][".view"] = true; } if (XVar.Pack(GlobalVars.pages[Constants.PAGE_IMPORT])) { tdataArray["dbo_TIPOEMPLEADO"][".import"] = true; } if (XVar.Pack(GlobalVars.pages[Constants.PAGE_EXPORT])) { tdataArray["dbo_TIPOEMPLEADO"][".exportTo"] = true; } if (XVar.Pack(GlobalVars.pages[Constants.PAGE_PRINT])) { tdataArray["dbo_TIPOEMPLEADO"][".printFriendly"] = true; } tdataArray["dbo_TIPOEMPLEADO"][".showSimpleSearchOptions"] = true; tdataArray["dbo_TIPOEMPLEADO"][".allowShowHideFields"] = true; tdataArray["dbo_TIPOEMPLEADO"][".allowFieldsReordering"] = true; tdataArray["dbo_TIPOEMPLEADO"][".isUseAjaxSuggest"] = true; tdataArray["dbo_TIPOEMPLEADO"][".rowHighlite"] = true; tdataArray["dbo_TIPOEMPLEADO"][".ajaxCodeSnippetAdded"] = false; tdataArray["dbo_TIPOEMPLEADO"][".buttonsAdded"] = false; tdataArray["dbo_TIPOEMPLEADO"][".addPageEvents"] = false; tdataArray["dbo_TIPOEMPLEADO"][".isUseTimeForSearch"] = false; tdataArray["dbo_TIPOEMPLEADO"][".badgeColor"] = "008B8B"; tdataArray["dbo_TIPOEMPLEADO"][".allSearchFields"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".filterFields"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".requiredSearchFields"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".googleLikeFields"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".googleLikeFields"].Add("id_tipo"); tdataArray["dbo_TIPOEMPLEADO"][".googleLikeFields"].Add("tipo_empleado"); tdataArray["dbo_TIPOEMPLEADO"][".tableType"] = "list"; tdataArray["dbo_TIPOEMPLEADO"][".printerPageOrientation"] = 0; tdataArray["dbo_TIPOEMPLEADO"][".nPrinterPageScale"] = 100; tdataArray["dbo_TIPOEMPLEADO"][".nPrinterSplitRecords"] = 40; tdataArray["dbo_TIPOEMPLEADO"][".nPrinterPDFSplitRecords"] = 40; tdataArray["dbo_TIPOEMPLEADO"][".geocodingEnabled"] = false; tdataArray["dbo_TIPOEMPLEADO"][".pageSize"] = 20; tdataArray["dbo_TIPOEMPLEADO"][".warnLeavingPages"] = true; tstrOrderBy = ""; if (MVCFunctions.strlen(tstrOrderBy) && MVCFunctions.strtolower(MVCFunctions.substr(tstrOrderBy, new XVar(0), new XVar(8))) != "order by") { tstrOrderBy = MVCFunctions.Concat("order by ", tstrOrderBy); } tdataArray["dbo_TIPOEMPLEADO"][".strOrderBy"] = tstrOrderBy; tdataArray["dbo_TIPOEMPLEADO"][".orderindexes"] = SettingsMap.GetArray(); tdataArray["dbo_TIPOEMPLEADO"][".sqlHead"] = "SELECT id_tipo, tipo_empleado"; tdataArray["dbo_TIPOEMPLEADO"][".sqlFrom"] = "FROM dbo.TIPOEMPLEADO"; tdataArray["dbo_TIPOEMPLEADO"][".sqlWhereExpr"] = ""; tdataArray["dbo_TIPOEMPLEADO"][".sqlTail"] = ""; arrRPP = SettingsMap.GetArray(); arrRPP.Add(10); arrRPP.Add(20); arrRPP.Add(30); arrRPP.Add(50); arrRPP.Add(100); arrRPP.Add(500); arrRPP.Add(-1); tdataArray["dbo_TIPOEMPLEADO"][".arrRecsPerPage"] = arrRPP; arrGPP = SettingsMap.GetArray(); arrGPP.Add(1); arrGPP.Add(3); arrGPP.Add(5); arrGPP.Add(10); arrGPP.Add(50); arrGPP.Add(100); arrGPP.Add(-1); tdataArray["dbo_TIPOEMPLEADO"][".arrGroupsPerPage"] = arrGPP; tdataArray["dbo_TIPOEMPLEADO"][".highlightSearchResults"] = true; tableKeysArray["dbo_TIPOEMPLEADO"] = SettingsMap.GetArray(); tableKeysArray["dbo_TIPOEMPLEADO"].Add("id_tipo"); tdataArray["dbo_TIPOEMPLEADO"][".Keys"] = tableKeysArray["dbo_TIPOEMPLEADO"]; tdataArray["dbo_TIPOEMPLEADO"][".hideMobileList"] = SettingsMap.GetArray(); fdata = SettingsMap.GetArray(); fdata["Index"] = 1; fdata["strName"] = "id_tipo"; fdata["GoodName"] = "id_tipo"; fdata["ownerTable"] = "dbo.TIPOEMPLEADO"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo_TIPOEMPLEADO", "id_tipo"); fdata["FieldType"] = 3; fdata["AutoInc"] = true; fdata["strField"] = "id_tipo"; fdata["isSQLExpression"] = true; fdata["FullName"] = "id_tipo"; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["IsRequired"] = true; edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "text"; edata["EditParams"] = ""; edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"].Add(CommonFunctions.getJsValidatorName(new XVar("Number"))); edata["validateAs"]["basicValidate"].Add("IsRequired"); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["defaultSearchOption"] = "Contains"; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); fdata["filterTotals"] = 0; fdata["filterMultiSelect"] = 0; fdata["filterFormat"] = "Values list"; fdata["showCollapsed"] = false; fdata["sortValueType"] = 0; fdata["numberOfVisibleItems"] = 10; tdataArray["dbo_TIPOEMPLEADO"]["id_tipo"] = fdata; tdataArray["dbo_TIPOEMPLEADO"][".searchableFields"].Add("id_tipo"); fdata = SettingsMap.GetArray(); fdata["Index"] = 2; fdata["strName"] = "tipo_empleado"; fdata["GoodName"] = "tipo_empleado"; fdata["ownerTable"] = "dbo.TIPOEMPLEADO"; fdata["Label"] = CommonFunctions.GetFieldLabel("dbo_TIPOEMPLEADO", "tipo_empleado"); fdata["FieldType"] = 200; fdata["strField"] = "tipo_empleado"; fdata["isSQLExpression"] = true; fdata["FullName"] = "tipo_empleado"; fdata["UploadFolder"] = "files"; fdata["ViewFormats"] = SettingsMap.GetArray(); vdata = new XVar("ViewFormat", ""); vdata["NeedEncode"] = true; fdata["ViewFormats"]["view"] = vdata; fdata["EditFormats"] = SettingsMap.GetArray(); edata = new XVar("EditFormat", "Text field"); edata["IsRequired"] = true; edata["acceptFileTypes"] = ".+$"; edata["maxNumberOfFiles"] = 1; edata["HTML5InuptType"] = "text"; edata["EditParams"] = ""; edata["EditParams"] = MVCFunctions.Concat(edata["EditParams"], " maxlength=100"); edata["controlWidth"] = 200; edata["validateAs"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"] = SettingsMap.GetArray(); edata["validateAs"]["customMessages"] = SettingsMap.GetArray(); edata["validateAs"]["basicValidate"].Add("IsRequired"); fdata["EditFormats"]["edit"] = edata; fdata["isSeparate"] = false; fdata["defaultSearchOption"] = "Contains"; fdata["searchOptionsList"] = new XVar(0, "Contains", 1, "Equals", 2, "Starts with", 3, "More than", 4, "Less than", 5, "Between", 6, "Empty", 7, Constants.NOT_EMPTY); fdata["filterTotals"] = 0; fdata["filterMultiSelect"] = 0; fdata["filterFormat"] = "Values list"; fdata["showCollapsed"] = false; fdata["sortValueType"] = 0; fdata["numberOfVisibleItems"] = 10; tdataArray["dbo_TIPOEMPLEADO"]["tipo_empleado"] = fdata; tdataArray["dbo_TIPOEMPLEADO"][".searchableFields"].Add("tipo_empleado"); GlobalVars.tables_data["dbo.TIPOEMPLEADO"] = tdataArray["dbo_TIPOEMPLEADO"]; GlobalVars.field_labels["dbo_TIPOEMPLEADO"] = fieldLabelsArray["dbo_TIPOEMPLEADO"]; GlobalVars.fieldToolTips["dbo_TIPOEMPLEADO"] = fieldToolTipsArray["dbo_TIPOEMPLEADO"]; GlobalVars.placeHolders["dbo_TIPOEMPLEADO"] = placeHoldersArray["dbo_TIPOEMPLEADO"]; GlobalVars.page_titles["dbo_TIPOEMPLEADO"] = pageTitlesArray["dbo_TIPOEMPLEADO"]; GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"] = SettingsMap.GetArray(); dIndex = 0; detailsParam = SettingsMap.GetArray(); detailsParam["dDataSourceTable"] = "dbo.EMPLEADO"; detailsParam["dOriginalTable"] = "dbo.EMPLEADO"; detailsParam["dType"] = Constants.PAGE_LIST; detailsParam["dShortTable"] = "dbo_EMPLEADO"; detailsParam["dCaptionTable"] = CommonFunctions.GetTableCaption(new XVar("dbo_EMPLEADO")); detailsParam["masterKeys"] = SettingsMap.GetArray(); detailsParam["detailKeys"] = SettingsMap.GetArray(); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex] = detailsParam; GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["masterKeys"] = SettingsMap.GetArray(); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["masterKeys"].Add("id_tipo"); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["detailKeys"] = SettingsMap.GetArray(); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["detailKeys"].Add("id_tipo"); dIndex = 1; detailsParam = SettingsMap.GetArray(); detailsParam["dDataSourceTable"] = "Saldo_Horas_Empleado"; detailsParam["dOriginalTable"] = "dbo.EMPLEADO"; detailsParam["dType"] = Constants.PAGE_LIST; detailsParam["dShortTable"] = "Saldo_Horas_Empleado"; detailsParam["dCaptionTable"] = CommonFunctions.GetTableCaption(new XVar("Saldo_Horas_Empleado")); detailsParam["masterKeys"] = SettingsMap.GetArray(); detailsParam["detailKeys"] = SettingsMap.GetArray(); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex] = detailsParam; GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["masterKeys"] = SettingsMap.GetArray(); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["masterKeys"].Add("id_tipo"); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["detailKeys"] = SettingsMap.GetArray(); GlobalVars.detailsTablesData["dbo.TIPOEMPLEADO"][dIndex]["detailKeys"].Add("id_tipo"); GlobalVars.masterTablesData["dbo.TIPOEMPLEADO"] = SettingsMap.GetArray(); SQLEntity obj = null; var protoArray = SettingsMap.GetArray(); protoArray["0"] = SettingsMap.GetArray(); protoArray["0"]["m_strHead"] = "SELECT"; protoArray["0"]["m_strFieldList"] = "id_tipo, tipo_empleado"; protoArray["0"]["m_strFrom"] = "FROM dbo.TIPOEMPLEADO"; protoArray["0"]["m_strWhere"] = ""; protoArray["0"]["m_strOrderBy"] = ""; protoArray["0"]["cipherer"] = null; protoArray["2"] = SettingsMap.GetArray(); protoArray["2"]["m_sql"] = ""; protoArray["2"]["m_uniontype"] = "SQLL_UNKNOWN"; obj = new SQLNonParsed(new XVar("m_sql", "")); protoArray["2"]["m_column"] = obj; protoArray["2"]["m_contained"] = SettingsMap.GetArray(); protoArray["2"]["m_strCase"] = ""; protoArray["2"]["m_havingmode"] = false; protoArray["2"]["m_inBrackets"] = false; protoArray["2"]["m_useAlias"] = false; obj = new SQLLogicalExpr(protoArray["2"]); protoArray["0"]["m_where"] = obj; protoArray["4"] = SettingsMap.GetArray(); protoArray["4"]["m_sql"] = ""; protoArray["4"]["m_uniontype"] = "SQLL_UNKNOWN"; obj = new SQLNonParsed(new XVar("m_sql", "")); protoArray["4"]["m_column"] = obj; protoArray["4"]["m_contained"] = SettingsMap.GetArray(); protoArray["4"]["m_strCase"] = ""; protoArray["4"]["m_havingmode"] = false; protoArray["4"]["m_inBrackets"] = false; protoArray["4"]["m_useAlias"] = false; obj = new SQLLogicalExpr(protoArray["4"]); protoArray["0"]["m_having"] = obj; protoArray["0"]["m_fieldlist"] = SettingsMap.GetArray(); protoArray["6"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "id_tipo", "m_strTable", "dbo.TIPOEMPLEADO", "m_srcTableName", "dbo.TIPOEMPLEADO")); protoArray["6"]["m_sql"] = "id_tipo"; protoArray["6"]["m_srcTableName"] = "dbo.TIPOEMPLEADO"; protoArray["6"]["m_expr"] = obj; protoArray["6"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["6"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["8"] = SettingsMap.GetArray(); obj = new SQLField(new XVar("m_strName", "tipo_empleado", "m_strTable", "dbo.TIPOEMPLEADO", "m_srcTableName", "dbo.TIPOEMPLEADO")); protoArray["8"]["m_sql"] = "tipo_empleado"; protoArray["8"]["m_srcTableName"] = "dbo.TIPOEMPLEADO"; protoArray["8"]["m_expr"] = obj; protoArray["8"]["m_alias"] = ""; obj = new SQLFieldListItem(protoArray["8"]); protoArray["0"]["m_fieldlist"].Add(obj); protoArray["0"]["m_fromlist"] = SettingsMap.GetArray(); protoArray["10"] = SettingsMap.GetArray(); protoArray["10"]["m_link"] = "SQLL_MAIN"; protoArray["11"] = SettingsMap.GetArray(); protoArray["11"]["m_strName"] = "dbo.TIPOEMPLEADO"; protoArray["11"]["m_srcTableName"] = "dbo.TIPOEMPLEADO"; protoArray["11"]["m_columns"] = SettingsMap.GetArray(); protoArray["11"]["m_columns"].Add("id_tipo"); protoArray["11"]["m_columns"].Add("tipo_empleado"); obj = new SQLTable(protoArray["11"]); protoArray["10"]["m_table"] = obj; protoArray["10"]["m_sql"] = "dbo.TIPOEMPLEADO"; protoArray["10"]["m_alias"] = ""; protoArray["10"]["m_srcTableName"] = "dbo.TIPOEMPLEADO"; protoArray["12"] = SettingsMap.GetArray(); protoArray["12"]["m_sql"] = ""; protoArray["12"]["m_uniontype"] = "SQLL_UNKNOWN"; obj = new SQLNonParsed(new XVar("m_sql", "")); protoArray["12"]["m_column"] = obj; protoArray["12"]["m_contained"] = SettingsMap.GetArray(); protoArray["12"]["m_strCase"] = ""; protoArray["12"]["m_havingmode"] = false; protoArray["12"]["m_inBrackets"] = false; protoArray["12"]["m_useAlias"] = false; obj = new SQLLogicalExpr(protoArray["12"]); protoArray["10"]["m_joinon"] = obj; obj = new SQLFromListItem(protoArray["10"]); protoArray["0"]["m_fromlist"].Add(obj); protoArray["0"]["m_groupby"] = SettingsMap.GetArray(); protoArray["0"]["m_orderby"] = SettingsMap.GetArray(); protoArray["0"]["m_srcTableName"] = "dbo.TIPOEMPLEADO"; obj = new SQLQuery(protoArray["0"]); queryData_Array["dbo_TIPOEMPLEADO"] = obj; tdataArray["dbo_TIPOEMPLEADO"][".sqlquery"] = queryData_Array["dbo_TIPOEMPLEADO"]; GlobalVars.tableEvents["dbo.TIPOEMPLEADO"] = new eventsBase(); tdataArray["dbo_TIPOEMPLEADO"][".hasEvents"] = false; GlobalVars.tables_data["dbo_TIPOEMPLEADO"] = tdataArray["dbo_TIPOEMPLEADO"]; }
public override XVar showDBValue(dynamic data, dynamic _param_keylink) { #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); #endregion if (data[this.field] == "") { return(""); } if (XVar.Pack(!(XVar)(this.isImageURL))) { dynamic arBigThumbnails = XVar.Array(), divBigThumbnailsSize = null, divSize = null, filesArray = XVar.Array(), resultValues = XVar.Array(), zoomboxRand = null; this.upload_handler.tkeys = XVar.Clone(keylink); resultValues = XVar.Clone(XVar.Array()); arBigThumbnails = XVar.Clone(XVar.Array()); zoomboxRand = XVar.Clone(MVCFunctions.rand(new XVar(11111), new XVar(99999))); filesArray = XVar.Clone(getFilesArray((XVar)(data[this.field]))); foreach (KeyValuePair <XVar, dynamic> imageFile in filesArray.GetEnumerator()) { dynamic hasBigImage = null, hasThumbnail = null, imagePath = null, imageValue = null, userFile = XVar.Array(); userFile = XVar.Clone(this.upload_handler.buildUserFile((XVar)(imageFile.Value))); if ((XVar)(this.container.pageType == Constants.PAGE_EXPORT) || (XVar)(this.container.forExport != "")) { resultValues.InitAndSetArrayItem(userFile["name"], null); continue; } if (XVar.Pack(!(XVar)(CommonFunctions.CheckImageExtension((XVar)(imageFile.Value["name"]))))) { resultValues.InitAndSetArrayItem(MVCFunctions.Concat("<a href=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"])), "\">", userFile["name"], "</a>"), null); continue; } userFile["url"] = MVCFunctions.Concat(userFile["url"], "&nodisp=1"); if (userFile["thumbnail_url"] != "") { userFile["thumbnail_url"] = MVCFunctions.Concat(userFile["thumbnail_url"], "&nodisp=1"); } imageValue = new XVar(""); divSize = new XVar(""); divBigThumbnailsSize = new XVar(""); hasThumbnail = new XVar(false); imagePath = XVar.Clone(getImagePath((XVar)(imageFile.Value["name"]))); hasBigImage = XVar.Clone(MVCFunctions.myfile_exists((XVar)(imagePath))); if (XVar.Pack(this.showThumbnails)) { dynamic thumbPath = null; thumbPath = XVar.Clone(getImagePath((XVar)(imageFile.Value["thumbnail"]))); hasThumbnail = XVar.Clone(MVCFunctions.myfile_exists((XVar)(thumbPath))); } if (XVar.Pack(this.showThumbnails)) { if (XVar.Pack(hasThumbnail)) { dynamic src = null; imageValue = MVCFunctions.Concat(imageValue, "<img class=\"bs-dbimage\" border=\"0\""); if (XVar.Pack(this.is508)) { imageValue = MVCFunctions.Concat(imageValue, " alt=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["name"])), "\""); } src = XVar.Clone((XVar.Pack(userFile["thumbnail_url"] != "") ? XVar.Pack(userFile["thumbnail_url"]) : XVar.Pack(userFile["url"]))); if ((XVar)(this.thumbWidth) || (XVar)(this.thumbHeight)) { imageValue = MVCFunctions.Concat(imageValue, getSmallThumbnailStyle()); } imageValue = MVCFunctions.Concat(imageValue, " src=\"", MVCFunctions.runner_htmlspecialchars((XVar)(src)), "\" />"); } else { if (XVar.Pack(hasBigImage)) { imageValue = MVCFunctions.Concat(imageValue, "<img class=\"bs-dbimage\" ", getImageSizeStyle(new XVar(true)), " border=\"0\""); if (XVar.Pack(this.is508)) { imageValue = MVCFunctions.Concat(imageValue, " alt=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["name"])), "\""); } imageValue = MVCFunctions.Concat(imageValue, " src=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"])), "\">"); } } if ((XVar)(hasBigImage) && (XVar)(imageValue != XVar.Pack(""))) { dynamic href = null, linkClass = null, smallThumbnailStyle = null; href = XVar.Clone(MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"]))); smallThumbnailStyle = new XVar(""); linkClass = XVar.Clone((XVar.Pack(!(XVar)(this.setOfThumbnails)) ? XVar.Pack(MVCFunctions.Concat("zoombox zgallery", zoomboxRand)) : XVar.Pack(""))); if ((XVar)(this.thumbWidth) && (XVar)(this.thumbHeight)) { dynamic thumbFileUrl = null; thumbFileUrl = XVar.Clone((XVar.Pack(hasThumbnail) ? XVar.Pack(userFile["thumbnail_url"]) : XVar.Pack(userFile["url"]))); smallThumbnailStyle = XVar.Clone(getSmallThumbnailStyle((XVar)(thumbFileUrl), (XVar)(hasThumbnail))); linkClass = MVCFunctions.Concat(linkClass, " background-picture"); } if (XVar.Pack(linkClass)) { linkClass = XVar.Clone(MVCFunctions.Concat("class='", linkClass, "'")); } imageValue = XVar.Clone(MVCFunctions.Concat("<a target=\"_blank\" href=\"", href, "\"", linkClass, smallThumbnailStyle, ">", imageValue, "</a>")); if (XVar.Pack(this.setOfThumbnails)) { dynamic bigThumbnailLink = null, bigThumbnailLinkStyle = null; bigThumbnailLinkStyle = XVar.Clone(getBigThumbnailSizeStyles()); bigThumbnailLink = XVar.Clone(MVCFunctions.Concat("<a style=\"display: none;\" href=\"", href, "\" ", (XVar.Pack(bigThumbnailLinkStyle) ? XVar.Pack("class=\"zoombox\"") : XVar.Pack("")), ">")); bigThumbnailLink = MVCFunctions.Concat(bigThumbnailLink, "<img src=\"", href, "\" border=\"0\""); bigThumbnailLink = MVCFunctions.Concat(bigThumbnailLink, getImageSizeStyle(new XVar(true))); bigThumbnailLink = MVCFunctions.Concat(bigThumbnailLink, "/></a>"); if (XVar.Pack(!(XVar)(divBigThumbnailsSize))) { divBigThumbnailsSize = XVar.Clone(MVCFunctions.Concat("style=\"", bigThumbnailLinkStyle, "\"")); } arBigThumbnails.InitAndSetArrayItem(bigThumbnailLink, null); } } } else { if (XVar.Pack(hasBigImage)) { imageValue = MVCFunctions.Concat(imageValue, "<img"); if (XVar.Pack(this.imageWidth)) { divSize = XVar.Clone(MVCFunctions.Concat("width: ", this.imageWidth, "px;")); } if (XVar.Pack(this.imageHeight)) { divSize = MVCFunctions.Concat(divSize, "height: ", this.imageHeight, "px;"); } if (divSize != XVar.Pack("")) { divSize = XVar.Clone(MVCFunctions.Concat("style=\"", divSize, "\"")); } imageValue = MVCFunctions.Concat(imageValue, " border=0"); if (XVar.Pack(this.is508)) { imageValue = MVCFunctions.Concat(imageValue, " alt=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["name"])), "\""); } imageValue = MVCFunctions.Concat(imageValue, getImageSizeStyle(new XVar(true)), " src=\"", MVCFunctions.runner_htmlspecialchars((XVar)(userFile["url"])), "\">"); } } if (imageValue != XVar.Pack("")) { resultValues.InitAndSetArrayItem(imageValue, null); } } if ((XVar)(1 < MVCFunctions.count(resultValues)) || (XVar)((XVar)(MVCFunctions.count(resultValues) == 1) && (XVar)(this.setOfThumbnails))) { dynamic divBigThumbnails = null, hiddenFields = null, i = null, presudoSlider = null; if ((XVar)(this.container.pageType == Constants.PAGE_EXPORT) || (XVar)(this.container.forExport != "")) { return(MVCFunctions.implode(new XVar(", "), (XVar)(resultValues))); } if (this.container.pageType == Constants.PAGE_PRINT) { return(MVCFunctions.implode(new XVar("<br />"), (XVar)(resultValues))); } i = new XVar(0); for (; i < MVCFunctions.count(resultValues); i++) { if (i == XVar.Pack(0)) { resultValues.InitAndSetArrayItem(MVCFunctions.Concat("<li>", resultValues[i], "</li>"), i); } else { resultValues.InitAndSetArrayItem(MVCFunctions.Concat("<li style=\"display:none;\">", resultValues[i], "</li>"), i); } } divBigThumbnails = new XVar(""); if (XVar.Pack(MVCFunctions.count(arBigThumbnails))) { divBigThumbnails = XVar.Clone(MVCFunctions.Concat("<div class=\"big-thumbnails\" ", divBigThumbnailsSize, ">", MVCFunctions.implode(new XVar(""), (XVar)(arBigThumbnails)), "</div>")); } if ((XVar)(!(XVar)(divSize)) && (XVar)(!(XVar)(this.setOfThumbnails))) { divSize = XVar.Clone(MVCFunctions.Concat("style=\"", getBigThumbnailSizeStyles(new XVar(true)), "\"")); } presudoSlider = XVar.Clone(MVCFunctions.Concat("<div class=\"presudoslider\" ", divSize, ">", divBigThumbnails, "<ul class=\"viewimage-thumblist\" style=\"list-style: none;\">", MVCFunctions.implode(new XVar(""), (XVar)(resultValues)), "</ul>", hiddenFields, "</div>")); return(MVCFunctions.Concat("<div style=\"position:relative;\" class=\"viewImage\">", presudoSlider, "</div>")); } if (MVCFunctions.count(resultValues) == 1) { return(resultValues[0]); } return(MVCFunctions.Concat("<img src=\"", MVCFunctions.GetRootPathForResources(new XVar("images/no_image.gif")), "\" />")); } else { if (0 < MVCFunctions.strlen((XVar)(data[this.field]))) { dynamic value = null; value = new XVar("<img class=\"bs-dbimage\""); value = MVCFunctions.Concat(value, " border=0"); value = MVCFunctions.Concat(value, getImageSizeStyle(new XVar(true)), " src='", data[this.field], "'>"); return(value); } } return(""); }