Ejemplo n.º 1
0
        public override XVar process()
        {
            dynamic extraParams = XVar.Array(), forExport = null;

            displayMasterTableInfo();
            assignPDFFormatSettings();
            forExport = new XVar(false);
            if (this.format == "excel")
            {
                forExport = new XVar("excel");
                MVCFunctions.Header("Content-Type", "application/vnd.ms-excel");
                MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=", this.shortTableName, ".xls")));
                MVCFunctions.Echo("<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">");
                MVCFunctions.Echo(MVCFunctions.Concat("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=", GlobalVars.cCharset, "\">"));
            }
            else
            {
                if (this.format == "word")
                {
                    forExport = new XVar("word");
                    MVCFunctions.Header("Content-Type", "application/vnd.ms-word");
                    MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=", this.shortTableName, ".doc")));
                    MVCFunctions.Echo(MVCFunctions.Concat("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=", GlobalVars.cCharset, "\">"));
                }
            }
            doCommonAssignments();
            extraParams = XVar.Clone(getExtraReportParams());
            setGoogleMapsParams((XVar)(extraParams["fieldsArr"]));
            setReportData((XVar)(extraParams));
            addButtonHandlers();
            addCommonJs();
            showPage();
            return(null);
        }
Ejemplo n.º 2
0
 public XVar detreccount()
 {
     try
     {
         dynamic dInd = null, dSTable = null, dTable = null, mKeys = null, mSTable = null, mTable = null, output = null, pageObject = null, pageType = null, respObj = null, var_params = XVar.Array();
         XTempl  xt;
         MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
         mSTable = XVar.Clone(MVCFunctions.postvalue(new XVar("mSTable")));
         if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(mSTable)))))
         {
             respObj = XVar.Clone(new XVar("success", false, "error", "Wrong master short table name"));
             MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(respObj)));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", mSTable, ""),
                                                                     "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null);
         dSTable = XVar.Clone(MVCFunctions.postvalue(new XVar("dSTable")));
         if (XVar.Pack(!(XVar)(CommonFunctions.checkTableName((XVar)(dSTable)))))
         {
             respObj = XVar.Clone(new XVar("success", false, "error", "Wrong detail short table name"));
             MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(respObj)));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", dSTable, ""),
                                                                     "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null);
         if ((XVar)(!(XVar)(CommonFunctions.isLogged())) || (XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search")))))
         {
             respObj = XVar.Clone(new XVar("success", false, "error", ""));
             MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(respObj)));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         mKeys      = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("mKeys")))));
         mTable     = XVar.Clone(MVCFunctions.postvalue(new XVar("mTable")));
         dTable     = XVar.Clone(MVCFunctions.postvalue(new XVar("dTable")));
         pageType   = XVar.Clone(MVCFunctions.postvalue(new XVar("pageType")));
         xt         = XVar.UnPackXTempl(new XTempl());
         var_params = XVar.Clone(new XVar("pageType", pageType));
         var_params.InitAndSetArrayItem(xt, "xt");
         var_params.InitAndSetArrayItem(mTable, "tName");
         var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
         pageObject = XVar.Clone(new RunnerPage((XVar)(var_params)));
         dInd       = new XVar(0);
         for (; dInd < MVCFunctions.count(pageObject.allDetailsTablesArr); dInd++)
         {
             if (pageObject.allDetailsTablesArr[dInd]["dDataSourceTable"] == dTable)
             {
                 break;
             }
         }
         output  = XVar.Clone(pageObject.countDetailsRecsNoSubQ((XVar)(dInd), (XVar)(mKeys)));
         respObj = XVar.Clone(new XVar("success", true, "recsCount", output));
         MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(respObj)));
         return(MVCFunctions.GetBuferContentAndClearBufer());
     }
     catch (RunnerRedirectException ex)
     { return(Redirect(ex.Message)); }
 }
Ejemplo n.º 3
0
        public virtual XVar post()
        {
            dynamic info = XVar.Array(), json = null, result = XVar.Array(), upload = XVar.Array();

            upload = XVar.Clone(MVCFunctions.uploadFiles((XVar)(this.options["param_name"])));
            info   = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> uploadedFile in upload.GetEnumerator())
            {
                info.InitAndSetArrayItem(handle_file_upload((XVar)(uploadedFile.Value), (XVar)(uploadedFile.Key)), null);
            }
            MVCFunctions.Header("Vary", "Accept");
            result = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> file in info.GetEnumerator())
            {
                dynamic userFile = XVar.Array();
                if (XVar.Equals(XVar.Pack(file.Value["error"]), XVar.Pack(false)))
                {
                    dynamic sessionArray = XVar.Array();
                    sessionArray = XVar.Clone(XVar.Array());
                    sessionArray.InitAndSetArrayItem(file.Value, "file");
                    sessionArray.InitAndSetArrayItem(false, "fromDB");
                    sessionArray.InitAndSetArrayItem(false, "deleted");
                    XSession.Session.InitAndSetArrayItem(sessionArray, MVCFunctions.Concat("mupload_", this.formStamp), file.Value["usrName"]);
                }
                userFile = XVar.Clone(buildUserFile((XVar)(file.Value)));
                if (XVar.Pack(!(XVar)(userFile["isImg"])))
                {
                    userFile.InitAndSetArrayItem(true, "isImg");
                    userFile.InitAndSetArrayItem(MVCFunctions.Concat(userFile["url"], "&icon=1"), "thumbnail_url");
                }
                result.InitAndSetArrayItem(userFile, null);
            }
            json = XVar.Clone(MVCFunctions.my_json_encode((XVar)(result)));
            if (XVar.Pack(MVCFunctions.IsJSONAccepted()))
            {
                MVCFunctions.Header("Content-type", "application/json");
            }
            else
            {
                MVCFunctions.Header("Content-type", "text/plain");
            }
            MVCFunctions.Echo(json);
            return(null);
        }
Ejemplo n.º 4
0
        public virtual XVar ExportToWord(dynamic _param_rs, dynamic _param_nPageSize)
        {
            #region pass-by-value parameters
            dynamic rs        = XVar.Clone(_param_rs);
            dynamic nPageSize = XVar.Clone(_param_nPageSize);
            #endregion

            MVCFunctions.Header("Content-Type", "application/vnd.ms-word");
            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=", CommonFunctions.GetTableURL((XVar)(this.tName)), ".doc")));
            MVCFunctions.Echo("<html>");
            MVCFunctions.Echo(MVCFunctions.Concat("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=", GlobalVars.cCharset, "\">"));
            MVCFunctions.Echo("<body>");
            MVCFunctions.Echo("<table border=1>");
            WriteTableData((XVar)(rs), (XVar)(nPageSize));
            MVCFunctions.Echo("</table>");
            MVCFunctions.Echo("</body>");
            MVCFunctions.Echo("</html>");
            return(null);
        }
Ejemplo n.º 5
0
        public virtual XVar ExportToExcel_old(dynamic _param_rs, dynamic _param_nPageSize)
        {
            #region pass-by-value parameters
            dynamic rs        = XVar.Clone(_param_rs);
            dynamic nPageSize = XVar.Clone(_param_nPageSize);
            #endregion

            MVCFunctions.Header("Content-Type", "application/vnd.ms-excel");
            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=", CommonFunctions.GetTableURL((XVar)(this.tName)), ".xls")));
            MVCFunctions.Echo("<html>");
            MVCFunctions.Echo("<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">");
            MVCFunctions.Echo(MVCFunctions.Concat("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=", GlobalVars.cCharset, "\">"));
            MVCFunctions.Echo("<body>");
            MVCFunctions.Echo("<table border=1>");
            WriteTableData((XVar)(rs), (XVar)(nPageSize));
            MVCFunctions.Echo("</table>");
            MVCFunctions.Echo("</body>");
            MVCFunctions.Echo("</html>");
            return(null);
        }
Ejemplo n.º 6
0
        public virtual XVar get()
        {
            dynamic file_name = null, info = null;

            file_name = new XVar(null);
            if (XVar.Pack(MVCFunctions.REQUESTKeyExists("file")))
            {
                MVCFunctions.basename((XVar)(GlobalVars.cman.byTable((XVar)(this.table)).stripSlashesBinary((XVar)(MVCFunctions.postvalue("file")))));
            }
            if (XVar.Pack(file_name))
            {
                info = XVar.Clone(get_file_object((XVar)(file_name)));
            }
            else
            {
                info = XVar.Clone(this.Invoke("get_file_objects"));
            }
            MVCFunctions.Header("Content-type", "application/json");
            MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(info)));
            return(null);
        }
Ejemplo n.º 7
0
 public XVar ie8css()
 {
     try
     {
         dynamic css = null, ext = null, file = null;
         MVCFunctions.Header("Content-Type", "text/css");
         file = XVar.Clone(MVCFunctions.GetQueryString());
         ext  = XVar.Clone(MVCFunctions.substr((XVar)(file), (XVar)(MVCFunctions.strrpos((XVar)(file), new XVar(".")) + 1)));
         if ((XVar)(ext != "css") || (XVar)(!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(file), new XVar(".."))), XVar.Pack(false))))
         {
             MVCFunctions.Echo(new XVar(""));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         css = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(MVCFunctions.getabspath((XVar)(file))), new XVar("r")));
         css = XVar.Clone(MVCFunctions.preg_replace((XVar)(new XVar(0, "/ :not\\(.*?\\)/", 1, "/ :first-child/", 2, "/ :last-child/", 3, "/ :nth-last-child\\(.*?\\)/")), new XVar(" *"), (XVar)(css)));
         css = XVar.Clone(MVCFunctions.preg_replace((XVar)(new XVar(0, "/:not\\(.*?\\)/", 1, "/:first-child/", 2, "/:last-child/", 3, "/:nth-last-child\\(.*?\\)/")), new XVar(""), (XVar)(css)));
         MVCFunctions.Echo(css);
         return(MVCFunctions.GetBuferContentAndClearBufer());
     }
     catch (RunnerRedirectException ex)
     { return(Redirect(ex.Message)); }
 }
Ejemplo n.º 8
0
        public virtual XVar delete()
        {
            dynamic fileName = null, success = null;

            fileName = XVar.Clone(MVCFunctions.postvalue(new XVar("fileName")));
            success  = new XVar(false);
            if (XVar.Pack(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].KeyExists(fileName)))
            {
                if (XVar.Pack(!(XVar)(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)][fileName]["fromDB"])))
                {
                    dynamic file_path = null, sessionFile = XVar.Array();
                    sessionFile = XVar.Clone(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)][fileName]["file"]);
                    file_path   = XVar.Clone(sessionFile["name"]);
                    if (XVar.Pack(MVCFunctions.file_exists(file_path)))
                    {
                        success = XVar.Clone(MVCFunctions.unlink((XVar)(file_path)));
                    }
                    if ((XVar)(success) && (XVar)(sessionFile["thumbnail"] != ""))
                    {
                        dynamic file = null;
                        file = XVar.Clone(sessionFile["thumbnail"]);
                        if (XVar.Pack(MVCFunctions.file_exists(file)))
                        {
                            MVCFunctions.unlink((XVar)(file));
                        }
                    }
                    XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].Remove(fileName);
                }
                else
                {
                    XSession.Session.InitAndSetArrayItem(true, MVCFunctions.Concat("mupload_", this.formStamp), fileName, "deleted");
                    success = new XVar(true);
                }
            }
            MVCFunctions.Header("Content-type", "application/json");
            MVCFunctions.Echo(MVCFunctions.my_json_encode((XVar)(success)));
            return(null);
        }
