Exemplo n.º 1
0
        public virtual XVar prepareWordOrExcelTemplate(dynamic _param_contents)
        {
            #region pass-by-value parameters
            dynamic contents = XVar.Clone(_param_contents);
            #endregion

            dynamic pos1 = null;
            pos1 = new XVar(0);
            while (!XVar.Equals(XVar.Pack(pos1), XVar.Pack(false)))
            {
                pos1 = XVar.Clone(MVCFunctions.stripos((XVar)(contents), new XVar("<link "), (XVar)(pos1)));
                if (!XVar.Equals(XVar.Pack(pos1), XVar.Pack(false)))
                {
                    dynamic pos2 = null;
                    pos2 = XVar.Clone(MVCFunctions.strpos((XVar)(contents), new XVar(">"), (XVar)(pos1)));
                    if (!(XVar)(pos2) == false)
                    {
                        contents = XVar.Clone(MVCFunctions.Concat(MVCFunctions.substr((XVar)(contents), new XVar(0), (XVar)(pos1)), MVCFunctions.substr((XVar)(contents), (XVar)(pos2 + 1))));
                    }
                }
            }
            contents = XVar.Clone(MVCFunctions.str_ireplace((XVar)(MVCFunctions.Concat("<img src=\"/", MVCFunctions.GetRootPathForResources(new XVar("images/spacer.gif")), "\">")), new XVar(""), (XVar)(contents)));
            contents = XVar.Clone(MVCFunctions.str_ireplace((XVar)(MVCFunctions.Concat("<img src=\"/", MVCFunctions.GetRootPathForResources(new XVar("images/spacer.gif")), "\"/>")), new XVar(""), (XVar)(contents)));
            contents = XVar.Clone(MVCFunctions.str_ireplace(new XVar("<img src=\"@webRootPath/images/spacer.gif\" />"), new XVar(""), (XVar)(contents)));
            return(contents);
        }
Exemplo n.º 2
0
        protected virtual XVar getFirstSearchWordData(dynamic _param_searchWords, dynamic _param_notContentPositions, dynamic _param_value)
        {
            #region pass-by-value parameters
            dynamic searchWords         = XVar.Clone(_param_searchWords);
            dynamic notContentPositions = XVar.Clone(_param_notContentPositions);
            dynamic value = XVar.Clone(_param_value);
            #endregion

            dynamic firstPos = null, firstSearchWord = null, hasTags = null, tagPattern = null;
            hasTags         = new XVar(false);
            firstSearchWord = new XVar("");
            firstPos        = XVar.Clone(MVCFunctions.strlen((XVar)(value)));
            tagPattern      = XVar.Clone(MVCFunctions.Concat("/(<[^=>]+\\s*(?:(?:[^=>]+=\\s*'[^']+'\\s*)|", "(?:[^=>]+=\\s*\"[^\"]+\"\\s*)", ")*>)/iU"));
            foreach (KeyValuePair <XVar, dynamic> searchWord in searchWords.GetEnumerator())
            {
                dynamic matches = null, pos = null;
                pos     = XVar.Clone(MVCFunctions.strpos((XVar)(value), (XVar)(searchWord.Value)));
                hasTags = new XVar(true);
                if (XVar.Pack(!(XVar)(MVCFunctions.preg_match((XVar)(tagPattern), (XVar)(searchWord.Value), (XVar)(matches)))))
                {
                    while ((XVar)(notInContent((XVar)(pos), (XVar)(notContentPositions))) && (XVar)(!XVar.Equals(XVar.Pack(pos), XVar.Pack(false))))
                    {
                        pos = XVar.Clone(MVCFunctions.strpos((XVar)(value), (XVar)(searchWord.Value), (XVar)(pos + 1)));
                    }
                    hasTags = new XVar(false);
                }
                if ((XVar)(!XVar.Equals(XVar.Pack(pos), XVar.Pack(false))) && (XVar)(pos < firstPos))
                {
                    firstPos        = XVar.Clone(pos);
                    firstSearchWord = XVar.Clone(searchWord.Value);
                }
            }
            return(new XVar("position", (XVar.Pack(firstPos != MVCFunctions.strlen((XVar)(value))) ? XVar.Pack(firstPos) : XVar.Pack(false)), "searchWord", firstSearchWord, "hasTags", hasTags));
        }
Exemplo n.º 3
0
 protected override XVar getPageFields()
 {
     if (XVar.Equals(XVar.Pack(this.updSelectedFields), XVar.Pack(null)))
     {
         dynamic denyDuplicateFields = XVar.Array(), updateFields = XVar.Array();
         this.updSelectedFields = XVar.Clone(MVCFunctions.array_diff((XVar)(this.pSet.getUpdateSelectedFields()), (XVar)(this.pSet.getTableKeys())));
         denyDuplicateFields    = XVar.Clone(XVar.Array());
         foreach (KeyValuePair <XVar, dynamic> f in this.updSelectedFields.GetEnumerator())
         {
             if (XVar.Pack(!(XVar)(this.pSet.allowDuplicateValues((XVar)(f.Value)))))
             {
                 denyDuplicateFields.InitAndSetArrayItem(f.Value, null);
             }
         }
         this.updSelectedFields = XVar.Clone(MVCFunctions.array_diff((XVar)(this.updSelectedFields), (XVar)(denyDuplicateFields)));
         updateFields           = XVar.Clone(XVar.Array());
         foreach (KeyValuePair <XVar, dynamic> f in this.updSelectedFields.GetEnumerator())
         {
             dynamic editFormat = null;
             editFormat = XVar.Clone(this.pSet.getEditFormat((XVar)(f.Value)));
             if (editFormat != Constants.EDIT_FORMAT_FILE)
             {
                 updateFields.InitAndSetArrayItem(f.Value, null);
             }
         }
         this.updSelectedFields = XVar.Clone(updateFields);
     }
     return(this.updSelectedFields);
 }
