Esempio n. 1
0
        public virtual XVar Logout(dynamic _param_redirectToLogin = null)
        {
            #region default values
            if (_param_redirectToLogin as Object == null)
            {
                _param_redirectToLogin = new XVar(false);
            }
            #endregion

            #region pass-by-value parameters
            dynamic redirectToLogin = XVar.Clone(_param_redirectToLogin);
            #endregion

            dynamic cookieName = null, username = null;
            if (XVar.Pack(this.auditObj))
            {
                this.auditObj.LogLogout();
            }
            username = XVar.Clone((XVar.Pack(XSession.Session["UserID"] != "Guest") ? XVar.Pack(XSession.Session["UserID"]) : XVar.Pack("")));
            XSession.Session.Remove("MyURL");
            Security.clearSecuritySession();
            if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("AfterLogout"))))
            {
                GlobalVars.globalEvents.AfterLogout((XVar)(username));
            }
            if (XVar.Pack(redirectToLogin))
            {
                MVCFunctions.HeaderRedirect((XVar)(MVCFunctions.Concat("", MVCFunctions.GetTableLink(new XVar("login")))));
                MVCFunctions.ob_flush();
                HttpContext.Current.Response.End();
                throw new RunnerInlineOutputException();
            }
            return(null);
        }
Esempio n. 2
0
        protected override XVar afterEditActionRedirect()
        {
            if (XVar.Pack(isPopupMode()))
            {
                return(false);
            }
            switch (((XVar)getAfterEditAction()).ToInt())
            {
            case Constants.AE_TO_EDIT:
                return(prgRedirect());

            case Constants.AE_TO_LIST:
                if (XVar.Pack(this.pSet.hasListPage()))
                {
                    MVCFunctions.HeaderRedirect((XVar)(this.shortTableName), new XVar(Constants.PAGE_LIST), new XVar("a=return"));
                }
                else
                {
                    MVCFunctions.HeaderRedirect(new XVar("menu"));
                }
                return(true);

            default:
                return(false);
            }
            return(null);
        }
Esempio n. 3
0
        public virtual XVar process()
        {
            dynamic redirect = null;

            if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("BeforeProcessLogin"))))
            {
                GlobalVars.globalEvents.BeforeProcessLogin(this);
            }
            redirect = XVar.Clone(getRedirectForMenuPage());
            if (XVar.Pack(redirect))
            {
                MVCFunctions.HeaderRedirect((XVar)(MVCFunctions.Concat("", redirect)));
                MVCFunctions.ob_flush();
                HttpContext.Current.Response.End();
                throw new RunnerInlineOutputException();
                return(null);
            }
            commonAssign();
            doCommonAssignments();
            if (XVar.Pack(isPD()))
            {
                hideWelcomeItemsIfEmpty((XVar)(this.pSet.welcomeItems()));
            }
            addButtonHandlers();
            addCommonJs();
            displayMenuPage();
            return(null);
        }
Esempio n. 4
0
 public override XVar rulePRG()
 {
     if ((XVar)(MVCFunctions.no_output_done()) && (XVar)(MVCFunctions.postvalue(new XVar("a")) == "save"))
     {
         MVCFunctions.HeaderRedirect((XVar)(this.shortTableName), (XVar)(getPageType()), new XVar("a=return"));
         MVCFunctions.ob_flush();
         HttpContext.Current.Response.End();
         throw new RunnerInlineOutputException();
     }
     return(null);
 }
Esempio n. 5
0
 protected virtual XVar redirectAfterSuccessfulLogin()
 {
     XSession.Session.Remove("MyURL");
     if (XVar.Pack(this.myurl))
     {
         MVCFunctions.HeaderRedirect((XVar)(MVCFunctions.Concat("", this.myurl)));
     }
     else
     {
         MVCFunctions.HeaderRedirect(new XVar("menu"));
     }
     return(null);
 }