Ejemplo n.º 9
0
        public ActionResult import()
        {
            try
            {
                dynamic id = null, pageObject = null, strtablename = null, var_params = XVar.Array();
                XTempl  xt;
                MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
                Server.ScriptTimeout = 600;
                Saldo_Horas_Empleado_Variables.Apply();
                if (XVar.Pack(!(XVar)(Security.processPageSecurity((XVar)(strtablename), new XVar("I")))))
                {
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                {
                    TLayout t_layout = null;

                    t_layout                    = new TLayout(new XVar("import_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version            = 3;
                    t_layout.bootstrapTheme     = "default";
                    t_layout.customCssPageName  = "Saldo_Horas_Empleado_import";
                    t_layout.blocks["top"]      = XVar.Array();
                    t_layout.containers["page"] = XVar.Array();
                    t_layout.containers["page"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "panel"));
                    t_layout.containers["panel"] = XVar.Array();
                    t_layout.containers["panel"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "header"));
                    t_layout.containers["header"] = XVar.Array();
                    t_layout.containers["header"].Add(new XVar("name", "importheader", "block", "", "substyle", 1));

                    t_layout.skins["header"] = "";


                    t_layout.containers["panel"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "body"));
                    t_layout.containers["body"] = XVar.Array();
                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "message"));
                    t_layout.containers["message"] = XVar.Array();
                    t_layout.containers["message"].Add(new XVar("name", "errormessage", "block", "", "substyle", 1));

                    t_layout.skins["message"] = "";


                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "import"));
                    t_layout.containers["import"] = XVar.Array();
                    t_layout.containers["import"].Add(new XVar("name", "importheader_text", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "importfields", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "import_rawtext_control", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "import_preview", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "import_process", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "import_results", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "importbuttons", "block", "", "substyle", 1));

                    t_layout.skins["import"] = "";


                    t_layout.skins["body"] = "";


                    t_layout.skins["panel"] = "";


                    t_layout.skins["page"] = "";

                    t_layout.blocks["top"].Add("page");
                    GlobalVars.page_layouts["Saldo_Horas_Empleado_import"] = t_layout;
                }

                xt         = XVar.UnPackXTempl(new XTempl());
                id         = XVar.Clone(CommonFunctions.postvalue_number(new XVar("id")));
                id         = XVar.Clone((XVar.Pack(id != XVar.Pack("")) ? XVar.Pack(id) : XVar.Pack(1)));
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(id, "id");
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("a")), "action");
                var_params.InitAndSetArrayItem(Constants.PAGE_IMPORT, "pageType");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("page")), "pageName");
                var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
                var_params.InitAndSetArrayItem(GlobalVars.strOriginalTableName, "strOriginalTableName");
                if (var_params["action"] == "importPreview")
                {
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("importType")), "importType");
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("importText")), "importText");
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("useXHR")), "useXHR");
                }
                else
                {
                    if (var_params["action"] == "importData")
                    {
                        var_params.InitAndSetArrayItem(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("importData")))), "importData");
                    }
                }
                GlobalVars.pageObject = XVar.Clone(new ImportPage((XVar)(var_params)));
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Ejemplo n.º 10
0
        public virtual XVar ExportToCSV(dynamic _param_rs, dynamic _param_nPageSize)
        {
            #region pass-by-value parameters
            dynamic rs        = XVar.Clone(_param_rs);
            dynamic nPageSize = XVar.Clone(_param_nPageSize);
            #endregion

            dynamic delimiter = null, eventRes = null, headerParts = XVar.Array(), iNumberOfRows = null, row = null, values = XVar.Array();
            if ((XVar)(this.pSet.chekcExportDelimiterSelection()) && (XVar)(MVCFunctions.strlen((XVar)(this.csvDelimiter))))
            {
                delimiter = XVar.Clone(this.csvDelimiter);
            }
            else
            {
                delimiter = XVar.Clone(this.pSet.getExportDelimiter());
            }
            MVCFunctions.Header("Content-Type", "application/csv");
            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=", CommonFunctions.GetTableURL((XVar)(this.tName)), ".csv")));
            MVCFunctions.printBOM();
            if (XVar.Pack(this.eventsObject.exists(new XVar("ListFetchArray"))))
            {
                row = XVar.Clone(this.eventsObject.ListFetchArray((XVar)(rs), this));
            }
            else
            {
                row = XVar.Clone(this.cipherer.DecryptFetchedArray((XVar)(this.connection.fetch_array((XVar)(rs)))));
            }
            headerParts = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> field in this.selectedFields.GetEnumerator())
            {
                headerParts.InitAndSetArrayItem(MVCFunctions.Concat("\"", MVCFunctions.str_replace(new XVar("\""), new XVar("\"\""), (XVar)(field.Value)), "\""), null);
            }
            MVCFunctions.Echo(MVCFunctions.implode((XVar)(delimiter), (XVar)(headerParts)));
            MVCFunctions.Echo("\r\n");
            this.viewControls.setForExportVar(new XVar("csv"));
            iNumberOfRows = new XVar(0);
            while ((XVar)((XVar)(!(XVar)(nPageSize)) || (XVar)(iNumberOfRows < nPageSize)) && (XVar)(row))
            {
                values = XVar.Clone(XVar.Array());
                foreach (KeyValuePair <XVar, dynamic> field in this.selectedFields.GetEnumerator())
                {
                    dynamic fType = null;
                    fType = XVar.Clone(this.pSet.getFieldType((XVar)(field.Value)));
                    if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(fType))))
                    {
                        values.InitAndSetArrayItem("código binario demasiado grande – no puede ser desplegado", field.Value);
                    }
                    else
                    {
                        values.InitAndSetArrayItem(getFormattedFieldValue((XVar)(field.Value), (XVar)(row)), field.Value);
                    }
                }
                eventRes = new XVar(true);
                if (XVar.Pack(this.eventsObject.exists(new XVar("BeforeOut"))))
                {
                    eventRes = XVar.Clone(this.eventsObject.BeforeOut((XVar)(row), (XVar)(values), this));
                }
                if (XVar.Pack(eventRes))
                {
                    dynamic dataRowParts = XVar.Array();
                    dataRowParts = XVar.Clone(XVar.Array());
                    foreach (KeyValuePair <XVar, dynamic> field in this.selectedFields.GetEnumerator())
                    {
                        dataRowParts.InitAndSetArrayItem(MVCFunctions.Concat("\"", MVCFunctions.str_replace(new XVar("\""), new XVar("\"\""), (XVar)(values[field.Value])), "\""), null);
                    }
                    MVCFunctions.Echo(MVCFunctions.implode((XVar)(delimiter), (XVar)(dataRowParts)));
                }
                iNumberOfRows++;
                if (XVar.Pack(this.eventsObject.exists(new XVar("ListFetchArray"))))
                {
                    row = XVar.Clone(this.eventsObject.ListFetchArray((XVar)(rs), this));
                }
                else
                {
                    row = XVar.Clone(this.cipherer.DecryptFetchedArray((XVar)(this.connection.fetch_array((XVar)(rs)))));
                }
                if ((XVar)((XVar)((XVar)(!(XVar)(nPageSize)) || (XVar)(iNumberOfRows < nPageSize)) && (XVar)(row)) && (XVar)(eventRes))
                {
                    MVCFunctions.Echo("\r\n");
                }
            }
            return(null);
        }
Ejemplo n.º 11
0
        public virtual XVar ExportToXML(dynamic _param_rs, dynamic _param_nPageSize)
        {
            #region pass-by-value parameters
            dynamic rs        = XVar.Clone(_param_rs);
            dynamic nPageSize = XVar.Clone(_param_nPageSize);
            #endregion

            dynamic eventRes = null, i = null, row = null, values = XVar.Array();
            MVCFunctions.Header("Content-Type", "text/xml");
            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=", CommonFunctions.GetTableURL((XVar)(this.tName)), ".xml")));
            if (XVar.Pack(this.eventsObject.exists(new XVar("ListFetchArray"))))
            {
                row = XVar.Clone(this.eventsObject.ListFetchArray((XVar)(rs), this));
            }
            else
            {
                row = XVar.Clone(this.cipherer.DecryptFetchedArray((XVar)(this.connection.fetch_array((XVar)(rs)))));
            }
            MVCFunctions.Echo(MVCFunctions.Concat("<?xml version=\"1.0\" encoding=\"", GlobalVars.cCharset, "\" standalone=\"yes\"?>\r\n"));
            MVCFunctions.Echo("<table>\r\n");
            i = new XVar(0);
            this.viewControls.setForExportVar(new XVar("xml"));
            while ((XVar)((XVar)(!(XVar)(nPageSize)) || (XVar)(i < nPageSize)) && (XVar)(row))
            {
                values = XVar.Clone(XVar.Array());
                foreach (KeyValuePair <XVar, dynamic> field in this.selectedFields.GetEnumerator())
                {
                    dynamic fType = null;
                    fType = XVar.Clone(this.pSet.getFieldType((XVar)(field.Value)));
                    if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(fType))))
                    {
                        values.InitAndSetArrayItem("código binario demasiado grande – no puede ser desplegado", field.Value);
                    }
                    else
                    {
                        values.InitAndSetArrayItem(getFormattedFieldValue((XVar)(field.Value), (XVar)(row)), field.Value);
                    }
                }
                eventRes = new XVar(true);
                if (XVar.Pack(this.eventsObject.exists(new XVar("BeforeOut"))))
                {
                    eventRes = XVar.Clone(this.eventsObject.BeforeOut((XVar)(row), (XVar)(values), this));
                }
                if (XVar.Pack(eventRes))
                {
                    i++;
                    MVCFunctions.Echo("<row>\r\n");
                    foreach (KeyValuePair <XVar, dynamic> val in values.GetEnumerator())
                    {
                        dynamic field = null;
                        field = XVar.Clone(MVCFunctions.runner_htmlspecialchars((XVar)(CommonFunctions.XMLNameEncode((XVar)(val.Key)))));
                        MVCFunctions.Echo(MVCFunctions.Concat("<", field, ">"));
                        MVCFunctions.Echo(CommonFunctions.xmlencode((XVar)(values[val.Key])));
                        MVCFunctions.Echo(MVCFunctions.Concat("</", field, ">\r\n"));
                    }
                    MVCFunctions.Echo("</row>\r\n");
                }
                if (XVar.Pack(this.eventsObject.exists(new XVar("ListFetchArray"))))
                {
                    row = XVar.Clone(this.eventsObject.ListFetchArray((XVar)(rs), this));
                }
                else
                {
                    row = XVar.Clone(this.cipherer.DecryptFetchedArray((XVar)(this.connection.fetch_array((XVar)(rs)))));
                }
            }
            MVCFunctions.Echo("</table>\r\n");
            return(null);
        }