Exemplo n.º 4
0
        public override XVar SecuritySQL(dynamic _param_strAction, dynamic _param_table = null)
        {
            #region default values
            if (_param_table as Object == null)
            {
                _param_table = new XVar("");
            }
            #endregion

            #region pass-by-value parameters
            dynamic strAction = XVar.Clone(_param_strAction);
            dynamic table     = XVar.Clone(_param_table);
            #endregion

            dynamic strPerm = null;
            if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(table)))))
            {
                table = XVar.Clone(GlobalVars.strTableName);
            }
            strPerm = XVar.Clone(CommonFunctions.GetUserPermissions((XVar)(table)));
            if (XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(strPerm), new XVar("S"))), XVar.Pack(false)))
            {
                strPerm = MVCFunctions.Concat(strPerm, "S");
            }
            return(CommonFunctions.SecuritySQL((XVar)(strAction), (XVar)(table), (XVar)(strPerm)));
        }
Exemplo n.º 5
0
        public virtual XVar MakeDBValue(dynamic _param_field, dynamic _param_value, dynamic _param_controltype = null, dynamic _param_phpEncryptionOnly = null)
        {
            #region default values
            if (_param_controltype as Object == null)
            {
                _param_controltype = new XVar("");
            }
            if (_param_phpEncryptionOnly as Object == null)
            {
                _param_phpEncryptionOnly = new XVar(false);
            }
            #endregion

            #region pass-by-value parameters
            dynamic field             = XVar.Clone(_param_field);
            dynamic value             = XVar.Clone(_param_value);
            dynamic controltype       = XVar.Clone(_param_controltype);
            dynamic phpEncryptionOnly = XVar.Clone(_param_phpEncryptionOnly);
            #endregion

            dynamic ret = null;
            ret = XVar.Clone(CommonFunctions.prepare_for_db((XVar)(field), (XVar)(value), (XVar)(controltype), new XVar(""), (XVar)(this.strTableName)));
            if (XVar.Equals(XVar.Pack(ret), XVar.Pack(false)))
            {
                return(ret);
            }
            ret = XVar.Clone(CommonFunctions.add_db_quotes((XVar)(field), (XVar)(EncryptField((XVar)(field), (XVar)(ret))), (XVar)(this.strTableName)));
            if (XVar.Pack(phpEncryptionOnly))
            {
                return(ret);
            }
            return(EncryptValueByDB((XVar)(field), (XVar)(ret)));
        }
Exemplo n.º 6
0
        public override XVar SQLWhere(dynamic _param_SearchFor, dynamic _param_strSearchOption, dynamic _param_SearchFor2, dynamic _param_etype, dynamic _param_isSuggest)
        {
            #region pass-by-value parameters
            dynamic SearchFor       = XVar.Clone(_param_SearchFor);
            dynamic strSearchOption = XVar.Clone(_param_strSearchOption);
            dynamic SearchFor2      = XVar.Clone(_param_SearchFor2);
            dynamic etype           = XVar.Clone(_param_etype);
            dynamic isSuggest       = XVar.Clone(_param_isSuggest);
            #endregion

            dynamic baseResult = null, gstrField = null;
            baseResult = XVar.Clone(baseSQLWhere((XVar)(strSearchOption)));
            if (XVar.Equals(XVar.Pack(baseResult), XVar.Pack(false)))
            {
                return("");
            }
            if (baseResult != XVar.Pack(""))
            {
                return(baseResult);
            }
            if (XVar.Pack(CommonFunctions.IsCharType((XVar)(this.var_type))))
            {
                gstrField = XVar.Clone(getFieldSQLDecrypt());
                if ((XVar)((XVar)(!(XVar)(this.btexttype)) && (XVar)(!(XVar)(this.pageObject.cipherer.isFieldPHPEncrypted((XVar)(this.field))))) && (XVar)(this.pageObject.pSetEdit.getNCSearch()))
                {
                    gstrField = XVar.Clone(this.connection.upper((XVar)(gstrField)));
                }
            }
            else
            {
                if ((XVar)(strSearchOption == "Contains") || (XVar)(strSearchOption == "Starts with"))
                {
                    gstrField = XVar.Clone(this.connection.field2char((XVar)(getFieldSQLDecrypt()), (XVar)(this.var_type)));
                }
                else
                {
                    gstrField = XVar.Clone(getFieldSQLDecrypt());
                }
            }
            if ((XVar)(strSearchOption == "Contains") || (XVar)(strSearchOption == "Starts with"))
            {
                SearchFor = XVar.Clone(this.connection.escapeLIKEpattern((XVar)(SearchFor)));
            }
            if (strSearchOption == "Contains")
            {
                SearchFor = XVar.Clone(MVCFunctions.Concat("%", SearchFor, "%"));
            }
            else
            {
                if (strSearchOption == "Starts with")
                {
                    SearchFor = XVar.Clone(MVCFunctions.Concat(SearchFor, "%"));
                }
            }
            if ((XVar)((XVar)(strSearchOption == "Contains") || (XVar)(strSearchOption == "Starts with")) || (XVar)(strSearchOption == "Equals"))
            {
                return(buildWhere((XVar)(gstrField), (XVar)(SearchFor), (XVar)(strSearchOption == "Equals")));
            }
            return("");
        }
