refactoring

This commit is contained in:
Paul Schneider
2014-10-08 10:47:40 +02:00
parent 347ffc8a5a
commit b5d19c5da6
38 changed files with 149 additions and 117 deletions

View File

@ -0,0 +1,14 @@
<%@ Page Title="Ajout d'un role" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary() %>
<% using(Html.BeginForm("DoAddRole")) %>
<% { %>
Nom du rôle :
<%= Html.TextBox( "RoleName" ) %>
<%= Html.ValidationMessage("RoleName", "*") %><br/>
<input class="actionlink" type="submit"/>
<% } %>
</asp:Content>

View File

@ -0,0 +1,31 @@
<%@ Page Title="Liste des administrateurs" Language="C#" Inherits="System.Web.Mvc.ViewPage<NewAdminModel>" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<table>
<% foreach (string u in (string[])ViewData["admins"]) { %>
<tr><td>
<%= u %> </td><td><%= Html.ActionLink("Remove","RemoveFromRole",new { username = u, rolename="Admin", returnUrl = Request.Url.PathAndQuery })%>
</td></tr>
<% } %>
</table>
</div>
<div>
<h2>Ajout d'un administrateur
</h2>
<p><%= Html.ValidationSummary() %> </p>
<% using ( Html.BeginForm("Admin", "Admin") ) { %>
<%= Html.LabelFor(model => model.UserName) %> :
<%= Html.DropDownListFor(model => model.UserName, (List<SelectListItem>)ViewData["useritems"] ) %>
<%= Html.ValidationMessage("UserName", "*") %>
<input type="submit"/>
<% } %>
</div>
</asp:Content>

View File

@ -0,0 +1,7 @@
<%@ Page Title="Backup created" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Export>" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<div><h2>Error message </h2> <%= Html.Encode(Model.Error) %></div>
<div><h2>Message </h2> <%= Html.Encode(Model.Message) %></div>
<div><h2>File name</h2> <%= Html.Encode(Model.FileName) %></div>
<div><h2>Exit Code</h2> <%= Html.Encode(Model.ExitCode) %></div>
</asp:Content>

View File

@ -0,0 +1,6 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<DataAccess>" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.ActionLink("Create a database backup", "CreateBackup")%><br/>
<%=Html.ActionLink("Restaurations", "Restore")%><br/>
</asp:Content>

View File

@ -0,0 +1,23 @@
<%@ Page Title="Backup creation" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<DataAccess>" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<%= Html.ValidationSummary("CreateBackup") %>
<% using (Html.BeginForm("CreateBackup")) { %>
<%= Html.LabelFor(model => model.Host) %>:
<%= Html.TextBox( "Host" ) %>
<%= Html.ValidationMessage("Host", "*") %><br/>
<%= Html.LabelFor(model => model.Port) %>:
<%= Html.TextBox( "Port" ) %>
<%= Html.ValidationMessage("Port", "*") %><br/>
<%= Html.LabelFor(model => model.Dbname) %>:
<%= Html.TextBox( "Dbname" ) %>
<%= Html.ValidationMessage("Dbname", "*") %><br/>
<%= Html.LabelFor(model => model.Dbuser) %>:
<%= Html.TextBox( "Dbuser" ) %>
<%= Html.ValidationMessage("Dbuser", "*") %><br/>
<%= Html.LabelFor(model => model.Password) %>:
<%= Html.Password( "Password" ) %>
<%= Html.ValidationMessage("Password", "*") %><br/>
<input type="submit"/>
<% } %>
</asp:Content>

View File

@ -0,0 +1,4 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<DataAccess>" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<%= Html.ActionLink("Backups","Backups") %>
</asp:Content>

View File

@ -0,0 +1,17 @@
<%@ Page Title="User removal" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<%= Html.ValidationSummary() %>
<% using ( Html.BeginForm("RemoveRole") ) { %>
Supprimer le rôle
<%= Html.Encode( ViewData["roletoremove"] ) %> ?
<br/>
<input type="hidden" name="rolename" value="<%=ViewData["roletoremove"]%>"/>
<input class="actionlink" type="submit" name="submitbutton" value="Supprimer"/>
<input class="actionlink" type="submit" name="submitbutton" value="Annuler" />
<% } %>
</div>
</asp:Content>

