Exemple #1
0
        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)));
                    }
                    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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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)); }
 }
Exemple #4
0
 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)); }
 }
Exemple #5
0
        public override XVar showDBValue(dynamic data, dynamic _param_keylink)
        {
            #region pass-by-value parameters
            dynamic keylink = XVar.Clone(_param_keylink);
            #endregion

            dynamic fieldIsUrl = null, fileName = null, value = null;
            value      = new XVar("");
            fieldIsUrl = XVar.Clone(this.container.pSet.isVideoUrlField((XVar)(this.field)));
            fileName   = XVar.Clone(data[this.field]);
            if (XVar.Pack(MVCFunctions.strlen((XVar)(fileName))))
            {
                dynamic counter = null, filesArray = XVar.Array(), pageType = null, printOrExportPage = null;
                if (XVar.Pack(!(XVar)(fieldIsUrl)))
                {
                    this.upload_handler.tkeys = XVar.Clone(keylink);
                    filesArray = XVar.Clone(getFilesArray((XVar)(fileName)));
                }
                else
                {
                    filesArray = XVar.Clone(new XVar(0, fileName));
                }
                pageType          = XVar.Clone(this.container.pageType);
                printOrExportPage = XVar.Clone((XVar)((XVar)(pageType == Constants.PAGE_EXPORT) || (XVar)(pageType == Constants.PAGE_PRINT)) || (XVar)(this.container.forExport != ""));
                counter           = new XVar(0);
                foreach (KeyValuePair <XVar, dynamic> file in filesArray.GetEnumerator())
                {
                    dynamic href = null, vHeight = null, vWidth = null, var_type = null, videoId = null;
                    if (XVar.Pack(printOrExportPage))
                    {
                        if (value != XVar.Pack(""))
                        {
                            value = MVCFunctions.Concat(value, ", ");
                        }
                        if (XVar.Pack(fieldIsUrl))
                        {
                            value = MVCFunctions.Concat(value, fileName);
                        }
                        else
                        {
                            value = MVCFunctions.Concat(value, file.Value["usrName"]);
                        }
                        continue;
                    }
                    if (XVar.Pack(!(XVar)(fieldIsUrl)))
                    {
                        if (XVar.Pack(!(XVar)(MVCFunctions.file_exists((XVar)(MVCFunctions.getabspath((XVar)(file.Value["name"])))))))
                        {
                            continue;
                        }
                    }
                    videoId = XVar.Clone(MVCFunctions.Concat("video_", MVCFunctions.GoodFieldName((XVar)(MVCFunctions.runner_htmlspecialchars((XVar)(this.field)))), "_"));
                    videoId = MVCFunctions.Concat(videoId, getContainer().id, "_");
                    if ((XVar)(pageType != Constants.PAGE_ADD) && (XVar)(pageType != Constants.PAGE_EDIT))
                    {
                        videoId = MVCFunctions.Concat(videoId, getContainer().recId);
                    }
                    else
                    {
                        videoId = MVCFunctions.Concat(videoId, MVCFunctions.postvalue(new XVar("id")));
                    }
                    videoId = MVCFunctions.Concat(videoId, "_", counter++);
                    if (XVar.Pack(fieldIsUrl))
                    {
                        href = XVar.Clone(fileName);
                        if (fileName != XVar.Pack(""))
                        {
                            dynamic ext = null, pos = null;
                            pos      = XVar.Clone(MVCFunctions.strrpos((XVar)(fileName), new XVar(".")));
                            ext      = XVar.Clone(MVCFunctions.substr((XVar)(fileName), (XVar)(pos)));
                            var_type = XVar.Clone(CommonFunctions.getContentTypeByExtension((XVar)(ext)));
                            if (var_type == "application/octet-stream")
                            {
                                var_type = new XVar("video/flv");
                            }
                        }
                    }
                    else
                    {
                        dynamic userFile = XVar.Array();
                        userFile = XVar.Clone(this.upload_handler.buildUserFile((XVar)(file.Value)));
                        href     = XVar.Clone(userFile["url"]);
                        if (XVar.Pack(!(XVar)(getContainer().pSet.isRewindEnabled((XVar)(this.field)))))
                        {
                            href = MVCFunctions.Concat(href, (XVar.Pack(XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(href), new XVar("?"))), XVar.Pack(false))) ? XVar.Pack("?") : XVar.Pack("&")), "norange=1");
                        }
                        if (file.Value["type"] == "application/octet-stream")
                        {
                            var_type = new XVar("video/flv");
                        }
                        else
                        {
                            var_type = XVar.Clone(file.Value["type"]);
                        }
                    }
                    if (!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(var_type), new XVar("video"))), XVar.Pack(0)))
                    {
                        continue;
                    }
                    if (XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(href), new XVar("rndVal="))), XVar.Pack(false)))
                    {
                        href = MVCFunctions.Concat(href, (XVar.Pack(XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(href), new XVar("?"))), XVar.Pack(false))) ? XVar.Pack("?") : XVar.Pack("&")), "rndVal=", MVCFunctions.rand(new XVar(0), new XVar(99999999)));
                    }
                    else
                    {
                        dynamic endPos = null, startPos = null;
                        startPos = XVar.Clone(MVCFunctions.strpos((XVar)(href), new XVar("rndVal=")) + 7);
                        endPos   = XVar.Clone(MVCFunctions.strpos((XVar)(href), new XVar("&"), (XVar)(startPos)));
                        href     = XVar.Clone(MVCFunctions.Concat(MVCFunctions.substr((XVar)(href), new XVar(0), (XVar)(startPos)), MVCFunctions.rand(new XVar(0), new XVar(99999999)), (XVar.Pack(endPos != -1) ? XVar.Pack(MVCFunctions.substr((XVar)(href), (XVar)(endPos))) : XVar.Pack(""))));
                    }
                    vWidth  = XVar.Clone(getContainer().pSet.getVideoWidth((XVar)(this.field)));
                    vHeight = XVar.Clone(getContainer().pSet.getVideoHeight((XVar)(this.field)));
                    if (vWidth == XVar.Pack(0))
                    {
                        vWidth = new XVar(300);
                    }
                    if (vHeight == XVar.Pack(0))
                    {
                        vHeight = new XVar(200);
                    }
                    value = MVCFunctions.Concat(value, "<div style=\"width:", vWidth, "px; height:", vHeight, "px;\">\r\n\t\t\t\t\t<video class=\"projekktor\"  width=\"", vWidth, "\" height=\"", vHeight, "\"  id=\"", videoId, "\" type=\"", var_type, "\" src=\"", href, "\">\r\n\t\t\t\t\t</video></div>");
                    if (this.pageObject != null)
                    {
                        this.pageObject.controlsMap.InitAndSetArrayItem(videoId, "video", null);
                    }
                }
            }
            return(value);
        }