Exemplo n.º 7
0
        public virtual XVar updateTablePermissions(dynamic _param_table, dynamic _param_group, dynamic _param_mask)
        {
            #region pass-by-value parameters
            dynamic table = XVar.Clone(_param_table);
            dynamic group = XVar.Clone(_param_group);
            dynamic mask  = XVar.Clone(_param_mask);
            #endregion

            dynamic accessMaskWFieldName = null, data = XVar.Array(), groupWhere = null, groupisWFieldName = null, rightWTableName = null, sql = null, tableNameWFieldName = null;
            rightWTableName      = XVar.Clone(this.connection.addTableWrappers(new XVar("ugrights")));
            accessMaskWFieldName = XVar.Clone(this.connection.addFieldWrappers(new XVar("")));
            groupisWFieldName    = XVar.Clone(this.connection.addFieldWrappers(new XVar("")));
            tableNameWFieldName  = XVar.Clone(this.connection.addFieldWrappers(new XVar("")));
            groupWhere           = XVar.Clone(MVCFunctions.Concat(groupisWFieldName, "=", group, " and ", tableNameWFieldName, "=", this.connection.prepareString((XVar)(table))));
            sql  = XVar.Clone(MVCFunctions.Concat("select ", accessMaskWFieldName, " from ", rightWTableName, "where", groupWhere));
            data = XVar.Clone(this.connection.query((XVar)(sql)).fetchNumeric());
            if (XVar.Pack(data))
            {
                dynamic correctedMask = null, pageMask = null, savedMask = null;
                savedMask     = XVar.Clone(data[0]);
                pageMask      = XVar.Clone(this.pageMasks[table]);
                correctedMask = new XVar("");
                foreach (KeyValuePair <XVar, dynamic> t in this.permissionNames.GetEnumerator())
                {
                    if (!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(pageMask), (XVar)(t.Key))), XVar.Pack(false)))
                    {
                        if (!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(mask), (XVar)(t.Key))), XVar.Pack(false)))
                        {
                            correctedMask = MVCFunctions.Concat(correctedMask, t.Key);
                        }
                    }
                    else
                    {
                        if (!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(savedMask), (XVar)(t.Key))), XVar.Pack(false)))
                        {
                            correctedMask = MVCFunctions.Concat(correctedMask, t.Key);
                        }
                    }
                }
                mask = XVar.Clone(correctedMask);
                if (XVar.Pack(MVCFunctions.strlen((XVar)(mask))))
                {
                    sql = XVar.Clone(MVCFunctions.Concat("update ", rightWTableName, " set ", accessMaskWFieldName, "='", mask, "',", tableNameWFieldName, "=", this.connection.prepareString((XVar)(table)), " where ", groupWhere));
                }
                else
                {
                    sql = XVar.Clone(MVCFunctions.Concat("delete from ", rightWTableName, " where ", groupWhere));
                }
            }
            else
            {
                if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(mask)))))
                {
                    return(null);
                }
                sql = XVar.Clone(MVCFunctions.Concat("insert into ", rightWTableName, " (", groupisWFieldName, ", ", tableNameWFieldName, ", ", accessMaskWFieldName, ")", " values (", group, ", ", this.connection.prepareString((XVar)(table)), ", '", mask, "')"));
            }
            this.connection.exec((XVar)(sql));
            return(null);
        }
Exemplo n.º 8
0
        public override XVar getPdfValue(dynamic data, dynamic _param_keylink = null)
        {
            #region default values
            if (_param_keylink as Object == null)
            {
                _param_keylink = new XVar("");
            }
            #endregion

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

            dynamic imageType = null, width = null;
            if (XVar.Pack(!(XVar)(data[this.field])))
            {
                return("\"\"");
            }
            width = XVar.Clone(this.container.pSet.getImageWidth((XVar)(this.field)));
            if (XVar.Pack(!(XVar)(width)))
            {
                width = new XVar(100);
                if (XVar.Equals(XVar.Pack(this.container.pageType), XVar.Pack(Constants.PAGE_VIEW)))
                {
                    width = new XVar(300);
                }
            }
            imageType = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(data[this.field])));
            if ((XVar)(imageType == "image/jpeg") || (XVar)(imageType == "image/png"))
            {
                return(MVCFunctions.Concat("{ \r\n\t\t\t\timage: \"", CommonFunctions.jsreplace((XVar)(MVCFunctions.Concat("data:", imageType, ";base64,", MVCFunctions.base64_encode((XVar)(data[this.field]))))), "\",\r\n\t\t\t\twidth: ", width, ", \r\n\t\t\t\theight: ", this.container.pSet.getImageHeight((XVar)(this.field)), " \r\n\t\t\t}"));
            }
            return("\"\"");
        }
Exemplo n.º 9
0
        public virtual XVar getSortBySettings()
        {
            dynamic sortSettings = XVar.Array();

            if (!XVar.Equals(XVar.Pack(this._cachedSortBySettings), XVar.Pack(null)))
            {
                return(this._cachedSortBySettings);
            }
            sortSettings = XVar.Clone(this.pSet.getSortControlSettingsJSONString());
            sortSettings = XVar.Clone(MVCFunctions.my_json_decode((XVar)(sortSettings)));
            if ((XVar)(!(XVar)(sortSettings)) || (XVar)(!(XVar)(MVCFunctions.count(sortSettings))))
            {
                sortSettings = XVar.Clone(XVar.Array());
                foreach (KeyValuePair <XVar, dynamic> fName in this.pSet.getListFields().GetEnumerator())
                {
                    if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(this.pSet.getFieldType((XVar)(fName.Value))))))
                    {
                        continue;
                    }
                    sortSettings.InitAndSetArrayItem(new XVar("label", "", "fields", new XVar(0, new XVar("field", fName.Value, "desc", false, "labelOnly", true))), null);
                }
            }
            this._cachedSortBySettings = XVar.Clone(sortSettings);
            return(sortSettings);
        }
Exemplo n.º 10
0
        protected override XVar getSubsetSQLComponents()
        {
            dynamic selectedRecords = XVar.Array(), sql = XVar.Array();

            sql             = XVar.Clone(XVar.Array());
            selectedRecords = XVar.Clone(getSelectedRecords());
            if (!XVar.Equals(XVar.Pack(selectedRecords), XVar.Pack(null)))
            {
                dynamic selectedWhereParts = XVar.Array();
                sql.InitAndSetArrayItem(this.gQuery.getSqlComponents(), "sqlParts");
                selectedWhereParts = XVar.Clone(XVar.Array());
                foreach (KeyValuePair <XVar, dynamic> keys in selectedRecords.GetEnumerator())
                {
                    selectedWhereParts.InitAndSetArrayItem(CommonFunctions.KeyWhere((XVar)(keys.Value)), null);
                }
                sql.InitAndSetArrayItem(MVCFunctions.implode(new XVar(" or "), (XVar)(selectedWhereParts)), "mandatoryWhere", null);
                if (0 == MVCFunctions.count(selectedRecords))
                {
                    sql.InitAndSetArrayItem("1=0", "mandatoryWhere", null);
                }
            }
            else
            {
                sql = XVar.Clone(base.getSubsetSQLComponents());
            }
            if (this.connection.dbType == Constants.nDATABASE_DB2)
            {
                sql["sqlParts"]["head"] = MVCFunctions.Concat(sql["sqlParts"]["head"], ", ROW_NUMBER() over () as DB2_ROW_NUMBER ");
            }
            sql.InitAndSetArrayItem(SecuritySQL(new XVar("Export"), (XVar)(this.tName)), "mandatoryWhere", null);
            return(sql);
        }
Exemplo n.º 11
0
        public virtual XVar setRecordId(dynamic _param_recId)
        {
            #region pass-by-value parameters
            dynamic recId = XVar.Clone(_param_recId);
            #endregion

            foreach (KeyValuePair <XVar, dynamic> dummy in this.cells.GetEnumerator())
            {
                dynamic cMapRef = XVar.Array();
                cMapRef = this.cells[dummy.Key];
                if ((XVar)(!(XVar)(cMapRef["hiddenRecords"])) || (XVar)(cMapRef["hidable"]))
                {
                    continue;
                }
                foreach (KeyValuePair <XVar, dynamic> rec in cMapRef["hiddenRecords"].GetEnumerator())
                {
                    if (XVar.Equals(XVar.Pack(rec.Value), XVar.Pack(recId)))
                    {
                        cMapRef.InitAndSetArrayItem(true, "hidable");
                        break;
                    }
                }
            }
            return(null);
        }
Exemplo n.º 12
0
        public virtual XVar refineOpenFilters(dynamic _param_openFilters)
        {
            #region pass-by-value parameters
            dynamic openFilters = XVar.Clone(_param_openFilters);
            #endregion

            dynamic openFiltersRefined = XVar.Array();
            openFiltersRefined = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> panelFiled in this.panelSearchFields.GetEnumerator())
            {
                dynamic key = null;
                key = XVar.Clone(MVCFunctions.array_search((XVar)(panelFiled.Value), (XVar)(openFilters)));
                if (!XVar.Equals(XVar.Pack(key), XVar.Pack(false)))
                {
                    MVCFunctions.array_splice((XVar)(openFilters), (XVar)(key), new XVar(1));
                }
            }
            foreach (KeyValuePair <XVar, dynamic> field in openFilters.GetEnumerator())
            {
                if (XVar.Pack(MVCFunctions.in_array((XVar)(field.Value), (XVar)(this.allSearchFields))))
                {
                    openFiltersRefined.InitAndSetArrayItem(field.Value, null);
                }
            }
            return(openFiltersRefined);
        }
Exemplo n.º 13
0
        public override XVar showDBValue(dynamic data, dynamic _param_keylink)
        {
            #region pass-by-value parameters
            dynamic keylink = XVar.Clone(_param_keylink);
            #endregion

            dynamic imgSrc = null, result = null, trueCondition = null;
            result = new XVar("<img src=\"");
            imgSrc = new XVar("images/check_");
            if (getHostPageDbType() == Constants.nDATABASE_PostgreSQL)
            {
                trueCondition = XVar.Clone((XVar)(XVar.Equals(XVar.Pack(data[this.field]), XVar.Pack("t"))) || (XVar)((XVar)(data[this.field] != 0) && (XVar)(data[this.field] != "")));
            }
            else
            {
                trueCondition = XVar.Clone((XVar)(data[this.field] != 0) && (XVar)(data[this.field] != ""));
            }
            imgSrc = MVCFunctions.Concat(imgSrc, (XVar.Pack(trueCondition) ? XVar.Pack("yes") : XVar.Pack("no")));
            result = MVCFunctions.Concat(result, MVCFunctions.GetRootPathForResources((XVar)(MVCFunctions.Concat(imgSrc, ".gif"))), "\" border=0");
            if (XVar.Pack(CommonFunctions.isEnableSection508()))
            {
                result = MVCFunctions.Concat(result, " alt=\" \"");
            }
            result = MVCFunctions.Concat(result, ">");
            return(result);
        }
Exemplo n.º 14
0
        public virtual XVar findHiddenRecords(dynamic _param_allItems, dynamic _param_hiddenItems)
        {
            #region pass-by-value parameters
            dynamic allItems    = XVar.Clone(_param_allItems);
            dynamic hiddenItems = XVar.Clone(_param_hiddenItems);
            #endregion

            dynamic result = null;
            result = new XVar(null);
            foreach (KeyValuePair <XVar, dynamic> dummy in allItems.GetEnumerator())
            {
                if (XVar.Pack(!(XVar)(hiddenItems[dummy.Key])))
                {
                    return(XVar.Array());
                }
                if (XVar.Equals(XVar.Pack(result), XVar.Pack(null)))
                {
                    result = XVar.Clone(hiddenItems[dummy.Key]);
                }
                else
                {
                    result = XVar.Clone(MVCFunctions.array_intersect((XVar)(result), (XVar)(hiddenItems[dummy.Key])));
                }
                if (MVCFunctions.count(result) == 0)
                {
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 15
0
        public override XVar SQLWhere(dynamic _param_SearchFor, dynamic _param_strSearchOption, dynamic _param_SearchFor2, dynamic _param_etype, dynamic _param_isSuggest)
        {
            #region pass-by-value parameters
            dynamic SearchFor       = XVar.Clone(_param_SearchFor);
            dynamic strSearchOption = XVar.Clone(_param_strSearchOption);
            dynamic SearchFor2      = XVar.Clone(_param_SearchFor2);
            dynamic etype           = XVar.Clone(_param_etype);
            dynamic isSuggest       = XVar.Clone(_param_isSuggest);
            #endregion

            dynamic bNeedQuotes = null, baseResult = null, fullFieldName = null;
            baseResult = XVar.Clone(baseSQLWhere((XVar)(strSearchOption)));
            if (XVar.Equals(XVar.Pack(baseResult), XVar.Pack(false)))
            {
                return("");
            }
            if (baseResult != XVar.Pack(""))
            {
                return(baseResult);
            }
            if ((XVar)(SearchFor == "none") || (XVar)((XVar)(SearchFor != "on") && (XVar)(SearchFor != "off")))
            {
                return("");
            }
            fullFieldName = XVar.Clone(getFieldSQLDecrypt());
            bNeedQuotes   = XVar.Clone(CommonFunctions.NeedQuotes((XVar)(this.var_type)));
            return(constructFieldWhere((XVar)(fullFieldName), (XVar)(bNeedQuotes), (XVar)(SearchFor == "on"), (XVar)(this.var_type), (XVar)(this.connection.dbType)));
        }
Exemplo n.º 16
0
 public LoginPage(dynamic var_params)
     : base((XVar)var_params)
 {
     if (skipLoginPageCtor)
     {
         skipLoginPageCtor = false;
         return;
     }
     this.pSetEdit   = XVar.UnPackProjectSettings(this.pSet);
     this.pSetSearch = XVar.Clone(new ProjectSettings((XVar)(this.tName), new XVar(Constants.PAGE_SEARCH)));
     this.auditObj   = XVar.Clone(CommonFunctions.GetAuditObject());
     if (XVar.Equals(XVar.Pack(getLayoutVersion()), XVar.Pack(Constants.PD_BS_LAYOUT)))
     {
         this.headerForms = XVar.Clone(new XVar(0, "top"));
         this.footerForms = XVar.Clone(new XVar(0, "footer"));
         this.bodyForms   = XVar.Clone(new XVar(0, "above-grid", 1, "grid", 2, "superbottom"));
     }
     else
     {
         this.formBricks.InitAndSetArrayItem("loginheader", "header");
         this.formBricks.InitAndSetArrayItem(new XVar(0, "loginbuttons", 1, "facebookbutton"), "footer");
         assignFormFooterAndHeaderBricks(new XVar(true));
     }
     initMyURL();
     initCredentials();
     this.body = XVar.Clone(new XVar("begin", "", "end", ""));
 }
Exemplo n.º 17
0
        protected virtual XVar getCommonWhere()
        {
            dynamic addWhere = null, typeWhere = null, wheres = XVar.Array();

            wheres = XVar.Clone(XVar.Array());
            if (XVar.Pack(this.userID))
            {
                wheres.InitAndSetArrayItem(MVCFunctions.Concat(this.dbUserNameFieldName, "=", this.connection.prepareString((XVar)(this.userID))), null);
            }
            if (XVar.Pack(this.cookie))
            {
                wheres.InitAndSetArrayItem(MVCFunctions.Concat(this.dbCookieFieldName, "=", this.connection.prepareString((XVar)(this.cookie))), null);
            }
            if (XVar.Pack(!(XVar)(MVCFunctions.count(wheres))))
            {
                return("1=0");
            }
            typeWhere = new XVar("1=1");
            if (!XVar.Equals(XVar.Pack(this.var_type), XVar.Pack(Constants.SSEARCH_PARAMS_TYPE)))
            {
                typeWhere = XVar.Clone(MVCFunctions.Concat(this.dbTypeFieldName, "=", this.var_type));
            }
            addWhere = XVar.Clone(CommonFunctions.whereAdd((XVar)(typeWhere), (XVar)(MVCFunctions.implode(new XVar(" OR "), (XVar)(wheres)))));
            return(CommonFunctions.whereAdd((XVar)(MVCFunctions.Concat(this.dbTableNameFieldName, "=", this.connection.prepareString((XVar)(this.tableNameId)))), (XVar)(addWhere)));
        }
Exemplo n.º 18
0
 public override XVar afterSuccessfulSave()
 {
     if (0 < MVCFunctions.count(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)]))
     {
         foreach (KeyValuePair <XVar, dynamic> fileArray in XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].GetEnumerator())
         {
             if (XVar.Equals(XVar.Pack(fileArray.Value["deleted"]), XVar.Pack(true)))
             {
                 dynamic file_path = null;
                 file_path = XVar.Clone(fileArray.Value["file"]["name"]);
                 if (XVar.Pack(MVCFunctions.file_exists(file_path)))
                 {
                     MVCFunctions.unlink((XVar)(file_path));
                 }
                 if (fileArray.Value["file"]["thumbnail"] != "")
                 {
                     file_path = XVar.Clone(fileArray.Value["file"]["thumbnail"]);
                     if (XVar.Pack(MVCFunctions.file_exists(file_path)))
                     {
                         MVCFunctions.unlink((XVar)(file_path));
                     }
                 }
             }
         }
     }
     XSession.Session.Remove(MVCFunctions.Concat("mupload_", this.formStamp));
     return(null);
 }
Exemplo n.º 19
0
        protected virtual XVar openQuery()
        {
            dynamic listarray = null;

            prepareCustomListQueryLegacySorting();
            calcPageSizeAndNumber();
            listarray = new XVar(false);
            if (XVar.Pack(this.eventsObject.exists(new XVar("ListQuery"))))
            {
                listarray = XVar.Clone(this.eventsObject.ListQuery((XVar)(this.searchClauseObj), (XVar)(this.customFieldForSort), (XVar)(this.customHowFieldSort), (XVar)(this.masterTable), (XVar)(this.masterKeys), (XVar)(this.selection), (XVar)(this.queryPageSize), (XVar)(this.queryPageNo), this));
            }
            if (!XVar.Equals(XVar.Pack(listarray), XVar.Pack(false)))
            {
                this.recordset = XVar.Clone(listarray);
            }
            else
            {
                if (XVar.Pack(this.allPagesMode))
                {
                    this.recordset = XVar.Clone(this.connection.query((XVar)(this.querySQL)));
                }
                else
                {
                    this.recordset = XVar.Clone(this.connection.queryPage((XVar)(this.querySQL), (XVar)(this.queryPageNo), (XVar)(this.queryPageSize), (XVar)(this.totalRowCount)));
                }
            }
            return(null);
        }