View File

@ -0,0 +1,22 @@
<%@ Page Title="User removal" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="head" ID="headContent" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
<h2>Suppression d'un utilisateur</h2>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<%= Html.ValidationSummary() %>
<% using ( Html.BeginForm("RemoveUser") ) { %>
Supprimer l'utilisateur
<%= Html.Encode( ViewData["usertoremove"] ) %> ?
<br/>
<input type="hidden" name="username" value="<%=ViewData["usertoremove"]%>"/>
<input class="actionlink" type="submit" name="submitbutton" value="Supprimer"/>
<input class="actionlink" type="submit" name="submitbutton" value="Annuler" />
<% } %>
</div>
</asp:Content>

View File

@ -0,0 +1,37 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<DataAccess>" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<%= Html.ValidationSummary("Restore a database backup") %>
<% using (Html.BeginForm("Restore")) { %>
<% string [] bckdirs = Model.GetBackupDirs(); %>
<select name="backupName">
<% foreach (string s in bckdirs)
{
%>
<option value="<%=s%>"><%=s%></option>
<%
}
%>
</select>
<label for="dataOnly">Data only :</label>
<%= Html.CheckBox("dataOnly")%>
<%= Html.LabelFor(model => model.Host) %>:
<%= Html.TextBox( "Host" ) %>
<%= Html.ValidationMessage("Host", "*") %><br/>
<%= Html.LabelFor(model => model.Port) %>:
<%= Html.TextBox( "Port" ) %>
<%= Html.ValidationMessage("Port", "*") %><br/>
<%= Html.LabelFor(model => model.Dbname) %>:
<%= Html.TextBox( "Dbname" ) %>
<%= Html.ValidationMessage("Dbname", "*") %><br/>
<%= Html.LabelFor(model => model.Dbuser) %>:
<%= Html.TextBox( "Dbuser" ) %>
<%= Html.ValidationMessage("Dbuser", "*") %><br/>
<%= Html.LabelFor(model => model.Password) %>:
<%= Html.Password( "Password" ) %>
<%= Html.ValidationMessage("Password", "*") %><br/>
<input type="submit"/>
<% } %>
</asp:Content>

View File

@ -0,0 +1,8 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<TaskOutput>" %>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<h1><%=Html.Encode(ViewData["BackupName"])%> Restauration</h1>
<div><h2>Error message </h2> <%= Html.Encode(Model.Error) %></div>
<div><h2>Message </h2> <%= Html.Encode(Model.Message) %></div>
<div><h2>Exit Code</h2> <%= Html.Encode(Model.ExitCode) %></div>
</asp:Content>

View File

@ -0,0 +1,18 @@
<%@ Page Title="Liste des rôles" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
Roles:
<ul>
<%foreach (string rolename in (string[]) Model){ %>
<li><%=rolename%> <% if (Roles.IsUserInRole("Admin")) { %>
<%= Html.ActionLink("Supprimer","RemoveRole", new { rolename = rolename }, new { @class="actionlink" } ) %>
<% } %></li>
<% } %>
</ul>
<% if (Roles.IsUserInRole("Admin")) { %>
<%= Html.ActionLink("Ajouter un rôle","AddRole", null, new { @class="actionlink" } ) %>
<% } %>
</asp:Content>

View File

@ -0,0 +1,17 @@
<%@ Page Title="User List" Language="C#" Inherits="System.Web.Mvc.ViewPage<System.Web.Security.MembershipUserCollection>" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<ul>
<%foreach (MembershipUser user in Model){ %>
<li><%=user.UserName%> <%=user.Email%> <%=(!user.IsApproved)?"(Not Approuved)":""%> <%=user.IsOnline?"Online":"Offline"%>
<% if (Roles.IsUserInRole("Admin")) { %>
<%= Html.ActionLink("Supprimer","RemoveUserQuery", new { username = user.UserName }, new { @class="actionlink" } ) %>
<% } %>
</li>
<% }%>
</ul>
</asp:Content>