URL prettification complete (I think)

This commit is contained in:
Rick Falkvinge
2014-12-21 03:56:15 +01:00
parent c5afbf7470
commit e46be463e8
5 changed files with 20 additions and 20 deletions
+8 -1
View File
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Web.UI;
using System.Xml.Serialization;
@@ -51,6 +52,12 @@ namespace Swarmops.Controls.Base
{
output.Write ("<li class=\"{0}\">", menuItem.Type);
string localizedText = "RESOURCE NOT FOUND";
string prettyNavUrl = menuItem.NavigateUrl;
if (!Debugger.IsAttached)
{
prettyNavUrl = prettyNavUrl.Replace ("/Pages/v5/", "/").Replace (".aspx", "");
}
if (!String.IsNullOrEmpty (menuItem.ResourceKey))
{
@@ -83,7 +90,7 @@ namespace Swarmops.Controls.Base
case MenuItemType.Link:
output.Write (
"<a href=\"{1}\"><img src=\"/Images/PageIcons/{0}-{3}.png\" height=\"20\" width=\"20\" />{2}</a>",
menuItem.ImageUrl, menuItem.NavigateUrl, localizedText, iconSize);
menuItem.ImageUrl, prettyNavUrl, localizedText, iconSize);
break;
case MenuItemType.Disabled:
case MenuItemType.BuildNumber:
+9 -3
View File
@@ -29,6 +29,15 @@
{
// The culture was once set here for localization, but Mono resets CultureInfo before entering the page cycle.
// Setting the CultureInfo has been moved to PageV5Base.OnPreInit().
// If we've been called as "/Default.aspx", strip it mercilessly and redirect
string callUrl = Request.Url.ToString();
if (callUrl.EndsWith("/Default.aspx"))
{
Response.Redirect(callUrl.Substring(0, callUrl.Length - "/Default.aspx".Length), true); // "true" prevents further processing
}
// Testing for page rewrite.
@@ -48,9 +57,6 @@
Context.RewritePath (rewrittenCandidate);
}
}
}
+1 -1
View File
@@ -125,7 +125,7 @@
<div class="center980px">
<div class="currentuserinfo">
<div style="background-image:url('/Images/Icons/iconshock-user-16px.png');background-repeat:no-repeat;padding-left:16px;float:left"><asp:Label ID="LabelCurrentUserName" runat="server" /> | </div>
<div style="background-image:url('/Images/Icons/iconshock-workchair-16px.png');background-repeat:no-repeat;padding-left:17px;float:left"><span class="hasTooltip" rel="Logged into <%=this.CurrentOrganization.Name %>" title="Click here to switch to another organization."><a href="/Pages/v5/Security/ChangeOrganizations.aspx" id="LinkChangeOrganizations"><asp:Label ID="LabelCurrentOrganizationName" runat="server" /></a></span> |&nbsp;</div>
<div style="background-image:url('/Images/Icons/iconshock-workchair-16px.png');background-repeat:no-repeat;padding-left:17px;float:left"><span class="hasTooltip" rel="Logged into <%=this.CurrentOrganization.Name %>" title="Click here to switch to another organization."><a href="/Security/ChangeOrganizations" id="LinkChangeOrganizations"><asp:Label ID="LabelCurrentOrganizationName" runat="server" /></a></span> |&nbsp;</div>
<div style="background-image:url('/Images/Icons/iconshock-gamepad-16px.png');background-repeat:no-repeat;padding-left:20px;float:left"><asp:Label ID="LabelPreferences" runat="server" /> | </div>
<div style="background-image:url('/Images/Icons/iconshock-lock-16px.png');background-repeat:no-repeat;padding-left:16px;float:left"><asp:LinkButton ID="LinkLogout" runat="server" OnClick="LinkLogout_Click" /> |&nbsp;</div>
<a href="/Pages/v5/User/SelectLanguage.aspx"><asp:Image ID="ImageCultureIndicator" runat="server" ImageUrl="~/Images/Flags/uk-24px.png" /></a>
+1 -1
View File
@@ -28,7 +28,7 @@ namespace Swarmops.Pages.Security
if (!SwarmDb.Configuration.IsConfigured())
{
Response.Redirect ("/Pages/v5/Init/", true);
Response.Redirect ("/Init/", true);
return;
}
+1 -14
View File
@@ -19,7 +19,7 @@
<customErrors mode="Off"/>
<httpRuntime maxRequestLength="40960" executionTimeout="180" targetFramework="4.5"/>
<authentication mode="Forms">
<forms loginUrl="~/Security/Login.aspx" name=".ActzAuth" path="/" protection="All" timeout="600" defaultUrl="/" cookieless="UseDeviceProfile"/>
<forms loginUrl="~/Security/Login" name=".ActzAuth" path="/" protection="All" timeout="600" defaultUrl="/" cookieless="UseDeviceProfile"/>
</authentication>
<authorization>
<deny users="?"/>
@@ -53,18 +53,5 @@
<requestLimits maxAllowedContentLength="41943040"/>
</requestFiltering>
</security>
<rewrite>
<rules>
<rule name="aspxcloak">
<!--Removes the .aspx extension for all pages.-->
<match url="(.*)"/>
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="{R:1}.aspx"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>