Exemple #6
0
 protected virtual XVar prepareFields()
 {
     foreach (KeyValuePair <XVar, dynamic> field in this.pSet.getAdvSearchFields().GetEnumerator())
     {
         dynamic ctrlBlockArr = XVar.Array(), ctrlInd = null, firstFieldParams = XVar.Array(), gfield = null, isFieldNeedSecCtrl = null, lookupTable = null, srchFields = XVar.Array(), srchTypeFull = null;
         gfield      = XVar.Clone(MVCFunctions.GoodFieldName((XVar)(field.Value)));
         lookupTable = XVar.Clone(this.pSet.getLookupTable((XVar)(field.Value)));
         if (XVar.Pack(lookupTable))
         {
             this.settingsMap.InitAndSetArrayItem(CommonFunctions.GetTableURL((XVar)(lookupTable)), "globalSettings", "shortTNames", lookupTable);
         }
         fillFieldToolTips((XVar)(field.Value));
         srchFields       = XVar.Clone(this.searchClauseObj.getSearchCtrlParams((XVar)(field.Value)));
         firstFieldParams = XVar.Clone(XVar.Array());
         if (XVar.Pack(MVCFunctions.count(srchFields)))
         {
             firstFieldParams = XVar.Clone(srchFields[0]);
         }
         else
         {
             firstFieldParams.InitAndSetArrayItem(field.Value, "fName");
             firstFieldParams.InitAndSetArrayItem("", "eType");
             firstFieldParams.InitAndSetArrayItem(this.pSet.getDefaultValue((XVar)(field.Value)), "value1");
             firstFieldParams.InitAndSetArrayItem("", "value2");
             firstFieldParams.InitAndSetArrayItem(false, "not");
             firstFieldParams.InitAndSetArrayItem(this.pSet.getDefaultSearchOption((XVar)(field.Value)), "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(this.is508))
         {
             this.xt.assign_section((XVar)(MVCFunctions.Concat(gfield, "_label")), (XVar)(MVCFunctions.Concat("<label for=\"", getInputElementId((XVar)(field.Value), (XVar)(this.pSet)), "\">")), new XVar("</label>"));
         }
         else
         {
             this.xt.assign((XVar)(MVCFunctions.Concat(gfield, "_label")), new XVar(true));
         }
         if (getLayoutVersion() == Constants.BOOTSTRAP_LAYOUT)
         {
             dynamic firstElementId = null;
             firstElementId = XVar.Clone(getControl((XVar)(field.Value), (XVar)(this.id)).getFirstElementId());
             if (XVar.Pack(firstElementId))
             {
                 this.xt.assign((XVar)(MVCFunctions.Concat("labelfor_", gfield)), (XVar)(firstElementId));
             }
         }
         this.xt.assign((XVar)(MVCFunctions.Concat(gfield, "_fieldblock")), new XVar(true));
         this.xt.assignbyref((XVar)(MVCFunctions.Concat(gfield, "_editcontrol")), (XVar)(ctrlBlockArr["searchcontrol"]));
         this.xt.assign((XVar)(MVCFunctions.Concat(gfield, "_notbox")), (XVar)(ctrlBlockArr["notbox"]));
         this.xt.assignbyref((XVar)(MVCFunctions.Concat(gfield, "_editcontrol1")), (XVar)(ctrlBlockArr["searchcontrol1"]));
         this.xt.assign((XVar)(MVCFunctions.Concat("searchtype_", gfield)), (XVar)(ctrlBlockArr["searchtype"]));
         this.xt.assign((XVar)(MVCFunctions.Concat("searchtypefull_", gfield)), (XVar)(srchTypeFull));
         isFieldNeedSecCtrl = XVar.Clone(this.searchControlBuilder.isNeedSecondCtrl((XVar)(field.Value)));
         ctrlInd            = new XVar(0);
         if (XVar.Pack(isFieldNeedSecCtrl))
         {
             this.controlsMap.InitAndSetArrayItem(new XVar("fName", field.Value, "recId", this.id, "ctrlsMap", new XVar(0, ctrlInd, 1, ctrlInd + 1)), "search", "searchBlocks", null);
             ctrlInd += 2;
         }
         else
         {
             this.controlsMap.InitAndSetArrayItem(new XVar("fName", field.Value, "recId", this.id, "ctrlsMap", new XVar(0, ctrlInd)), "search", "searchBlocks", null);
             ctrlInd++;
         }
     }
     return(null);
 }
Exemple #7
0
        public virtual XVar displaySearchControl()
        {
            dynamic ctrlBlockArr = XVar.Array(), defaultValue = null, resArr = XVar.Array();

            this.searchControlBuilder = XVar.Clone(new PanelSearchControl((XVar)(this.searchControllerId), (XVar)(this.tName), (XVar)(this.searchClauseObj), this));
            defaultValue = XVar.Clone(this.pSet.getDefaultValue((XVar)(this.ctrlField)));
            ctrlBlockArr = XVar.Clone(this.searchControlBuilder.buildSearchCtrlBlockArr((XVar)(this.id), (XVar)(this.ctrlField), new XVar(0), new XVar(""), new XVar(false), new XVar(true), (XVar)(defaultValue), new XVar("")));
            resArr       = XVar.Clone(XVar.Array());
            resArr.InitAndSetArrayItem(MVCFunctions.trim((XVar)(this.xt.call_func((XVar)(ctrlBlockArr["searchcontrol"])))), "control1");
            resArr.InitAndSetArrayItem(MVCFunctions.trim((XVar)(this.xt.call_func((XVar)(ctrlBlockArr["searchcontrol1"])))), "control2");
            resArr.InitAndSetArrayItem(MVCFunctions.trim((XVar)(ctrlBlockArr["searchtype"])), "comboHtml");
            resArr.InitAndSetArrayItem(MVCFunctions.trim((XVar)(ctrlBlockArr["delCtrlButt"])), "delButt");
            resArr.InitAndSetArrayItem(MVCFunctions.trim((XVar)(this.searchControlBuilder.getDelButtonId((XVar)(this.ctrlField), (XVar)(this.id)))), "delButtId");
            resArr.InitAndSetArrayItem(MVCFunctions.trim((XVar)(this.id)), "divInd");
            resArr.InitAndSetArrayItem(CommonFunctions.GetFieldLabel((XVar)(MVCFunctions.GoodFieldName((XVar)(this.tName))), (XVar)(MVCFunctions.GoodFieldName((XVar)(this.ctrlField)))), "fLabel");
            resArr.InitAndSetArrayItem(this.controlsMap["controls"], "ctrlMap");
            if (this.needSettings == "true")
            {
                fillSettings();
                resArr.InitAndSetArrayItem(this.jsSettings, "settings");
            }
            MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(resArr)));
            MVCFunctions.ob_flush();
            HttpContext.Current.Response.End();
            throw new RunnerInlineOutputException();
            return(null);
        }
