Exemplo n.º 1
0
        public static XVar readSelectedRecordsFromRequest(dynamic _param_table)
        {
            #region pass-by-value parameters
            dynamic table = XVar.Clone(_param_table);
            #endregion

            dynamic         keyFields = XVar.Array(), selected_recs = XVar.Array();
            ProjectSettings pSet;
            if (XVar.Pack(!(XVar)(MVCFunctions.postvalue("selection"))))
            {
                return(XVar.Array());
            }
            pSet          = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(table)));
            keyFields     = XVar.Clone(pSet.getTableKeys());
            selected_recs = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> keyblock in MVCFunctions.EnumeratePOST("selection"))
            {
                dynamic arr = XVar.Array(), keys = XVar.Array();
                arr = XVar.Clone(MVCFunctions.explode(new XVar("&"), (XVar)(keyblock.Value)));
                if (MVCFunctions.count(arr) < MVCFunctions.count(keyFields))
                {
                    continue;
                }
                keys = XVar.Clone(XVar.Array());
                foreach (KeyValuePair <XVar, dynamic> value in arr.GetEnumerator())
                {
                    keys.InitAndSetArrayItem(MVCFunctions.urldecode((XVar)(value.Value)), keyFields[value.Key]);
                }
                selected_recs.InitAndSetArrayItem(keys, null);
            }
            return(selected_recs);
        }
Exemplo n.º 2
0
        public static XVar saveRedirectURL()
        {
            dynamic query = null, url = null;

            url   = XVar.Clone(MVCFunctions.GetScriptName());
            query = new XVar("");
            foreach (KeyValuePair <XVar, dynamic> value in MVCFunctions.EnumeratePOST())
            {
                if ((XVar)(value.Key == "a") && (XVar)(value.Value == "logout"))
                {
                    continue;
                }
                if (query != XVar.Pack(""))
                {
                    query = MVCFunctions.Concat(query, "&");
                }
                if (XVar.Pack(MVCFunctions.is_array((XVar)(value.Value))))
                {
                    query = MVCFunctions.Concat(query, MVCFunctions.RawUrlEncode((XVar)(MVCFunctions.Concat(value.Key, "[]"))), "=");
                    query = MVCFunctions.Concat(query, MVCFunctions.implode((XVar)(MVCFunctions.Concat(MVCFunctions.RawUrlEncode((XVar)(MVCFunctions.Concat(value.Key, "[]"))), "=")), (XVar)(value.Value)));
                }
                else
                {
                    query = MVCFunctions.Concat(query, MVCFunctions.RawUrlEncode((XVar)(value.Key)));
                    if (XVar.Pack(MVCFunctions.strlen((XVar)(value.Value))))
                    {
                        query = MVCFunctions.Concat(query, "=", MVCFunctions.RawUrlEncode((XVar)(value.Value)));
                    }
                }
            }
            if (query != XVar.Pack(""))
            {
                url = MVCFunctions.Concat(url, "?", query);
            }
            XSession.Session["MyURL"] = url;
            return(null);
        }