protected override XVar crossTableCommonAssign(dynamic _param_showSummary) { #region pass-by-value parameters dynamic showSummary = XVar.Clone(_param_showSummary); #endregion dynamic grid_row = XVar.Array(), pages = XVar.Array(); this.xt.assign(new XVar("report_cross_header"), (XVar)(this.crossTableObj.getPrintCrossHeader())); this.xt.assign(new XVar("totals"), (XVar)(this.crossTableObj.getTotalsName())); grid_row.InitAndSetArrayItem(this.crossTableObj.getCrossTableData(), "data"); if (0 < MVCFunctions.count(grid_row["data"])) { this.xt.assign(new XVar("grid_row"), (XVar)(grid_row)); this.xt.assignbyref(new XVar("group_header"), (XVar)(this.crossTableObj.getCrossTableHeader())); this.xt.assignbyref(new XVar("col_summary"), (XVar)(this.crossTableObj.getCrossTableSummary())); this.xt.assignbyref(new XVar("total_summary"), (XVar)(this.crossTableObj.getTotalSummary())); this.xt.assign(new XVar("cross_totals"), (XVar)(showSummary)); } else { if (XVar.Pack(this.isDetail)) { this.isReportEmpty = new XVar(true); return(null); } } pages = XVar.Clone(XVar.Array()); pages.InitAndSetArrayItem(grid_row, 0, "grid_row"); pages.InitAndSetArrayItem("<div name=page class=printpage>", 0, "begin"); pages.InitAndSetArrayItem("</div>", 0, "end"); this.xt.assign(new XVar("pageno"), new XVar(1)); this.xt.assign(new XVar("maxpages"), new XVar(1)); this.xt.assign(new XVar("printheader"), new XVar(true)); this.xt.assign_loopsection(new XVar("pages"), (XVar)(pages)); if (XVar.Pack(!(XVar)(this.pdfMode))) { this.xt.assign(new XVar("printbuttons"), new XVar(true)); } return(null); }
public override XVar suggestValue(dynamic _param_value, dynamic _param_searchFor, dynamic var_response, dynamic row) { #region pass-by-value parameters dynamic value = XVar.Clone(_param_value); dynamic searchFor = XVar.Clone(_param_searchFor); #endregion dynamic filesArray = XVar.Array(); if (XVar.Pack(!(XVar)(value))) { return(null); } value = XVar.Clone(MVCFunctions.substr((XVar)(value), new XVar(1))); filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(value))); if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0)) { var_response.InitAndSetArrayItem(MVCFunctions.Concat("_", value), MVCFunctions.Concat("_", value)); } else { dynamic i = null, pos = null; i = new XVar(0); for (; (XVar)(i < MVCFunctions.count(filesArray)) && (XVar)(MVCFunctions.count(var_response) < 10); i++) { if (XVar.Pack(this.pageObject.pSetEdit.getNCSearch())) { pos = XVar.Clone(MVCFunctions.stripos((XVar)(filesArray[i]["usrName"]), (XVar)(searchFor))); } else { pos = XVar.Clone(MVCFunctions.strpos((XVar)(filesArray[i]["usrName"]), (XVar)(searchFor))); } if (!XVar.Equals(XVar.Pack(pos), XVar.Pack(false))) { var_response.InitAndSetArrayItem(MVCFunctions.Concat("_", filesArray[i]["usrName"]), MVCFunctions.Concat("_", filesArray[i]["usrName"])); } } } return(null); }
public virtual XVar getCSSFiles(dynamic _param_rtl = null, dynamic _param_mobile = null, dynamic _param_pdf = null) { #region default values if (_param_rtl as Object == null) { _param_rtl = new XVar(false); } if (_param_mobile as Object == null) { _param_mobile = new XVar(false); } if (_param_pdf as Object == null) { _param_pdf = new XVar(false); } #endregion #region pass-by-value parameters dynamic rtl = XVar.Clone(_param_rtl); dynamic mobile = XVar.Clone(_param_mobile); dynamic pdf = XVar.Clone(_param_pdf); #endregion dynamic files = XVar.Array(), suffix = null; files = XVar.Clone(XVar.Array()); suffix = new XVar(""); if (XVar.Pack(rtl)) { suffix = new XVar("RTL"); } files.InitAndSetArrayItem(MVCFunctions.Concat("styles/bootstrap/", this.bootstrapTheme, "/", this.bootstrapSize, "/style", suffix, ".css"), null); files.InitAndSetArrayItem("styles/font-awesome/css/font-awesome.min.css", null); if (XVar.Pack(MVCFunctions.file_exists((XVar)(MVCFunctions.getabspath(new XVar("styles/custom/custom.css")))))) { files.InitAndSetArrayItem(MVCFunctions.Concat("styles/custom/custom", suffix, ".css"), null); } files.InitAndSetArrayItem(MVCFunctions.Concat("styles/pages/", this.table, "_", this.page["id"], suffix, ".css"), null); return(files); }
protected override XVar getFilterBlockStructure(dynamic _param_filterControl, dynamic _param_visibilityClass, dynamic _param_value, dynamic _param_parentFiltersData = null) { #region default values if (_param_parentFiltersData as Object == null) { _param_parentFiltersData = new XVar(XVar.Array()); } #endregion #region pass-by-value parameters dynamic filterControl = XVar.Clone(_param_filterControl); dynamic visibilityClass = XVar.Clone(_param_visibilityClass); dynamic value = XVar.Clone(_param_value); dynamic parentFiltersData = XVar.Clone(_param_parentFiltersData); #endregion if (this.multiSelect != Constants.FM_ALWAYS) { visibilityClass = MVCFunctions.Concat(visibilityClass, " filter-link"); } return(new XVar(MVCFunctions.Concat(this.gfName, "_filter"), filterControl, MVCFunctions.Concat("visibilityClass_", this.gfName), visibilityClass, "sortValue", value)); }
public override XVar showDBValue(dynamic data, dynamic _param_keylink, dynamic _param_html = null) { #region default values if (_param_html as Object == null) { _param_html = new XVar(true); } #endregion #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); dynamic html = XVar.Clone(_param_html); #endregion dynamic linkData = XVar.Array(); linkData = XVar.Clone(getLinkData((XVar)(data), (XVar)(keylink), (XVar)(html))); if (XVar.Pack(!(XVar)(linkData))) { return(""); } return(MVCFunctions.Concat("<a href=\"", MVCFunctions.runner_htmlspecialchars((XVar)(linkData["link"])), "\"", linkData["target"], ">", linkData["title"], "</a>")); }
protected virtual XVar buildControl(dynamic _param_data, dynamic _param_parentFiltersData = null) { #region default values if (_param_parentFiltersData as Object == null) { _param_parentFiltersData = new XVar(XVar.Array()); } #endregion #region pass-by-value parameters dynamic data = XVar.Clone(_param_data); dynamic parentFiltersData = XVar.Clone(_param_parentFiltersData); #endregion dynamic dataValue = null, separator = null, showValue = null, totalValue = null, value = null; value = XVar.Clone(data["index"]); showValue = XVar.Clone(data["label"]); dataValue = XVar.Clone(data["index"]); totalValue = XVar.Clone(getTotalValueToShow((XVar)(data["total"]))); separator = XVar.Clone(this.separator); return(getControlHTML((XVar)(value), (XVar)(showValue), (XVar)(dataValue), (XVar)(totalValue), (XVar)(separator))); }
protected virtual XVar doVerifySMSCode(dynamic _param_code) { #region pass-by-value parameters dynamic code = XVar.Clone(_param_code); #endregion dynamic data = XVar.Array(), verified = null; if (XVar.Pack(!(XVar)(this.twoFactAuth))) { return(null); } if (XVar.Pack(this.skipSecondStep)) { verified = new XVar(true); } else { verified = XVar.Clone(verifySMSCode((XVar)(code))); } data = XVar.Clone(XSession.Session["firsAuthStepData"]); this.var_pUsername = XVar.Clone(data[GlobalVars.cUserNameField]); this.var_pPassword = XVar.Clone(data[GlobalVars.cPasswordField]); if (XVar.Pack(verified)) { dynamic userName = null; XSession.Session.Remove("smsCode"); XSession.Session.Remove("firsAuthStepData"); XSession.Session["UserID"] = this.var_pUsername; userName = XVar.Clone((XVar.Pack(data[GlobalVars.cDisplayNameField] != "") ? XVar.Pack(data[GlobalVars.cDisplayNameField]) : XVar.Pack(this.var_pUsername))); XSession.Session["UserName"] = MVCFunctions.runner_htmlspecialchars((XVar)(userName)); XSession.Session["AccessLevel"] = Constants.ACCESS_LEVEL_USER; CommonFunctions.SetAuthSessionData((XVar)(this.var_pUsername), (XVar)(data), new XVar(false), (XVar)(this.var_pPassword), this, new XVar(true)); } else { callAfterUnsuccessfulLoginEvent(); } return(verified); }
public override XVar getFilterButtonParams(dynamic _param_dBtnParams = null) { #region default values if (_param_dBtnParams as Object == null) { _param_dBtnParams = new XVar(); } #endregion #region pass-by-value parameters dynamic dBtnParams = XVar.Clone(_param_dBtnParams); #endregion dynamic mBtnParams = XVar.Array(); mBtnParams = XVar.Clone(base.getFilterButtonParams()); if ((XVar)(this.hasDependent) && (XVar)(!(XVar)(dBtnParams == null))) { mBtnParams.InitAndSetArrayItem((XVar)(mBtnParams["hasMultiselectBtn"]) || (XVar)(dBtnParams["hasMultiselectBtn"]), "hasMultiselectBtn"); mBtnParams.InitAndSetArrayItem((XVar)(mBtnParams["hasApplyBtn"]) || (XVar)(dBtnParams["hasApplyBtn"]), "hasApplyBtn"); } return(mBtnParams); }
public static IEnumerable <XVar> IterateSheetPreview(ExcelPackage xlsPack) { foreach (var worksheet in xlsPack.Workbook.Worksheets) { for (int row = 1; row <= worksheet.Dimension.End.Row; ++row) { XVar arr = XVar.Array(); for (int i = 0; i < worksheet.Dimension.End.Column; i++) { var cell = worksheet.Cells[row, i + 1]; XVar val = null; if (cell != null && cell.Value != null) { if (cell.Value is DateTime) // sometimes date stored in a DateTime { val = ((DateTime)cell.Value).ToString("yyyy-MM-dd H:mm:ss"); } else if (Regex.IsMatch(cell.Style.Numberformat.Format, ("([ymdHis])"))) // sometimes date stored in a weird number { cell.Style.Numberformat.Format = "yyyy-MM-dd H:mm:ss"; val = cell.Text; } else if (cell.IsRichText) { val = cell.RichText.Text; } else { val = new XVar(cell.Value.ToString()); } } arr.Add(MVCFunctions.runner_htmlspecialchars(val)); } yield return(arr); } } }
protected virtual XVar buildSQL() { dynamic orderClause = null, orderbyModifiedInEvent = null, sql = XVar.Array(), strSQLbak = null, whereModifiedInEvent = null; sql = XVar.Clone(getSubsetSQLComponents()); orderClause = XVar.Clone(getOrderByClause()); GlobalVars.strSQL = XVar.Clone(SQLQuery.buildSQL((XVar)(sql["sqlParts"]), (XVar)(sql["mandatoryWhere"]), (XVar)(sql["mandatoryHaving"]), (XVar)(sql["optionalWhere"]), (XVar)(sql["optionalHaving"]))); GlobalVars.strSQL = MVCFunctions.Concat(GlobalVars.strSQL, orderClause); strSQLbak = XVar.Clone(GlobalVars.strSQL); whereModifiedInEvent = new XVar(false); orderbyModifiedInEvent = new XVar(false); if (XVar.Pack(this.eventsObject.exists(new XVar("BeforeQueryExport")))) { dynamic strWhereBak = null, tstrOrderBy = null, tstrWhereClause = null; tstrWhereClause = XVar.Clone(SQLQuery.combineCases((XVar)(new XVar(0, SQLQuery.combineCases((XVar)(sql["mandatoryWhere"]), new XVar("and")), 1, SQLQuery.combineCases((XVar)(sql["optionalWhere"]), new XVar("or")))), new XVar("and"))); strWhereBak = XVar.Clone(tstrWhereClause); tstrOrderBy = XVar.Clone(orderClause); this.eventsObject.BeforeQueryExport((XVar)(GlobalVars.strSQL), ref tstrWhereClause, ref tstrOrderBy, this); whereModifiedInEvent = XVar.Clone(tstrWhereClause != strWhereBak); orderbyModifiedInEvent = XVar.Clone(tstrOrderBy != orderClause); orderClause = XVar.Clone(tstrOrderBy); if (XVar.Pack(whereModifiedInEvent)) { GlobalVars.strSQL = XVar.Clone(SQLQuery.buildSQL((XVar)(sql["sqlParts"]), (XVar)(new XVar(0, tstrWhereClause)), (XVar)(sql["mandatoryHaving"]))); GlobalVars.strSQL = MVCFunctions.Concat(GlobalVars.strSQL, orderClause); } else { if (XVar.Pack(orderbyModifiedInEvent)) { GlobalVars.strSQL = XVar.Clone(SQLQuery.buildSQL((XVar)(sql["sqlParts"]), (XVar)(sql["mandatoryWhere"]), (XVar)(sql["mandatoryHaving"]), (XVar)(sql["optionalWhere"]), (XVar)(sql["optionalHaving"]))); GlobalVars.strSQL = MVCFunctions.Concat(GlobalVars.strSQL, orderClause); } } } CommonFunctions.LogInfo((XVar)(GlobalVars.strSQL)); this.querySQL = XVar.Clone(GlobalVars.strSQL); return(null); }
public override XVar getTextValue(dynamic data) { dynamic localData = XVar.Array(), lookupValues = XVar.Array(), textValues = XVar.Array(), value = null; value = XVar.Clone(data[this.field]); if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(value))))) { return(""); } textValues = XVar.Clone(XVar.Array()); localData = XVar.Clone(data); lookupValues = XVar.Clone(getLookupValues((XVar)(value))); foreach (KeyValuePair <XVar, dynamic> lookupvalue in lookupValues.GetEnumerator()) { if (this.pSet.getViewFormat((XVar)(this.field)) != "Custom") { localData.InitAndSetArrayItem(lookupvalue.Value, this.field); } textValues.InitAndSetArrayItem(this.localControlsContainer.getControl((XVar)(this.field)).getTextValue((XVar)(localData)), null); } return(MVCFunctions.implode(new XVar(","), (XVar)(textValues))); }
private static XVar findLanguage(dynamic _param_lng) { #region pass-by-value parameters dynamic lng = XVar.Clone(_param_lng); #endregion dynamic languages = XVar.Array(); languages = XVar.Clone(getLanguages()); if (!XVar.Equals(XVar.Pack(MVCFunctions.array_search((XVar)(lng), (XVar)(languages))), XVar.Pack(false))) { return(lng); } lng = XVar.Clone(MVCFunctions.strtoupper((XVar)(lng))); foreach (KeyValuePair <XVar, dynamic> l in languages.GetEnumerator()) { if (MVCFunctions.strtoupper((XVar)(l.Value)) == lng) { return(l.Value); } } return(CommonFunctions.mlang_getcurrentlang()); }
protected virtual XVar buildBasicSQL() { dynamic mandatoryHaving = XVar.Array(), mandatoryWhere = XVar.Array(), optionalHaving = XVar.Array(), optionalWhere = XVar.Array(), query = null, sqlParts = XVar.Array(); query = XVar.Clone(this.pSet.getSQLQuery()); sqlParts = XVar.Clone(query.getSqlComponents()); mandatoryWhere = XVar.Clone(XVar.Array()); mandatoryHaving = XVar.Clone(XVar.Array()); optionalWhere = XVar.Clone(XVar.Array()); optionalHaving = XVar.Clone(XVar.Array()); if (XVar.Pack(this.whereComponents["searchUnionRequired"])) { optionalWhere.InitAndSetArrayItem(this.whereComponents["searchWhere"], null); optionalHaving.InitAndSetArrayItem(this.whereComponents["searchHaving"], null); } else { mandatoryWhere.InitAndSetArrayItem(this.whereComponents["searchWhere"], null); mandatoryHaving.InitAndSetArrayItem(this.whereComponents["searchHaving"], null); } sqlParts["from"] = MVCFunctions.Concat(sqlParts["from"], this.whereComponents["joinFromPart"]); foreach (KeyValuePair <XVar, dynamic> w in this.whereComponents["filterWhere"].GetEnumerator()) { if (w.Key != this.fName) { mandatoryWhere.InitAndSetArrayItem(w.Value, null); } } foreach (KeyValuePair <XVar, dynamic> w in this.whereComponents["filterHaving"].GetEnumerator()) { if (w.Key != this.fName) { mandatoryHaving.InitAndSetArrayItem(w.Value, null); } } mandatoryWhere.InitAndSetArrayItem(this.whereComponents["security"], null); mandatoryWhere.InitAndSetArrayItem(this.whereComponents["master"], null); return(SQLQuery.buildSQL((XVar)(sqlParts), (XVar)(mandatoryWhere), (XVar)(mandatoryHaving), (XVar)(optionalWhere), (XVar)(optionalHaving))); }
protected virtual XVar buildControl(dynamic _param_data, dynamic _param_parentFiltersData = null) { #region default values if (_param_parentFiltersData as Object == null) { _param_parentFiltersData = new XVar(XVar.Array()); } #endregion #region pass-by-value parameters dynamic data = XVar.Clone(_param_data); dynamic parentFiltersData = XVar.Clone(_param_parentFiltersData); #endregion dynamic dataValue = null, separator = null, showValue = null, totalValue = null, value = null; value = XVar.Clone(data[this.fName]); showValue = XVar.Clone(this.viewControl.showDBValue((XVar)(data), new XVar(""))); dataValue = XVar.Clone(data[this.fName]); totalValue = XVar.Clone(getTotalValueToShow((XVar)(data[MVCFunctions.Concat(this.fName, "TOTAL")]))); separator = XVar.Clone(this.separator); return(getControlHTML((XVar)(value), (XVar)(showValue), (XVar)(dataValue), (XVar)(totalValue), (XVar)(separator), (XVar)(parentFiltersData))); }
public virtual XVar preparePage() { dynamic fields = XVar.Array(), i = null, keylink = null, tKeys = XVar.Array(); if ((XVar)(!(XVar)(this.masterRecordData)) || (XVar)(!(XVar)(MVCFunctions.count(this.masterRecordData)))) { return(null); } this.xt.assign(new XVar("chart_block"), new XVar(true)); assignChartElement(); this.xt.assign(new XVar("pagetitlelabel"), (XVar)(getPageTitle((XVar)(this.pageType), (XVar)(MVCFunctions.GoodFieldName((XVar)(this.tName))), (XVar)(this.masterRecordData)))); tKeys = XVar.Clone(this.pSet.getTableKeys()); keylink = new XVar(""); i = new XVar(0); for (; i < MVCFunctions.count(tKeys); i++) { keylink = MVCFunctions.Concat(keylink, "&key", i + 1, "=", MVCFunctions.runner_htmlspecialchars((XVar)(MVCFunctions.RawUrlEncode((XVar)(this.masterRecordData[tKeys[i]]))))); } fields = XVar.Clone(this.pSet.getMasterListFields()); fields = XVar.Clone(MVCFunctions.array_merge((XVar)(fields), (XVar)(tKeys))); foreach (KeyValuePair <XVar, dynamic> f in fields.GetEnumerator()) { dynamic fieldClassStr = null; fieldClassStr = XVar.Clone(fieldClass((XVar)(f.Value))); this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_mastervalue")), (XVar)(MVCFunctions.Concat("<span class='", fieldClassStr, "'>", showDBValue((XVar)(f.Value), (XVar)(this.masterRecordData), (XVar)(keylink)), "</span>"))); this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_class")), (XVar)(fieldClassStr)); } if (XVar.Pack(this.pageLayout)) { this.xt.assign(new XVar("pageattrs"), (XVar)(MVCFunctions.Concat("class=\"", this.pageLayout.style, " page-", this.pageLayout.name, "\""))); } if (XVar.Pack(this.pageLayout)) { this.xt.assign(new XVar("pageattrs"), (XVar)(MVCFunctions.Concat("class=\"", this.pageLayout.style, " page-", this.pageLayout.name, "\""))); } this.xt.load_template((XVar)(MVCFunctions.GetTemplateName((XVar)(this.shortTableName), new XVar("masterchart")))); return(null); }
public override XVar showDBValue(dynamic data, dynamic _param_keylink, dynamic _param_html = null) { #region default values if (_param_html as Object == null) { _param_html = new XVar(true); } #endregion #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); dynamic html = XVar.Clone(_param_html); #endregion dynamic localData = XVar.Array(), lookupValues = XVar.Array(), outValues = XVar.Array(), value = null; value = XVar.Clone(data[this.field]); if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(value))))) { return(""); } outValues = XVar.Clone(XVar.Array()); localData = XVar.Clone(data); lookupValues = XVar.Clone(getLookupValues((XVar)(value))); foreach (KeyValuePair <XVar, dynamic> lookupvalue in lookupValues.GetEnumerator()) { this.localControlsContainer.linkFieldValues.InitAndSetArrayItem(data[this.field], this.field); if ((XVar)(this.resolvedLinkLookupValues.KeyExists(value)) && (XVar)(this.resolvedLinkLookupValues[value].KeyExists(lookupvalue.Value))) { this.localControlsContainer.originlinkValues.InitAndSetArrayItem(this.resolvedLinkLookupValues[value][lookupvalue.Value], this.field); } if (this.pSet.getViewFormat((XVar)(this.field)) != "Custom") { localData.InitAndSetArrayItem(lookupvalue.Value, this.field); } outValues.InitAndSetArrayItem(this.localControlsContainer.showDBValue((XVar)(this.field), (XVar)(localData), (XVar)(keylink), (XVar)(lookupvalue.Value)), null); } return(MVCFunctions.implode(new XVar(","), (XVar)(outValues))); }
public static XVar ImportDataFromExcel(XVar fileHandle, XVar fieldsData, XVar keys, ImportPage importPageObject, XVar autoinc, XVar useFirstLine) { if (fileHandle == null) { return(null); } XVar metaData = XVar.Array(); metaData["totalRecords"] = 0; dynamic addedRecords = 0; dynamic updatedRecords = 0; XVar errorMessages = XVar.Array(); XVar unprocessedData = XVar.Array(); try { ExcelPackage xlsPack = fileHandle.Value as ExcelPackage; foreach (var record in IterateSheet(xlsPack, fieldsData, useFirstLine)) { importPageObject.importRecord(record, keys, autoinc, ref addedRecords, ref updatedRecords, errorMessages, unprocessedData); metaData["totalRecords"] = metaData["totalRecords"] + 1; } } catch (Exception ex) { MVCFunctions.import_error_handler(ex); } metaData["addedRecords"] = addedRecords; metaData["updatedRecords"] = updatedRecords; metaData["errorMessages"] = errorMessages; metaData["unprocessedData"] = unprocessedData; return(metaData); }
public virtual XVar delete() { dynamic fileName = null, success = null; fileName = XVar.Clone(MVCFunctions.postvalue(new XVar("fileName"))); success = new XVar(false); if (XVar.Pack(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].KeyExists(fileName))) { if (XVar.Pack(!(XVar)(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)][fileName]["fromDB"]))) { dynamic file_path = null, sessionFile = XVar.Array(); sessionFile = XVar.Clone(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)][fileName]["file"]); file_path = XVar.Clone(sessionFile["name"]); if (XVar.Pack(MVCFunctions.file_exists(file_path))) { success = XVar.Clone(MVCFunctions.unlink((XVar)(file_path))); } if ((XVar)(success) && (XVar)(sessionFile["thumbnail"] != "")) { dynamic file = null; file = XVar.Clone(sessionFile["thumbnail"]); if (XVar.Pack(MVCFunctions.file_exists(file))) { MVCFunctions.unlink((XVar)(file)); } } XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].Remove(fileName); } else { XSession.Session.InitAndSetArrayItem(true, MVCFunctions.Concat("mupload_", this.formStamp), fileName, "deleted"); success = new XVar(true); } } MVCFunctions.Header("Content-type", "application/json"); MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(success))); return(null); }
public virtual XVar addSearchFieldToControlsMap(dynamic _param_fName, ref dynamic recId) { #region pass-by-value parameters dynamic fName = XVar.Clone(_param_fName); #endregion dynamic ctrlInd = null, isFieldNeedSecCtrl = null, searchBlock = XVar.Array(); isFieldNeedSecCtrl = XVar.Clone(this.searchControlBuilder.isNeedSecondCtrl((XVar)(fName))); searchBlock = XVar.Clone(new XVar("fName", fName, "recId", recId)); ctrlInd = new XVar(0); searchBlock.InitAndSetArrayItem(ctrlInd, "ctrlsMap", 0); if (XVar.Pack(isFieldNeedSecCtrl)) { searchBlock.InitAndSetArrayItem(ctrlInd + 1, "ctrlsMap", 1); } if (XVar.Pack(!(XVar)(this.isFlexibleSearch))) { searchBlock.InitAndSetArrayItem(this.searchOptions[fName], "inflexSearchOption"); } this.pageObj.controlsMap.InitAndSetArrayItem(searchBlock, "search", "searchBlocks", null); recId = XVar.Clone(this.pageObj.genId()); return(null); }
protected virtual XVar getBaseContolsMapParams() { dynamic ctrlsMap = XVar.Array(); ctrlsMap = XVar.Clone(XVar.Array()); ctrlsMap.InitAndSetArrayItem(this.fName, "fieldName"); ctrlsMap.InitAndSetArrayItem(this.gfName, "gfieldName"); ctrlsMap.InitAndSetArrayItem(this.filterFormat, "filterFormat"); ctrlsMap.InitAndSetArrayItem(this.multiSelect, "multiSelect"); ctrlsMap.InitAndSetArrayItem(this.filtered, "filtered"); ctrlsMap.InitAndSetArrayItem(this.separator, "separator"); ctrlsMap.InitAndSetArrayItem(this.showCollapsed, "collapsed"); if (XVar.Pack(this.filtered)) { ctrlsMap.InitAndSetArrayItem(this.filteredFields[this.fName]["values"], "defaultValuesArray"); ctrlsMap.InitAndSetArrayItem(XVar.Array(), "defaultShowValues"); foreach (KeyValuePair <XVar, dynamic> dv in ctrlsMap["defaultValuesArray"].GetEnumerator()) { ctrlsMap.InitAndSetArrayItem(getValueToShow((XVar)(dv.Value)), "defaultShowValues", null); } } return(ctrlsMap); }
protected virtual XVar assignParentFiltersData() { dynamic parentFiltersData = XVar.Array(); if (XVar.Pack(!(XVar)(this.dependent))) { return(null); } this.parentFiltersNames = XVar.Clone(this.pSet.getParentFiltersNames((XVar)(this.fName))); parentFiltersData = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> parentName in this.parentFiltersNames.GetEnumerator()) { dynamic dbName = null, hasAlias = null, rsName = null; dbName = XVar.Clone(getDbFieldName((XVar)(parentName.Value))); hasAlias = XVar.Clone(dbName != this.connection.addFieldWrappers((XVar)(parentName.Value))); rsName = XVar.Clone((XVar.Pack(hasAlias) ? XVar.Pack(this.connection.addFieldWrappers((XVar)(parentName.Value))) : XVar.Pack(dbName))); parentFiltersData.InitAndSetArrayItem(dbName, parentName.Value, "dbName"); parentFiltersData.InitAndSetArrayItem(rsName, parentName.Value, "rsName"); parentFiltersData.InitAndSetArrayItem(hasAlias, parentName.Value, "hasAlias"); } this.parentFiltersNamesData = XVar.Clone(parentFiltersData); return(null); }
public virtual XVar createElementContainers() { foreach (KeyValuePair <XVar, dynamic> elem in this.pSet.getDashboardElements().GetEnumerator()) { dynamic contentHtml = null, style = null; if (XVar.Pack(!(XVar)(this.elementsPermissions[elem.Key]))) { continue; } style = new XVar(""); if (getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT) { if (XVar.Pack(elem.Value["width"])) { style = MVCFunctions.Concat(style, "#dashelement_", elem.Value["elementName"], this.id, " > .panel > .panel-body, \r\n\t\t\t\t\t\t#dashelement_", elem.Value["elementName"], this.id, " > * > .tab-content > * > * > .panel > .panel-body, \r\n\t\t\t\t\t\t#dashelement_", elem.Value["elementName"], this.id, " > .bs-containedpage > .panel > .panel-body {\r\n\t\t\t\t\t\twidth: ", elem.Value["width"], "px;\r\n\t\t\t\t\t\toverflow-x: auto;\r\n\t\t\t\t\t}"); } if (XVar.Pack(elem.Value["height"])) { style = MVCFunctions.Concat(style, "#dashelement_", elem.Value["elementName"], this.id, " > .panel > .panel-body,\r\n\t\t\t\t\t\t#dashelement_", elem.Value["elementName"], this.id, " > * > .tab-content > * > * > .panel > .panel-body, \r\n\t\t\t\t\t\t#dashelement_", elem.Value["elementName"], this.id, " > .bs-containedpage > .panel > .panel-body {\r\n\t\t\t\t\t\theight: ", elem.Value["height"], "px;\r\n\t\t\t\t\t\toverflow-y: auto;\r\n\t\t\t\t\t}"); } if (style != XVar.Pack("")) { style = XVar.Clone(MVCFunctions.Concat("<style> @media (min-width: 768px){ ", style, " } </style>")); } } contentHtml = new XVar(""); if (elem.Value["type"] == Constants.DASHBOARD_SNIPPET) { dynamic method = null, snippetData = XVar.Array(); method = XVar.Clone(elem.Value["snippetId"]); snippetData = XVar.Clone(MVCFunctions.callDashboardSnippet((XVar)(elem.Value["snippetId"]), (XVar)(this.eventsObject))); contentHtml = XVar.Clone(getSnippetHtml((XVar)(snippetData["header"]), (XVar)(snippetData["body"]), (XVar)(elem.Value["width"]), (XVar)(elem.Value["height"]))); } this.xt.assign((XVar)(MVCFunctions.Concat("db_", elem.Value["elementName"])), (XVar)(MVCFunctions.Concat(style, "<div class=\"", getElementClass((XVar)(elem.Value)), "\" id=\"dashelement_", elem.Value["elementName"], this.id, "\">", contentHtml, "</div>"))); } return(null); }
public virtual XVar GetLockInfo(dynamic _param_strtable, dynamic _param_keys, dynamic _param_links, dynamic _param_pageid) { #region pass-by-value parameters dynamic strtable = XVar.Clone(_param_strtable); dynamic keys = XVar.Clone(_param_keys); dynamic links = XVar.Clone(_param_links); dynamic pageid = XVar.Clone(_param_pageid); #endregion dynamic data = XVar.Array(), page = null, qResult = null, skeys = null, where = null; page = XVar.Clone(MVCFunctions.GetTableLink((XVar)(CommonFunctions.GetTableURL((XVar)(strtable))), new XVar("edit"))); skeys = new XVar(""); foreach (KeyValuePair <XVar, dynamic> val in keys.GetEnumerator()) { if (XVar.Pack(MVCFunctions.strlen((XVar)(skeys)))) { skeys = MVCFunctions.Concat(skeys, "&"); } skeys = MVCFunctions.Concat(skeys, MVCFunctions.RawUrlEncode((XVar)(val.Value))); } where = XVar.Clone(MVCFunctions.Concat(this.connection.addFieldWrappers(new XVar("table")), "=", this.connection.prepareString((XVar)(strtable)), " AND ", this.connection.addFieldWrappers(new XVar("keys")), "=", this.connection.prepareString((XVar)(skeys)), " AND ", this.connection.addFieldWrappers(new XVar("sessionid")), "<>'", MVCFunctions.session_id(), "' AND ", this.connection.addFieldWrappers(new XVar("action")), "=1")); qResult = XVar.Clone(query((XVar)(where), (XVar)(MVCFunctions.Concat(this.connection.addFieldWrappers(new XVar("id")), " asc")))); if (XVar.Pack(data = XVar.Clone(qResult.fetchAssoc()))) { dynamic arrDateTime = null, sdate = null, str = null; sdate = XVar.Clone(MVCFunctions.now()); arrDateTime = XVar.Clone(CommonFunctions.db2time((XVar)(data["startdatetime"]))); str = XVar.Clone(MVCFunctions.mysprintf((XVar)(this.LockAdmin), (XVar)(new XVar(0, data["userid"], 1, (XVar)Math.Round((double)(MVCFunctions.secondsPassedFrom((XVar)(data["startdatetime"])) / 60), 2))))); if (XVar.Pack(links)) { str = MVCFunctions.Concat(str, "<a class=\"unlock\" href=\"#\" onclick=\"Runner.pages.PageManager.getAt('", MVCFunctions.runner_htmlspecialchars((XVar)(CommonFunctions.jsreplace((XVar)(strtable)))), "', ", pageid, ").locking.UnlockAdmin('", MVCFunctions.runner_htmlspecialchars((XVar)(CommonFunctions.jsreplace((XVar)(skeys)))), "','", data["sessionid"], "','no');return false;\">", "Desbloquear registro", "</a>"); str = MVCFunctions.Concat(str, "<a class=\"edit\" href=\"#\" onclick=\"Runner.pages.PageManager.getAt('", MVCFunctions.runner_htmlspecialchars((XVar)(CommonFunctions.jsreplace((XVar)(strtable)))), "', ", pageid, ").locking.UnlockAdmin('", MVCFunctions.runner_htmlspecialchars((XVar)(CommonFunctions.jsreplace((XVar)(skeys)))), "','", data["sessionid"], "','yes');return false;\">", "Editar registro", "</a>"); } return(str); } return(""); }
public virtual XVar buildFilterCtrlBlockArray(dynamic _param_pageObj, dynamic _param_dFilterBlocks = null) { #region default values if (_param_dFilterBlocks as Object == null) { _param_dFilterBlocks = new XVar(); } #endregion #region pass-by-value parameters dynamic pageObj = XVar.Clone(_param_pageObj); dynamic dFilterBlocks = XVar.Clone(_param_dFilterBlocks); #endregion dynamic filterCtrlBlocks = null; addFilterControlToControlsMap((XVar)(pageObj)); filterCtrlBlocks = XVar.Clone(XVar.Array()); if ((XVar)(this.multiSelect != Constants.FM_ALWAYS) && (XVar)(this.filtered)) { filterCtrlBlocks = XVar.Clone(getFilteredFilterBlocks()); if (this.multiSelect == Constants.FM_NONE) { return(filterCtrlBlocks); } } addFilterBlocksFromDB((XVar)(filterCtrlBlocks)); if ((XVar)(this.multiSelect != Constants.FM_NONE) && (XVar)(this.filtered)) { addOutRangeValuesToFilter((XVar)(filterCtrlBlocks)); } if (XVar.Pack(!(XVar)(MVCFunctions.count(filterCtrlBlocks)))) { this.visible = new XVar(false); } extraBlocksProcessing(ref filterCtrlBlocks); return(filterCtrlBlocks); }
protected virtual XVar reportLogStatus(dynamic _param_logged) { #region pass-by-value parameters dynamic logged = XVar.Clone(_param_logged); #endregion dynamic returnJSON = XVar.Array(); returnJSON = XVar.Clone(XVar.Array()); returnJSON.InitAndSetArrayItem(logged, "success"); if (XVar.Pack(this.message)) { returnJSON.InitAndSetArrayItem(this.message, "message"); } else { if (XVar.Pack(logged)) { returnJSON.InitAndSetArrayItem(getLoggedInRedirectUrl(), "redirect"); } } if (this.mode == Constants.LOGIN_EMBEDED) { if (XVar.Pack(MVCFunctions.strlen((XVar)(XSession.Session["loginBlockMessage"])))) { returnJSON.InitAndSetArrayItem("loginblocked", "messageParam"); } else { returnJSON.InitAndSetArrayItem("invalidlogin", "messageParam"); } } MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON))); MVCFunctions.ob_flush(); HttpContext.Current.Response.End(); throw new RunnerInlineOutputException(); return(null); }
public override XVar showPage() { dynamic detFoundMessage = null, returnJSON = XVar.Array(); returnJSON = XVar.Clone(XVar.Array()); this.xt.assign(new XVar("view_column"), new XVar(false)); this.xt.assign(new XVar("edit_column"), new XVar(false)); this.xt.assign(new XVar("inlineedit_column"), new XVar(false)); this.xt.assign(new XVar("inlinesave_column"), new XVar(false)); this.xt.assign(new XVar("inlinecancel_column"), new XVar(false)); this.xt.assign(new XVar("copy_column"), new XVar(false)); this.xt.assign(new XVar("checkbox_column"), new XVar(false)); this.xt.assign(new XVar("dtable_column"), new XVar(false)); this.xt.prepare_template((XVar)(this.templatefile)); returnJSON.InitAndSetArrayItem(true, "success"); returnJSON.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("counter")), "counter"); detFoundMessage = new XVar("Detalles encontrados"); returnJSON.InitAndSetArrayItem(MVCFunctions.Concat("<span>", detFoundMessage, ": <strong>", this.numRowsFromSQL, "</strong></span>", this.xt.fetch_loaded(new XVar("grid_block"))), "body"); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON))); MVCFunctions.ob_flush(); HttpContext.Current.Response.End(); throw new RunnerInlineOutputException(); return(null); }
public static XVar getUserGroupIds() { dynamic groups = XVar.Array(); if ((XVar)(GlobalVars.globalSettings["nLoginMethod"] == Constants.SECURITY_NONE) || (XVar)(GlobalVars.globalSettings["nLoginMethod"] == Constants.SECURITY_HARDCODED)) { return(XVar.Array()); } if (XVar.Pack(!(XVar)(GlobalVars.globalSettings["isDynamicPerm"]))) { if (XVar.Pack(XSession.Session["GroupID"])) { return(new XVar(XSession.Session["GroupID"], true)); } return(XVar.Array()); } CommonFunctions.ReadUserPermissions(); groups = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> g in XSession.Session["UserRights"][XSession.Session["UserID"]][".Groups"].GetEnumerator()) { groups.InitAndSetArrayItem(true, g.Value); } return(groups); }
public virtual XVar showPageAjax() { dynamic lookupSearchControls = null, returnJSON = XVar.Array(); lookupSearchControls = XVar.Clone(MVCFunctions.Concat(this.xt.fetch_loaded(new XVar("searchform_text")), this.xt.fetch_loaded(new XVar("searchform_search")), this.xt.fetch_loaded(new XVar("searchform_showall")))); this.xt.assign(new XVar("lookupSearchControls"), (XVar)(lookupSearchControls)); addControlsJSAndCSS(); fillSetCntrlMaps(); returnJSON = XVar.Clone(XVar.Array()); returnJSON.InitAndSetArrayItem(GlobalVars.pagesData, "pagesData"); returnJSON.InitAndSetArrayItem(this.controlsHTMLMap, "controlsMap"); returnJSON.InitAndSetArrayItem(this.viewControlsHTMLMap, "viewControlsMap"); returnJSON.InitAndSetArrayItem(this.jsSettings, "settings"); this.xt.assign(new XVar("header"), new XVar(false)); this.xt.assign(new XVar("footer"), new XVar(false)); returnJSON.InitAndSetArrayItem(MVCFunctions.Concat("<h2>", getPageTitle((XVar)(this.pageType), (XVar)(MVCFunctions.GoodFieldName((XVar)(this.tName)))), "</h2>"), "headerCont"); returnJSON.InitAndSetArrayItem(this.xt.fetch_loaded(new XVar("body")), "html"); returnJSON.InitAndSetArrayItem(this.flyId, "idStartFrom"); returnJSON.InitAndSetArrayItem(true, "success"); returnJSON.InitAndSetArrayItem(grabAllJsFiles(), "additionalJS"); returnJSON.InitAndSetArrayItem(grabAllCSSFiles(), "CSSFiles"); MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON))); return(null); }
protected virtual XVar getCommonFormatSettings(dynamic _param_viewFomat) { #region pass-by-value parameters dynamic viewFomat = XVar.Clone(_param_viewFomat); #endregion dynamic formatSettings = XVar.Array(); formatSettings = XVar.Clone(XVar.Array()); if (XVar.Equals(XVar.Pack(viewFomat), XVar.Pack(Constants.FORMAT_CURRENCY))) { formatSettings.InitAndSetArrayItem(GlobalVars.locale_info["LOCALE_ICURRDIGITS"], "decimalDigits"); formatSettings.InitAndSetArrayItem(MVCFunctions.explode(new XVar(";"), (XVar)(GlobalVars.locale_info["LOCALE_SMONGROUPING"])), "grouping"); formatSettings.InitAndSetArrayItem(GlobalVars.locale_info["LOCALE_SMONTHOUSANDSEP"], "thousandSep"); formatSettings.InitAndSetArrayItem(GlobalVars.locale_info["LOCALE_SMONDECIMALSEP"], "decimalSep"); } if (viewFomat == Constants.FORMAT_NUMBER) { formatSettings.InitAndSetArrayItem(this.pSet.isDecimalDigits((XVar)(this.fName)), "decimalDigits"); formatSettings.InitAndSetArrayItem(MVCFunctions.explode(new XVar(";"), (XVar)(GlobalVars.locale_info["LOCALE_SGROUPING"])), "grouping"); formatSettings.InitAndSetArrayItem(GlobalVars.locale_info["LOCALE_STHOUSAND"], "thousandSep"); formatSettings.InitAndSetArrayItem(GlobalVars.locale_info["LOCALE_SDECIMAL"], "decimalSep"); } return(formatSettings); }
public ActionResult export() { try { dynamic pageObject = null, strtablename = null, var_params = XVar.Array(); XTempl xt; MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT"); admin_users_Variables.Apply(); if (XVar.Pack(!(XVar)(Security.processPageSecurity((XVar)(strtablename), new XVar("P"))))) { return(MVCFunctions.GetBuferContentAndClearBufer()); } { TLayout t_layout = null; t_layout = new TLayout(new XVar("export_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice")); t_layout.version = 3; t_layout.bootstrapTheme = "default"; t_layout.customCssPageName = "admin_users_export"; t_layout.blocks["top"] = XVar.Array(); t_layout.containers["page"] = XVar.Array(); t_layout.containers["page"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "page_1")); t_layout.containers["page_1"] = XVar.Array(); t_layout.containers["page_1"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "panel")); t_layout.containers["panel"] = XVar.Array(); t_layout.containers["panel"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "header")); t_layout.containers["header"] = XVar.Array(); t_layout.containers["header"].Add(new XVar("name", "exportheader", "block", "exportheader", "substyle", 1)); t_layout.skins["header"] = ""; t_layout.containers["panel"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "body")); t_layout.containers["body"] = XVar.Array(); t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "range")); t_layout.containers["range"] = XVar.Array(); t_layout.containers["range"].Add(new XVar("name", "bsexprange", "block", "range_block", "substyle", 1)); t_layout.skins["range"] = ""; t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "fields")); t_layout.containers["fields"] = XVar.Array(); t_layout.containers["fields"].Add(new XVar("name", "bsexportchoosefields", "block", "choosefields", "substyle", 1)); t_layout.skins["fields"] = ""; t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "fields_1")); t_layout.containers["fields_1"] = XVar.Array(); t_layout.containers["fields_1"].Add(new XVar("name", "bsexportformat", "block", "exportformat", "substyle", 1)); t_layout.skins["fields_1"] = ""; t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "fields_2")); t_layout.containers["fields_2"] = XVar.Array(); t_layout.containers["fields_2"].Add(new XVar("name", "bsexpoutput", "block", "", "substyle", 1)); t_layout.skins["fields_2"] = ""; t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "buttons")); t_layout.containers["buttons"] = XVar.Array(); t_layout.containers["buttons"].Add(new XVar("name", "bsexpbuttons", "block", "exportbuttons", "substyle", 2)); t_layout.skins["buttons"] = ""; t_layout.skins["body"] = ""; t_layout.skins["panel"] = ""; t_layout.skins["page_1"] = ""; t_layout.skins["page"] = ""; t_layout.blocks["top"].Add("page"); GlobalVars.page_layouts["admin_users_export"] = t_layout; } xt = XVar.UnPackXTempl(new XTempl()); var_params = XVar.Clone(XVar.Array()); var_params.InitAndSetArrayItem(CommonFunctions.postvalue_number(new XVar("id")), "id"); var_params.InitAndSetArrayItem(xt, "xt"); var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName"); var_params.InitAndSetArrayItem(Constants.PAGE_EXPORT, "pageType"); var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("page")), "pageName"); if ((XVar)(!(XVar)(GlobalVars.eventObj.exists(new XVar("ListGetRowCount")))) && (XVar)(!(XVar)(GlobalVars.eventObj.exists(new XVar("ListQuery"))))) { var_params.InitAndSetArrayItem(false, "needSearchClauseObj"); } var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("exportFields")), "selectedFields"); var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("type")), "exportType"); var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("a")), "action"); var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("records")), "records"); var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("selection")), "selection"); var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("delimiter")), "csvDelimiter"); if (MVCFunctions.postvalue(new XVar("txtformatting")) == "raw") { var_params.InitAndSetArrayItem(true, "useRawValues"); } var_params.InitAndSetArrayItem(ExportPage.readModeFromRequest(), "mode"); GlobalVars.pageObject = XVar.Clone(new ExportPage((XVar)(var_params))); GlobalVars.pageObject.init(); GlobalVars.pageObject.process(); ViewBag.xt = xt; return(View(xt.GetViewPath())); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }