Exemple #1
0
        protected override XVar sortFilterBlocks(ref dynamic filterCtrlBlocks)
        {
            dynamic compareFunction = null;

            if (this.sortingType != Constants.SORT_BY_DISP_VALUE)
            {
                return(null);
            }
            compareFunction = XVar.Clone((XVar.Pack(CommonFunctions.IsNumberType((XVar)(this.fieldType))) ? XVar.Pack("compareBlocksByNumericValues") : XVar.Pack("compareBlocksByStringValues")));
            MVCFunctions.usort((XVar)(filterCtrlBlocks), (XVar)(new XVar(0, "FilterControl", 1, compareFunction)));
            if (XVar.Pack(this.isDescendingSortOrder))
            {
                filterCtrlBlocks = XVar.Clone(MVCFunctions.array_reverse((XVar)(filterCtrlBlocks)));
            }
            return(null);
        }
Exemple #2
0
        public virtual XVar prepareContainers()
        {
            dynamic classPrefix = null, containerCss = null, containersNames = XVar.Array(), displayed_containers = XVar.Array(), hidden_containers = XVar.Array(), pageStyle = null;

            if (XVar.Pack(!(XVar)(this.layout)))
            {
                return(null);
            }
            containerCss = XVar.Clone(XVar.Array());
            pageStyle    = XVar.Clone(getPageStyle());
            classPrefix  = new XVar("rnr-");
            if (this.layout.version == 1)
            {
                classPrefix = new XVar("runner-");
            }
            assign(new XVar("stylename"), (XVar)(MVCFunctions.Concat(pageStyle, " page-", this.layout.name)));
            assign(new XVar("pageStyleName"), (XVar)(pageStyle));
            displayed_containers = XVar.Clone(XVar.Array());
            hidden_containers    = XVar.Clone(XVar.Array());
            containersNames      = XVar.Clone(MVCFunctions.array_keys((XVar)(this.layout.containers)));
            containersNames      = XVar.Clone(MVCFunctions.array_reverse((XVar)(containersNames)));
            foreach (KeyValuePair <XVar, dynamic> cname in containersNames.GetEnumerator())
            {
                dynamic container = XVar.Array(), firstContainerSubstyle = null, hideContainer = null, lastContainerSubstyle = null, showContainer = null;
                container = XVar.Clone(this.layout.containers[cname.Value]);
                if ((XVar)(this.xt_vars.KeyExists(MVCFunctions.Concat("container_", cname.Value))) && (XVar)(XVar.Equals(XVar.Pack(this.xt_vars[MVCFunctions.Concat("container_", cname.Value)]), XVar.Pack(false))))
                {
                    continue;
                }
                firstContainerSubstyle = new XVar("");
                lastContainerSubstyle  = new XVar("");
                showContainer          = new XVar(false);
                hideContainer          = new XVar(true);
                foreach (KeyValuePair <XVar, dynamic> brick in container.GetEnumerator())
                {
                    dynamic hideBrick = null;
                    if (XVar.Pack(!(XVar)(MVCFunctions.strlen((XVar)(brick.Value["block"])))))
                    {
                        showContainer = new XVar(true);
                    }
                    else
                    {
                        if (XVar.Pack(!(XVar)(this.xt_vars.KeyExists(brick.Value["block"]))))
                        {
                            continue;
                        }
                        else
                        {
                            if (XVar.Pack(!(XVar)(this.xt_vars[brick.Value["block"]])))
                            {
                                continue;
                            }
                        }
                    }
                    if (XVar.Pack(!(XVar)(firstContainerSubstyle)))
                    {
                        firstContainerSubstyle = XVar.Clone(MVCFunctions.Concat("runner-toprow style", brick.Value["substyle"]));
                        if (brick.Value["name"] == "vmenu")
                        {
                            firstContainerSubstyle = new XVar("runner-toprow runner-vmenu");
                        }
                    }
                    lastContainerSubstyle = XVar.Clone(MVCFunctions.Concat("runner-bottomrow style", brick.Value["substyle"]));
                    if (brick.Value["name"] == "vmenu")
                    {
                        lastContainerSubstyle = new XVar("runner-bottomrow runner-vmenu");
                    }
                    showContainer = new XVar(true);
                    if ((XVar)(this.hiddenBricks[brick.Value["name"]]) || (XVar)((XVar)(brick.Value["name"] == "wrapper") && (XVar)((XVar)(hidden_containers.KeyExists(brick.Value["container"])) || (XVar)(!(XVar)(displayed_containers.KeyExists(brick.Value["container"]))))))
                    {
                        hideBrick = new XVar(true);
                    }
                    else
                    {
                        hideBrick     = new XVar(false);
                        hideContainer = new XVar(false);
                    }
                    if (this.layout.version != Constants.BOOTSTRAP_LAYOUT)
                    {
                        if (XVar.Pack(hideBrick))
                        {
                            assign((XVar)(MVCFunctions.Concat("brickclass_", brick.Value["name"])), (XVar)(MVCFunctions.Concat(classPrefix, "hiddenbrick")));
                        }
                        else
                        {
                            unassign((XVar)(MVCFunctions.Concat("brickclass_", brick.Value["name"])));
                        }
                    }
                    else
                    {
                        if (XVar.Pack(hideBrick))
                        {
                            assign((XVar)(MVCFunctions.Concat(brick.Value["name"], "_hiddenattr")), new XVar("data-hidden"));
                        }
                    }
                }
                if (XVar.Pack(showContainer))
                {
                    if (XVar.Pack(hideContainer))
                    {
                        hidden_containers.InitAndSetArrayItem(true, cname.Value);
                    }
                    setContainerDisplayed((XVar)(cname.Value), (XVar)(!(XVar)(hideContainer)), (XVar)(firstContainerSubstyle), (XVar)(lastContainerSubstyle));
                    displayed_containers.InitAndSetArrayItem(true, cname.Value);
                    unassign((XVar)(MVCFunctions.Concat("wrapperclass_", cname.Value)));
                }
                else
                {
                    unassign((XVar)(MVCFunctions.Concat("container_", cname.Value)));
                    assign((XVar)(MVCFunctions.Concat("wrapperclass_", cname.Value)), (XVar)(MVCFunctions.Concat(classPrefix, "hiddencontainer")));
                }
            }
            foreach (KeyValuePair <XVar, dynamic> block in this.layout.blocks.GetEnumerator())
            {
                dynamic hideBlock = null, showBlock = null;
                showBlock = new XVar(false);
                hideBlock = new XVar(true);
                foreach (KeyValuePair <XVar, dynamic> cname in block.Value.GetEnumerator())
                {
                    if (XVar.Pack(displayed_containers[cname.Value]))
                    {
                        showBlock = new XVar(true);
                        if (XVar.Pack(!(XVar)(hidden_containers[cname.Value])))
                        {
                            hideBlock = new XVar(false);
                            break;
                        }
                    }
                }
                if (this.layout.version != Constants.BOOTSTRAP_LAYOUT)
                {
                    if ((XVar)(!(XVar)(showBlock)) || (XVar)(hideBlock))
                    {
                        assign((XVar)(MVCFunctions.Concat("blockclass_", block.Key)), (XVar)(MVCFunctions.Concat(classPrefix, "hiddenblock")));
                    }
                }
                else
                {
                    if ((XVar)(!(XVar)(showBlock)) || (XVar)(hideBlock))
                    {
                        assign((XVar)(MVCFunctions.Concat("blockattr_", block.Key)), new XVar("data-hidden"));
                    }
                }
            }
            if (this.layout.version == Constants.BOOTSTRAP_LAYOUT)
            {
                assign(new XVar("pageid"), (XVar)(this.pageId));
            }
            return(null);
        }