Exemplo n.º 20
0
 public SearchPage(dynamic var_params)
     : base((XVar)var_params)
 {
     if (skipSearchPageCtor)
     {
         skipSearchPageCtor = false;
         return;
     }
     if (XVar.Equals(XVar.Pack(getLayoutVersion()), XVar.Pack(Constants.PD_BS_LAYOUT)))
     {
         this.headerForms = XVar.Clone(new XVar(0, "top"));
         this.footerForms = XVar.Clone(new XVar(0, "below-grid"));
         this.bodyForms   = XVar.Clone(new XVar(0, "grid"));
     }
     else
     {
         this.formBricks.InitAndSetArrayItem("searchheader", "header");
         this.formBricks.InitAndSetArrayItem("searchbuttons", "footer");
     }
     if (XVar.Pack(MVCFunctions.count(this.extraPageParams)))
     {
         this.jsSettings.InitAndSetArrayItem(this.extraPageParams, "tableSettings", this.tName, "extraSearchPageParams");
     }
     this.jsSettings.InitAndSetArrayItem(this.pSet.getAdvSearchFields(), "tableSettings", this.tName, "searchPageFields");
 }
Exemplo n.º 21
0
        public virtual XVar getFilterExtraControls(dynamic _param_dExtraCtrls = null)
        {
            #region default values
            if (_param_dExtraCtrls as Object == null)
            {
                _param_dExtraCtrls = new XVar();
            }
            #endregion

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

            dynamic selectAllAttrs = null;
            selectAllAttrs = new XVar("");
            if ((XVar)(!(XVar)(this.filtered)) && (XVar)(!XVar.Equals(XVar.Pack(this.multiSelect), XVar.Pack(Constants.FM_NONE))))
            {
                selectAllAttrs = new XVar("checked=\"checked\"");
            }
            if (this.multiSelect == Constants.FM_ON_DEMAND)
            {
                selectAllAttrs = MVCFunctions.Concat(selectAllAttrs, " style=\"display: none;\"");
            }
            return(new XVar("clearLink", this.filtered, "selectAllAttrs", selectAllAttrs, "numberOfExtraItemsToShow", getNumberOfExtraItemsToShow()));
        }
Exemplo n.º 22
0
        protected virtual XVar getControlMap(dynamic _param_fName, dynamic _param_format, dynamic _param_recId, dynamic _param_fieldNum, dynamic _param_hidden, dynamic _param_value)
        {
            #region pass-by-value parameters
            dynamic fName    = XVar.Clone(_param_fName);
            dynamic format   = XVar.Clone(_param_format);
            dynamic recId    = XVar.Clone(_param_recId);
            dynamic fieldNum = XVar.Clone(_param_fieldNum);
            dynamic hidden   = XVar.Clone(_param_hidden);
            dynamic value    = XVar.Clone(_param_value);
            #endregion

            dynamic ctrlsMap = XVar.Array(), preload = null;
            ctrlsMap = XVar.Clone(new XVar("controls", XVar.Array()));
            ctrlsMap.InitAndSetArrayItem(fName, "controls", "fieldName");
            ctrlsMap.InitAndSetArrayItem(Constants.MODE_SEARCH, "controls", "mode");
            ctrlsMap.InitAndSetArrayItem(format, "controls", "editFormat");
            ctrlsMap.InitAndSetArrayItem(recId, "controls", "id");
            ctrlsMap.InitAndSetArrayItem(fieldNum, "controls", "ctrlInd");
            ctrlsMap.InitAndSetArrayItem(hidden, "controls", "hidden");
            ctrlsMap.InitAndSetArrayItem(this.tName, "controls", "table");
            preload = XVar.Clone(this.pageObj.fillPreload((XVar)(fName), (XVar)(new XVar(0, fName)), (XVar)(new XVar(fName, value)), (XVar)(this.controlsContainer)));
            if (!XVar.Equals(XVar.Pack(preload), XVar.Pack(false)))
            {
                ctrlsMap.InitAndSetArrayItem(preload, "controls", "preloadData");
            }
            return(ctrlsMap);
        }
Exemplo n.º 23
0
        public virtual XVar display_loaded(dynamic _param_filtertag = null)
        {
            #region default values
            if (_param_filtertag as Object == null)
            {
                _param_filtertag = new XVar("");
            }
            #endregion

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

            dynamic str = null;
            str = XVar.Clone(this.template);
            if (XVar.Pack(filtertag))
            {
                dynamic pos1 = null, pos2 = null;
                if ((XVar)(!(XVar)(this.xt_vars.KeyExists(filtertag))) || (XVar)(XVar.Equals(XVar.Pack(this.xt_vars[filtertag]), XVar.Pack(false))))
                {
                    return(null);
                }
                pos1 = XVar.Clone(MVCFunctions.strpos((XVar)(this.template), (XVar)(MVCFunctions.Concat("{BEGIN ", filtertag, "}"))));
                pos2 = XVar.Clone(MVCFunctions.strpos((XVar)(this.template), (XVar)(MVCFunctions.Concat("{END ", filtertag, "}"))));
                if ((XVar)(XVar.Equals(XVar.Pack(pos1), XVar.Pack(false))) || (XVar)(XVar.Equals(XVar.Pack(pos2), XVar.Pack(false))))
                {
                    return(null);
                }
                pos2 += MVCFunctions.strlen((XVar)(MVCFunctions.Concat("{END ", filtertag, "}")));
                str   = XVar.Clone(MVCFunctions.substr((XVar)(this.template), (XVar)(pos1), (XVar)(pos2 - pos1)));
            }
            Testing();
            CommonFunctions.xt_process_template(this, (XVar)(str));
            return(null);
        }
