protected virtual XVar queryData(dynamic _param_addWhere = null) { #region default values if (_param_addWhere as Object == null) { _param_addWhere = new XVar(""); } #endregion #region pass-by-value parameters dynamic addWhere = XVar.Clone(_param_addWhere); #endregion dynamic sql = null; if (addWhere != XVar.Pack("")) { addWhere = MVCFunctions.Concat(addWhere, " AND "); } sql = XVar.Clone(MVCFunctions.Concat("SELECT ", this.dbNameFieldName, ",", this.dbDataFieldName, " from ", this.dbParamsTableName, " where ", addWhere, getCommonWhere())); return(this.connection.querySilent((XVar)(sql))); }
public virtual XVar simpleSearchFieldCombo(dynamic _param_fNamesArr, dynamic _param_selOpt) { #region pass-by-value parameters dynamic fNamesArr = XVar.Clone(_param_fNamesArr); dynamic selOpt = XVar.Clone(_param_selOpt); #endregion dynamic options = null; options = new XVar(""); if (MVCFunctions.count(this.pSet.getGoogleLikeFields()) != 0) { options = XVar.Clone(MVCFunctions.Concat("<option value=\"\" >", "Any field", "</option>")); } foreach (KeyValuePair <XVar, dynamic> fName in fNamesArr.GetEnumerator()) { dynamic fLabel = null; fLabel = XVar.Clone(CommonFunctions.GetFieldLabel((XVar)(MVCFunctions.GoodFieldName((XVar)(this.tName))), (XVar)(MVCFunctions.GoodFieldName((XVar)(fName.Value))))); options = MVCFunctions.Concat(options, "<option value=\"", fName.Value, "\" ", (XVar.Pack(selOpt == fName.Value) ? XVar.Pack("selected") : XVar.Pack("")), ">", fLabel, "</option>"); } return(options); }
public virtual XVar get() { dynamic file_name = null, info = null; file_name = new XVar(null); if (XVar.Pack(MVCFunctions.REQUESTKeyExists("file"))) { MVCFunctions.basename((XVar)(GlobalVars.cman.byTable((XVar)(this.table)).stripSlashesBinary((XVar)(MVCFunctions.postvalue("file"))))); } if (XVar.Pack(file_name)) { info = XVar.Clone(get_file_object((XVar)(file_name))); } else { info = XVar.Clone(this.Invoke("get_file_objects")); } MVCFunctions.Header("Content-type", "application/json"); MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(info))); return(null); }
public virtual XVar getCtrlSearchType(dynamic _param_fName, dynamic _param_recId, dynamic _param_fieldNum, dynamic _param_selOpt, dynamic _param_not, dynamic _param_flexible, dynamic _param_both) { #region pass-by-value parameters dynamic fName = XVar.Clone(_param_fName); dynamic recId = XVar.Clone(_param_recId); dynamic fieldNum = XVar.Clone(_param_fieldNum); dynamic selOpt = XVar.Clone(_param_selOpt); dynamic var_not = XVar.Clone(_param_not); dynamic flexible = XVar.Clone(_param_flexible); dynamic both = XVar.Clone(_param_both); #endregion dynamic emptyOption = null, searchtype = null, var_class = null, visibility = null; emptyOption = XVar.Clone((XVar)(selOpt == Constants.EMPTY_SEARCH) || (XVar)(selOpt == Constants.NOT_EMPTY)); visibility = XVar.Clone((XVar.Pack((XVar)((XVar)(!(XVar)(flexible)) || (XVar)(this.getSrchPanelAttrs["ctrlTypeComboStatus"])) || (XVar)(emptyOption)) ? XVar.Pack("") : XVar.Pack("style=\"display: none;\""))); searchtype = XVar.Clone(MVCFunctions.Concat("<span id=\"", getCtrlComboContId((XVar)(recId), (XVar)(fName)), "\" ", visibility, ">")); searchtype = MVCFunctions.Concat(searchtype, "<select class=\"form-control\" ", var_class, " id=\"", getSearchOptionId((XVar)(fName), (XVar)(recId)), "\" name=\"", getSearchOptionId((XVar)(fName), (XVar)(recId)), "\" size=1 ", visibility, ">"); searchtype = MVCFunctions.Concat(searchtype, getCtrlSearchTypeOptions((XVar)(fName), (XVar)(selOpt), (XVar)(var_not), (XVar)(flexible), (XVar)(both))); searchtype = MVCFunctions.Concat(searchtype, "</select></span>"); return(searchtype); }
public override XVar getPdfValue(dynamic data, dynamic _param_keylink = null) { #region default values if (_param_keylink as Object == null) { _param_keylink = new XVar(""); } #endregion #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); #endregion dynamic html = null, linkData = XVar.Array(); linkData = XVar.Clone(getLinkData((XVar)(data), (XVar)(keylink), (XVar)(html))); if (XVar.Pack(!(XVar)(linkData))) { return("''"); } return(MVCFunctions.my_json_encode((XVar)(new XVar("text", linkData["title"], "link", linkData["link"])))); }
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 classString = null; base.buildControl((XVar)(value), (XVar)(mode), (XVar)(fieldNum), (XVar)(validate), (XVar)(additionalCtrlParams), (XVar)(data)); if (XVar.Pack(this.pageObject.isBootstrap())) { classString = new XVar(" class=\"form-control\""); } MVCFunctions.Echo(MVCFunctions.Concat("<input ", this.inputStyle, " ", getPlaceholderAttr(), " id=\"", this.cfield, "\" ", classString, " type=\"Password\" ", (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); }
public static XVar redirectToList(dynamic _param_table) { #region pass-by-value parameters dynamic table = XVar.Clone(_param_table); #endregion dynamic settings = null; settings = XVar.Clone(new ProjectSettings((XVar)(table))); if (XVar.Pack(settings.hasListPage())) { MVCFunctions.HeaderRedirect((XVar)(settings.getShortTableName()), new XVar("list"), new XVar("a=return")); MVCFunctions.ob_flush(); HttpContext.Current.Response.End(); throw new RunnerInlineOutputException(); } MVCFunctions.HeaderRedirect(new XVar("menu")); MVCFunctions.ob_flush(); HttpContext.Current.Response.End(); throw new RunnerInlineOutputException(); return(null); }
public override XVar showPageDp(dynamic _param_params = null) { #region default values if (_param_params as Object == null) { _param_params = new XVar(""); } #endregion #region pass-by-value parameters dynamic var_params = XVar.Clone(_param_params); #endregion dynamic contents = null, layout = null, pageSkinStyle = null; if (XVar.Pack(isBootstrap())) { return(showGridOnly()); } BeforeShowList(); prepareTemplate(); contents = XVar.Clone(this.xt.fetch_loaded(new XVar("body"))); layout = GlobalVars.page_layouts[MVCFunctions.Concat(this.shortTableName, "_", this.pageType)]; pageSkinStyle = XVar.Clone(MVCFunctions.Concat(layout.style, " page-", layout.name)); this.xt.assign(new XVar("dpShowHide"), new XVar(true)); this.xt.assign(new XVar("dpMinus"), new XVar(true)); this.xt.assign(new XVar("dpShowHide_attrs"), (XVar)(MVCFunctions.Concat("id=\"dpShowHide", this.id, "\""))); this.xt.assign(new XVar("dpMinus_attrs"), (XVar)(MVCFunctions.Concat("id=\"dpMinus", this.id, "\""))); this.xt.assign(new XVar("dt_attrs"), (XVar)(MVCFunctions.Concat("name=\"dt", this.id, "\""))); if (XVar.Pack(CommonFunctions.GetGlobalData(new XVar("printDetailTableName"), new XVar(false)))) { this.xt.assign(new XVar("dpShowHide"), new XVar(false)); this.xt.assign(new XVar("dpMinus"), new XVar(false)); } if (MVCFunctions.postvalue(new XVar("pdf")) == 1) { this.xt.assign(new XVar("dpMinus"), new XVar(false)); } MVCFunctions.Echo(MVCFunctions.Concat("<div id=\"detailPreview", this.id, "\" class=\"", pageSkinStyle, " rnr-pagewrapper dpStyle\">", contents, "</div>")); 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 pattern = null, searchOpt = null, searchWordArr = XVar.Array(); searchWordArr = XVar.Clone(XVar.Array()); foreach (KeyValuePair <XVar, dynamic> searchWord in highlightData["searchWords"].GetEnumerator()) { dynamic word = null, wordArr = null; word = XVar.Clone(MVCFunctions.preg_replace(new XVar("/[\\.,]/"), new XVar(""), (XVar)(searchWord.Value))); wordArr = XVar.Clone(MVCFunctions.str_split((XVar)(word))); word = XVar.Clone(MVCFunctions.implode(new XVar("[^\\d]{0,2}"), (XVar)(wordArr))); word = XVar.Clone(MVCFunctions.runner_htmlspecialchars((XVar)(word))); if (searchOpt == "Starts with") { word = XVar.Clone(MVCFunctions.Concat("^", word)); } searchWordArr.InitAndSetArrayItem(word, null); } pattern = XVar.Clone(MVCFunctions.Concat("/(", MVCFunctions.implode(new XVar("|"), (XVar)(searchWordArr)), ")/")); searchOpt = XVar.Clone(highlightData["searchOpt"]); switch (((XVar)searchOpt).ToString()) { case "Equals": return(addHighlightingSpan((XVar)(value))); case "Starts with": return(MVCFunctions.preg_replace((XVar)(pattern), (XVar)(addHighlightingSpan(new XVar("$1"))), (XVar)(value))); case "Contains": return(MVCFunctions.preg_replace((XVar)(pattern), (XVar)(addHighlightingSpan(new XVar("$1"))), (XVar)(value))); default: return(value); } return(null); }
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); }
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>")); }
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()); }
public override XVar getTextValue(dynamic data) { dynamic link = null, prefix = null, ret = null; if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(data[this.field]))))) { return(""); } link = XVar.Clone(data[this.field]); if (MVCFunctions.substr((XVar)(ret), (XVar)(MVCFunctions.strlen((XVar)(ret)) - 1)) == "#") { dynamic i = null; i = XVar.Clone(MVCFunctions.strpos((XVar)(ret), new XVar("#"))); link = XVar.Clone(MVCFunctions.substr((XVar)(ret), (XVar)(i + 1), (XVar)((MVCFunctions.strlen((XVar)(ret)) - i) - 2))); } prefix = XVar.Clone(getContainer().pSet.getLinkPrefix((XVar)(this.field))); if ((XVar)(XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(link), new XVar("://"))), XVar.Pack(false))) && (XVar)(MVCFunctions.substr((XVar)(link), new XVar(0), new XVar(7)) != "mailto:")) { link = XVar.Clone(MVCFunctions.Concat(prefix, link)); } return(link); }
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))); }
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 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))); }
protected virtual XVar delete(dynamic _param_addWhere = null) { #region default values if (_param_addWhere as Object == null) { _param_addWhere = new XVar(""); } #endregion #region pass-by-value parameters dynamic addWhere = XVar.Clone(_param_addWhere); #endregion dynamic sql = null; if (addWhere != XVar.Pack("")) { addWhere = MVCFunctions.Concat(addWhere, " AND "); } sql = XVar.Clone(MVCFunctions.Concat("DELETE FROM ", this.dbParamsTableName, " WHERE ", addWhere, getCommonWhere())); this.connection.execSilent((XVar)(sql)); return(null); }
public XVar ie8css() { try { dynamic css = null, ext = null, file = null; MVCFunctions.Header("Content-Type", "text/css"); file = XVar.Clone(MVCFunctions.GetQueryString()); ext = XVar.Clone(MVCFunctions.substr((XVar)(file), (XVar)(MVCFunctions.strrpos((XVar)(file), new XVar(".")) + 1))); if ((XVar)(ext != "css") || (XVar)(!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(file), new XVar(".."))), XVar.Pack(false)))) { MVCFunctions.Echo(new XVar("")); return(MVCFunctions.GetBuferContentAndClearBufer()); } css = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(MVCFunctions.getabspath((XVar)(file))), new XVar("r"))); css = XVar.Clone(MVCFunctions.preg_replace((XVar)(new XVar(0, "/ :not\\(.*?\\)/", 1, "/ :first-child/", 2, "/ :last-child/", 3, "/ :nth-last-child\\(.*?\\)/")), new XVar(" *"), (XVar)(css))); css = XVar.Clone(MVCFunctions.preg_replace((XVar)(new XVar(0, "/:not\\(.*?\\)/", 1, "/:first-child/", 2, "/:last-child/", 3, "/:nth-last-child\\(.*?\\)/")), new XVar(""), (XVar)(css))); MVCFunctions.Echo(css); return(MVCFunctions.GetBuferContentAndClearBufer()); } catch (RunnerRedirectException ex) { return(Redirect(ex.Message)); } }
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); }
public virtual XVar GetLikeClause(dynamic _param_field, dynamic _param_value) { #region pass-by-value parameters dynamic field = XVar.Clone(_param_field); dynamic value = XVar.Clone(_param_value); #endregion dynamic searchPattern = null; if ((XVar)(this.connection.isEncryptionByPHPEnabled()) && (XVar)(isFieldEncrypted((XVar)(field)))) { return(MVCFunctions.Concat("=", this.connection.prepareString((XVar)(EncryptField((XVar)(field), (XVar)(value)))))); } if (XVar.Pack(GlobalVars.ajaxSearchStartsWith)) { searchPattern = XVar.Clone(MVCFunctions.Concat(value, "%")); } else { searchPattern = XVar.Clone(MVCFunctions.Concat("%", value, "%")); } return(MVCFunctions.Concat(" LIKE ", this.connection.prepareString((XVar)(searchPattern)))); }
public static XVar getTableCaption(dynamic _param_table, dynamic _param_lng = null) { #region default values if (_param_lng as Object == null) { _param_lng = new XVar(""); } #endregion #region pass-by-value parameters dynamic table = XVar.Clone(_param_table); dynamic lng = XVar.Clone(_param_lng); #endregion table = XVar.Clone(findTable((XVar)(table))); if (table == XVar.Pack("")) { return(""); } lng = XVar.Clone(findLanguage((XVar)(lng))); return(GlobalVars.tableCaptions[lng][MVCFunctions.GoodFieldName((XVar)(table))]); }
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 doCommonAssignments() { setLangParams(); this.xt.assign(new XVar("id"), (XVar)(this.id)); this.xt.assign(new XVar("menu_block"), new XVar(true)); this.xt.assign(new XVar("username"), (XVar)(XSession.Session["UserName"])); this.xt.assign(new XVar("changepwd_link"), (XVar)((XVar)(XSession.Session["AccessLevel"] != Constants.ACCESS_LEVEL_GUEST) && (XVar)(XSession.Session["fromFacebook"] == false))); this.xt.assign(new XVar("changepwdlink_attrs"), (XVar)(MVCFunctions.Concat("onclick=\"window.location.href='", MVCFunctions.GetTableLink(new XVar("changepwd")), "';return false;\""))); this.xt.assign(new XVar("logoutlink_attrs"), (XVar)(MVCFunctions.Concat("id=\"logoutButton", this.id, "\""))); this.xt.assign(new XVar("guestloginlink_attrs"), (XVar)(MVCFunctions.Concat("id=\"loginButton", this.id, "\""))); this.xt.assign(new XVar("loggedas_block"), (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest()))); this.xt.assign(new XVar("loggedas_message"), (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest()))); this.xt.assign(new XVar("logout_link"), new XVar(true)); this.xt.assign(new XVar("guestloginbutton"), (XVar)(CommonFunctions.isLoggedAsGuest())); this.xt.assign(new XVar("logoutbutton"), (XVar)((XVar)(CommonFunctions.isSingleSign()) && (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())))); if (XVar.Pack(CommonFunctions.IsAdmin())) { this.xt.assign(new XVar("adminarea_link"), new XVar(true)); } assignBody(); return(null); }
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 virtual XVar process() { if (XVar.Pack(this.eventsObject.exists(new XVar("BeforeProcessExport")))) { this.eventsObject.BeforeProcessExport(this); } if (XVar.Pack(this.exportType)) { buildSQL(); exportByType(); MVCFunctions.ob_flush(); HttpContext.Current.Response.End(); throw new RunnerInlineOutputException(); return(null); } fillSettings(); doCommonAssignments(); addButtonHandlers(); addCommonJs(); displayExportPage(); return(null); }
protected virtual XVar displayExportPage() { dynamic templatefile = null; templatefile = XVar.Clone(this.templatefile); if (XVar.Pack(this.eventsObject.exists(new XVar("BeforeShowExport")))) { this.eventsObject.BeforeShowExport((XVar)(this.xt), ref templatefile, this); } if (this.mode == Constants.EXPORT_POPUP) { this.xt.assign(new XVar("footer"), new XVar(false)); this.xt.assign(new XVar("header"), new XVar(false)); this.xt.assign(new XVar("body"), (XVar)(this.body)); displayAJAX((XVar)(templatefile), (XVar)(this.id + 1)); MVCFunctions.ob_flush(); HttpContext.Current.Response.End(); throw new RunnerInlineOutputException(); } display((XVar)(templatefile)); return(null); }
public virtual XVar buildSearchOptions(dynamic _param_optionsArray, dynamic _param_selOpt, dynamic _param_not, dynamic _param_both) { #region pass-by-value parameters dynamic optionsArray = XVar.Clone(_param_optionsArray); dynamic selOpt = XVar.Clone(_param_selOpt); dynamic var_not = XVar.Clone(_param_not); dynamic both = XVar.Clone(_param_both); #endregion dynamic currentOption = null, defaultOption = null, result = null, userSearchOptions = XVar.Array(); userSearchOptions = XVar.Clone(this.pageObject.pSetEdit.getSearchOptionsList((XVar)(this.field))); currentOption = XVar.Clone((XVar.Pack(var_not) ? XVar.Pack(MVCFunctions.Concat("NOT ", selOpt)) : XVar.Pack(selOpt))); if ((XVar)(MVCFunctions.count(userSearchOptions)) && (XVar)(this.searchOptions.KeyExists(currentOption))) { userSearchOptions.InitAndSetArrayItem(currentOption, null); } if (XVar.Pack(MVCFunctions.count(userSearchOptions))) { optionsArray = XVar.Clone(MVCFunctions.array_intersect((XVar)(optionsArray), (XVar)(userSearchOptions))); } defaultOption = XVar.Clone(this.pageObject.pSetEdit.getDefaultSearchOption((XVar)(this.field))); if (XVar.Pack(!(XVar)(defaultOption))) { defaultOption = XVar.Clone(optionsArray[0]); } result = new XVar(""); foreach (KeyValuePair <XVar, dynamic> var_option in optionsArray.GetEnumerator()) { dynamic dataAttr = null, selected = null; if ((XVar)(!(XVar)(this.searchOptions.KeyExists(var_option.Value))) || (XVar)((XVar)(!(XVar)(both)) && (XVar)(MVCFunctions.substr((XVar)(var_option.Value), new XVar(0), new XVar(4)) == "NOT "))) { continue; } selected = XVar.Clone((XVar.Pack(currentOption == var_option.Value) ? XVar.Pack("selected") : XVar.Pack(""))); dataAttr = XVar.Clone((XVar.Pack(defaultOption == var_option.Value) ? XVar.Pack(" data-default-option=\"true\"") : XVar.Pack(""))); result = MVCFunctions.Concat(result, "<option value=\"", var_option.Value, "\" ", selected, dataAttr, ">", this.searchOptions[var_option.Value], "</option>"); } return(result); }
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); }