Exemplo n.º 1
0
        private JProperty _getNode(CswNbtNode ThisNode, bool RunProps = true, NodeSpecies ThisNodeSpecies = null)
        {
            JProperty Ret = new JProperty("No Results");

            if (null != ThisNode)
            {
                string ThisNodeName = ThisNode.NodeName;

                Ret = new JProperty(NodeIdPrefix + ThisNode.NodeId);
                JObject NodeProps = new JObject();
                Ret.Value = NodeProps;

                NodeSpecies NodeSpecie = ThisNodeSpecies ?? ThisNode.NodeSpecies;
                if (NodeSpecies.More == NodeSpecie)
                {
                    ThisNodeName = "Results Truncated at " + _MobilePageSize;
                }

                NodeProps["node_name"]   = CswTools.SafeJavascriptParam(ThisNodeName);
                NodeProps["nodetype"]    = CswTools.SafeJavascriptParam(ThisNode.getNodeType().NodeTypeName);
                NodeProps["objectclass"] = CswTools.SafeJavascriptParam(ThisNode.getObjectClass().ObjectClass.ToString());
                NodeProps["nodespecies"] = CswTools.SafeJavascriptParam(NodeSpecie.ToString());
                if (RunProps)
                {
                    JObject TabsObj = new JObject();
                    NodeProps["tabs"] = TabsObj;
                    _runProperties(ThisNode, TabsObj);
                }

                if (ThisNode.Locked)
                {
                    NodeProps["iconfilename"] = "Images/quota/lock.gif";
                }
                else if (false == string.IsNullOrEmpty(ThisNode.IconFileName))
                {
                    NodeProps["iconfilename"] = CswNbtMetaDataObjectClass.IconPrefix16 + CswTools.SafeJavascriptParam(ThisNode.IconFileName);
                }

                _addObjectClassProps(ThisNode, NodeProps);

                foreach (CswNbtMetaDataNodeTypeProp MetaDataProp in _CswNbtResources.MetaData.getNodeTypeProps(ThisNode.NodeTypeId)
                         .Cast <CswNbtMetaDataNodeTypeProp>()
                         .Where(MetaDataProp => MetaDataProp.MobileSearch))
                {
                    if ((MetaDataProp.getObjectClassProp() != null))
                    {
                        NodeProps["search_ocp_" + MetaDataProp.ObjectClassPropId] = CswTools.SafeJavascriptParam(ThisNode.Properties[MetaDataProp].Gestalt);
                    }
                    else
                    {
                        NodeProps["search_ntp_" + MetaDataProp.PropId] = CswTools.SafeJavascriptParam(ThisNode.Properties[MetaDataProp].Gestalt);
                    }
                }
            }
            return(Ret);
        }
Exemplo n.º 2
0
        private void _runProperties(CswNbtNode Node, JObject SubItemsJProp)
        {
            Collection <CswNbtMetaDataNodeTypeTab> Tabs = new Collection <CswNbtMetaDataNodeTypeTab>();

            foreach (CswNbtMetaDataNodeTypeTab Tab in from _Tab in _CswNbtResources.MetaData.getNodeTypeTabs(Node.NodeTypeId)
                     orderby _Tab.TabOrder
                     select _Tab)
            {
                Tabs.Add(Tab);
            }
            for (Int32 i = 0; i < Tabs.Count; i++)
            {
                CswNbtMetaDataNodeTypeTab CurrentTab = Tabs[i];

                SubItemsJProp[CurrentTab.TabName] = new JObject();

                //if( i > 1 )
                //{
                //    CswNbtMetaDataNodeTypeTab PrevTab = Tabs[i - 1];
                //    TabObj.Add( new JProperty( "prevtab", PrevTab.TabName ) );
                //}
                SubItemsJProp[CurrentTab.TabName]["currenttab"] = Tabs[i].TabName;
                if (i < Tabs.Count - 1)
                {
                    SubItemsJProp[CurrentTab.TabName]["nexttab"] = Tabs[i + 1].TabName;
                }

                foreach (CswNbtMetaDataNodeTypeProp Prop in from _Prop in CurrentTab.getNodeTypePropsByDisplayOrder()
                         where false == _Prop.HideInMobile &&
                         _Prop.getFieldType().FieldType != CswNbtMetaDataFieldType.NbtFieldType.Password &&
                         _Prop.getFieldType().FieldType != CswNbtMetaDataFieldType.NbtFieldType.Grid
                         select _Prop)
                {
                    CswNbtNodePropWrapper PropWrapper = Node.Properties[Prop];

                    string PropId = PropIdPrefix + Prop.PropId + "_" + NodeIdPrefix + Node.NodeId;
                    SubItemsJProp[CurrentTab.TabName][PropId] = new JObject();
                    SubItemsJProp[CurrentTab.TabName][PropId]["prop_name"] = CswTools.SafeJavascriptParam(Prop.PropNameWithQuestionNo);
                    SubItemsJProp[CurrentTab.TabName][PropId]["fieldtype"] = Prop.getFieldType().FieldType.ToString();
                    SubItemsJProp[CurrentTab.TabName][PropId]["gestalt"]   = CswTools.SafeJavascriptParam(PropWrapper.Gestalt);
                    SubItemsJProp[CurrentTab.TabName][PropId]["ocpname"]   = CswTools.SafeJavascriptParam(PropWrapper.ObjectClassPropName);

                    PropWrapper.ToJSON((JObject)SubItemsJProp[CurrentTab.TabName][PropId]);
                }
            }
        }