Ejemplo n.º 12
0
        public ActionResult detailspreview()
        {
            try
            {
                dynamic         masterKeys = XVar.Array(), mastertable = null, mode = null, pageObject = null, query = null, recordsCounter = null, returnJSON = XVar.Array(), rowcount = null, sessionPrefix = null, var_params = XVar.Array(), whereClauses = XVar.Array();
                ProjectSettings pSet;
                XTempl          xt;
                dbo__ABCVotes_Variables.Apply();
                MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
                mode = XVar.Clone(MVCFunctions.postvalue(new XVar("mode")));
                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());
                }
                GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName)));
                xt = XVar.UnPackXTempl(new XTempl());
                {
                    TLayout t_layout = null;

                    t_layout                      = new TLayout(new XVar("detailspreview"), new XVar("AvenueAvenue"), new XVar("MobileAvenue"));
                    t_layout.version              = 2;
                    t_layout.blocks["bare"]       = XVar.Array();
                    t_layout.containers["dcount"] = XVar.Array();
                    t_layout.containers["dcount"].Add(new XVar("name", "detailspreviewheader", "block", "", "substyle", 1));

                    t_layout.containers["dcount"].Add(new XVar("name", "detailspreviewdetailsfount", "block", "", "substyle", 1));

                    t_layout.containers["dcount"].Add(new XVar("name", "detailspreviewdispfirst", "block", "display_first", "substyle", 1));

                    t_layout.skins["dcount"] = "empty";

                    t_layout.blocks["bare"].Add("dcount");
                    t_layout.containers["detailspreviewgrid"] = XVar.Array();
                    t_layout.containers["detailspreviewgrid"].Add(new XVar("name", "detailspreviewfields", "block", "details_data", "substyle", 1));

                    t_layout.skins["detailspreviewgrid"] = "grid";

                    t_layout.blocks["bare"].Add("detailspreviewgrid");
                    GlobalVars.page_layouts["dbo__ABCVotes_detailspreview"] = t_layout;

                    t_layout.skinsparams                        = XVar.Array();
                    t_layout.skinsparams["empty"]               = XVar.Array();
                    t_layout.skinsparams["empty"]["button"]     = "button2";
                    t_layout.skinsparams["menu"]                = XVar.Array();
                    t_layout.skinsparams["menu"]["button"]      = "button1";
                    t_layout.skinsparams["hmenu"]               = XVar.Array();
                    t_layout.skinsparams["hmenu"]["button"]     = "button1";
                    t_layout.skinsparams["undermenu"]           = XVar.Array();
                    t_layout.skinsparams["undermenu"]["button"] = "button1";
                    t_layout.skinsparams["fields"]              = XVar.Array();
                    t_layout.skinsparams["fields"]["button"]    = "button1";
                    t_layout.skinsparams["form"]                = XVar.Array();
                    t_layout.skinsparams["form"]["button"]      = "button1";
                    t_layout.skinsparams["1"]                   = XVar.Array();
                    t_layout.skinsparams["1"]["button"]         = "button1";
                    t_layout.skinsparams["2"]                   = XVar.Array();
                    t_layout.skinsparams["2"]["button"]         = "button1";
                    t_layout.skinsparams["3"]                   = XVar.Array();
                    t_layout.skinsparams["3"]["button"]         = "button1";
                }

                recordsCounter = new XVar(0);
                mastertable    = XVar.Clone(MVCFunctions.postvalue(new XVar("mastertable")));
                masterKeys     = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("masterKeys")))));
                sessionPrefix  = new XVar("_detailsPreview");
                if (mastertable != XVar.Pack(""))
                {
                    dynamic i = null;
                    XSession.Session[MVCFunctions.Concat(sessionPrefix, "_mastertable")] = mastertable;
                    i = new XVar(1);
                    if ((XVar)(MVCFunctions.is_array((XVar)(masterKeys))) && (XVar)(0 < MVCFunctions.count(masterKeys)))
                    {
                        while (XVar.Pack(masterKeys.KeyExists(MVCFunctions.Concat("masterkey", i))))
                        {
                            XSession.Session[MVCFunctions.Concat(sessionPrefix, "_masterkey", i)] = masterKeys[MVCFunctions.Concat("masterkey", i)];
                            i++;
                        }
                    }
                    if (XVar.Pack(XSession.Session.KeyExists(MVCFunctions.Concat(sessionPrefix, "_masterkey", i))))
                    {
                        XSession.Session.Remove(MVCFunctions.Concat(sessionPrefix, "_masterkey", i));
                    }
                }
                else
                {
                    mastertable = XVar.Clone(XSession.Session[MVCFunctions.Concat(sessionPrefix, "_mastertable")]);
                }
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(1, "id");
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName");
                var_params.InitAndSetArrayItem("detailspreview", "pageType");
                GlobalVars.pageObject = XVar.Clone(new DetailsPreview((XVar)(var_params)));
                pSet         = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(GlobalVars.strTableName), new XVar(Constants.PAGE_LIST)));
                whereClauses = XVar.Clone(XVar.Array());
                if (mastertable == "dbo._ABCReports")
                {
                    dynamic formattedValue = null;
                    formattedValue = XVar.Clone(CommonFunctions.make_db_value(new XVar("record"), (XVar)(XSession.Session[MVCFunctions.Concat(sessionPrefix, "_masterkey1")])));
                    if (formattedValue == "null")
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), " is null"), null);
                    }
                    else
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), "=", formattedValue), null);
                    }
                }
                if (mastertable == "ABC_Voting_Submitted")
                {
                    dynamic formattedValue = null;
                    formattedValue = XVar.Clone(CommonFunctions.make_db_value(new XVar("record"), (XVar)(XSession.Session[MVCFunctions.Concat(sessionPrefix, "_masterkey1")])));
                    if (formattedValue == "null")
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), " is null"), null);
                    }
                    else
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), "=", formattedValue), null);
                    }
                }
                if (mastertable == "ABC_Voting_Recirculated")
                {
                    dynamic formattedValue = null;
                    formattedValue = XVar.Clone(CommonFunctions.make_db_value(new XVar("record"), (XVar)(XSession.Session[MVCFunctions.Concat(sessionPrefix, "_masterkey1")])));
                    if (formattedValue == "null")
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), " is null"), null);
                    }
                    else
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), "=", formattedValue), null);
                    }
                }
                if (mastertable == "ABC_Voting_My_Voting")
                {
                    dynamic formattedValue = null;
                    formattedValue = XVar.Clone(CommonFunctions.make_db_value(new XVar("record"), (XVar)(XSession.Session[MVCFunctions.Concat(sessionPrefix, "_masterkey1")])));
                    if (formattedValue == "null")
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), " is null"), null);
                    }
                    else
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), "=", formattedValue), null);
                    }
                }
                if (mastertable == "dbo.vwABCReportsVoteCount")
                {
                    dynamic formattedValue = null;
                    formattedValue = XVar.Clone(CommonFunctions.make_db_value(new XVar("record"), (XVar)(XSession.Session[MVCFunctions.Concat(sessionPrefix, "_masterkey1")])));
                    if (formattedValue == "null")
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), " is null"), null);
                    }
                    else
                    {
                        whereClauses.InitAndSetArrayItem(MVCFunctions.Concat(GlobalVars.pageObject.getFieldSQLDecrypt(new XVar("record")), "=", formattedValue), null);
                    }
                }
                whereClauses.InitAndSetArrayItem(CommonFunctions.SecuritySQL(new XVar("Search"), (XVar)(GlobalVars.strTableName)), null);
                query             = XVar.Clone(pSet.getSQLQuery());
                GlobalVars.strSQL = XVar.Clone(query.buildSQL_default((XVar)(whereClauses)));
                rowcount          = XVar.Clone(GlobalVars.pageObject.connection.getFetchedRowsNumber((XVar)(GlobalVars.strSQL)));
                GlobalVars.strSQL = MVCFunctions.Concat(GlobalVars.strSQL, GlobalVars.pageObject.getOrderByClause());
                xt.assign(new XVar("row_count"), (XVar)(rowcount));
                if (XVar.Pack(rowcount))
                {
                    dynamic b = null, data = XVar.Array(), display_count = null, format = null, keylink = null, qResult = null, row = XVar.Array(), rowinfo = XVar.Array(), rowinfo2 = XVar.Array(), value = null, var_class = null, viewContainer = null;
                    xt.assign(new XVar("details_data"), new XVar(true));

                    display_count = new XVar(10);
                    if (mode == "inline")
                    {
                        display_count *= 2;
                    }
                    if (display_count + 2 < rowcount)
                    {
                        xt.assign(new XVar("display_first"), new XVar(true));
                        xt.assign(new XVar("display_count"), (XVar)(display_count));
                    }
                    else
                    {
                        display_count = XVar.Clone(rowcount);
                    }
                    rowinfo       = XVar.Clone(XVar.Array());
                    viewContainer = XVar.Clone(new ViewControlsContainer((XVar)(pSet), new XVar(Constants.PAGE_LIST)));
                    viewContainer.isDetailsPreview = new XVar(true);
                    b       = new XVar(true);
                    qResult = XVar.Clone(GlobalVars.pageObject.connection.query((XVar)(GlobalVars.strSQL)));
                    data    = XVar.Clone(GlobalVars.cipherer.DecryptFetchedArray((XVar)(qResult.fetchAssoc())));
                    while ((XVar)(data) && (XVar)(recordsCounter < display_count))
                    {
                        recordsCounter++;
                        row     = XVar.Clone(XVar.Array());
                        keylink = new XVar("");
                        keylink = MVCFunctions.Concat(keylink, "&key1=", MVCFunctions.runner_htmlspecialchars((XVar)(MVCFunctions.RawUrlEncode((XVar)(data["id"])))));
                        keylink = MVCFunctions.Concat(keylink, "&key2=", MVCFunctions.runner_htmlspecialchars((XVar)(MVCFunctions.RawUrlEncode((XVar)(data["record"])))));

                        viewContainer.recId = XVar.Clone(recordsCounter);
                        value = XVar.Clone(viewContainer.showDBValue(new XVar("committee_member"), (XVar)(data), (XVar)(keylink)));
                        row.InitAndSetArrayItem(value, "committee_member_value");
                        format    = XVar.Clone(pSet.getViewFormat(new XVar("committee_member")));
                        var_class = new XVar("rnr-field-text");
                        if (format == Constants.FORMAT_FILE)
                        {
                            var_class = new XVar(" rnr-field-file");
                        }
                        if (format == Constants.FORMAT_AUDIO)
                        {
                            var_class = new XVar(" rnr-field-audio");
                        }
                        if (format == Constants.FORMAT_CHECKBOX)
                        {
                            var_class = new XVar(" rnr-field-checkbox");
                        }
                        if ((XVar)(format == Constants.FORMAT_NUMBER) || (XVar)(CommonFunctions.IsNumberType((XVar)(pSet.getFieldType(new XVar("committee_member"))))))
                        {
                            var_class = new XVar(" rnr-field-number");
                        }
                        row.InitAndSetArrayItem(var_class, "committee_member_class");
                        viewContainer.recId = XVar.Clone(recordsCounter);
                        value = XVar.Clone(viewContainer.showDBValue(new XVar("date_voted"), (XVar)(data), (XVar)(keylink)));
                        row.InitAndSetArrayItem(value, "date_voted_value");
                        format    = XVar.Clone(pSet.getViewFormat(new XVar("date_voted")));
                        var_class = new XVar("rnr-field-text");
                        if (format == Constants.FORMAT_FILE)
                        {
                            var_class = new XVar(" rnr-field-file");
                        }
                        if (format == Constants.FORMAT_AUDIO)
                        {
                            var_class = new XVar(" rnr-field-audio");
                        }
                        if (format == Constants.FORMAT_CHECKBOX)
                        {
                            var_class = new XVar(" rnr-field-checkbox");
                        }
                        if ((XVar)(format == Constants.FORMAT_NUMBER) || (XVar)(CommonFunctions.IsNumberType((XVar)(pSet.getFieldType(new XVar("date_voted"))))))
                        {
                            var_class = new XVar(" rnr-field-number");
                        }
                        row.InitAndSetArrayItem(var_class, "date_voted_class");
                        viewContainer.recId = XVar.Clone(recordsCounter);
                        value = XVar.Clone(viewContainer.showDBValue(new XVar("vote"), (XVar)(data), (XVar)(keylink)));
                        row.InitAndSetArrayItem(value, "vote_value");
                        format    = XVar.Clone(pSet.getViewFormat(new XVar("vote")));
                        var_class = new XVar("rnr-field-text");
                        if (format == Constants.FORMAT_FILE)
                        {
                            var_class = new XVar(" rnr-field-file");
                        }
                        if (format == Constants.FORMAT_AUDIO)
                        {
                            var_class = new XVar(" rnr-field-audio");
                        }
                        if (format == Constants.FORMAT_CHECKBOX)
                        {
                            var_class = new XVar(" rnr-field-checkbox");
                        }
                        if ((XVar)(format == Constants.FORMAT_NUMBER) || (XVar)(CommonFunctions.IsNumberType((XVar)(pSet.getFieldType(new XVar("vote"))))))
                        {
                            var_class = new XVar(" rnr-field-number");
                        }
                        row.InitAndSetArrayItem(var_class, "vote_class");
                        viewContainer.recId = XVar.Clone(recordsCounter);
                        value = XVar.Clone(viewContainer.showDBValue(new XVar("comment"), (XVar)(data), (XVar)(keylink)));
                        row.InitAndSetArrayItem(value, "comment_value");
                        format    = XVar.Clone(pSet.getViewFormat(new XVar("comment")));
                        var_class = new XVar("rnr-field-text");
                        if (format == Constants.FORMAT_FILE)
                        {
                            var_class = new XVar(" rnr-field-file");
                        }
                        if (format == Constants.FORMAT_AUDIO)
                        {
                            var_class = new XVar(" rnr-field-audio");
                        }
                        if (format == Constants.FORMAT_CHECKBOX)
                        {
                            var_class = new XVar(" rnr-field-checkbox");
                        }
                        if ((XVar)(format == Constants.FORMAT_NUMBER) || (XVar)(CommonFunctions.IsNumberType((XVar)(pSet.getFieldType(new XVar("comment"))))))
                        {
                            var_class = new XVar(" rnr-field-number");
                        }
                        row.InitAndSetArrayItem(var_class, "comment_class");
                        rowinfo.InitAndSetArrayItem(row, null);
                        if (XVar.Pack(b))
                        {
                            rowinfo2.InitAndSetArrayItem(row, null);
                            b = new XVar(false);
                        }
                        data = XVar.Clone(GlobalVars.cipherer.DecryptFetchedArray((XVar)(qResult.fetchAssoc())));
                    }
                    xt.assign_loopsection(new XVar("details_row"), (XVar)(rowinfo));
                    xt.assign_loopsection(new XVar("details_row_header"), (XVar)(rowinfo2));
                }
                returnJSON = XVar.Clone(new XVar("success", true));
                xt.load_template((XVar)(MVCFunctions.GetTemplateName(new XVar("dbo__ABCVotes"), new XVar("detailspreview"))));
                returnJSON.InitAndSetArrayItem(xt.fetch_loaded(), "body");
                if (mode != "inline")
                {
                    dynamic layout = null;
                    returnJSON.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("counter")), "counter");
                    layout = XVar.Clone(CommonFunctions.GetPageLayout((XVar)(MVCFunctions.GoodFieldName((XVar)(GlobalVars.strTableName))), new XVar("detailspreview")));
                    if (XVar.Pack(layout))
                    {
                        foreach (KeyValuePair <XVar, dynamic> css in layout.getCSSFiles((XVar)(CommonFunctions.isRTL()), (XVar)((XVar)(CommonFunctions.mobileDeviceDetected()) && (XVar)(layout.version != Constants.BOOTSTRAP_LAYOUT))).GetEnumerator())
                        {
                            returnJSON.InitAndSetArrayItem(css.Value, "CSSFiles", null);
                        }
                    }
                }
                MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON)));
                MVCFunctions.Echo(new XVar(""));
                return(MVCFunctions.GetBuferContentAndClearBufer());
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Ejemplo n.º 13
0
        public XVar mfhandler()
        {
            try
            {
                dynamic         _connection = null, field = null, fileName = null, formStamp = null, fsFileName = null, fsize = null, ftype = null, havePermission = null, iconShowed = null, isDBFile = null, isPDF = null, outputAsAttachment = null, pageType = null, pdf = null, requestAction = null, sessionFile = XVar.Array(), upload_handler = null, value = null, var_params = XVar.Array();
                ProjectSettings pSet;
                isPDF = new XVar(false);
                if (XVar.Pack(isPDF))
                {
                    GlobalVars.strTableName = XVar.Clone(var_params["table"]);
                    field              = XVar.Clone(var_params["field"]);
                    pageType           = XVar.Clone(var_params["pageType"]);
                    outputAsAttachment = new XVar(false);
                }
                else
                {
                    GlobalVars.strTableName = XVar.Clone(MVCFunctions.postvalue(new XVar("table")));
                    field              = XVar.Clone(MVCFunctions.postvalue(new XVar("field")));
                    pageType           = XVar.Clone(MVCFunctions.postvalue(new XVar("pageType")));
                    outputAsAttachment = XVar.Clone(MVCFunctions.postvalue(new XVar("nodisp")) != 1);
                }
                if (GlobalVars.strTableName == XVar.Pack(""))
                {
                    if (XVar.Pack(!(XVar)(isPDF)))
                    {
                        MVCFunctions.Echo("<p>No table name received</p>");
                    }
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                if (field == XVar.Pack(""))
                {
                    if (XVar.Pack(!(XVar)(isPDF)))
                    {
                        MVCFunctions.Echo("<p>No field name received</p>");
                    }
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                if (XVar.Pack(!(XVar)(CommonFunctions.GetTableURL((XVar)(GlobalVars.strTableName)))))
                {
                    MVCFunctions.Echo(new XVar(0));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                if (XVar.Pack(isPDF))
                {
                    requestAction = new XVar("GET");
                }
                else
                {
                    requestAction = XVar.Clone(MVCFunctions.postvalue("_action"));
                }
                _connection = XVar.Clone(GlobalVars.cman.byTable((XVar)(GlobalVars.strTableName)));
                pSet        = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(GlobalVars.strTableName), (XVar)(pageType)));
                if (XVar.Pack(!(XVar)(isPDF)))
                {
                    CommonFunctions.add_nocache_headers();
                }
                Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", CommonFunctions.GetTableURL((XVar)(GlobalVars.strTableName)), ""),
                                                                            "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null);
                if (requestAction == "POST")
                {
                    havePermission = XVar.Clone((XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Add"))) || (XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Edit"))));
                }
                else
                {
                    havePermission = XVar.Clone((XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search"))) || (XVar)(MVCFunctions.postvalue(new XVar("fkey"))));
                }
                if ((XVar)((XVar)(!(XVar)(CommonFunctions.isLogged())) && (XVar)(pageType != Constants.PAGE_REGISTER)) || (XVar)(!(XVar)(havePermission)))
                {
                    MVCFunctions.HeaderRedirect(new XVar("login"), new XVar(""), new XVar("message=expired"));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                upload_handler          = XVar.Clone(new UploadHandler((XVar)(CommonFunctions.getOptionsForMultiUpload((XVar)(pSet), (XVar)(field)))));
                upload_handler.pSet     = XVar.Clone(pSet);
                upload_handler.field    = XVar.Clone(field);
                upload_handler.table    = XVar.Clone(GlobalVars.strTableName);
                upload_handler.pageType = XVar.Clone(pageType);
                switch (((XVar)requestAction).ToString())
                {
                case "DELETE":
                    CommonFunctions.printMFHandlerHeaders();
                    formStamp = XVar.Clone(MVCFunctions.postvalue(new XVar("formStamp")));
                    if (formStamp != XVar.Pack(""))
                    {
                        upload_handler.formStamp = XVar.Clone(formStamp);
                        upload_handler.delete();
                    }
                    break;

                case "POST":
                    CommonFunctions.printMFHandlerHeaders();
                    formStamp = XVar.Clone(MVCFunctions.postvalue(new XVar("formStamp")));
                    if (formStamp != XVar.Pack(""))
                    {
                        upload_handler.formStamp = XVar.Clone(formStamp);
                        upload_handler.post();
                    }
                    break;

                case "GET":
                default:
                    if (XVar.Pack(isPDF))
                    {
                        isDBFile = XVar.Clone(var_params.KeyExists("filename"));
                        fileName = XVar.Clone((XVar.Pack(var_params.KeyExists("file")) ? XVar.Pack(var_params["file"]) : XVar.Pack(var_params["filename"])));
                    }
                    else
                    {
                        isDBFile  = XVar.Clone(MVCFunctions.postvalue(new XVar("filename")) != "");
                        fileName  = XVar.Clone((XVar.Pack(MVCFunctions.postvalue(new XVar("file")) != "") ? XVar.Pack(MVCFunctions.postvalue(new XVar("file"))) : XVar.Pack(MVCFunctions.postvalue(new XVar("filename")))));
                        formStamp = XVar.Clone(MVCFunctions.postvalue(new XVar("fkey")));
                    }
                    if (fileName == XVar.Pack(""))
                    {
                        MVCFunctions.Echo(new XVar(""));
                        return(MVCFunctions.GetBuferContentAndClearBufer());
                    }
                    sessionFile = new XVar(null);
                    fsFileName  = new XVar("");
                    if ((XVar)(!(XVar)(isDBFile)) && (XVar)(formStamp != XVar.Pack("")))
                    {
                        sessionFile = XVar.Clone(XSession.Session[MVCFunctions.Concat("mupload_", formStamp)][fileName]["file"]);
                    }
                    else
                    {
                        dynamic i = null, keys = XVar.Array(), qResult = null, queryObj = null, strWhereClause = null, tKeys = XVar.Array();
                        keys  = XVar.Clone(XVar.Array());
                        tKeys = XVar.Clone(pSet.getTableKeys());
                        i     = new XVar(0);
                        for (; i < MVCFunctions.count(tKeys); i++)
                        {
                            if (XVar.Pack(isPDF))
                            {
                                keys.InitAndSetArrayItem(var_params[MVCFunctions.Concat("key", i + 1)], tKeys[i]);
                            }
                            else
                            {
                                keys.InitAndSetArrayItem(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("key", i + 1))), tKeys[i]);
                            }
                        }
                        strWhereClause = XVar.Clone(CommonFunctions.KeyWhere((XVar)(keys)));
                        if (pSet.getAdvancedSecurityType() != Constants.ADVSECURITY_ALL)
                        {
                            strWhereClause = XVar.Clone(CommonFunctions.whereAdd((XVar)(strWhereClause), (XVar)(CommonFunctions.SecuritySQL(new XVar("Search")))));
                        }
                        queryObj = XVar.Clone(pSet.getSQLQuery().CloneObject());
                        if (XVar.Pack(!(XVar)(queryObj.HasGroupBy())))
                        {
                            queryObj.RemoveAllFieldsExcept((XVar)(pSet.getFieldIndex((XVar)(field))));
                        }
                        qResult = XVar.Clone(_connection.query((XVar)(queryObj.gSQLWhere((XVar)(strWhereClause)))));
                        if (XVar.Pack(isDBFile))
                        {
                            if (XVar.Pack(qResult))
                            {
                                dynamic data = XVar.Array();
                                data = XVar.Clone(qResult.fetchAssoc());
                                if (XVar.Pack(data))
                                {
                                    value = XVar.Clone(_connection.stripSlashesBinary((XVar)(data[field])));
                                }
                            }
                        }
                        else
                        {
                            dynamic row = XVar.Array();
                            GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName), (XVar)(pSet)));
                            row = XVar.Clone(GlobalVars.cipherer.DecryptFetchedArray((XVar)(qResult.fetchAssoc())));
                            if (XVar.Pack(row))
                            {
                                dynamic filesArray = XVar.Array();
                                filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(row[field])));
                                if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0))
                                {
                                    if (row[field] == "")
                                    {
                                        filesArray = XVar.Clone(XVar.Array());
                                    }
                                    else
                                    {
                                        dynamic uploadedFile = XVar.Array();
                                        uploadedFile = XVar.Clone(upload_handler.get_file_object((XVar)(row[field])));
                                        if (XVar.Pack(uploadedFile == null))
                                        {
                                            filesArray = XVar.Clone(XVar.Array());
                                        }
                                        else
                                        {
                                            filesArray = XVar.Clone(new XVar(0, MVCFunctions.my_json_decode((XVar)(MVCFunctions.my_json_encode((XVar)(uploadedFile))))));
                                        }
                                    }
                                }
                                foreach (KeyValuePair <XVar, dynamic> uploadedFile in filesArray.GetEnumerator())
                                {
                                    if (uploadedFile.Value["usrName"] == fileName)
                                    {
                                        sessionFile = XVar.Clone(uploadedFile.Value);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    iconShowed = new XVar(false);
                    if (XVar.Pack(isDBFile))
                    {
                        ftype = new XVar("");
                        if (pSet.getViewFormat((XVar)(field)) == Constants.FORMAT_DATABASE_IMAGE)
                        {
                            if (XVar.Pack(!(XVar)(value)))
                            {
                                value = XVar.Clone(MVCFunctions.myfile_get_contents(new XVar("images/no_image.gif")));
                            }
                            ftype = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(value)));
                        }
                        if (XVar.Pack(!(XVar)(ftype)))
                        {
                            ftype = XVar.Clone(CommonFunctions.getContentTypeByExtension((XVar)(MVCFunctions.substr((XVar)(fileName), (XVar)(MVCFunctions.strrpos((XVar)(fileName), new XVar(".")))))));
                        }
                        fsize = XVar.Clone(MVCFunctions.strlen_bin((XVar)(value)));
                    }
                    else
                    {
                        if (sessionFile != null)
                        {
                            dynamic isSRC = null, isThumbnail = null;
                            isThumbnail = new XVar(false);
                            isSRC       = new XVar(false);
                            if (XVar.Pack(isPDF))
                            {
                                isThumbnail = XVar.Clone(var_params.KeyExists("thumbnail"));
                                isSRC       = XVar.Clone(var_params.KeyExists("src"));
                            }
                            else
                            {
                                isThumbnail = XVar.Clone(MVCFunctions.postvalue(new XVar("thumbnail")) != "");
                                isSRC       = XVar.Clone(MVCFunctions.postvalue(new XVar("src")) == 1);
                            }
                            if (MVCFunctions.postvalue(new XVar("icon")) != "")
                            {
                                fsFileName = XVar.Clone(MVCFunctions.Concat("images/icons/", CommonFunctions.getIconByFileType((XVar)(sessionFile["type"]), (XVar)(sessionFile["name"]))));
                                fsize      = XVar.Clone(MVCFunctions.filesize((XVar)(MVCFunctions.getabspath((XVar)(fsFileName)))));
                                ftype      = new XVar("image/png");
                            }
                            else
                            {
                                if ((XVar)((XVar)(isThumbnail) && (XVar)(sessionFile["thumbnail"])) && (XVar)(MVCFunctions.GDExist()))
                                {
                                    fsFileName = XVar.Clone(sessionFile["thumbnail"]);
                                    fsize      = XVar.Clone(sessionFile["thumbnail_size"]);
                                    ftype      = XVar.Clone(sessionFile["thumbnail_type"]);
                                }
                                else
                                {
                                    if ((XVar)((XVar)(false) && (XVar)((XVar)(pageType == Constants.PAGE_EDIT) || (XVar)(pageType == Constants.PAGE_ADD))) && (XVar)(isSRC))
                                    {
                                        iconShowed = new XVar(true);
                                        fsFileName = XVar.Clone(MVCFunctions.Concat("images/icons/", CommonFunctions.getIconByFileType((XVar)(sessionFile["type"]), (XVar)(sessionFile["name"]))));
                                        fsize      = XVar.Clone(MVCFunctions.filesize((XVar)(MVCFunctions.getabspath((XVar)(fsFileName)))));
                                        ftype      = new XVar("image/png");
                                    }
                                    else
                                    {
                                        fsFileName = XVar.Clone(sessionFile["name"]);
                                        fsize      = XVar.Clone(sessionFile["size"]);
                                        ftype      = XVar.Clone(sessionFile["type"]);
                                    }
                                }
                            }
                        }
                    }
                    if ((XVar)((XVar)(isDBFile) && (XVar)(value)) || (XVar)(fsFileName != XVar.Pack("")))
                    {
                        dynamic norange = null;
                        if (XVar.Pack(!(XVar)(isDBFile)))
                        {
                            if ((XVar)((XVar)(!(XVar)(pSet.isAbsolute((XVar)(field)))) && (XVar)(!(XVar)(MVCFunctions.isAbsolutePath((XVar)(fsFileName))))) || (XVar)(iconShowed))
                            {
                                fsFileName = XVar.Clone(MVCFunctions.getabspath((XVar)(fsFileName)));
                            }
                            if (XVar.Pack(!(XVar)(MVCFunctions.myfile_exists((XVar)(fsFileName)))))
                            {
                                fsFileName = XVar.Clone(MVCFunctions.getabspath(new XVar("images/no_image.gif")));
                                fsize      = XVar.Clone(MVCFunctions.filesize((XVar)(fsFileName)));
                                ftype      = new XVar("image/gif");
                            }
                        }
                        if (XVar.Pack(isPDF))
                        {
                            dynamic file = null;
                            if (XVar.Pack(isDBFile))
                            {
                                file = XVar.Clone(value);
                            }
                            else
                            {
                                file = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(fsFileName)));
                            }
                            return(MVCFunctions.GetBuferContentAndClearBufer());
                        }
                        norange = XVar.Clone(MVCFunctions.postvalue(new XVar("norange")) == 1);
                        if (MVCFunctions.postvalue(new XVar("norange")) == 1)
                        {
                            MVCFunctions.Header("Accept-Ranges", "none");
                            MVCFunctions.Header("Cache-Control", "private");
                            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Type: ", ftype)));
                            MVCFunctions.Header("Access-Control-Allow-Methods", "HEAD, GET, POST");
                            if (XVar.Pack(outputAsAttachment))
                            {
                                MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=\"", fileName, "\"")));
                            }
                            MVCFunctions.SendContentLength((XVar)(fsize));
                            if (MVCFunctions.GetServerVariable("REQUEST_METHOD") == "HEAD")
                            {
                                MVCFunctions.Echo(new XVar(""));
                                return(MVCFunctions.GetBuferContentAndClearBufer());
                            }
                            if (XVar.Pack(isDBFile))
                            {
                                MVCFunctions.echoBinary((XVar)(value));
                            }
                            else
                            {
                                MVCFunctions.printfile((XVar)(fsFileName));
                            }
                        }
                        else
                        {
                            dynamic httpRange = null, printContentLength = null, range = null, range_orig = null, seek_end = null, seek_start = null, size_unit = null, tmparr = XVar.Array();
                            size_unit  = new XVar("");
                            range_orig = new XVar("");
                            httpRange  = XVar.Clone(MVCFunctions.GetHttpRange());
                            if (XVar.Pack(MVCFunctions.preg_match(new XVar("/^bytes=((\\d*-\\d*,? ?)+)$/"), (XVar)(httpRange))))
                            {
                                tmparr     = XVar.Clone(MVCFunctions.explode(new XVar("="), (XVar)(httpRange)));
                                size_unit  = XVar.Clone(tmparr[0]);
                                range_orig = XVar.Clone(tmparr[1]);
                            }
                            if (size_unit == "bytes")
                            {
                                if (!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(range_orig), new XVar(","))), XVar.Pack(false)))
                                {
                                    dynamic extra_ranges = null;
                                    tmparr       = XVar.Clone(MVCFunctions.explode(new XVar(","), (XVar)(range_orig)));
                                    range        = XVar.Clone(tmparr[0]);
                                    extra_ranges = XVar.Clone(tmparr[1]);
                                }
                                else
                                {
                                    range = XVar.Clone(range_orig);
                                }
                            }
                            else
                            {
                                range = new XVar("-");
                            }
                            tmparr     = XVar.Clone(MVCFunctions.explode(new XVar("-"), (XVar)(range)));
                            seek_start = XVar.Clone(tmparr[0]);
                            seek_end   = XVar.Clone(tmparr[1]);
                            seek_end   = XVar.Clone((XVar.Pack(MVCFunctions.strlen((XVar)(seek_end)) == 0) ? XVar.Pack(fsize - 1) : XVar.Pack(MVCFunctions.min((XVar)(MVCFunctions.abs((XVar)(MVCFunctions.intval((XVar)(seek_end))))), (XVar)(fsize - 1)))));
                            seek_start = XVar.Clone((XVar.Pack((XVar)(MVCFunctions.strlen((XVar)(seek_start)) == 0) || (XVar)(seek_end < MVCFunctions.abs((XVar)(MVCFunctions.intval((XVar)(seek_start)))))) ? XVar.Pack(0) : XVar.Pack(MVCFunctions.max((XVar)(MVCFunctions.abs((XVar)(MVCFunctions.intval((XVar)(seek_start))))), new XVar(0)))));
                            if ((XVar)(XVar.Pack(0) < seek_start) || (XVar)(seek_end < fsize - 1))
                            {
                                MVCFunctions.Header(new XVar("HTTP/1.1 206 Partial Content"));
                            }
                            MVCFunctions.Header("Accept-Ranges", "bytes");
                            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Range: bytes ", seek_start, "-", seek_end, "/", fsize)));
                            if (XVar.Pack(outputAsAttachment))
                            {
                                MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=\"", fileName, "\"")));
                            }
                            printContentLength = new XVar(true);
                            if (XVar.Pack(printContentLength))
                            {
                                MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Length: ", (seek_end - seek_start) + 1)));
                            }
                            MVCFunctions.Header("Cache-Control", "cache, must-revalidate");
                            MVCFunctions.Header("Pragma", "public");
                            MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Type: ", ftype)));
                            if (MVCFunctions.GetServerVariable("REQUEST_METHOD") == "HEAD")
                            {
                                MVCFunctions.Echo(new XVar(""));
                                return(MVCFunctions.GetBuferContentAndClearBufer());
                            }
                            if (XVar.Pack(isDBFile))
                            {
                                MVCFunctions.echoBinaryPartial((XVar)(value), (XVar)(seek_start), (XVar)(seek_end));
                            }
                            else
                            {
                                MVCFunctions.printfileByRange((XVar)(fsFileName), (XVar)(seek_start), (XVar)(seek_end));
                            }
                        }
                    }
                    break;
                }
                MVCFunctions.Echo(new XVar(""));
                return(MVCFunctions.GetBuferContentAndClearBufer());
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Ejemplo n.º 14
0
 public XVar lookupsuggest()
 {
     try
     {
         dynamic LookupSQL = null, LookupSQLTable = null, LookupType = null, contextParams = XVar.Array(), data = XVar.Array(), displayFieldIndex = null, displayFieldName = 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, 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();
         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)));
         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._ABCSecurity")
         {
             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;
             checkResult = new XVar(true);
             if (field == "username")
             {
                 checkResult = new XVar(false);
             }
             if (field == "password")
             {
                 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 (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);
             }
         }
         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 = 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"]);
         var_response      = XVar.Clone(XVar.Array());
         qResult           = XVar.Clone(lookupConnection.query((XVar)(LookupSQL)));
         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);
             }
             var_response.InitAndSetArrayItem(data[linkFieldIndex], null);
             var_response.InitAndSetArrayItem(data[displayFieldIndex], 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)); }
 }
