Example #1
0
 public static SiteMapNode CreateSiteMapView(SiteMapNode node, SiteMapViewModes mode)
 {
   Dictionary<string, List<SiteMapNode>> dict = sortSiteMapView(node, mode);
   fakeProvider prov = new fakeProvider();
   SiteMapNode res = new SiteMapNode(prov, node.Key);
   res.ChildNodes = new SiteMapNodeCollection();
   res.Url = node.Url; res.Title = node.Title;
   foreach (KeyValuePair<string, List<SiteMapNode>> de in dict)
   {
     SiteMapNode nd = new SiteMapNode(prov, de.Key); nd.Url = res.Url; nd.Title = de.Key;
     res.ChildNodes.Add(nd);
     nd.ChildNodes = new SiteMapNodeCollection();
     foreach (SiteMapNode subNd in de.Value)
     {
       if (subNd.HasChildNodes) continue;
       SiteMapNode newNd = subNd.Clone(false);
       nd.ChildNodes.Add(newNd);
     }
   }
   return res;
 }
Example #2
0
 public static List<SiteMapNode> sortSiteMapView(SiteMapNode node, SiteMapViewModes mode, string value)
 {
   List<SiteMapNode> res = new List<SiteMapNode>();
   foreach (SiteMapNode nd in LowUtils.allNodes(node))
   {
     string[] crits = viewCriterium(nd, mode);
     if (crits == null) crits = defaultCrit;
     foreach (string crit in crits)
       if (crit == value) { res.Add(nd); continue; }
   }
   return res;
 }
Example #3
0
 public static Dictionary<string, List<SiteMapNode>> sortSiteMapView(SiteMapNode node, SiteMapViewModes mode)
 {
   Dictionary<string, List<SiteMapNode>> dict = new Dictionary<string, List<SiteMapNode>>();
   foreach (SiteMapNode nd in LowUtils.allNodes(node))
   {
     string[] crits = viewCriterium(nd, mode);
     if (crits == null) crits = defaultCrit;
     List<SiteMapNode> list;
     foreach (string crit in crits)
     {
       string myCrit = string.IsNullOrEmpty(crit) ? "null" : crit;
       if (!dict.TryGetValue(myCrit, out list))
       {
         list = new List<SiteMapNode>();
         dict.Add(myCrit, list);
       }
       list.Add(nd);
     }
   }
   return dict;
 }
Example #4
0
 static string[] viewCriterium(SiteMapNode node, SiteMapViewModes mode)
 {
   if (node.Url.IndexOf(".wma.") >= 0) return wmaCrit;
   lm_scorm root = LMDataReader.Read(node);
   switch (mode)
   {
     case SiteMapViewModes.template: return new string[] { root.template.ToString() };
     case SiteMapViewModes.status:
     case SiteMapViewModes.statusTable:
       return new string[] { root.status.ToString() };
     case SiteMapViewModes.keywords: return root.keywords == null ? null : root.keywords.Split(' ');
     default: return null;
   }
 }