Esempio n. 6
0
        public ChangePasswordPage(dynamic var_params = null)
            : base((XVar)var_params)
        {
            if (skipChangePasswordPageCtor)
            {
                skipChangePasswordPageCtor = false;
                return;
            }
            #region default values
            if (var_params as Object == null)
            {
                var_params = new XVar("");
            }
            #endregion

            if ((XVar)(!(XVar)(this.action)) && (XVar)(!(XVar)(checkToken())))
            {
                Security.saveRedirectURL();
                MVCFunctions.HeaderRedirect(new XVar("login"));
                return;
            }
            this.passwordField = XVar.Clone(CommonFunctions.GetPasswordField());
            this.usernameField = XVar.Clone(CommonFunctions.GetUserNameField());
            this.auditObj      = XVar.Clone(CommonFunctions.GetAuditObject());
            if (XVar.Pack(this.token))
            {
                this.changePwdFields = XVar.Clone(new XVar(0, "newpass", 1, "confirm"));
                setProxyValue(new XVar("token"), (XVar)(this.token));
            }
            else
            {
                this.changePwdFields = XVar.Clone(new XVar(0, "oldpass", 1, "newpass", 2, "confirm"));
            }
            this.pwdStrong = XVar.Clone(CommonFunctions.GetGlobalData(new XVar("pwdStrong"), new XVar(false)));
            if (XVar.Pack(this.pwdStrong))
            {
                this.settingsMap.InitAndSetArrayItem(true, "globalSettings", "pwdStrong");
                this.settingsMap.InitAndSetArrayItem(CommonFunctions.GetGlobalData(new XVar("pwdLen"), new XVar(0)), "globalSettings", "pwdLen");
                this.settingsMap.InitAndSetArrayItem(CommonFunctions.GetGlobalData(new XVar("pwdUnique"), new XVar(0)), "globalSettings", "pwdUnique");
                this.settingsMap.InitAndSetArrayItem(CommonFunctions.GetGlobalData(new XVar("pwdDigits"), new XVar(0)), "globalSettings", "pwdDigits");
                this.settingsMap.InitAndSetArrayItem(CommonFunctions.GetGlobalData(new XVar("pwdUpperLower"), new XVar(false)), "globalSettings", "pwdUpperLower");
            }
            this.formBricks.InitAndSetArrayItem("changeheader", "header");
            this.formBricks.InitAndSetArrayItem("changebuttons", "footer");
            assignFormFooterAndHeaderBricks(new XVar(true));
        }
Esempio n. 7
0
 protected virtual XVar readRecord()
 {
     if (XVar.Pack(getCurrentRecordInternal()))
     {
         return(true);
     }
     if (this.mode == Constants.VIEW_SIMPLE)
     {
         MVCFunctions.HeaderRedirect((XVar)(this.pSet.getShortTableName()), new XVar("list"), new XVar("a=return"));
         MVCFunctions.ob_flush();
         HttpContext.Current.Response.End();
         throw new RunnerInlineOutputException();
     }
     MVCFunctions.ob_flush();
     HttpContext.Current.Response.End();
     throw new RunnerInlineOutputException();
     return(false);
 }
Esempio n. 8
0
 protected override XVar prgRedirect()
 {
     if (XVar.Pack(this.stopPRG))
     {
         return(false);
     }
     if ((XVar)((XVar)(!(XVar)(this.updatedSuccessfully)) || (XVar)(!(XVar)(isSimpleMode()))) || (XVar)(!(XVar)(MVCFunctions.no_output_done())))
     {
         return(false);
     }
     XSession.Session["edit_seletion"]     = this.selection;
     XSession.Session["message_edit"]      = getMessages();
     XSession.Session["message_edit_type"] = this.messageType;
     MVCFunctions.HeaderRedirect((XVar)(this.pSet.getShortTableName()), (XVar)(getPageType()));
     MVCFunctions.ob_flush();
     HttpContext.Current.Response.End();
     throw new RunnerInlineOutputException();
     return(true);
 }
Esempio n. 9
0
        public static XVar redirectToList(dynamic _param_table)
        {
            #region pass-by-value parameters
            dynamic table = XVar.Clone(_param_table);
            #endregion

            dynamic settings = null;
            settings = XVar.Clone(new ProjectSettings((XVar)(table)));
            if (XVar.Pack(settings.hasListPage()))
            {
                MVCFunctions.HeaderRedirect((XVar)(settings.getShortTableName()), new XVar("list"), new XVar("a=return"));
                MVCFunctions.ob_flush();
                HttpContext.Current.Response.End();
                throw new RunnerInlineOutputException();
            }
            MVCFunctions.HeaderRedirect(new XVar("menu"));
            MVCFunctions.ob_flush();
            HttpContext.Current.Response.End();
            throw new RunnerInlineOutputException();
            return(null);
        }
Esempio n. 10
0
        public static XVar processPageSecurity(dynamic _param_table, dynamic _param_permission, dynamic _param_ajaxMode = null, dynamic _param_message = null)
        {
            #region default values
            if (_param_ajaxMode as Object == null)
            {
                _param_ajaxMode = new XVar(false);
            }
            if (_param_message as Object == null)
            {
                _param_message = new XVar("");
            }
            #endregion

            #region pass-by-value parameters
            dynamic table      = XVar.Clone(_param_table);
            dynamic permission = XVar.Clone(_param_permission);
            dynamic ajaxMode   = XVar.Clone(_param_ajaxMode);
            dynamic message    = XVar.Clone(_param_message);
            #endregion

            if (XVar.Pack(checkPagePermissions((XVar)(table), (XVar)(permission))))
            {
                return(true);
            }
            if (XVar.Pack(ajaxMode))
            {
                sendPermissionError((XVar)(message));
                return(false);
            }
            if ((XVar)(CommonFunctions.isLogged()) && (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())))
            {
                MVCFunctions.HeaderRedirect(new XVar("menu"));
                return(false);
            }
            CommonFunctions.redirectToLogin();
            return(false);
        }
Esempio n. 11
0
        public virtual XVar LogoutAndRedirect(dynamic _param_url = null)
        {
            #region default values
            if (_param_url as Object == null)
            {
                _param_url = new XVar("");
            }
            #endregion

            #region pass-by-value parameters
            dynamic url = XVar.Clone(_param_url);
            #endregion

            Logout();
            if (url == XVar.Pack(""))
            {
                url = XVar.Clone(MVCFunctions.GetTableLink(new XVar("menu")));
            }
            MVCFunctions.HeaderRedirect((XVar)(MVCFunctions.Concat("", url)));
            MVCFunctions.ob_flush();
            HttpContext.Current.Response.End();
            throw new RunnerInlineOutputException();
            return(null);
        }
Esempio n. 12
0
        public static XVar processAdminPageSecurity(dynamic _param_ajaxMode = null)
        {
            #region default values
            if (_param_ajaxMode as Object == null)
            {
                _param_ajaxMode = new XVar(false);
            }
            #endregion

            #region pass-by-value parameters
            dynamic ajaxMode = XVar.Clone(_param_ajaxMode);
            #endregion

            processLogoutRequest();
            if ((XVar)(!(XVar)(CommonFunctions.isLogged())) || (XVar)(CommonFunctions.isLoggedAsGuest()))
            {
                tryRelogin();
            }
            if (XVar.Pack(CommonFunctions.IsAdmin()))
            {
                return(true);
            }
            if (XVar.Pack(ajaxMode))
            {
                sendPermissionError();
                return(false);
            }
            if ((XVar)(CommonFunctions.isLogged()) && (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())))
            {
                MVCFunctions.HeaderRedirect(new XVar("menu"));
                return(false);
            }
            saveRedirectURL();
            CommonFunctions.redirectToLogin();
            return(false);
        }