Ejemplo n.º 15
0
 public XVar download()
 {
     try
     {
         dynamic _connection = null, absFileName = null, ctype = null, data = XVar.Array(), ext = null, field = null, fieldsArr = XVar.Array(), filename = null, keys = XVar.Array(), keysArr = XVar.Array(), qResult = null, sql = null, strfilesize = null, table = null, where = null;
         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)(!(XVar)(CommonFunctions.isLogged())) || (XVar)(!(XVar)(CommonFunctions.CheckSecurity((XVar)(XSession.Session[MVCFunctions.Concat("_", GlobalVars.strTableName, "_OwnerID")]), new XVar("Search")))))
         {
             MVCFunctions.HeaderRedirect(new XVar("login"));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         field = XVar.Clone(MVCFunctions.postvalue(new XVar("field")));
         if (XVar.Pack(!(XVar)(GlobalVars.gSettings.checkFieldPermissions((XVar)(field)))))
         {
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         fieldsArr = XVar.Clone(GlobalVars.gSettings.getFieldsList());
         foreach (KeyValuePair <XVar, dynamic> f in fieldsArr.GetEnumerator())
         {
             dynamic fViewFormat = null;
             fViewFormat = XVar.Clone(GlobalVars.gSettings.getViewFormat((XVar)(f.Value)));
             if ((XVar)(field == f.Value) && (XVar)((XVar)((XVar)(fViewFormat != Constants.FORMAT_FILE) && (XVar)(fViewFormat != Constants.FORMAT_AUDIO)) && (XVar)(fViewFormat != Constants.FORMAT_VIDEO)))
             {
                 MVCFunctions.Echo(new XVar(0));
                 return(MVCFunctions.GetBuferContentAndClearBufer());
             }
         }
         _connection = XVar.Clone(GlobalVars.cman.byTable((XVar)(GlobalVars.strTableName)));
         keysArr     = XVar.Clone(GlobalVars.gSettings.getTableKeys());
         keys        = XVar.Clone(XVar.Array());
         foreach (KeyValuePair <XVar, dynamic> k in keysArr.GetEnumerator())
         {
             keys.InitAndSetArrayItem(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("key", k.Key + 1))), k.Value);
         }
         where = XVar.Clone(CommonFunctions.KeyWhere((XVar)(keys)));
         if (GlobalVars.gSettings.getAdvancedSecurityType() == Constants.ADVSECURITY_VIEW_OWN)
         {
             where = XVar.Clone(CommonFunctions.whereAdd((XVar)(where), (XVar)(CommonFunctions.SecuritySQL(new XVar("Search"), (XVar)(GlobalVars.strTableName)))));
         }
         sql     = XVar.Clone(GlobalVars.gQuery.gSQLWhere((XVar)(where)));
         qResult = XVar.Clone(_connection.query((XVar)(sql)));
         if (XVar.Pack(!(XVar)(qResult)))
         {
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         data = XVar.Clone(qResult.fetchAssoc());
         if (XVar.Pack(!(XVar)(data)))
         {
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         filename = XVar.Clone(data[field]);
         ext      = XVar.Clone(MVCFunctions.substr((XVar)(filename), (XVar)(MVCFunctions.strlen((XVar)(filename)) - 4)));
         ctype    = XVar.Clone(CommonFunctions.getContentTypeByExtension((XVar)(ext)));
         if (XVar.Pack(GlobalVars.gSettings.isAbsolute((XVar)(field))))
         {
             absFileName = XVar.Clone(MVCFunctions.Concat(GlobalVars.gSettings.getUploadFolder((XVar)(field)), filename));
         }
         else
         {
             absFileName = XVar.Clone(MVCFunctions.getabspath((XVar)(MVCFunctions.Concat(GlobalVars.gSettings.getUploadFolder((XVar)(field)), filename))));
         }
         if (XVar.Pack(!(XVar)(MVCFunctions.file_exists((XVar)(absFileName)))))
         {
             MVCFunctions.returnError404();
             MVCFunctions.Echo(new XVar(""));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         strfilesize = XVar.Clone(MVCFunctions.filesize((XVar)(absFileName)));
         if (XVar.Equals(XVar.Pack(strfilesize), XVar.Pack(false)))
         {
             MVCFunctions.returnError404();
             MVCFunctions.Echo(new XVar(""));
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Type: ", ctype)));
         MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Disposition: attachment;Filename=\"", filename, "\"")));
         MVCFunctions.Header("Cache-Control", "private");
         MVCFunctions.SendContentLength((XVar)(strfilesize));
         MVCFunctions.printfile((XVar)(absFileName));
         return(MVCFunctions.GetBuferContentAndClearBufer());
     }
     catch (RunnerRedirectException ex)
     { return(Redirect(ex.Message)); }
 }