Exemplo n.º 3
0
        private RadTreeNode _CreateNode(CswNbtViewNode ViewNode, ViewTreeSelectType SelectType)
        {
            RadTreeNode node = new RadTreeNode();

            node.ImageUrl = ViewNode.IconFileName;
            node.Text     = ViewNode.TextLabel;

            if (SelectableNodeTextPrefix != string.Empty || SelectableNodeTextSuffix != string.Empty)
            {
                if ((SelectType == ViewTreeSelectType.Relationship && ViewNode is CswNbtViewRelationship &&
                     (IsFirstLevelRemovable || ViewNode.Parent is CswNbtViewRelationship)) ||                    // BZ 9203
                    (SelectType == ViewTreeSelectType.Property && ViewNode is CswNbtViewProperty) ||
                    (SelectType == ViewTreeSelectType.Filter && ViewNode is CswNbtViewPropertyFilter))
                {
                    {
                        node.Text = node.Text + SelectableNodeTextPrefix;
                        node.Text = node.Text + CswTools.SafeJavascriptParam(ViewNode.ArbitraryId);
                        node.Text = node.Text + SelectableNodeTextSuffix;
                    }
                }
            }
            node.Expanded = true;

            if (SelectType != ViewTreeSelectType.None)
            {
                node.Enabled = false;
                if ((SelectType == ViewTreeSelectType.Relationship && ((ViewNode is CswNbtViewRoot && IsRootSelectable) || ViewNode is CswNbtViewRelationship)) ||
                    (SelectType == ViewTreeSelectType.Property && (ViewNode is CswNbtViewRelationship || ViewNode is CswNbtViewProperty)) ||
                    (SelectType == ViewTreeSelectType.Filter && (ViewNode is CswNbtViewProperty || ViewNode is CswNbtViewPropertyFilter)))
                {
                    node.Enabled = true;
                }
            }

            node.CssClass         = "TreeNode";
            node.SelectedCssClass = "SelectedTreeNode";
            node.Value            = ViewNode.ArbitraryId;
            return(node);
        }
Exemplo n.º 4
0
        } // Run()

        // case 20083 - search options
        private JProperty _getSearchNodes(CswNbtView View)
        {
            JProperty ReturnJson = new JProperty("searches",
                                                 new JObject(
                                                     from CswNbtMetaDataNodeType NodeType in _CswNbtResources.MetaData.getNodeTypesLatestVersion()
                                                     where View.ContainsNodeType(NodeType)
                                                     from CswNbtMetaDataNodeTypeProp MetaDataProp in NodeType.getNodeTypeProps()
                                                     where MetaDataProp.MobileSearch
                                                     let PropId = (MetaDataProp.ObjectClassPropId != Int32.MinValue) ? "search_ocp_" + MetaDataProp.ObjectClassPropId : "search_ntp_" + MetaDataProp.PropId
                                                                  select new JProperty(PropId, CswTools.SafeJavascriptParam(MetaDataProp.PropNameWithQuestionNo))));

            return(ReturnJson);
        } // _getSearchNodes