Esempio n. 13
0
        public ActionResult menu()
        {
            try
            {
                dynamic pageObject = null, var_params = XVar.Array();
                XTempl  xt;
                Security.processLogoutRequest();
                if (XVar.Pack(!(XVar)(CommonFunctions.isLogged())))
                {
                    MVCFunctions.HeaderRedirect(new XVar("login"));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                if ((XVar)(XSession.Session["MyURL"] == "") || (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())))
                {
                    Security.saveRedirectURL();
                }
                {
                    TLayout t_layout = null;

                    t_layout                    = new TLayout(new XVar("menu_bootstrap1"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version            = 3;
                    t_layout.bootstrapTheme     = "default";
                    t_layout.customCssPageName  = "_menu";
                    t_layout.blocks["top"]      = XVar.Array();
                    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", "login"));
                    t_layout.containers["login"] = XVar.Array();
                    t_layout.containers["login"].Add(new XVar("name", "morebutton", "block", "more_list", "substyle", 1));

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

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


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


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

                    t_layout.blocks["top"].Add("menu");
                    t_layout.containers["center"] = XVar.Array();
                    t_layout.containers["center"].Add(new XVar("name", "welcome", "block", "", "substyle", 1));

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

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

                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_dbo_Permisos2(), "dbo.Permisos2");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_dbo_REGISTRO_HORAS_COMPESADAS(), "dbo.REGISTRO_HORAS_COMPESADAS");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_APROBAR_PERMISOS(), "APROBAR_PERMISOS");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_VISTOBUENO_JEFEINMEDIATO(), "VISTOBUENO_JEFEINMEDIATO");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_VISTOBUENO_JEFEDEPARTAMENTO(), "VISTOBUENO_JEFEDEPARTAMENTO");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_VER_PERMISOS(), "VER_PERMISOS");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_APROBACION_COMPESADOS_JEFEINMEDIATO(), "APROBACION_COMPESADOS_JEFEINMEDIATO");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_APROBACION_COMPESADOS_JEFEDEPARTAMENTO(), "APROBACION_COMPESADOS_JEFEDEPARTAMENTO");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_APROBAR_COMPESADOS(), "APROBAR_COMPESADOS");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_INGRESAR_PERMISO(), "INGRESAR PERMISO");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_INGRESAR_COMPESADO(), "INGRESAR_COMPESADO");
                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(Constants.GLOBAL_PAGES, "tName");
                var_params.InitAndSetArrayItem(Constants.PAGE_MENU, "pageType");
                var_params.InitAndSetArrayItem(GlobalVars.isGroupSecurity, "isGroupSecurity");
                var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("page")), "pageName");
                GlobalVars.pageObject = XVar.Clone(new MenuPage((XVar)(var_params)));
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Esempio n. 14
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)); }
        }