Ejemplo n.º 16
0
 public XVar combo()
 {
     try
     {
         dynamic contentType = null, library = null, queryString = null, start = null, var_end = null, yuiComponents = XVar.Array(), yuiFiles = XVar.Array();
         GlobalVars.cCharset = new XVar("utf-8");
         queryString         = XVar.Clone(MVCFunctions.GetQueryString());
         if ((XVar)(!(XVar)(queryString as object != null)) || (XVar)(MVCFunctions.strlen((XVar)(queryString)) == 0))
         {
             return(MVCFunctions.GetBuferContentAndClearBufer());
         }
         yuiFiles      = XVar.Clone(MVCFunctions.explode(new XVar("&"), (XVar)(queryString)));
         contentType   = XVar.Clone((XVar.Pack(MVCFunctions.strpos((XVar)(yuiFiles[0]), new XVar(".js"))) ? XVar.Pack("application/x-javascript") : XVar.Pack(" text/css")));
         yuiComponents = XVar.Clone(XVar.Array());
         if (contentType == "application/x-javascript")
         {
             foreach (KeyValuePair <XVar, dynamic> yuiFile in yuiFiles.GetEnumerator())
             {
                 dynamic parts = XVar.Array();
                 parts = XVar.Clone(MVCFunctions.explode(new XVar("/"), (XVar)(yuiFile.Value)));
                 if (MVCFunctions.count(parts) == 4)
                 {
                     if ((XVar)((XVar)(parts.KeyExists(0)) && (XVar)(parts.KeyExists(1))) && (XVar)(parts.KeyExists(2)))
                     {
                         yuiComponents.InitAndSetArrayItem(MVCFunctions.Concat(parts[2], "/", parts[2]), null);
                     }
                     else
                     {
                         MVCFunctions.Echo((XVar)(MVCFunctions.Concat("<!-- Unable to determine module name! ", MVCFunctions.runner_htmlspecialchars((XVar)(yuiFile.Value)), " -->")));
                         return(MVCFunctions.GetBuferContentAndClearBufer());
                     }
                 }
                 else
                 {
                     start = XVar.Clone(MVCFunctions.strpos((XVar)(yuiFile.Value), new XVar("/build/")));
                     if (XVar.Equals(XVar.Pack(start), XVar.Pack(false)))
                     {
                         MVCFunctions.Echo((XVar)(MVCFunctions.Concat("<!-- Unable to determine module name! ", MVCFunctions.runner_htmlspecialchars((XVar)(yuiFile.Value)), " -->")));
                         return(MVCFunctions.GetBuferContentAndClearBufer());
                     }
                     start  += MVCFunctions.strlen(new XVar("/build/"));
                     var_end = XVar.Clone(MVCFunctions.strpos((XVar)(yuiFile.Value), new XVar(".js")));
                     if (XVar.Equals(XVar.Pack(var_end), XVar.Pack(false)))
                     {
                         MVCFunctions.Echo((XVar)(MVCFunctions.Concat("<!-- Unable to determine module name! ", MVCFunctions.runner_htmlspecialchars((XVar)(yuiFile.Value)), " -->")));
                         return(MVCFunctions.GetBuferContentAndClearBufer());
                     }
                     yuiComponents.InitAndSetArrayItem(MVCFunctions.substr((XVar)(yuiFile.Value), (XVar)(start), (XVar)(var_end - start)), null);
                 }
             }
             library = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(MVCFunctions.getabspath(new XVar("include/yui/yui.lib"))), new XVar("r")));
         }
         else
         {
             foreach (KeyValuePair <XVar, dynamic> yuiFile in yuiFiles.GetEnumerator())
             {
                 start = XVar.Clone(MVCFunctions.strpos((XVar)(yuiFile.Value), new XVar("/build/")));
                 if (XVar.Equals(XVar.Pack(start), XVar.Pack(false)))
                 {
                     MVCFunctions.Echo((XVar)(MVCFunctions.Concat("<!-- Unable to determine module name! ", MVCFunctions.runner_htmlspecialchars((XVar)(yuiFile.Value)), " -->")));
                     return(MVCFunctions.GetBuferContentAndClearBufer());
                 }
                 start += MVCFunctions.strlen(new XVar("/build/"));
                 yuiComponents.InitAndSetArrayItem(MVCFunctions.substr((XVar)(yuiFile.Value), (XVar)(start)), null);
             }
             library = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(MVCFunctions.getabspath(new XVar("include/yui/yuicss.lib"))), new XVar("r")));
         }
         MVCFunctions.Header("Cache-Control", "max-age=315360000");
         MVCFunctions.Header("Expires", "Thu, 29 Oct 2020 20:00:00 GMT");
         MVCFunctions.Header((XVar)(MVCFunctions.Concat("Content-Type: ", contentType)));
         foreach (KeyValuePair <XVar, dynamic> y in yuiComponents.GetEnumerator())
         {
             start = XVar.Clone(MVCFunctions.strpos((XVar)(library), (XVar)(MVCFunctions.Concat("begincombofile ", y.Value))));
             if (XVar.Equals(XVar.Pack(start), XVar.Pack(false)))
             {
                 MVCFunctions.Echo((XVar)(MVCFunctions.Concat("Unknown file ", MVCFunctions.runner_htmlspecialchars((XVar)(y.Value)))));
                 return(MVCFunctions.GetBuferContentAndClearBufer());
             }
             start  += MVCFunctions.strlen((XVar)(MVCFunctions.Concat("begincombofile ", y.Value)));
             var_end = XVar.Clone(MVCFunctions.strpos((XVar)(library), new XVar("endcombofile"), (XVar)(start)));
             if (XVar.Equals(XVar.Pack(var_end), XVar.Pack(false)))
             {
                 MVCFunctions.Echo((XVar)(MVCFunctions.Concat("Unknown file ", MVCFunctions.runner_htmlspecialchars((XVar)(y.Value)))));
                 return(MVCFunctions.GetBuferContentAndClearBufer());
             }
             MVCFunctions.Echo(MVCFunctions.substr((XVar)(library), (XVar)(start), (XVar)(var_end - start)));
         }
         return(MVCFunctions.GetBuferContentAndClearBufer());
     }
     catch (RunnerRedirectException ex)
     { return(Redirect(ex.Message)); }
 }