Exemple #8
0
        public virtual XVar preparePage()
        {
            dynamic fields = XVar.Array(), i = null, keylink = null, pageTypeTitle = null, tKeys = XVar.Array();

            if ((XVar)(!(XVar)(this.masterRecordData)) || (XVar)(!(XVar)(MVCFunctions.count(this.masterRecordData))))
            {
                return(null);
            }
            pageTypeTitle = XVar.Clone(this.pageType);
            if (this.masterPageType == "report")
            {
                pageTypeTitle = new XVar("masterprint");
            }
            this.xt.assign(new XVar("pagetitlelabel"), (XVar)(getPageTitle((XVar)(pageTypeTitle), (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.getPageFields());
            fields = XVar.Clone(MVCFunctions.array_merge((XVar)(fields), (XVar)(tKeys)));
            foreach (KeyValuePair <XVar, dynamic> f in fields.GetEnumerator())
            {
                dynamic fieldClassStr = null, value = null;
                this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_fieldheader")), new XVar(true));
                fieldClassStr = XVar.Clone(fieldClass((XVar)(f.Value)));
                value         = XVar.Clone(showDBValue((XVar)(f.Value), (XVar)(this.masterRecordData), (XVar)(keylink)));
                if (XVar.Pack(pdfJsonMode()))
                {
                    this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_pdfvalue")), (XVar)(value));
                }
                else
                {
                    dynamic wrappedValue = null;
                    wrappedValue = XVar.Clone(MVCFunctions.Concat("<span class='", fieldClassStr, "'>", value, "</span>"));
                    this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_mastervalue")), (XVar)(wrappedValue));
                    this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_value")), (XVar)(wrappedValue));
                }
                this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_class")), (XVar)(fieldClassStr));
                this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_fieldcolumn")), new XVar(true));
                this.xt.assign((XVar)(MVCFunctions.Concat(MVCFunctions.GoodFieldName((XVar)(f.Value)), "_fieldheadercolumn")), new XVar(true));
            }
            this.xt.assign(new XVar("grid_header"), new XVar(true));
            this.xt.assign(new XVar("grid_row"), new XVar(true));
            this.xt.assign(new XVar("grid_record"), new XVar(true));
            this.xt.assign(new XVar("grid_vrecord"), new XVar(true));
            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(!(XVar)(pdfJsonMode())))
            {
                this.xt.load_template((XVar)(MVCFunctions.GetTemplateName((XVar)(this.shortTableName), (XVar)(this.pageType))));
            }
            return(null);
        }
Exemple #9
0
 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)); }
 }