Esempio n. 15
0
        public ActionResult search()
        {
            try
            {
                dynamic accessGranted = null, chrt_array = XVar.Array(), cname = null, id = null, layoutVersion = null, pageMode = null, pageObject = null, rname = null, templatefile = null, var_params = XVar.Array();
                XTempl  xt;
                CommonFunctions.add_nocache_headers();
                dbo_GRUPOS_Variables.Apply();
                Security.processLogoutRequest();
                if (XVar.Pack(!(XVar)(CommonFunctions.isLogged())))
                {
                    Security.saveRedirectURL();
                    CommonFunctions.redirectToLogin();
                }
                cname         = XVar.Clone(MVCFunctions.postvalue(new XVar("cname")));
                rname         = XVar.Clone(MVCFunctions.postvalue(new XVar("rname")));
                accessGranted = XVar.Clone(CommonFunctions.CheckTablePermissions((XVar)(GlobalVars.strTableName), new XVar("S")));
                if (XVar.Pack(!(XVar)(accessGranted)))
                {
                    MVCFunctions.HeaderRedirect(new XVar("menu"));
                }
                {
                    TLayout t_layout = null;

                    t_layout                          = new TLayout(new XVar("search_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version                  = 3;
                    t_layout.bootstrapTheme           = "default";
                    t_layout.customCssPageName        = "dbo_GRUPOS_search";
                    t_layout.blocks["top"]            = XVar.Array();
                    t_layout.containers["searchpage"] = XVar.Array();
                    t_layout.containers["searchpage"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "header"));
                    t_layout.containers["header"] = XVar.Array();
                    t_layout.containers["header"].Add(new XVar("name", "bssearchheader", "block", "searchheader", "substyle", 1));

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


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

                    t_layout.blocks["top"].Add("searchpage");
                    t_layout.containers["fields"] = XVar.Array();
                    t_layout.containers["fields"].Add(new XVar("name", "bssearchfields", "block", "", "substyle", 1));

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

                    t_layout.blocks["top"].Add("fields");
                    t_layout.containers["bottombuttons"] = XVar.Array();
                    t_layout.containers["bottombuttons"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "bbuttons"));
                    t_layout.containers["bbuttons"] = XVar.Array();
                    t_layout.containers["bbuttons"].Add(new XVar("name", "wrapper", "block", "", "substyle", 1, "container", "leftbuttons"));
                    t_layout.containers["leftbuttons"] = XVar.Array();
                    t_layout.containers["leftbuttons"].Add(new XVar("name", "srchbuttons", "block", "searchbuttons", "substyle", 1));

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


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


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

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

                xt       = XVar.UnPackXTempl(new XTempl());
                pageMode = XVar.Clone(SearchPage.readSearchModeFromRequest());
                if (pageMode == Constants.SEARCH_LOAD_CONTROL)
                {
                    layoutVersion = XVar.Clone(MVCFunctions.postvalue(new XVar("layoutVersion")));
                }
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(CommonFunctions.postvalue_number(new XVar("id")), "id");
                var_params.InitAndSetArrayItem(pageMode, "mode");
                var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("page")), "pageName");
                var_params.InitAndSetArrayItem(Constants.PAGE_SEARCH, "pageType");
                var_params.InitAndSetArrayItem(cname, "chartName");
                var_params.InitAndSetArrayItem(rname, "reportName");
                var_params.InitAndSetArrayItem(templatefile, "templatefile");
                var_params.InitAndSetArrayItem("dbo_GRUPOS", "shortTableName");
                var_params.InitAndSetArrayItem(layoutVersion, "layoutVersion");
                var_params.InitAndSetArrayItem((XVar.Pack(MVCFunctions.postvalue(new XVar("searchControllerId"))) ? XVar.Pack(MVCFunctions.postvalue(new XVar("searchControllerId"))) : XVar.Pack(id)), "searchControllerId");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("ctrlField")), "ctrlField");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("isNeedSettings")), "needSettings");
                if (pageMode == Constants.SEARCH_DASHBOARD)
                {
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("table")), "dashTName");
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("dashelement")), "dashElementName");
                }
                var_params.InitAndSetArrayItem(SearchPage.getExtraPageParams(), "extraPageParams");
                GlobalVars.pageObject = XVar.Clone(new SearchPage((XVar)(var_params)));
                if (pageMode == Constants.SEARCH_LOAD_CONTROL)
                {
                    GlobalVars.pageObject.displaySearchControl();
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                if (pageMode == Constants.SEARCH_DASHBOARD)
                {
                    MVCFunctions.Echo(new XVar(""));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Esempio n. 16
0
        public ActionResult search()
        {
            try
            {
                dynamic accessGranted = null, chrt_array = XVar.Array(), cname = null, id = null, layoutVersion = null, mode = null, pageObject = null, rname = null, templatefile = null, var_params = XVar.Array();
                XTempl  xt;
                dbo__ABCReports_Variables.Apply();
                CommonFunctions.add_nocache_headers();
                Security.processLogoutRequest();
                if (XVar.Pack(!(XVar)(CommonFunctions.isLogged())))
                {
                    Security.saveRedirectURL();
                    CommonFunctions.redirectToLogin();
                }
                cname         = XVar.Clone(MVCFunctions.postvalue(new XVar("cname")));
                rname         = XVar.Clone(MVCFunctions.postvalue(new XVar("rname")));
                accessGranted = XVar.Clone(CommonFunctions.CheckTablePermissions((XVar)(GlobalVars.strTableName), new XVar("S")));
                if (XVar.Pack(!(XVar)(accessGranted)))
                {
                    MVCFunctions.HeaderRedirect(new XVar("menu"));
                }
                {
                    TLayout t_layout = null;

                    t_layout                      = new TLayout(new XVar("search2"), new XVar("AvenueAvenue"), new XVar("MobileAvenue"));
                    t_layout.version              = 2;
                    t_layout.blocks["top"]        = XVar.Array();
                    t_layout.containers["search"] = XVar.Array();
                    t_layout.containers["search"].Add(new XVar("name", "srchheader", "block", "searchheader", "substyle", 2));

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

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

                    t_layout.containers["fields"].Add(new XVar("name", "srchbuttons", "block", "searchbuttons", "substyle", 2));

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


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

                    t_layout.blocks["top"].Add("search");
                    GlobalVars.page_layouts["dbo__ABCReports_search"] = 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(id) : XVar.Pack(1)));
                mode = new XVar(Constants.SEARCH_SIMPLE);
                if (MVCFunctions.postvalue(new XVar("mode")) == "dashsearch")
                {
                    mode = new XVar(Constants.SEARCH_DASHBOARD);
                }
                else
                {
                    if (MVCFunctions.postvalue(new XVar("mode")) == "inlineLoadCtrl")
                    {
                        mode          = new XVar(Constants.SEARCH_LOAD_CONTROL);
                        layoutVersion = XVar.Clone(MVCFunctions.postvalue(new XVar("layoutVersion")));
                    }
                }
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(id, "id");
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(mode, "mode");
                var_params.InitAndSetArrayItem(cname, "chartName");
                var_params.InitAndSetArrayItem(rname, "reportName");
                var_params.InitAndSetArrayItem(GlobalVars.strTableName, "tName");
                var_params.InitAndSetArrayItem(Constants.PAGE_SEARCH, "pageType");
                var_params.InitAndSetArrayItem(templatefile, "templatefile");
                var_params.InitAndSetArrayItem("dbo__ABCReports", "shortTableName");
                var_params.InitAndSetArrayItem(layoutVersion, "layoutVersion");
                var_params.InitAndSetArrayItem((XVar.Pack(MVCFunctions.postvalue(new XVar("searchControllerId"))) ? XVar.Pack(MVCFunctions.postvalue(new XVar("searchControllerId"))) : XVar.Pack(id)), "searchControllerId");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("ctrlField")), "ctrlField");
                var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("isNeedSettings")), "needSettings");
                if (mode == Constants.SEARCH_DASHBOARD)
                {
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("table")), "dashTName");
                    var_params.InitAndSetArrayItem(MVCFunctions.postvalue(new XVar("dashelement")), "dashElementName");
                }
                var_params.InitAndSetArrayItem(SearchPage.getExtraPageParams(), "extraPageParams");
                GlobalVars.pageObject = XVar.Clone(new SearchPage((XVar)(var_params)));
                if (mode == Constants.SEARCH_LOAD_CONTROL)
                {
                    GlobalVars.pageObject.displaySearchControl();
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                if (mode == Constants.SEARCH_DASHBOARD)
                {
                    MVCFunctions.Echo(new XVar(""));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Esempio n. 17
0
        public ActionResult changepwd()
        {
            try
            {
                dynamic pageObject = null, token = null, var_params = XVar.Array();
                XTempl  xt;
                token = XVar.Clone(MVCFunctions.postvalue(new XVar("token")));
                if ((XVar)(!(XVar)(token)) && (XVar)((XVar)(!(XVar)(CommonFunctions.isLogged())) || (XVar)(XSession.Session["UserID"] == "<Guest>")))
                {
                    Security.saveRedirectURL();
                    MVCFunctions.HeaderRedirect(new XVar("login"), new XVar(""), new XVar("message=expired"));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                {
                    TLayout t_layout = null;

                    t_layout                    = new TLayout(new XVar("changepwd_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version            = 3;
                    t_layout.bootstrapTheme     = "default";
                    t_layout.customCssPageName  = "_changepwd";
                    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", "changeheader", "block", "changeheader", "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", "header_1"));
                    t_layout.containers["header_1"] = XVar.Array();
                    t_layout.containers["header_1"].Add(new XVar("name", "message", "block", "message_block", "substyle", 1));

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


                    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", "changefields", "block", "", "substyle", 1));

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


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

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


                    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["changepwd"] = t_layout;
                }

                {
                    TLayout t_layout = null;

                    t_layout                    = new TLayout(new XVar("changepwd_success_bootstrap"), new XVar("OfficeOffice"), new XVar("MobileOffice"));
                    t_layout.version            = 3;
                    t_layout.bootstrapTheme     = "default";
                    t_layout.customCssPageName  = "_changepwd_success";
                    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", "changeheader", "block", "changeheader", "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", "header_1"));
                    t_layout.containers["header_1"] = XVar.Array();
                    t_layout.containers["header_1"].Add(new XVar("name", "changepwd_message", "block", "", "substyle", 1));

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


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

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


                    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["changepwd_success"] = t_layout;
                }

                xt         = XVar.UnPackXTempl(new XTempl());
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(token, "token");
                var_params.InitAndSetArrayItem(CommonFunctions.postvalue_number(new XVar("id")), "id");
                var_params.InitAndSetArrayItem(GlobalVars.cLoginTable, "tName");
                var_params.InitAndSetArrayItem(Constants.GLOBAL_PAGES, "pageTable");
                var_params.InitAndSetArrayItem(Constants.PAGE_CHANGEPASS, "pageType");
                var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
                var_params.InitAndSetArrayItem(ChangePasswordPage.readActionFromRequest(), "action");
                GlobalVars.pageObject = XVar.Clone(new ChangePasswordPage((XVar)(var_params)));
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.process();
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Esempio n. 18
0
        public ActionResult menu()
        {
            try
            {
                dynamic id = null, pageObject = null, redirect = null, var_params = XVar.Array();
                XTempl  xt;
                Security.processLogoutRequest();
                if (XVar.Pack(!(XVar)(CommonFunctions.isLogged())))
                {
                    MVCFunctions.HeaderRedirect(new XVar("login"));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                if ((XVar)(XSession.Session["MyURL"] == "") || (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())))
                {
                    Security.saveRedirectURL();
                }
                {
                    TLayout t_layout = null;

                    t_layout                    = new TLayout(new XVar("menu2"), new XVar("AvenueAvenue"), new XVar("MobileAvenue"));
                    t_layout.version            = 2;
                    t_layout.blocks["top"]      = XVar.Array();
                    t_layout.containers["menu"] = XVar.Array();
                    t_layout.containers["menu"].Add(new XVar("name", "login_menu", "block", "loggedas_block", "substyle", 2));

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

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

                    t_layout.blocks["top"].Add("menu");
                    GlobalVars.page_layouts["menu"] = 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";
                }

                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_dbo__ABCVotes(), "dbo._ABCVotes");
                GlobalVars.tableEvents.InitAndSetArrayItem(new eventclass_ABC_Voting_My_Voting(), "ABC_Voting_My_Voting");
                xt         = XVar.UnPackXTempl(new XTempl());
                id         = XVar.Clone((XVar.Pack(!XVar.Equals(XVar.Pack(MVCFunctions.postvalue(new XVar("id"))), XVar.Pack(""))) ? XVar.Pack(MVCFunctions.postvalue(new XVar("id"))) : XVar.Pack(1)));
                var_params = XVar.Clone(XVar.Array());
                var_params.InitAndSetArrayItem(id, "id");
                var_params.InitAndSetArrayItem(xt, "xt");
                var_params.InitAndSetArrayItem(Constants.NOT_TABLE_BASED_TNAME, "tName");
                var_params.InitAndSetArrayItem(Constants.PAGE_MENU, "pageType");
                var_params.InitAndSetArrayItem("menu.cshtml", "templatefile");
                var_params.InitAndSetArrayItem(GlobalVars.isGroupSecurity, "isGroupSecurity");
                var_params.InitAndSetArrayItem(false, "needSearchClauseObj");
                GlobalVars.pageObject = XVar.Clone(new RunnerPage((XVar)(var_params)));
                GlobalVars.pageObject.init();
                GlobalVars.pageObject.commonAssign();
                if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("BeforeProcessMenu"))))
                {
                    GlobalVars.globalEvents.BeforeProcessMenu((XVar)(GlobalVars.pageObject));
                }
                GlobalVars.pageObject.body["begin"] = MVCFunctions.Concat(GlobalVars.pageObject.body["begin"], CommonFunctions.GetBaseScriptsForPage(new XVar(false)));
                GlobalVars.pageObject.addCommonJs();
                GlobalVars.pageObject.fillSetCntrlMaps();
                GlobalVars.pageObject.setLangParams();
                xt.assign(new XVar("id"), (XVar)(id));
                xt.assign(new XVar("username"), (XVar)(XSession.Session["UserName"]));
                xt.assign(new XVar("changepwd_link"), (XVar)((XVar)(XSession.Session["AccessLevel"] != Constants.ACCESS_LEVEL_GUEST) && (XVar)(XSession.Session["fromFacebook"] == false)));
                xt.assign(new XVar("changepwdlink_attrs"), (XVar)(MVCFunctions.Concat("onclick=\"window.location.href='", MVCFunctions.GetTableLink(new XVar("changepwd")), "';return false;\"")));
                xt.assign(new XVar("logoutlink_attrs"), (XVar)(MVCFunctions.Concat("id=\"logoutButton", id, "\"")));
                xt.assign(new XVar("guestloginlink_attrs"), (XVar)(MVCFunctions.Concat("id=\"loginButton", id, "\"")));
                xt.assign(new XVar("loggedas_block"), (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())));
                xt.assign(new XVar("loggedas_message"), (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest())));
                xt.assign(new XVar("logout_link"), new XVar(true));
                xt.assign(new XVar("guestloginbutton"), (XVar)(CommonFunctions.isLoggedAsGuest()));
                xt.assign(new XVar("logoutbutton"), (XVar)((XVar)(CommonFunctions.isSingleSign()) && (XVar)(!(XVar)(CommonFunctions.isLoggedAsGuest()))));
                redirect = XVar.Clone(GlobalVars.pageObject.getRedirectForMenuPage());
                if (XVar.Pack(redirect))
                {
                    MVCFunctions.HeaderRedirect((XVar)(MVCFunctions.Concat("", redirect)));
                    MVCFunctions.Echo(new XVar(""));
                    return(MVCFunctions.GetBuferContentAndClearBufer());
                }
                xt.assign(new XVar("menu_block"), new XVar(true));
                if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("BeforeShowMenu"))))
                {
                    new Func <XVar>(() => { var GlobalVars_pageObject_templatefile_byref = GlobalVars.pageObject.templatefile; var result = GlobalVars.globalEvents.BeforeShowMenu((XVar)(xt), ref GlobalVars_pageObject_templatefile_byref, (XVar)(GlobalVars.pageObject)); GlobalVars.pageObject.templatefile = GlobalVars_pageObject_templatefile_byref; return(result); }).Invoke();
                }
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "<script>");
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "window.controlsMap = ", MVCFunctions.my_json_encode((XVar)(GlobalVars.pageObject.controlsHTMLMap)), ";");
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "window.viewControlsMap = ", MVCFunctions.my_json_encode((XVar)(GlobalVars.pageObject.viewControlsHTMLMap)), ";");
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "Runner.applyPagesData( ", MVCFunctions.my_json_encode((XVar)(GlobalVars.pagesData)), " );");
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "window.settings = ", MVCFunctions.my_json_encode((XVar)(GlobalVars.pageObject.jsSettings)), ";</script>");
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "<script type=\"text/javascript\" src=\"", MVCFunctions.GetRootPathForResources(new XVar("include/runnerJS/RunnerAll.js")), "\"></script>");
                GlobalVars.pageObject.body["end"] = MVCFunctions.Concat(GlobalVars.pageObject.body["end"], "<script>", GlobalVars.pageObject.PrepareJS(), "</script>");
                xt.assignbyref(new XVar("body"), (XVar)(GlobalVars.pageObject.body));
                GlobalVars.pageObject.display((XVar)(GlobalVars.pageObject.templatefile));
                ViewBag.xt = xt;
                return(View(xt.GetViewPath()));
            }
            catch (RunnerRedirectException ex)
            { return(Redirect(ex.Message)); }
        }
Esempio n. 19
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)); }
 }