Changing Themes activate and uninstall actions to POST

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045458
This commit is contained in:
skewed
2010-01-15 09:40:29 +00:00
parent 341d2fa817
commit ba82badc6c
6 changed files with 27 additions and 6 deletions
@@ -37,6 +37,7 @@ namespace Orchard.Core.Themes.Controllers {
} }
} }
[HttpPost]
public ActionResult Activate(string themeName) { public ActionResult Activate(string themeName) {
try { try {
if (!_authorizer.Authorize(Permissions.SetSiteTheme, T("Couldn't set the current theme"))) if (!_authorizer.Authorize(Permissions.SetSiteTheme, T("Couldn't set the current theme")))
@@ -54,7 +55,7 @@ namespace Orchard.Core.Themes.Controllers {
return View(new AdminViewModel()); return View(new AdminViewModel());
} }
[AcceptVerbs(HttpVerbs.Post)] [HttpPost]
public ActionResult Install(FormCollection input) { public ActionResult Install(FormCollection input) {
try { try {
if (!_authorizer.Authorize(Permissions.InstallUninstallTheme, T("Couldn't install theme"))) if (!_authorizer.Authorize(Permissions.InstallUninstallTheme, T("Couldn't install theme")))
@@ -71,6 +72,7 @@ namespace Orchard.Core.Themes.Controllers {
} }
} }
[HttpPost]
public ActionResult Uninstall(string themeName) { public ActionResult Uninstall(string themeName) {
try { try {
if (!_authorizer.Authorize(Permissions.InstallUninstallTheme, T("Couldn't uninstall theme"))) if (!_authorizer.Authorize(Permissions.InstallUninstallTheme, T("Couldn't uninstall theme")))
@@ -29,9 +29,20 @@
<%=_Encoded("By") %> <%=Html.Encode(theme.Author) %><br /> <%=_Encoded("By") %> <%=Html.Encode(theme.Author) %><br />
<%=Html.Encode(theme.Version) %><br /> <%=Html.Encode(theme.Version) %><br />
<%=Html.Encode(theme.Description) %><br /> <%=Html.Encode(theme.Description) %><br />
<%=Html.Encode(theme.HomePage) %><br /> <%=Html.Encode(theme.HomePage) %>
<%=Html.ActionLink(T("Activate").ToString(), "Activate", new {themeName = theme.ThemeName}) %> | <%=Html.ActionLink(T("Uninstall").ToString(), "Uninstall", new {themeName = theme.ThemeName}) %>
</p> </p>
<div>
<% using(Html.BeginFormAntiForgeryPost(Url.Action("Activate"), FormMethod.Post, new { @class = "inline" })) { %>
<fieldset>
<button type="submit" title="<%=_Encoded("Activate") %>" name="themeName" value="<%=theme.ThemeName %>"><%=_Encoded("Activate") %></button>
</fieldset>
<% } %>
<% using(Html.BeginFormAntiForgeryPost(Url.Action("Uninstall"), FormMethod.Post, new { @class = "inline" })) { %>
<fieldset>
<button type="submit" class="remove" title="<%=_Encoded("Uninstall") %>" name="themeName" value="<%=theme.ThemeName %>"><%=_Encoded("Uninstall")%></button>
</fieldset>
<% } %>
</div>
</li> </li>
<% } <% }
} %> } %>
@@ -12,7 +12,7 @@
<li class="destruct"> <li class="destruct">
<% using (Html.BeginFormAntiForgeryPost(Url.BlogDelete(Model.Item.Slug), FormMethod.Post, new { @class = "inline" })) { %> <% using (Html.BeginFormAntiForgeryPost(Url.BlogDelete(Model.Item.Slug), FormMethod.Post, new { @class = "inline" })) { %>
<fieldset> <fieldset>
<button type="submit" src="<%=Html.ThemePath("/styles/images/remove.png") %>" class="ibutton remove" title="<%=_Encoded("Remove Blog") %>"><%=_Encoded("Remove Blog") %></button> <button type="submit" class="ibutton remove" title="<%=_Encoded("Remove Blog") %>"><%=_Encoded("Remove Blog") %></button>
</fieldset><% </fieldset><%
} %> } %>
</li> </li>
@@ -20,7 +20,7 @@
<%-- todo: (heskew) this is waaaaa too verbose. need template helpers for all ibuttons --%> <%-- todo: (heskew) this is waaaaa too verbose. need template helpers for all ibuttons --%>
<% using (Html.BeginFormAntiForgeryPost(Url.BlogDelete(Model.Item.Slug), FormMethod.Post, new { @class = "inline" })) { %> <% using (Html.BeginFormAntiForgeryPost(Url.BlogDelete(Model.Item.Slug), FormMethod.Post, new { @class = "inline" })) { %>
<fieldset> <fieldset>
<button type="submit" src="<%=Html.ThemePath("/styles/images/remove.png") %>" class="ibutton remove" title="<%=_Encoded("Remove Blog") %>"><%=_Encoded("Remove Blog") %></button> <button type="submit" class="ibutton remove" title="<%=_Encoded("Remove Blog") %>"><%=_Encoded("Remove Blog") %></button>
</fieldset><% </fieldset><%
} %> } %>
</li> </li>
@@ -20,7 +20,7 @@
<li class="destruct"> <li class="destruct">
<% using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Slug), FormMethod.Post, new { @class = "inline" })) { %> <% using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Slug), FormMethod.Post, new { @class = "inline" })) { %>
<fieldset> <fieldset>
<button type="submit" src="<%=Html.ThemePath("/styles/images/remove.png") %>" class="ibutton remove" title="<%=_Encoded("Remove Post") %>"><%=_Encoded("Remove Post") %></button> <button type="submit" class="ibutton remove" title="<%=_Encoded("Remove Post") %>"><%=_Encoded("Remove Post") %></button>
</fieldset><% </fieldset><%
} %> } %>
</li> </li>
@@ -343,6 +343,9 @@ span.message {
/* Forms /* Forms
----------------------------------------------------------*/ ----------------------------------------------------------*/
form.inline, form.inline fieldset { /* todo: (heskew) need something other than .inline ... */
display:inline;
}
form.inline fieldset { form.inline fieldset {
margin:0; margin:0;
} }
@@ -658,6 +661,11 @@ todo: (heskew) pull out into relevant modules where appropriate
/* Pages /* Pages
----------------------------------------------------------*/ ----------------------------------------------------------*/
.templates li {
border-bottom:1px dashed #e4e7dc;
margin-bottom:2em;
padding-bottom:2em;
}
.templates fieldset { .templates fieldset {
margin:0 0 .933%; margin:0 0 .933%;
} }