Superfish is ugly as ugliest fuck BUT OPERATIONAL. Yay or something. Much work ahead to make it look decent...
This commit is contained in:
+154
-18
@@ -1,30 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Xml.Serialization;
|
||||
using Swarmops.Logic.Security;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for MainMenuItem
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MainMenuItem
|
||||
|
||||
namespace Swarmops
|
||||
{
|
||||
public MainMenuItem()
|
||||
{
|
||||
Children = new MainMenuItem[0];
|
||||
}
|
||||
/// <summary>
|
||||
/// Summary description for MainMenuItem
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MainMenuItem
|
||||
{
|
||||
public MainMenuItem()
|
||||
{
|
||||
Children = new MainMenuItem[0];
|
||||
}
|
||||
|
||||
// FromXml
|
||||
// ToXml
|
||||
public static MainMenuItem Separator
|
||||
{
|
||||
get
|
||||
{
|
||||
MainMenuItem result = new MainMenuItem();
|
||||
result.Type = MenuItemType.Separator;
|
||||
|
||||
public string ResourceKey { get; set; }
|
||||
public int UserLevel { get; set; }
|
||||
public string Permissions { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
public string NavigateUrl { get; set; }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: INSERTION POINT (for plugins)
|
||||
public static MainMenuItem Link(string image, string navUrl, string resourceKey, int userLevel,
|
||||
string permissions)
|
||||
{
|
||||
MainMenuItem result = new MainMenuItem()
|
||||
{
|
||||
ImageUrl = image,
|
||||
NavigateUrl = navUrl,
|
||||
Permissions = permissions,
|
||||
ResourceKey = resourceKey,
|
||||
UserLevel = userLevel,
|
||||
Type = MenuItemType.Link
|
||||
};
|
||||
|
||||
public MainMenuItem[] Children { get; set; }
|
||||
return result;
|
||||
}
|
||||
|
||||
public static MainMenuItem Submenu(string resourceKey, int userLevel, string permissions)
|
||||
{
|
||||
MainMenuItem result = new MainMenuItem()
|
||||
{
|
||||
Permissions = permissions,
|
||||
ResourceKey = resourceKey,
|
||||
UserLevel = userLevel,
|
||||
Type = MenuItemType.Submenu
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static MainMenuItem Disabled(string image, string resourceKey, int userLevel, string permissions)
|
||||
{
|
||||
MainMenuItem result = new MainMenuItem()
|
||||
{
|
||||
ImageUrl = image,
|
||||
Permissions = permissions,
|
||||
ResourceKey = resourceKey,
|
||||
UserLevel = userLevel,
|
||||
Type = MenuItemType.Disabled
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void PrimeXml(MainMenuItem[] items)
|
||||
{
|
||||
// This is only supposed to be used once, to prime the initial menu
|
||||
XmlSerializer serializer = new XmlSerializer(typeof (MainMenuItem[]));
|
||||
|
||||
using (TextWriter writer = new StreamWriter("C:\\Windows\\Temp\\temp.xml"))
|
||||
{
|
||||
serializer.Serialize(writer, items);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PrimeNewMenuFile()
|
||||
{
|
||||
MainMenuItem todoItem = MainMenuItem.Disabled(string.Empty, "Placeholder_Todo", 1, string.Empty);
|
||||
MainMenuItem[] todoItemArray = new MainMenuItem[] {todoItem};
|
||||
|
||||
MainMenuItem peopleItem = MainMenuItem.Submenu("People", 1, string.Empty);
|
||||
peopleItem.Children = todoItemArray;
|
||||
|
||||
MainMenuItem commsItem = MainMenuItem.Submenu("Communications", 1, string.Empty);
|
||||
peopleItem.Children = todoItemArray;
|
||||
|
||||
MainMenuItem claimRefundItem = MainMenuItem.Link("iconshock-moneyback",
|
||||
"/Pages/v5/Financial/FileExpenseClaim.aspx", "Financial_ClaimExpense", 2, String.Empty);
|
||||
MainMenuItem separatorItem = MainMenuItem.Separator;
|
||||
|
||||
MainMenuItem[] financialChildren = new[] {claimRefundItem, separatorItem};
|
||||
MainMenuItem financialItem = MainMenuItem.Submenu("Financial", 2, string.Empty);
|
||||
financialItem.Children = financialChildren;
|
||||
|
||||
MainMenuItem[] protoMenu = new[] {peopleItem, commsItem, financialItem};
|
||||
PrimeXml(protoMenu);
|
||||
|
||||
}
|
||||
|
||||
public string ResourceKey { get; set; }
|
||||
public int UserLevel { get; set; }
|
||||
public string Permissions { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
public string NavigateUrl { get; set; }
|
||||
public MenuItemType Type { get; set; }
|
||||
|
||||
// TODO: INSERTION POINT (for plugins)
|
||||
|
||||
public MainMenuItem[] Children { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public enum MenuItemType
|
||||
{
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// A normal link
|
||||
/// </summary>
|
||||
Link,
|
||||
|
||||
/// <summary>
|
||||
/// Something that looks like a menu item but is disabled
|
||||
/// </summary>
|
||||
Disabled,
|
||||
|
||||
/// <summary>
|
||||
/// A header (with or without image) that leads to more options as sub
|
||||
/// </summary>
|
||||
Submenu,
|
||||
|
||||
/// <summary>
|
||||
/// A thin line separating menu items
|
||||
/// </summary>
|
||||
Separator,
|
||||
|
||||
/// <summary>
|
||||
/// A major header (non-link) introducing new menu section
|
||||
/// </summary>
|
||||
Header,
|
||||
|
||||
/// <summary>
|
||||
/// Build number indicator
|
||||
/// </summary>
|
||||
BuildNumber,
|
||||
|
||||
/// <summary>
|
||||
/// SPECIAL CASE: Close Books menu item
|
||||
/// </summary>
|
||||
SpecialCloseBooks
|
||||
}
|
||||
}
|
||||
@@ -351,4 +351,7 @@
|
||||
<data name="Menu5_People_SelfSignup" xml:space="preserve">
|
||||
<value>Self-Signup Page</value>
|
||||
</data>
|
||||
<data name="Menu5_Placeholder_Todo" xml:space="preserve">
|
||||
<value>Placeholder (Todo)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,31 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Swarmops.Controls.Base
|
||||
{
|
||||
public partial class MainMenu : System.Web.UI.UserControl
|
||||
public partial class MainMenu : ControlV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// TODO: Put a small cache on this
|
||||
|
||||
// TODO: Put plugins on it
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(MainMenuItem[]));
|
||||
|
||||
using (TextReader reader = new StreamReader(Server.MapPath("~/MainMenu-v5.xml")))
|
||||
{
|
||||
this.MainMenuData = (MainMenuItem[]) serializer.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Render(HtmlTextWriter output)
|
||||
{
|
||||
output.Write("<ul id='MainMenuContainer' class='sf-menu'>");
|
||||
foreach (MainMenuItem menuItem in MainMenuData)
|
||||
{
|
||||
WriteMenuItem(menuItem, output);
|
||||
}
|
||||
output.Write("</ul>");
|
||||
}
|
||||
|
||||
private void WriteMenuItem(MainMenuItem menuItem, HtmlTextWriter output)
|
||||
{
|
||||
output.Write("<li>");
|
||||
string localizedText = "RESOURCE NOT FOUND";
|
||||
|
||||
if (!String.IsNullOrEmpty(menuItem.ResourceKey))
|
||||
{
|
||||
object resourceObject = GetGlobalResourceObject("Menu5", "Menu5_" + menuItem.ResourceKey);
|
||||
if (resourceObject != null)
|
||||
{
|
||||
localizedText = resourceObject.ToString();
|
||||
}
|
||||
}
|
||||
localizedText = Server.HtmlEncode(localizedText); // muy importante
|
||||
|
||||
switch (menuItem.Type)
|
||||
{
|
||||
case MenuItemType.Link:
|
||||
output.Write("<img src=\"/Images/PageIcons/{0}-16px.png\" /><a href=\"{1}\">{2}</a>",
|
||||
menuItem.ImageUrl, menuItem.NavigateUrl, localizedText);
|
||||
break;
|
||||
case MenuItemType.Disabled:
|
||||
string imageUrl = "/Images/PageIcons/" + menuItem.ImageUrl + "-16px.png";
|
||||
if (String.IsNullOrEmpty(menuItem.ImageUrl))
|
||||
{
|
||||
imageUrl = "/Images/PageIcons/transparency-16px.png";
|
||||
}
|
||||
output.Write("<img src=\"{0}\" />{1}", imageUrl, localizedText);
|
||||
break;
|
||||
case MenuItemType.Submenu:
|
||||
output.Write(localizedText);
|
||||
break;
|
||||
case MenuItemType.Separator:
|
||||
output.Write("---");
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (menuItem.Children.Length > 0)
|
||||
{
|
||||
output.Write("<ul>");
|
||||
foreach (MainMenuItem child in menuItem.Children)
|
||||
{
|
||||
WriteMenuItem(child, output);
|
||||
}
|
||||
output.Write("</ul>");
|
||||
}
|
||||
|
||||
output.Write("</li>");
|
||||
}
|
||||
|
||||
public MainMenuItem[] MainMenuData { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class MainMenuItem
|
||||
{
|
||||
public string ResourceString;
|
||||
public string IconUrl;
|
||||
public string NavigateUrl;
|
||||
public int UserLevel;
|
||||
public string Permission;
|
||||
public bool IsSeparator;
|
||||
public MainMenuItem[] Children;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 170 B |
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ArrayOfMainMenuItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<!-- This file is maintained by hand. -->
|
||||
<MainMenuItem>
|
||||
<ResourceKey>People</ResourceKey>
|
||||
<UserLevel>1</UserLevel>
|
||||
<Permissions />
|
||||
<Type>Submenu</Type>
|
||||
<Children>
|
||||
<MainMenuItem>
|
||||
<ResourceKey>Placeholder_Todo</ResourceKey>
|
||||
<UserLevel>1</UserLevel>
|
||||
<Permissions />
|
||||
<ImageUrl />
|
||||
<Type>Disabled</Type>
|
||||
<Children />
|
||||
</MainMenuItem>
|
||||
</Children>
|
||||
</MainMenuItem>
|
||||
<MainMenuItem>
|
||||
<ResourceKey>Communications</ResourceKey>
|
||||
<UserLevel>1</UserLevel>
|
||||
<Permissions />
|
||||
<Type>Submenu</Type>
|
||||
<Children>
|
||||
<MainMenuItem>
|
||||
<ResourceKey>Placeholder_Todo</ResourceKey>
|
||||
<UserLevel>1</UserLevel>
|
||||
<Permissions />
|
||||
<ImageUrl />
|
||||
<Type>Disabled</Type>
|
||||
<Children />
|
||||
</MainMenuItem>
|
||||
</Children>
|
||||
</MainMenuItem>
|
||||
<MainMenuItem>
|
||||
<ResourceKey>Financial</ResourceKey>
|
||||
<UserLevel>2</UserLevel>
|
||||
<Permissions />
|
||||
<Type>Submenu</Type>
|
||||
<Children>
|
||||
<MainMenuItem>
|
||||
<ResourceKey>Financial_ClaimExpense</ResourceKey>
|
||||
<UserLevel>2</UserLevel>
|
||||
<Permissions />
|
||||
<ImageUrl>iconshock-moneyback</ImageUrl>
|
||||
<NavigateUrl>/Pages/v5/Financial/FileExpenseClaim.aspx</NavigateUrl>
|
||||
<Type>Link</Type>
|
||||
<Children />
|
||||
</MainMenuItem>
|
||||
<MainMenuItem>
|
||||
<UserLevel>0</UserLevel>
|
||||
<Type>Separator</Type>
|
||||
<Children />
|
||||
</MainMenuItem>
|
||||
</Children>
|
||||
</MainMenuItem>
|
||||
</ArrayOfMainMenuItem>
|
||||
@@ -1,6 +1,7 @@
|
||||
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Master-v5.master.cs" Inherits="Swarmops.MasterV5" %>
|
||||
<%@ Register Src="~/Controls/v5/Base/LanguageSelector.ascx" TagName="LanguageSelector" TagPrefix="act5" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="MainMenu" Src="~/Controls/v5/Base/MainMenu.ascx" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -12,6 +13,7 @@
|
||||
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" ></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/jquery.leanModal.min.js" ></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/jquery.qtip.js" ></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/superfish.js" ></script>
|
||||
|
||||
<!-- fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Permanent+Marker' rel='stylesheet' type='text/css' />
|
||||
@@ -25,6 +27,7 @@
|
||||
<link href="/Style/style-v5.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/jquery.qtip.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/alertify.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Style/superfish.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- additional scripts etc from individual pages -->
|
||||
<asp:ContentPlaceHolder id="PlaceHolderHead" runat="server" />
|
||||
@@ -67,6 +70,8 @@
|
||||
|
||||
$("a[rel*=leanModal]").leanModal();
|
||||
|
||||
$("#MainMenuContainer").superfish();
|
||||
|
||||
<asp:Literal runat="server" ID="LiteralDocumentReadyHook" />
|
||||
|
||||
});
|
||||
@@ -113,6 +118,7 @@
|
||||
<div class="break"></div>
|
||||
<div class="topmenu">
|
||||
<div class="searchbox"><asp:TextBox ID="SearchBox" runat="server" /></div>
|
||||
<Swarmops5:MainMenu ID="MainMenu" runat="server" />
|
||||
</div>
|
||||
|
||||
<div class="mainbar">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Some of these scripts are not in the public domain.
|
||||
|
||||
jQuery is licensed as MIT (free to use for any purpose). So is FancyBox, Alertify, Superfish, and jQuery SwitchButton.
|
||||
jQuery is licensed as MIT (free to use for any purpose). So is FancyBox, Alertify, Superfish, HoverIntent, and jQuery SwitchButton.
|
||||
|
||||
SmartWizard is licensed under Creative Commons Attribution-ShareAlike.
|
||||
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
|
||||
* http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
*
|
||||
* You may use hoverIntent under the terms of the MIT license. Basically that
|
||||
* means you are free to use hoverIntent as long as this header is left intact.
|
||||
* Copyright 2007, 2014 Brian Cherne
|
||||
*/
|
||||
(function ($) { $.fn.hoverIntent = function (handlerIn, handlerOut, selector) { var cfg = { interval: 100, sensitivity: 6, timeout: 0 }; if (typeof handlerIn === "object") { cfg = $.extend(cfg, handlerIn) } else { if ($.isFunction(handlerOut)) { cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector }) } else { cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut }) } } var cX, cY, pX, pY; var track = function (ev) { cX = ev.pageX; cY = ev.pageY }; var compare = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); if (Math.sqrt((pX - cX) * (pX - cX) + (pY - cY) * (pY - cY)) < cfg.sensitivity) { $(ob).off("mousemove.hoverIntent", track); ob.hoverIntent_s = true; return cfg.over.apply(ob, [ev]) } else { pX = cX; pY = cY; ob.hoverIntent_t = setTimeout(function () { compare(ev, ob) }, cfg.interval) } }; var delay = function (ev, ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = false; return cfg.out.apply(ob, [ev]) }; var handleHover = function (e) { var ev = $.extend({}, e); var ob = this; if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t) } if (e.type === "mouseenter") { pX = ev.pageX; pY = ev.pageY; $(ob).on("mousemove.hoverIntent", track); if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob) }, cfg.interval) } } else { $(ob).off("mousemove.hoverIntent", track); if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob) }, cfg.timeout) } } }; return this.on({ "mouseenter.hoverIntent": handleHover, "mouseleave.hoverIntent": handleHover }, cfg.selector) } })(jQuery);
|
||||
@@ -0,0 +1,113 @@
|
||||
/*** ESSENTIAL STYLES ***/
|
||||
.sf-menu, .sf-menu * {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.sf-menu li {
|
||||
position: relative;
|
||||
}
|
||||
.sf-menu ul {
|
||||
position: absolute;
|
||||
display: none;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 9990;
|
||||
}
|
||||
.sf-menu > li {
|
||||
float: left;
|
||||
}
|
||||
.sf-menu li:hover > ul,
|
||||
.sf-menu li.sfHover > ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sf-menu a {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.sf-menu ul ul {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
|
||||
/*** DEMO SKIN ***/
|
||||
.sf-menu {
|
||||
float: left;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.sf-menu ul {
|
||||
box-shadow: 2px 2px 6px rgba(0,0,0,.2);
|
||||
min-width: 12em; /* allow long menu items to determine submenu width */
|
||||
*width: 12em; /* no auto sub width for IE7, see white-space comment below */
|
||||
}
|
||||
.sf-menu a {
|
||||
border-left: 1px solid #fff;
|
||||
border-top: 1px solid #dFeEFF; /* fallback colour must use full shorthand */
|
||||
border-top: 1px solid rgba(255,255,255,.5);
|
||||
padding: .75em 1em;
|
||||
text-decoration: none;
|
||||
zoom: 1; /* IE7 */
|
||||
}
|
||||
.sf-menu a {
|
||||
color: #13a;
|
||||
}
|
||||
.sf-menu li {
|
||||
background: #BDD2FF;
|
||||
white-space: nowrap; /* no need for Supersubs plugin */
|
||||
*white-space: normal; /* ...unless you support IE7 (let it wrap) */
|
||||
-webkit-transition: background .2s;
|
||||
transition: background .2s;
|
||||
}
|
||||
.sf-menu ul li {
|
||||
background: #AABDE6;
|
||||
}
|
||||
.sf-menu ul ul li {
|
||||
background: #9AAEDB;
|
||||
}
|
||||
.sf-menu li:hover,
|
||||
.sf-menu li.sfHover {
|
||||
background: #CFDEFF;
|
||||
/* only transition out, not in */
|
||||
-webkit-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/*** arrows (for all except IE7) **/
|
||||
.sf-arrows .sf-with-ul {
|
||||
padding-right: 2.5em;
|
||||
*padding-right: 1em; /* no CSS arrows for IE7 (lack pseudo-elements) */
|
||||
}
|
||||
/* styling for both css and generated arrows */
|
||||
.sf-arrows .sf-with-ul:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 1em;
|
||||
margin-top: -3px;
|
||||
height: 0;
|
||||
width: 0;
|
||||
/* order of following 3 rules important for fallbacks to work */
|
||||
border: 5px solid transparent;
|
||||
border-top-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
|
||||
border-top-color: rgba(255,255,255,.5);
|
||||
}
|
||||
.sf-arrows > li > .sf-with-ul:focus:after,
|
||||
.sf-arrows > li:hover > .sf-with-ul:after,
|
||||
.sf-arrows > .sfHover > .sf-with-ul:after {
|
||||
border-top-color: white; /* IE8 fallback colour */
|
||||
}
|
||||
/* styling for right-facing arrows */
|
||||
.sf-arrows ul .sf-with-ul:after {
|
||||
margin-top: -5px;
|
||||
margin-right: -3px;
|
||||
border-color: transparent;
|
||||
border-left-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
|
||||
border-left-color: rgba(255,255,255,.5);
|
||||
}
|
||||
.sf-arrows ul li > .sf-with-ul:focus:after,
|
||||
.sf-arrows ul li:hover > .sf-with-ul:after,
|
||||
.sf-arrows ul .sfHover > .sf-with-ul:after {
|
||||
border-left-color: white;
|
||||
}
|
||||
Reference in New Issue
Block a user