Exemplo n.º 24
0
 protected virtual XVar getLoggedInRedirectUrl()
 {
     if (XVar.Pack(this.myurl))
     {
         return(MVCFunctions.Concat(this.myurl, (XVar.Pack(!XVar.Equals(XVar.Pack(MVCFunctions.strpos((XVar)(this.myurl), new XVar("?"))), XVar.Pack(false))) ? XVar.Pack("&a=login") : XVar.Pack("?a=login"))));
     }
     return(MVCFunctions.GetTableLink(new XVar("menu")));
 }
Exemplo n.º 25
0
        public virtual XVar create_scaled_image(dynamic _param_file_path, dynamic _param_uploadDir, dynamic _param_new_file_name, dynamic _param_options, dynamic file, dynamic _param_isThumbnail, dynamic _param_uploadDirRelative, dynamic _param_uploadedFile)
        {
            #region pass-by-value parameters
            dynamic file_path         = XVar.Clone(_param_file_path);
            dynamic uploadDir         = XVar.Clone(_param_uploadDir);
            dynamic new_file_name     = XVar.Clone(_param_new_file_name);
            dynamic options           = XVar.Clone(_param_options);
            dynamic isThumbnail       = XVar.Clone(_param_isThumbnail);
            dynamic uploadDirRelative = XVar.Clone(_param_uploadDirRelative);
            dynamic uploadedFile      = XVar.Clone(_param_uploadedFile);
            #endregion

            dynamic img_height = null, img_size = XVar.Array(), img_width = null, new_file_path = null, new_height = null, new_width = null, scale = null, success = null;
            img_size      = XVar.Clone(MVCFunctions.runner_getimagesize((XVar)(file_path), (XVar)(uploadedFile)));
            img_width     = XVar.Clone(img_size[0]);
            img_height    = XVar.Clone(img_size[1]);
            new_file_path = XVar.Clone(MVCFunctions.Concat(uploadDir, new_file_name));
            if ((XVar)(!(XVar)(img_width)) || (XVar)(!(XVar)(img_height)))
            {
                MVCFunctions.unlink((XVar)(new_file_path));
                return(false);
            }
            scale = XVar.Clone(MVCFunctions.min((XVar)(options["max_width"] / img_width), (XVar)(options["max_height"] / img_height)));
            if (1 <= scale)
            {
                if (!XVar.Equals(XVar.Pack(file_path), XVar.Pack(new_file_path)))
                {
                    dynamic result = null;
                    result = XVar.Clone(MVCFunctions.copy((XVar)(file_path), (XVar)(new_file_path)));
                    if ((XVar)(result) && (XVar)(isThumbnail))
                    {
                        file.InitAndSetArrayItem(MVCFunctions.Concat(uploadDirRelative, new_file_name), "thumbnail");
                        file.InitAndSetArrayItem(MVCFunctions.filesize((XVar)(file_path)), "thumbnail_size");
                        file.InitAndSetArrayItem(file["type"], "thumbnail_type");
                    }
                    return(result);
                }
                return(false);
            }
            new_width  = XVar.Clone(img_width * scale);
            new_height = XVar.Clone(img_height * scale);
            success    = XVar.Clone(MVCFunctions.imageCreateThumb((XVar)(new_width), (XVar)(new_height), (XVar)(img_width), (XVar)(img_height), (XVar)(file_path), (XVar)(options), (XVar)(new_file_path), (XVar)(uploadedFile)));
            if (XVar.Pack(success))
            {
                if (XVar.Pack(isThumbnail))
                {
                    file.InitAndSetArrayItem(MVCFunctions.Concat(uploadDirRelative, new_file_name), "thumbnail");
                    file.InitAndSetArrayItem(MVCFunctions.filesize((XVar)(new_file_path)), "thumbnail_size");
                    file.InitAndSetArrayItem(file["type"], "thumbnail_type");
                }
                else
                {
                    file.InitAndSetArrayItem(new_file_name, "name");
                    file.InitAndSetArrayItem(MVCFunctions.filesize((XVar)(new_file_path)), "size");
                }
            }
            return(success);
        }
Exemplo n.º 26
0
        public virtual XVar showPageAjax()
        {
            dynamic proceedLink = null, returnJSON = XVar.Array();

            returnJSON  = XVar.Clone(XVar.Array());
            proceedLink = XVar.Clone(getProceedLink());
            if ((XVar)((XVar)((XVar)((XVar)((XVar)(!(XVar)(this.numRowsFromSQL)) && (XVar)(!(XVar)(addAvailable()))) && (XVar)(!(XVar)(inlineAddAvailable()))) && (XVar)(!(XVar)(this.recordsDeleted))) && (XVar)(proceedLink == XVar.Pack(""))) && (XVar)(getGridTabsCount() == 0))
            {
                returnJSON.InitAndSetArrayItem(false, "success");
                MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON)));
                return(null);
            }
            addControlsJSAndCSS();
            fillSetCntrlMaps();
            returnJSON.InitAndSetArrayItem(GlobalVars.pagesData, "pagesData");
            returnJSON.InitAndSetArrayItem(this.controlsHTMLMap, "controlsMap");
            returnJSON.InitAndSetArrayItem(this.viewControlsHTMLMap, "viewControlsMap");
            returnJSON.InitAndSetArrayItem(this.jsSettings, "settings");
            this.xt.assign(new XVar("header"), new XVar(false));
            this.xt.assign(new XVar("footer"), new XVar(false));
            if (XVar.Equals(XVar.Pack(getLayoutVersion()), XVar.Pack(Constants.PD_BS_LAYOUT)))
            {
                returnJSON.InitAndSetArrayItem(MVCFunctions.Concat(proceedLink, this.xt.fetch_loaded(new XVar("above-grid_block"))), "headerCont");
            }
            else
            {
                returnJSON.InitAndSetArrayItem(MVCFunctions.Concat(proceedLink, getHeaderControlsBlocks()), "headerCont");
            }
            if (XVar.Pack(this.formBricks["footer"]))
            {
                if (XVar.Equals(XVar.Pack(getLayoutVersion()), XVar.Pack(Constants.PD_BS_LAYOUT)))
                {
                    returnJSON.InitAndSetArrayItem(this.xt.fetch_loaded(new XVar("below-grid_block")), "footerCont");
                }
                else
                {
                    returnJSON.InitAndSetArrayItem(fetchBlocksList((XVar)(this.formBricks["footer"]), new XVar(true)), "footerCont");
                }
            }
            assignFormFooterAndHeaderBricks(new XVar(false));
            this.xt.prepareContainers();
            if (XVar.Equals(XVar.Pack(getLayoutVersion()), XVar.Pack(Constants.PD_BS_LAYOUT)))
            {
                returnJSON.InitAndSetArrayItem(this.xt.fetch_loaded(new XVar("grid_block")), "html");
            }
            else
            {
                returnJSON.InitAndSetArrayItem(this.xt.fetch_loaded(new XVar("body")), "html");
            }
            returnJSON.InitAndSetArrayItem(this.flyId, "idStartFrom");
            returnJSON.InitAndSetArrayItem(true, "success");
            returnJSON.InitAndSetArrayItem(grabAllJsFiles(), "additionalJS");
            returnJSON.InitAndSetArrayItem(grabAllCSSFiles(), "CSSFiles");
            MVCFunctions.Echo(CommonFunctions.printJSON((XVar)(returnJSON)));
            return(null);
        }