Exemple #3
0
        protected virtual XVar getPocessedHTMLValueData(dynamic _param_value, dynamic _param_cNumberOfChars)
        {
            #region pass-by-value parameters
            dynamic value          = XVar.Clone(_param_value);
            dynamic cNumberOfChars = XVar.Clone(_param_cNumberOfChars);
            #endregion

            dynamic attrCloseMark = null, attrValue = null, closingTag = null, data = XVar.Array(), i = null, j = null, notContentPositions = XVar.Array(), skipTagContent = null, skipTagStart = null, tag = null, tagName = null, tagNameReady = null, tagStart = null, tags = XVar.Array(), truncatedValue = null, waitForAttrValue = null;
            tag                 = XVar.Clone(closingTag = XVar.Clone(attrValue = XVar.Clone(tagNameReady = XVar.Clone(waitForAttrValue = XVar.Clone(skipTagContent = new XVar(false))))));
            attrCloseMark       = new XVar("");
            tagName             = new XVar("");
            tags                = XVar.Clone(XVar.Array());
            notContentPositions = XVar.Clone(XVar.Array());
            i            = XVar.Clone(j = new XVar(0));
            skipTagStart = XVar.Clone(-1);
            while ((XVar)(i < MVCFunctions.strlen((XVar)(value))) && (XVar)(j < cNumberOfChars))
            {
                if ((XVar)(!(XVar)(tag)) && (XVar)(value[i] == "<"))
                {
                    data = XVar.Clone(isComment((XVar)(i), (XVar)(value)));
                    if (XVar.Pack(data["status"]))
                    {
                        notContentPositions.InitAndSetArrayItem(new XVar(0, i, 1, i + data["commentLength"]), null);
                        i = XVar.Clone(i + data["commentLength"]);
                    }
                    else
                    {
                        tagStart     = XVar.Clone(i);
                        tagNameReady = new XVar(false);
                        tag          = new XVar(true);
                        i            = XVar.Clone(i + 1);
                    }
                    continue;
                }
                if ((XVar)((XVar)((XVar)(tag) && (XVar)(attrValue)) && (XVar)((XVar)(attrCloseMark == XVar.Pack("")) || (XVar)(attrCloseMark == " "))) && (XVar)(value[i] == ">"))
                {
                    attrValue = new XVar(false);
                }
                if ((XVar)((XVar)(tag) && (XVar)(!(XVar)(attrValue))) && (XVar)(value[i] == ">"))
                {
                    if (XVar.Pack(isInvisibleTag((XVar)(tagName))))
                    {
                        skipTagContent = XVar.Clone(!(XVar)(closingTag));
                    }
                    if (XVar.Pack(skipTagContent))
                    {
                        skipTagStart = XVar.Clone(i);
                    }
                    else
                    {
                        if (skipTagStart != -1)
                        {
                            notContentPositions.InitAndSetArrayItem(new XVar(0, skipTagStart, 1, i), null);
                            skipTagStart = XVar.Clone(-1);
                        }
                    }
                    data = XVar.Clone(processTagsToClose((XVar)(tags), (XVar)(tagName), (XVar)(closingTag)));
                    tags = XVar.Clone(data["tags"]);
                    if (XVar.Pack(data["removeTag"]))
                    {
                        removeCurrentTag(ref value, (XVar)(tagStart), (XVar)(i));
                        i = XVar.Clone(tagStart);
                    }
                    else
                    {
                        notContentPositions.InitAndSetArrayItem(new XVar(0, tagStart, 1, i), null);
                        i = XVar.Clone(i + 1);
                    }
                    tag          = XVar.Clone(closingTag = new XVar(false));
                    tagNameReady = new XVar(true);
                    tagName      = new XVar("");
                    continue;
                }
                if ((XVar)(tag) && (XVar)(!(XVar)(tagNameReady)))
                {
                    if (value[i] == "/")
                    {
                        closingTag = new XVar(true);
                    }
                    else
                    {
                        if ((XVar)(value[i] == " ") && (XVar)(tagName != XVar.Pack("")))
                        {
                            tagNameReady = new XVar(true);
                        }
                        else
                        {
                            if (value[i] != " ")
                            {
                                tagName = MVCFunctions.Concat(tagName, value[i]);
                            }
                        }
                    }
                    i = XVar.Clone(i + 1);
                    continue;
                }
                if ((XVar)(tag) && (XVar)(tagNameReady))
                {
                    if ((XVar)(value[i] == "=") && (XVar)(!(XVar)(attrValue)))
                    {
                        waitForAttrValue = new XVar(true);
                    }
                    else
                    {
                        if ((XVar)(waitForAttrValue) && (XVar)(value[i] != " "))
                        {
                            if ((XVar)(value[i] == "'") || (XVar)(value[i] == "\""))
                            {
                                attrCloseMark = XVar.Clone(value[i]);
                            }
                            waitForAttrValue = new XVar(false);
                            attrValue        = new XVar(true);
                        }
                        else
                        {
                            if ((XVar)(attrValue) && (XVar)(value[i] == attrCloseMark))
                            {
                                attrValue     = new XVar(false);
                                attrCloseMark = new XVar(" ");
                            }
                        }
                    }
                    i = XVar.Clone(i + 1);
                    continue;
                }
                if (XVar.Pack(skipTagContent))
                {
                    i = XVar.Clone(i + 1);
                    continue;
                }
                if (value[i] == "&")
                {
                    data = XVar.Clone(isHTMLEntity((XVar)(i), (XVar)(value)));
                    if (XVar.Pack(data["isHTMLEntity"]))
                    {
                        i = XVar.Clone(i + data["htmlEntityLength"]);
                        j = XVar.Clone(j + data["entityLength"]);
                        continue;
                    }
                }
                i = XVar.Clone(i + 1);
                j = XVar.Clone(j + 1);
            }
            truncatedValue = XVar.Clone(MVCFunctions.substr((XVar)(value), new XVar(0), (XVar)(i)));
            tags           = XVar.Clone(MVCFunctions.array_reverse((XVar)(tags)));
            foreach (KeyValuePair <XVar, dynamic> _tag in tags.GetEnumerator())
            {
                truncatedValue = MVCFunctions.Concat(truncatedValue, "</", _tag.Value, ">");
            }
            notContentPositions.InitAndSetArrayItem(new XVar(0, i, 1, MVCFunctions.strlen((XVar)(truncatedValue)) - 1), null);
            return(new XVar("value", truncatedValue, "isTruncated", i < MVCFunctions.strlen((XVar)(value)), "notContentPositions", notContentPositions, "truncLength", i));
        }