Ejemplo n.º 17
0
        public ActionResult list()
        {
            try
            {
                dynamic options = XVar.Array(), pageObject = null;
                XTempl  xt;
                MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
                admin_members_Variables.Apply();
                if (XVar.Pack(!(XVar)(Security.processAdminPageSecurity(new XVar(false)))))
                {
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                {
                    TLayout t_layout = null;

                    t_layout                   = new TLayout(new XVar("admin_members_list_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version           = 3;
                    t_layout.bootstrapTheme    = "default";
                    t_layout.customCssPageName = "_admin_members_list";
                    t_layout.blocks["top"]     = XVar.Array();
                    t_layout.containers["top"] = XVar.Array();
                    t_layout.containers["top"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "menu"));
                    t_layout.containers["menu"] = XVar.Array();
                    t_layout.containers["menu"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "hdr"));
                    t_layout.containers["hdr"] = XVar.Array();
                    t_layout.containers["hdr"].Add(new XVar("name", "logo", "block", "logo_block", "substyle", 1));

                    t_layout.containers["hdr"].Add(new XVar("name", "bsnavbarcollapse", "block", "collapse_block", "substyle", 1));

                    t_layout.skins["hdr"] = "";


                    t_layout.containers["menu"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "menu_1"));
                    t_layout.containers["menu_1"] = XVar.Array();
                    t_layout.containers["menu_1"].Add(new XVar("name", "hmenu", "block", "menu_block", "substyle", 1));

                    t_layout.containers["menu_1"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "more"));
                    t_layout.containers["more"] = XVar.Array();
                    t_layout.containers["more"].Add(new XVar("name", "morebutton", "block", "more_list", "substyle", 1));

                    t_layout.containers["more"].Add(new XVar("name", "loggedas", "block", "security_block", "substyle", 1));

                    t_layout.skins["more"] = "";


                    t_layout.containers["menu_1"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "more_1"));
                    t_layout.containers["more_1"] = XVar.Array();
                    t_layout.containers["more_1"].Add(new XVar("name", "search", "block", "searchform_block", "substyle", 1));

                    t_layout.skins["more_1"] = "";


                    t_layout.skins["menu_1"] = "";


                    t_layout.skins["menu"] = "";


                    t_layout.containers["top"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "breadcrumbs"));
                    t_layout.containers["breadcrumbs"] = XVar.Array();
                    t_layout.containers["breadcrumbs"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "bc"));
                    t_layout.containers["bc"] = XVar.Array();
                    t_layout.containers["bc"].Add(new XVar("name", "breadcrumbs", "block", "breadcrumbs", "substyle", 1));

                    t_layout.skins["bc"] = "";


                    t_layout.skins["breadcrumbs"] = "";


                    t_layout.containers["top"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "messagerow"));
                    t_layout.containers["messagerow"] = XVar.Array();
                    t_layout.containers["messagerow"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "message"));
                    t_layout.containers["message"] = XVar.Array();
                    t_layout.containers["message"].Add(new XVar("name", "message", "block", "message_block", "substyle", 1));

                    t_layout.skins["message"] = "";


                    t_layout.skins["messagerow"] = "";


                    t_layout.containers["top"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "ugcontrols"));
                    t_layout.containers["ugcontrols"] = XVar.Array();
                    t_layout.containers["ugcontrols"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "save"));
                    t_layout.containers["save"] = XVar.Array();
                    t_layout.containers["save"].Add(new XVar("name", "ugbuttons", "block", "", "substyle", 1));

                    t_layout.skins["save"] = "";


                    t_layout.containers["ugcontrols"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "filter"));
                    t_layout.containers["filter"] = XVar.Array();
                    t_layout.containers["filter"].Add(new XVar("name", "ugmembersbuttons", "block", "", "substyle", 1));

                    t_layout.skins["filter"] = "";


                    t_layout.skins["ugcontrols"] = "";


                    t_layout.containers["top"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "permgrid"));
                    t_layout.containers["permgrid"] = XVar.Array();
                    t_layout.containers["permgrid"].Add(new XVar("name", "ugmemgrid", "block", "grid_block", "substyle", 1));

                    t_layout.skins["permgrid"] = "";


                    t_layout.containers["top"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "pagination"));
                    t_layout.containers["pagination"] = XVar.Array();
                    t_layout.containers["pagination"].Add(new XVar("name", "pagination", "block", "pagination_block", "substyle", 1));

                    t_layout.skins["pagination"] = "";


                    t_layout.skins["top"] = "";

                    t_layout.blocks["top"].Add("top");
                    GlobalVars.page_layouts["admin_members_list"] = t_layout;
                }

                xt      = XVar.UnPackXTempl(new XTempl());
                options = XVar.Clone(XVar.Array());
                options.InitAndSetArrayItem(Constants.PAGE_LIST, "pageType");
                options.InitAndSetArrayItem((XVar.Pack(CommonFunctions.postvalue_number(new XVar("id"))) ? XVar.Pack(CommonFunctions.postvalue_number(new XVar("id"))) : XVar.Pack(1)), "id");
                options.InitAndSetArrayItem(Constants.MEMBERS_PAGE, "mode");
                options.InitAndSetArrayItem(xt, "xt");
                GlobalVars.pageObject = XVar.Clone(ListPage.createListPage((XVar)(GlobalVars.strTableName), (XVar)(options)));
                if (MVCFunctions.postvalue(new XVar("a")) == "saveMembers")
                {
                    dynamic modifiedMembers = null;
                    modifiedMembers = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("values")))));
                    GlobalVars.pageObject.saveMembers((XVar)(modifiedMembers));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                GlobalVars.pageObject.prepareForBuildPage();
                GlobalVars.pageObject.showPage();
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Ejemplo n.º 18
0
        public XVar ug_group()
        {
            try
            {
                dynamic cbxNames = null, data = XVar.Array(), groupId = null, i = null, nonAdminTablesArr = XVar.Array(), realUsers = XVar.Array(), sql = null, state = XVar.Array(), ug_connection = null, var_error = null, wGroupTableName = null, wMemebersTableName = null;
                MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
                if (XVar.Pack(!(XVar)(CommonFunctions.isLogged())))
                {
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                if (XVar.Pack(!(XVar)(CommonFunctions.IsAdmin())))
                {
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                nonAdminTablesArr = XVar.Clone(XVar.Array());
                nonAdminTablesArr.InitAndSetArrayItem("dbo.DEPARTAMENTO", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.EMPLEADO", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.ESTADO_COMPESADO", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.ESTADO_PERSONALES", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.HORARIOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.Permisos2", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.PERMISOSGRUPOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.Preferencias", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.REGISTRO_HORAS_COMPESADAS", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.TIPOEMPLEADO", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.TIPOPERMISO", null);
                nonAdminTablesArr.InitAndSetArrayItem("APROBAR_PERMISOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("VISTOBUENO_JEFEINMEDIATO", null);
                nonAdminTablesArr.InitAndSetArrayItem("VISTOBUENO_JEFEDEPARTAMENTO", null);
                nonAdminTablesArr.InitAndSetArrayItem("VER_PERMISOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("Saldo_Horas_Empleado", null);
                nonAdminTablesArr.InitAndSetArrayItem("VER_COMPESADOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("APROBACION_COMPESADOS_JEFEINMEDIATO", null);
                nonAdminTablesArr.InitAndSetArrayItem("APROBACION_COMPESADOS_JEFEDEPARTAMENTO", null);
                nonAdminTablesArr.InitAndSetArrayItem("APROBAR_COMPESADOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("INGRESAR PERMISO", null);
                nonAdminTablesArr.InitAndSetArrayItem("INGRESAR_COMPESADO", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.GRUPOS", null);
                nonAdminTablesArr.InitAndSetArrayItem("dbo.acceso_ugmembers", null);
                nonAdminTablesArr.InitAndSetArrayItem("Licencias_sin_goce_sueldo", null);
                ug_connection   = XVar.Clone(GlobalVars.cman.getForUserGroups());
                cbxNames        = XVar.Clone(new XVar("add", new XVar("mask", "A", "rightName", "add"), "edt", new XVar("mask", "E", "rightName", "edit"), "del", new XVar("mask", "D", "rightName", "delete"), "lst", new XVar("mask", "S", "rightName", "list"), "exp", new XVar("mask", "P", "rightName", "export"), "imp", new XVar("mask", "I", "rightName", "import"), "adm", new XVar("mask", "M")));
                wGroupTableName = XVar.Clone(ug_connection.addTableWrappers(new XVar("dbo.acceso_uggroups")));
                switch (((XVar)MVCFunctions.postvalue(new XVar("a"))).ToString())
                {
                case "add":
                    sql = XVar.Clone(MVCFunctions.Concat("insert into ", wGroupTableName, " (", ug_connection.addFieldWrappers(new XVar("Label")), ")", " values (", ug_connection.prepareString((XVar)(MVCFunctions.postvalue(new XVar("name")))), ")"));
                    ug_connection.exec((XVar)(sql));
                    sql  = XVar.Clone(MVCFunctions.Concat("select max(", ug_connection.addFieldWrappers(new XVar("GroupID")), ") from ", wGroupTableName));
                    data = XVar.Clone(ug_connection.query((XVar)(sql)).fetchNumeric());
                    MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true, "id", data[0]))));
                    break;

                case "del":
                    sql = XVar.Clone(MVCFunctions.Concat("delete from ", wGroupTableName, " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id"))));
                    ug_connection.exec((XVar)(sql));
                    sql = XVar.Clone(MVCFunctions.Concat("delete from ", ug_connection.addTableWrappers(new XVar("dbo.acceso_ugrights")), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id"))));
                    ug_connection.exec((XVar)(sql));
                    sql = XVar.Clone(MVCFunctions.Concat("delete from ", ug_connection.addTableWrappers(new XVar("dbo.acceso_ugmembers")), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id"))));
                    ug_connection.exec((XVar)(sql));
                    MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true))));
                    break;

                case "rename":
                    sql = XVar.Clone(MVCFunctions.Concat("update ", wGroupTableName, " set ", ug_connection.addFieldWrappers(new XVar("Label")), "=", ug_connection.prepareString((XVar)(MVCFunctions.postvalue(new XVar("name")))), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", CommonFunctions.postvalue_number(new XVar("id"))));
                    ug_connection.exec((XVar)(sql));
                    MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(new XVar("success", true))));
                    break;

                case "saveRights":
                    var_error = new XVar("");
                    if (XVar.Pack(MVCFunctions.postvalue(new XVar("state"))))
                    {
                        dynamic allRights = XVar.Array(), delGroupId = null, qResult = null, realTables = XVar.Array(), rightsRow = null, wRightsTableName = null;
                        allRights = XVar.Clone(XVar.Array());
                        sql       = XVar.Clone(MVCFunctions.Concat("select ", ug_connection.addFieldWrappers(new XVar("GroupID")), ", ", ug_connection.addFieldWrappers(new XVar("TableName")), ", ", ug_connection.addFieldWrappers(new XVar("AccessMask")), " from ", wGroupTableName));
                        qResult   = XVar.Clone(ug_connection.query((XVar)(sql)));
                        while (XVar.Pack(rightsRow = XVar.Clone(qResult.fetchNumeric())))
                        {
                            allRights.InitAndSetArrayItem(rightsRow, null);
                        }
                        wRightsTableName = XVar.Clone(ug_connection.addTableWrappers(new XVar("dbo.acceso_ugrights")));
                        delGroupId       = new XVar(0);
                        state            = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("state")))));
                        foreach (KeyValuePair <XVar, dynamic> rightValue in allRights.GetEnumerator())
                        {
                            dynamic groupIDInt = null;
                            groupIDInt = XVar.Clone((int)rightValue.Value[0]);
                            if (groupIDInt == delGroupId)
                            {
                                continue;
                            }
                            if (XVar.Pack(!(XVar)(state.KeyExists(groupIDInt))))
                            {
                                sql = XVar.Clone(MVCFunctions.Concat("delete from ", wRightsTableName, " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", groupIDInt));
                                ug_connection.exec((XVar)(sql));
                            }
                            else
                            {
                                if (XVar.Pack(!(XVar)(state[groupIDInt].KeyExists(GetTableId((XVar)(data[1]))))))
                                {
                                    sql = XVar.Clone(MVCFunctions.Concat("delete from ", wRightsTableName, " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", groupIDInt, " and ", ug_connection.addFieldWrappers(new XVar("TableName")), "=", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(data[1]))))));
                                    ug_connection.exec((XVar)(sql));
                                }
                            }
                        }
                        realTables = XVar.Clone(GetRealValues());
                        foreach (KeyValuePair <XVar, dynamic> groupRights in state.GetEnumerator())
                        {
                            foreach (KeyValuePair <XVar, dynamic> mask in groupRights.Value.GetEnumerator())
                            {
                                dynamic ins = null;
                                if (XVar.Pack(!(XVar)(realTables.KeyExists(mask.Key))))
                                {
                                    continue;
                                }
                                ins = new XVar(true);
                                foreach (KeyValuePair <XVar, dynamic> rightValue in allRights.GetEnumerator())
                                {
                                    if ((XVar)(rightValue.Value[0] == groupRights.Key) && (XVar)(rightValue.Value[1] == realTables[mask.Key]))
                                    {
                                        ins = new XVar(false);
                                        if (data[2] != mask.Value)
                                        {
                                            sql = XVar.Clone(MVCFunctions.Concat("update", wRightsTableName, " set ", ug_connection.addFieldWrappers(new XVar("AccessMask")), "=", ug_connection.prepareString((XVar)(mask.Value)), " where ", ug_connection.addFieldWrappers(new XVar("GroupID")), "=", groupRights.Key, " and ", ug_connection.addFieldWrappers(new XVar("TableName")), "=", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realTables[mask.Key]))))));
                                            ug_connection.exec((XVar)(sql));
                                        }
                                    }
                                }
                                if (XVar.Pack(ins))
                                {
                                    sql = XVar.Clone(MVCFunctions.Concat("insert into ", wRightsTableName, " (", ug_connection.addFieldWrappers(new XVar("TableName")), ", ", ug_connection.addFieldWrappers(new XVar("GroupID")), ", ", ug_connection.addFieldWrappers(new XVar("AccessMask")), ") ", "values (", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realTables[mask.Key])))), ", ", groupRights.Key, ", ", ug_connection.prepareString((XVar)(mask.Value)), ")"));
                                    ug_connection.exec((XVar)(sql));
                                }
                                var_error = XVar.Clone(ug_connection.lastError());
                            }
                        }
                    }
                    getJSONResult((XVar)(var_error));
                    break;

                case "saveMembership":
                    var_error          = new XVar("");
                    groupId            = XVar.Clone(MVCFunctions.postvalue(new XVar("group")));
                    realUsers          = XVar.Clone(GetRealValues());
                    wMemebersTableName = XVar.Clone(ug_connection.addTableWrappers(new XVar("dbo.acceso_ugmembers")));
                    i = new XVar(0);
                    for (; i < MVCFunctions.count(realUsers); i++)
                    {
                        if (realUsers[i] != XSession.Session["UserID"])
                        {
                            sql = XVar.Clone(MVCFunctions.Concat("delete from ", wMemebersTableName, " where ", ug_connection.addFieldWrappers(new XVar("UserName")), "=%s"));
                        }
                        else
                        {
                            sql = XVar.Clone(MVCFunctions.Concat("delete from ", wMemebersTableName, " where ", ug_connection.addFieldWrappers(new XVar("UserName")), "=%s ", "and ", ug_connection.addFieldWrappers(new XVar("GroupID")), "<>-1"));
                        }
                        ug_connection.exec((XVar)(MVCFunctions.mysprintf((XVar)(sql), (XVar)(new XVar(0, ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realUsers[i])))))))));
                    }
                    if (XVar.Pack(MVCFunctions.postvalue(new XVar("state"))))
                    {
                        state = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("state")))));
                        foreach (KeyValuePair <XVar, dynamic> users in state.GetEnumerator())
                        {
                            foreach (KeyValuePair <XVar, dynamic> user in users.Value.GetEnumerator())
                            {
                                if (XVar.Pack(!(XVar)(realUsers.KeyExists(user.Value))))
                                {
                                    continue;
                                }
                                sql = XVar.Clone(MVCFunctions.Concat("insert into ", wMemebersTableName, " (", ug_connection.addFieldWrappers(new XVar("UserName")), ", ", ug_connection.addFieldWrappers(new XVar("GroupID")), ") values (", ug_connection.prepareString((XVar)(CommonFunctions.html_special_decode((XVar)(realUsers[user.Value])))), ", ", users.Key, ")"));
                                ug_connection.exec((XVar)(sql));
                                var_error = XVar.Clone(ug_connection.lastError());
                            }
                        }
                    }
                    getJSONResult((XVar)(var_error));
                    break;
                }
                return(MVCFunctions.GetBuferContentAndClearBufer());
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Ejemplo n.º 19
0
 public XVar autocomplete()
 {
     try
     {
         dynamic         contextParams = XVar.Array(), control = null, editControls = null, field = null, isExistParent = null, masterTable = null, mode = null, pageType = null, parentCtrlsData = null, respObj = null, shortTableName = null;
         ProjectSettings pSet;
         MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
         shortTableName = XVar.Clone(MVCFunctions.postvalue(new XVar("shortTName")));
         Assembly.GetExecutingAssembly().GetType(MVCFunctions.Concat("runnerDotNet.", MVCFunctions.Concat("", shortTableName, ""),
                                                                     "_Variables")).InvokeMember("Apply", BindingFlags.InvokeMethod, null, null, null);
         field = XVar.Clone(MVCFunctions.postvalue(new XVar("field")));
         if (GlobalVars.strTableName != "dbo._ABCSecurity")
         {
             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 checkField = null;
             checkField = new XVar(true);
             if (field == "username")
             {
                 checkField = new XVar(false);
             }
             if (field == "password")
             {
                 checkField = new XVar(false);
             }
             if (XVar.Pack(checkField))
             {
                 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());
                 }
             }
         }
         pageType            = XVar.Clone(MVCFunctions.postvalue(new XVar("pageType")));
         GlobalVars.cipherer = XVar.Clone(new RunnerCipherer((XVar)(GlobalVars.strTableName)));
         pSet          = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(GlobalVars.strTableName), (XVar)(pageType)));
         editControls  = XVar.Clone(new EditControlsContainer(new XVar(null), (XVar)(pSet), (XVar)(pageType), (XVar)(GlobalVars.cipherer)));
         control       = XVar.Clone(editControls.getControl((XVar)(field)));
         contextParams = XVar.Clone(XVar.Array());
         contextParams.InitAndSetArrayItem(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("data")))), "data");
         masterTable = XVar.Clone(MVCFunctions.postvalue(new XVar("masterTable")));
         if ((XVar)(masterTable != XVar.Pack("")) && (XVar)(XSession.Session.KeyExists(MVCFunctions.Concat(masterTable, "_masterRecordData"))))
         {
             dynamic masterControlsData = XVar.Array(), masterData = XVar.Array();
             masterData         = XVar.Clone(XSession.Session[MVCFunctions.Concat(masterTable, "_masterRecordData")]);
             masterControlsData = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("masterData")))));
             foreach (KeyValuePair <XVar, dynamic> mValue in masterControlsData.GetEnumerator())
             {
                 masterData.InitAndSetArrayItem(mValue.Value, mValue.Key);
             }
             contextParams.InitAndSetArrayItem(masterData, "masterData");
         }
         RunnerContext.push((XVar)(new RunnerContextItem(new XVar(Constants.CONTEXT_ROW), (XVar)(contextParams))));
         parentCtrlsData = XVar.Clone(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("parentCtrlsData")))));
         isExistParent   = XVar.Clone(MVCFunctions.postvalue(new XVar("isExistParent")));
         mode            = XVar.Clone(MVCFunctions.intval((XVar)(MVCFunctions.postvalue(new XVar("mode")))));
         respObj         = XVar.Clone(new XVar("success", true, "data", control.getLookupContentToReload((XVar)(XVar.Equals(XVar.Pack(isExistParent), XVar.Pack("1"))), (XVar)(mode), (XVar)(parentCtrlsData))));
         MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(respObj)));
         RunnerContext.pop();
         MVCFunctions.Echo(new XVar(""));
         return(MVCFunctions.GetBuferContentAndClearBufer());
     }
     catch (RunnerRedirectException ex)
     { return(Redirect(ex.Message)); }
 }