Exemple #10
0
        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>&nbsp;</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("&nbsp;")), " </option><option>22</option>"));
                initYearOpt  = XVar.Clone(MVCFunctions.Concat("<option>", (XVar.Pack(time[0]) ? XVar.Pack(time[0]) : XVar.Pack("&nbsp;")), "</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("&nbsp;")));
                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);
        }
Exemple #11
0
        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);
        }
Exemple #12
0
 protected virtual XVar getPlaceholderAttr()
 {
     if ((XVar)(!(XVar)(this.searchPanelControl)) && (XVar)(this.container.pageType != Constants.PAGE_SEARCH))
     {
         return(MVCFunctions.Concat(" placeholder=\"", CommonFunctions.GetFieldPlaceHolder((XVar)(MVCFunctions.GoodFieldName((XVar)(this.pageObject.tName))), (XVar)(MVCFunctions.GoodFieldName((XVar)(this.field)))), "\""));
     }
     return("");
 }
Exemple #13
0
        public virtual XVar buildSearchCtrlBlockArr(dynamic _param_recId, dynamic _param_fName, dynamic _param_ctrlInd, dynamic _param_opt, dynamic _param_not, dynamic _param_isChached, dynamic _param_val1, dynamic _param_val2, dynamic _param_panelField = null, dynamic _param_flexible = null, dynamic _param_immutable = null, dynamic _param_both = null)
        {
            #region default values
            if (_param_panelField as Object == null)
            {
                _param_panelField = new XVar(false);
            }
            if (_param_flexible as Object == null)
            {
                _param_flexible = new XVar(true);
            }
            if (_param_immutable as Object == null)
            {
                _param_immutable = new XVar(false);
            }
            if (_param_both as Object == null)
            {
                _param_both = new XVar(false);
            }
            #endregion

            #region pass-by-value parameters
            dynamic recId      = XVar.Clone(_param_recId);
            dynamic fName      = XVar.Clone(_param_fName);
            dynamic ctrlInd    = XVar.Clone(_param_ctrlInd);
            dynamic opt        = XVar.Clone(_param_opt);
            dynamic var_not    = XVar.Clone(_param_not);
            dynamic isChached  = XVar.Clone(_param_isChached);
            dynamic val1       = XVar.Clone(_param_val1);
            dynamic val2       = XVar.Clone(_param_val2);
            dynamic panelField = XVar.Clone(_param_panelField);
            dynamic flexible   = XVar.Clone(_param_flexible);
            dynamic immutable  = XVar.Clone(_param_immutable);
            dynamic both       = XVar.Clone(_param_both);
            #endregion

            dynamic filterRowAttrs = null, filterRowId = null, postfix = null, renderHidden = null, srchCtrlBlock = XVar.Array();
            srchCtrlBlock = XVar.Clone(XVar.Array());
            postfix       = new XVar("");
            if (XVar.Pack(panelField))
            {
                postfix = XVar.Clone(MVCFunctions.Concat("_", MVCFunctions.GoodFieldName((XVar)(fName))));
            }
            if (opt == XVar.Pack(""))
            {
                opt = XVar.Clone(this.pSet.getDefaultSearchOption((XVar)(fName)));
            }
            renderHidden = XVar.Clone((XVar)(MVCFunctions.strtolower((XVar)(opt)) == "empty") || (XVar)(MVCFunctions.strtolower((XVar)(opt)) == "not empty"));
            srchCtrlBlock.InitAndSetArrayItem(getCtrlParamsArr((XVar)(fName), (XVar)(recId), (XVar)(ctrlInd), (XVar)(val1), (XVar)(opt), (XVar)(renderHidden), (XVar)(isChached)), MVCFunctions.Concat("searchcontrol", postfix));
            renderHidden = XVar.Clone((XVar)(MVCFunctions.strtolower((XVar)(opt)) != "between") && (XVar)(MVCFunctions.strtolower((XVar)(opt)) != "not between"));
            if ((XVar)(flexible) || (XVar)(!(XVar)(renderHidden)))
            {
                srchCtrlBlock.InitAndSetArrayItem(getSecCtrlParamsArr((XVar)(fName), (XVar)(recId), (XVar)(ctrlInd), (XVar)(val2), (XVar)(opt), (XVar)(renderHidden), (XVar)(isChached)), MVCFunctions.Concat("searchcontrol1", postfix));
            }
            if (XVar.Pack(!(XVar)(immutable)))
            {
                srchCtrlBlock.InitAndSetArrayItem(getDelButtonHtml((XVar)(fName), (XVar)(recId)), "delCtrlButt");
            }
            filterRowId    = XVar.Clone(getFilterRowId((XVar)(recId), (XVar)(fName)));
            filterRowAttrs = XVar.Clone(MVCFunctions.Concat("id=\"", filterRowId, "\" "));
            if (XVar.Pack(isChached))
            {
                filterRowAttrs = MVCFunctions.Concat(filterRowAttrs, this.dispNoneStyle);
            }
            srchCtrlBlock.InitAndSetArrayItem(filterRowAttrs, MVCFunctions.Concat("filterRow_attrs", postfix));
            if (XVar.Pack(immutable))
            {
                srchCtrlBlock.InitAndSetArrayItem("rnr-basic-search-field", MVCFunctions.Concat("filterRow_class", postfix));
            }
            srchCtrlBlock.InitAndSetArrayItem(fName, "fName");
            srchCtrlBlock.InitAndSetArrayItem(getCtrlSearchType((XVar)(fName), (XVar)(recId), (XVar)(ctrlInd), (XVar)(opt), (XVar)(var_not), (XVar)(flexible), (XVar)(both)), MVCFunctions.Concat("searchtype", postfix));
            srchCtrlBlock.InitAndSetArrayItem(getNotBox((XVar)(fName), (XVar)(recId), (XVar)(var_not)), "notbox");
            srchCtrlBlock.InitAndSetArrayItem(CommonFunctions.GetFieldLabel((XVar)(MVCFunctions.GoodFieldName((XVar)(this.tName))), (XVar)(MVCFunctions.GoodFieldName((XVar)(fName)))), MVCFunctions.Concat("fLabel", postfix));
            return(srchCtrlBlock);
        }
Exemple #14
0
        public virtual XVar getDelButtonHtml(dynamic _param_fName, dynamic _param_recId)
        {
            #region pass-by-value parameters
            dynamic fName = XVar.Clone(_param_fName);
            dynamic recId = XVar.Clone(_param_recId);
            #endregion

            dynamic html = null, iconAttr = null, text = null;
            text     = new XVar("");
            iconAttr = new XVar("data-icon=\"remove\"");
            if (XVar.Pack(this.pageObj.isBootstrap()))
            {
                text     = new XVar("<span class=\"glyphicon glyphicon-remove\"></span>");
                iconAttr = new XVar("");
            }
            html = XVar.Clone(MVCFunctions.Concat("<a id = \"", getDelButtonId((XVar)(fName), (XVar)(recId)), "\" ctrlId=\"", recId, "\" fName=\"", MVCFunctions.GoodFieldName((XVar)(fName)), "\" class=\"searchPanelButton searchpanel-options\" ", iconAttr, " href=\"#\" title=\"", "Borrar control", "\">", text, "</a>"));
            return(html);
        }
Exemple #15
0
        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);
        }
Exemple #16
0
        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, strfilename = null, strtype = null;
            base.buildControl((XVar)(value), (XVar)(mode), (XVar)(fieldNum), (XVar)(validate), (XVar)(additionalCtrlParams), (XVar)(data));
            disp        = new XVar("");
            strfilename = new XVar("");
            if ((XVar)(mode == Constants.MODE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_EDIT))
            {
                dynamic filename = null, itype = null;
                value = XVar.Clone(this.connection.stripSlashesBinary((XVar)(value)));
                itype = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(value)));
                if (XVar.Pack(itype))
                {
                    if (XVar.Pack(this.pageObject.pSetEdit.showThumbnail((XVar)(this.field))))
                    {
                        disp = new XVar("<a target=_blank");
                        disp = MVCFunctions.Concat(disp, " href=\"", MVCFunctions.GetTableLink(new XVar("imager"), new XVar(""), (XVar)(MVCFunctions.Concat("table=", CommonFunctions.GetTableURL((XVar)(this.pageObject.tName)), "&", this.iquery, "&rndVal=", MVCFunctions.rand(new XVar(0), new XVar(32768))))), "\" class='zoombox'>");
                        disp = MVCFunctions.Concat(disp, "<img id=\"image_", MVCFunctions.GoodFieldName((XVar)(this.field)), "_", this.id, "\" name=\"", this.cfield, "\" border=0");
                        if (XVar.Pack(this.is508))
                        {
                            disp = MVCFunctions.Concat(disp, " alt=\"Image from DB\"");
                        }
                        disp = MVCFunctions.Concat(disp, " src=\"", MVCFunctions.GetTableLink(new XVar("imager"), new XVar(""), (XVar)(MVCFunctions.Concat("table=", CommonFunctions.GetTableURL((XVar)(this.pageObject.tName)), "&field=", MVCFunctions.RawUrlEncode((XVar)(this.pageObject.pSetEdit.getStrThumbnail((XVar)(this.field)))), "&alt=", MVCFunctions.RawUrlEncode((XVar)(this.field)), this.keylink, "&rndVal=", MVCFunctions.rand(new XVar(0), new XVar(32768))))), "\">");
                        disp = MVCFunctions.Concat(disp, "</a>");
                    }
                    else
                    {
                        disp = XVar.Clone(MVCFunctions.Concat("<img id=\"image_", MVCFunctions.GoodFieldName((XVar)(this.field)), "_", this.id, "\" name=\"", this.cfield, "\""));
                        if (XVar.Pack(this.is508))
                        {
                            disp = MVCFunctions.Concat(disp, " alt=\"Image from DB\"");
                        }
                        disp = MVCFunctions.Concat(disp, " border=0 src=\"", MVCFunctions.GetTableLink(new XVar("imager"), new XVar(""), (XVar)(MVCFunctions.Concat("table=", CommonFunctions.GetTableURL((XVar)(this.pageObject.tName)), "&", this.iquery, "&src=1&rndVal=", MVCFunctions.rand(new XVar(0), new XVar(32768))))), "\">");
                    }
                }
                else
                {
                    if (XVar.Pack(MVCFunctions.strlen((XVar)(value))))
                    {
                        disp = XVar.Clone(MVCFunctions.Concat("<img id=\"image_", MVCFunctions.GoodFieldName((XVar)(this.field)), "_", this.id, "\" name=\"", this.cfield, "\" border=0 "));
                        if (XVar.Pack(this.is508))
                        {
                            disp = MVCFunctions.Concat(disp, " alt=\"file\"");
                        }
                        disp = MVCFunctions.Concat(disp, " src=\"", MVCFunctions.GetRootPathForResources(new XVar("images/file.gif")), "\">");
                    }
                }
                if ((XVar)((XVar)(this.format == Constants.EDIT_FORMAT_DATABASE_FILE) && (XVar)(!(XVar)(itype))) && (XVar)(MVCFunctions.strlen((XVar)(value))))
                {
                    if (XVar.Pack(!(XVar)(filename = XVar.Clone(data[this.pageObject.pSetEdit.getFilenameField((XVar)(this.field))]))))
                    {
                        filename = new XVar("file.bin");
                    }
                    disp = XVar.Clone(MVCFunctions.Concat("<a href=\"", MVCFunctions.GetTableLink(new XVar("getfile"), new XVar(""), (XVar)(MVCFunctions.Concat("table=", CommonFunctions.GetTableURL((XVar)(this.pageObject.tName)), "&filename=", MVCFunctions.runner_htmlspecialchars((XVar)(filename)), "&pagename=", MVCFunctions.runner_htmlspecialchars((XVar)(this.pageObject.pSetEdit.pageName())), "&", this.iquery))), "\".>", disp, "</a>"));
                }
                if ((XVar)(this.format == Constants.EDIT_FORMAT_DATABASE_FILE) && (XVar)(this.pageObject.pSetEdit.getFilenameField((XVar)(this.field))))
                {
                    if (XVar.Pack(!(XVar)(filename = XVar.Clone(data[this.pageObject.pSetEdit.getFilenameField((XVar)(this.field))]))))
                    {
                        filename = new XVar("");
                    }
                    if (mode == Constants.MODE_INLINE_EDIT)
                    {
                        strfilename = XVar.Clone(MVCFunctions.Concat("<br><label for=\"filename_", this.cfieldname, "\">", "Nombre de archivo", "</label>&nbsp;&nbsp;<input type=\"text\" ", this.inputStyle, " id=\"filename_", this.cfieldname, "\" name=\"filename_", this.cfieldname, "\" size=\"20\" maxlength=\"50\" value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(filename)), "\">"));
                    }
                    else
                    {
                        strfilename = XVar.Clone(MVCFunctions.Concat("<br><label for=\"filename_", this.cfieldname, "\">", "Nombre de archivo", "</label>&nbsp;&nbsp;<input type=\"text\" ", this.inputStyle, " id=\"filename_", this.cfieldname, "\" name=\"filename_", this.cfieldname, "\" size=\"20\" maxlength=\"50\" value=\"", MVCFunctions.runner_htmlspecialchars((XVar)(filename)), "\">"));
                    }
                }
                if (XVar.Pack(MVCFunctions.strlen((XVar)(value))))
                {
                    strtype = XVar.Clone(MVCFunctions.Concat("<br><input id=\"", this.ctype, "_keep\" type=\"Radio\" name=\"", this.ctype, "\" value=\"file0\" checked class=\"rnr-uploadtype\">", "Guardar"));
                    if ((XVar)(MVCFunctions.strlen((XVar)(value))) && (XVar)(!(XVar)(this.pageObject.pSetEdit.isRequired((XVar)(this.field)))))
                    {
                        strtype = MVCFunctions.Concat(strtype, "<input id=\"", this.ctype, "_delete\" type=\"Radio\" name=\"", this.ctype, "\" value=\"file1\" class=\"rnr-uploadtype\">", "Borrar artículos seleccionados");
                    }
                    strtype = MVCFunctions.Concat(strtype, "<input id=\"", this.ctype, "_update\" type=\"Radio\" name=\"", this.ctype, "\" value=\"file2\" class=\"rnr-uploadtype\">", "Actualizar");
                }
                else
                {
                    strtype = XVar.Clone(MVCFunctions.Concat("<input id=\"", this.ctype, "_update\" type=\"hidden\" name=\"", this.ctype, "\" value=\"file2\" class=\"rnr-uploadtype\">"));
                }
            }
            else
            {
                strtype = XVar.Clone(MVCFunctions.Concat("<input id=\"", this.ctype, "\" type=\"hidden\" name=\"", this.ctype, "\" value=\"file2\">"));
                if ((XVar)(this.format == Constants.EDIT_FORMAT_DATABASE_FILE) && (XVar)(this.pageObject.pSetEdit.getFilenameField((XVar)(this.field))))
                {
                    strfilename = XVar.Clone(MVCFunctions.Concat("<br><label for=\"filename_", this.cfieldname, "\">", "Nombre de archivo", "</label>&nbsp;&nbsp;<input type=\"text\" ", this.inputStyle, " id=\"filename_", this.cfieldname, "\" name=\"filename_", this.cfieldname, "\" size=\"20\" maxlength=\"50\">"));
                }
            }
            if ((XVar)(mode == Constants.MODE_INLINE_EDIT) && (XVar)(this.format == Constants.EDIT_FORMAT_DATABASE_FILE))
            {
                disp = new XVar("");
            }
            MVCFunctions.Echo(MVCFunctions.Concat(disp, strtype));
            if ((XVar)((XVar)(mode == Constants.MODE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_EDIT)) && (XVar)(MVCFunctions.strlen((XVar)(value))))
            {
                MVCFunctions.Echo("<br>");
            }
            MVCFunctions.Echo(MVCFunctions.Concat("<input type=\"File\" ", this.inputStyle, " id=\"", this.cfield, "\" ", (XVar.Pack((XVar)((XVar)(mode == Constants.MODE_INLINE_EDIT) || (XVar)(mode == Constants.MODE_INLINE_ADD)) && (XVar)(this.is508)) ? 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);
        }