Exemplo n.º 27
0
        public virtual XVar isStopSymbol(dynamic _param_smb)
        {
            #region pass-by-value parameters
            dynamic smb = XVar.Clone(_param_smb);
            #endregion

            return(!XVar.Equals(XVar.Pack(MVCFunctions.strpos(new XVar(" .,;:\"'?!|\\/=(){}[]*-+\n\r"), (XVar)(smb))), XVar.Pack(false)));

            return(null);
        }
Exemplo n.º 28
0
        public static XVar cutprefix(XVar table)
        {
            XVar pos = MVCFunctions.strpos(table, ".");

            if (pos.Equals(false))
            {
                return(table);
            }
            return(MVCFunctions.substr(table, pos + 1));
        }
Exemplo n.º 29
0
        public virtual XVar buildControl(dynamic _param_value, dynamic _param_mode, dynamic _param_fieldNum, dynamic _param_validate, dynamic _param_additionalCtrlParams, dynamic _param_data)
        {
            #region pass-by-value parameters
            dynamic value                = XVar.Clone(_param_value);
            dynamic mode                 = XVar.Clone(_param_mode);
            dynamic fieldNum             = XVar.Clone(_param_fieldNum);
            dynamic validate             = XVar.Clone(_param_validate);
            dynamic additionalCtrlParams = XVar.Clone(_param_additionalCtrlParams);
            dynamic data                 = XVar.Clone(_param_data);
            #endregion

            dynamic additionalClass = null, arrKeys = XVar.Array(), isHidden = null, j = null;
            this.searchPanelControl = XVar.Clone(isSearchPanelControl((XVar)(mode), (XVar)(additionalCtrlParams)));
            this.inputStyle         = XVar.Clone(getInputStyle((XVar)(mode)));
            if (XVar.Pack(fieldNum))
            {
                this.cfield = XVar.Clone(MVCFunctions.Concat("value", fieldNum, "_", this.goodFieldName, "_", this.id));
                this.ctype  = XVar.Clone(MVCFunctions.Concat("type", fieldNum, "_", this.goodFieldName, "_", this.id));
            }
            this.iquery = XVar.Clone(MVCFunctions.Concat("field=", MVCFunctions.RawUrlEncode((XVar)(this.field))));
            arrKeys     = XVar.Clone(this.pageObject.pSetEdit.getTableKeys());
            j           = new XVar(0);
            for (; j < MVCFunctions.count(arrKeys); j++)
            {
                this.keylink = MVCFunctions.Concat(this.keylink, "&key", j + 1, "=", MVCFunctions.RawUrlEncode((XVar)(data[arrKeys[j]])));
            }
            this.iquery     = MVCFunctions.Concat(this.iquery, this.keylink);
            isHidden        = XVar.Clone((XVar)(additionalCtrlParams.KeyExists("hidden")) && (XVar)(additionalCtrlParams["hidden"]));
            additionalClass = new XVar("");
            if (XVar.Pack(this.pageObject.isBootstrap()))
            {
                if (XVar.Pack(this.pageObject.isPD()))
                {
                    additionalClass = MVCFunctions.Concat(additionalClass, "bs-ctrlspan ");
                }
                else
                {
                    additionalClass = MVCFunctions.Concat(additionalClass, "bs-ctrlspan rnr-nowrap ");
                }
                if (this.format == Constants.EDIT_FORMAT_READONLY)
                {
                    additionalClass = MVCFunctions.Concat(additionalClass, "form-control-static ");
                }
                if ((XVar)(MVCFunctions.count(validate["basicValidate"])) && (XVar)(!XVar.Equals(XVar.Pack(MVCFunctions.array_search(new XVar("IsRequired"), (XVar)(validate["basicValidate"]))), XVar.Pack(false))))
                {
                    additionalClass = MVCFunctions.Concat(additionalClass, "bs-inlinerequired");
                }
            }
            else
            {
                additionalClass = MVCFunctions.Concat(additionalClass, "rnr-nowrap ");
            }
            MVCFunctions.Echo(MVCFunctions.Concat("<span id=\"edit", this.id, "_", this.goodFieldName, "_", fieldNum, "\" class=\"", additionalClass, "\"", (XVar.Pack(isHidden) ? XVar.Pack(" style=\"display:none\"") : XVar.Pack("")), ">"));
            return(null);
        }
Exemplo n.º 30
0
        public virtual XVar addDateQuotes(dynamic _param_val)
        {
            #region pass-by-value parameters
            dynamic val = XVar.Clone(_param_val);
            #endregion

            if ((XVar)(val == XVar.Pack("")) || (XVar)(XVar.Equals(XVar.Pack(val), XVar.Pack(null))))
            {
                return("null");
            }
            return(MVCFunctions.Concat("'", addSlashes((XVar)(val)), "'"));
        }