Ejemplo n.º 20
0
        public ActionResult export()
        {
            try
            {
                dynamic pageObject = null, strtablename = null, var_params = XVar.Array();
                XTempl  xt;
                MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
                admin_users_Variables.Apply();
                if (XVar.Pack(!(XVar)(Security.processPageSecurity((XVar)(strtablename), new XVar("P")))))
                {
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                {
                    TLayout t_layout = null;

                    t_layout                    = new TLayout(new XVar("export_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version            = 3;
                    t_layout.bootstrapTheme     = "default";
                    t_layout.customCssPageName  = "admin_users_export";
                    t_layout.blocks["top"]      = XVar.Array();
                    t_layout.containers["page"] = XVar.Array();
                    t_layout.containers["page"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "page_1"));
                    t_layout.containers["page_1"] = XVar.Array();
                    t_layout.containers["page_1"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "panel"));
                    t_layout.containers["panel"] = XVar.Array();
                    t_layout.containers["panel"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "header"));
                    t_layout.containers["header"] = XVar.Array();
                    t_layout.containers["header"].Add(new XVar("name", "exportheader", "block", "exportheader", "substyle", 1));

                    t_layout.skins["header"] = "";


                    t_layout.containers["panel"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "body"));
                    t_layout.containers["body"] = XVar.Array();
                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "range"));
                    t_layout.containers["range"] = XVar.Array();
                    t_layout.containers["range"].Add(new XVar("name", "bsexprange", "block", "range_block", "substyle", 1));

                    t_layout.skins["range"] = "";


                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "fields"));
                    t_layout.containers["fields"] = XVar.Array();
                    t_layout.containers["fields"].Add(new XVar("name", "bsexportchoosefields", "block", "choosefields", "substyle", 1));

                    t_layout.skins["fields"] = "";


                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "fields_1"));
                    t_layout.containers["fields_1"] = XVar.Array();
                    t_layout.containers["fields_1"].Add(new XVar("name", "bsexportformat", "block", "exportformat", "substyle", 1));

                    t_layout.skins["fields_1"] = "";


                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "fields_2"));
                    t_layout.containers["fields_2"] = XVar.Array();
                    t_layout.containers["fields_2"].Add(new XVar("name", "bsexpoutput", "block", "", "substyle", 1));

                    t_layout.skins["fields_2"] = "";


                    t_layout.containers["body"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "buttons"));
                    t_layout.containers["buttons"] = XVar.Array();
                    t_layout.containers["buttons"].Add(new XVar("name", "bsexpbuttons", "block", "exportbuttons", "substyle", 2));

                    t_layout.skins["buttons"] = "";


                    t_layout.skins["body"] = "";


                    t_layout.skins["panel"] = "";


                    t_layout.skins["page_1"] = "";


                    t_layout.skins["page"] = "";

                    t_layout.blocks["top"].Add("page");
                    GlobalVars.page_layouts["admin_users_export"] = t_layout;
                }

                xt         = XVar.UnPackXTempl(new XTempl());
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(CommonFunctions.postvalue_number(new XVar("id")), "id");
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName");
                var_params.InitAndSetArrayItem(Constants.PAGE_EXPORT, "pageType");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("page")), "pageName");
                if ((XVar)(!(XVar)(GlobalVars.eventObj.exists(new XVar("ListGetRowCount")))) && (XVar)(!(XVar)(GlobalVars.eventObj.exists(new XVar("ListQuery")))))
                {
                    var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
                }
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("exportFields")), "selectedFields");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("type")), "exportType");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("a")), "action");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("records")), "records");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("selection")), "selection");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("delimiter")), "csvDelimiter");
                if (MVCFunctions.postvalue(new XVar("txtformatting")) == "raw")
                {
                    var_params.InitAndSetArrayItem(true, "useRawValues");
                }
                var_params.InitAndSetArrayItem(ExportPage.readModeFromRequest(), "mode");
                GlobalVars.pageObject = XVar.Clone(new ExportPage((XVar)(var_params)));
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Ejemplo n.º 21
0
        public ActionResult import()
        {
            try
            {
                dynamic id = null, pageObject = null, strtablename = null, var_params = XVar.Array();
                XTempl  xt;
                ABC_Voting_Submitted1_Variables.Apply();
                MVCFunctions.Header("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
                Server.ScriptTimeout = 600;
                if (XVar.Pack(!(XVar)(Security.processPageSecurity((XVar)(strtablename), new XVar("I")))))
                {
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                {
                    TLayout t_layout = null;

                    t_layout                      = new TLayout(new XVar("import2"), new XVar("AvenueAvenue"), new XVar("MobileAvenue"));
                    t_layout.version              = 2;
                    t_layout.blocks["top"]        = XVar.Array();
                    t_layout.containers["import"] = XVar.Array();
                    t_layout.containers["import"].Add(new XVar("name", "importheader", "block", "", "substyle", 2));

                    t_layout.containers["import"].Add(new XVar("name", "errormessage", "block", "", "substyle", 1));

                    t_layout.containers["import"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "importfields"));
                    t_layout.containers["importfields"] = XVar.Array();
                    t_layout.containers["importfields"].Add(new XVar("name", "importheader_text", "block", "", "substyle", 1));

                    t_layout.containers["importfields"].Add(new XVar("name", "importfields", "block", "", "substyle", 1));

                    t_layout.containers["importfields"].Add(new XVar("name", "import_rawtext_control", "block", "", "substyle", 1));

                    t_layout.containers["importfields"].Add(new XVar("name", "import_preview", "block", "", "substyle", 1));

                    t_layout.containers["importfields"].Add(new XVar("name", "import_process", "block", "", "substyle", 1));

                    t_layout.containers["importfields"].Add(new XVar("name", "import_results", "block", "", "substyle", 1));

                    t_layout.containers["importfields"].Add(new XVar("name", "importbuttons", "block", "", "substyle", 2));

                    t_layout.skins["importfields"] = "fields";


                    t_layout.skins["import"] = "1";

                    t_layout.blocks["top"].Add("import");
                    GlobalVars.page_layouts["ABC_Voting_Submitted1_import"] = t_layout;

                    t_layout.skinsparams                        = XVar.Array();
                    t_layout.skinsparams["empty"]               = XVar.Array();
                    t_layout.skinsparams["empty"]["button"]     = "button2";
                    t_layout.skinsparams["menu"]                = XVar.Array();
                    t_layout.skinsparams["menu"]["button"]      = "button1";
                    t_layout.skinsparams["hmenu"]               = XVar.Array();
                    t_layout.skinsparams["hmenu"]["button"]     = "button1";
                    t_layout.skinsparams["undermenu"]           = XVar.Array();
                    t_layout.skinsparams["undermenu"]["button"] = "button1";
                    t_layout.skinsparams["fields"]              = XVar.Array();
                    t_layout.skinsparams["fields"]["button"]    = "button1";
                    t_layout.skinsparams["form"]                = XVar.Array();
                    t_layout.skinsparams["form"]["button"]      = "button1";
                    t_layout.skinsparams["1"]                   = XVar.Array();
                    t_layout.skinsparams["1"]["button"]         = "button1";
                    t_layout.skinsparams["2"]                   = XVar.Array();
                    t_layout.skinsparams["2"]["button"]         = "button1";
                    t_layout.skinsparams["3"]                   = XVar.Array();
                    t_layout.skinsparams["3"]["button"]         = "button1";
                }

                xt         = XVar.UnPackXTempl(new XTempl());
                id         = XVar.Clone(MVCFunctions.postvalue(new XVar("id")));
                id         = XVar.Clone((XVar.Pack(id != XVar.Pack("")) ? XVar.Pack(id) : XVar.Pack(1)));
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(id, "id");
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("a")), "action");
                var_params.InitAndSetArrayItem(Constants.PAGE_IMPORT, "pageType");
                var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
                var_params.InitAndSetArrayItem(GlobalVars.strOriginalTableName, "strOriginalTableName");
                if (var_params["action"] == "importPreview")
                {
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("importType")), "importType");
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("importText")), "importText");
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("useXHR")), "useXHR");
                }
                else
                {
                    if (var_params["action"] == "importData")
                    {
                        var_params.InitAndSetArrayItem(MVCFunctions.my_json_decode((XVar)(MVCFunctions.postvalue(new XVar("importData")))), "importData");
                    }
                }
                GlobalVars.pageObject = XVar.Clone(new ImportPage((XVar)(var_params)));
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }