yavsc/web/Views/Account/Circles.aspx
Paul Schneider 3355f9fed0 * bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes

* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes

* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
  post

* NpgsqlCircleProvider.cs: Fixes the "Match" method.

* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring

* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider

* NpgsqlRoleProvider.cs: simpler init method

* NpgsqlUserNameProvider.cs: impements a UserNameProvider

* MyClass.cs: refactoring from Yavsc.Model

* BlogsController.cs: access control simplified

* FrontOfficeController.cs: Pdf generation made public ni case of
  formatting exception

* mdd_styles.css: Theme -> App_Themes

* style.css: yet another style impact

* AccountController.cs: Fixes the user name modification

* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle

* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.

* GoogleController.cs: Fixes the user name modification on a Google
  account

* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
  helper)

* FormatterException.cs: formatter exception exposes error and
  standard output of the process

* TexToPdfFormatter.cs: * generates temporary files in the folder
  returned by Path.GetTempPath()
* throws FormatterException

* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}

* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*

* NoLogin.master: refactoring: Theme moved to App_Themes

* Circles.aspx: refactoring : circles now are given as select items

* Login.aspx: fixes the html presentation

* Register.aspx: Fixes a Typo

* Index.aspx: Implements a blog index, due to M&C changes with this
  commit

* RemovePost.aspx: links to the new route to the "RemovePost" action,
  giving it a post id

* RemoveTitle.aspx: fixes a not yet linked page to remove a post
  collection under a given title

* EventPub.aspx: code refactoring

* Writting.ascx: cleans the code

* Web.config: fills the config with new names in the space

* Web.config: configures the new NpgsqlUserNameProvider

* Web.csproj: refactoring and others

* BlogEntryCollection.cs: implement the BlogEntryCollection

* BlogManager.cs: the manager helps to filter on access

* BlogProvider.cs: The title is not unique anymore, and one can modify
  it, post a lot under it, drop all posts under it.
A Post is deleted by id.

* UUBlogEntryCollection.cs: implements a collection of post under a
  given user name.

* UUTBlogEntryCollection.cs: implements a collection of post under a
  given couple (user name, title).

* ListItem.cs: ListItem is declared obsolete in this model, helpers
  can build MVC SelectListItem on data returned by the manager.

* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml

* LocalizedText.resx:
* LocalizedText.fr.resx: new labels

* ChangeUserNameProvider.cs: xml doc

* Profile.cs: the UserName property is read only, and comes from
  authentication, to change it, we set a Name and validate it agains
  the "Profile" method

* UserManager.cs: simpler code a init time

* IContentProvider.cs: implements the new IDataProvider interface

* IDataProvider.cs: defines the new IDataProvider interface

* YavscModel.csproj: includes new classes

* UserPosts.aspx: adds a link to remove a post

* UserPost.aspx: now uses the new BlogEntryCollection object
2015-08-04 02:10:28 +02:00

179 lines
5.8 KiB
Text

<%@ Page Title="Circles" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script>
</asp:Content>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<table id="tbc">
<thead>
<tr>
<th data-sort="string"><%=Html.Translate("Title")%></th>
</tr>
</thead>
<tbody id="tbcb">
<% int lc=0;
foreach (SelectListItem ci in (IEnumerable<SelectListItem>) ViewData["Circles"]) { lc++; %>
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Value%>">
<td><%=ci.Text%></td>
<td>
<input type="button" value="<%=Html.Translate("Remove")%>" class="actionlink rowbtnrm"/>
<input type="button" value="<%=Html.Translate("Members")%>" class="actionlink rowbtnvw"/>
</td>
</tr>
<% } %>
</tbody>
</table>
<script>
$(function(){
$("#tbc").stupidtable();
});
</script>
</asp:Content>
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
<div id="dfnuser" class="hidden panel">
<%= Html.Partial("~/Views/Account/Register.ascx",new RegisterClientModel(),new ViewDataDictionary(ViewData)
{
TemplateInfo = new System.Web.Mvc.TemplateInfo
{
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"ur":ViewData.TemplateInfo.HtmlFieldPrefix+"_ur"
}
}) %>
</div>
<form>
<fieldset>
<legend>Nouveau cercle</legend>
<span id="msg" class="field-validation-valid error"></span>
<label for="title"><b><%=Html.Translate("Title")%></b></label>
<input type="text" id="title" name="title" class="inputtext"/>
<span id="Err_cr_title" class="field-validation-valid error"></span>
<table id="tbmbrs">
<thead>
<tr>
<th data-sort="string"><%=Html.Translate("Members")%>
<span id="Err_cr_users" class="field-validation-valid error"></span>
<yavsc:InputUserName
id="users"
name="users"
emptyvalue="[nouvel utilisateur]"
onchange="onmembersChange(this.value);"
multiple="true"
runat="server" >
</yavsc:InputUserName>
<script>
function message(msg) {
if (msg) {
$("#msg").removeClass("hidden");
$("#msg").text(msg);
} else { $("#msg").addClass("hidden"); } }
function onmembersChange(newval)
{
if (newval=='')
$("#dfnuser").removeClass("hidden");
else
$("#dfnuser").addClass("hidden");
}
function clearRegistrationValidation(){
$("#Err_ur_Name").text("");
$("#Err_ur_UserName").text("");
$("#Err_ur_Mobile").text("");
$("#Err_ur_Phone").text("");
$("#Err_ur_Email").text("");
$("#Err_ur_Address").text("");
$("#Err_ur_ZipCode").text("");
$("#Err_ur_CityAndState").text("");
$("#Err_ur_IsApprouved").text("");
}
function clearCircleValidation() {}
function addCircle()
{
var circle = { title: $("#title").val(), users: $("#users").val() } ;
$("#title").text('');
$("#users").val('');
$.ajax({
url: "<%=Url.Content("~/api/Circle/Create")%>",
type: "POST",
data: circle,
success: function (data) {
$("#users option:last").after($('<option>'+user.UserName+'</option>'));
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
function addUser()
{
var user={
UserName: $("#ur_UserName").val(),
Name: $("#ur_Name").val(),
Password: $("#ur_Password").val(),
Email: $("#ur_Email").val(),
Address: $("#ur_Address").val(),
CityAndState: $("#ur_CityAndState").val(),
ZipCode: $("#ur_ZipCode").val(),
Phone: $("#ur_Phone").val(),
Mobile: $("#ur_Mobile").val(),
IsApprouved: true
};
clearRegistrationValidation();
$.ajax({
url: "<%=Url.Content("~/api/FrontOffice/Register")%>",
type: "POST",
data: user,
success: function (data) {
$("#users option:last").after($('<option>'+user.UserName+'</option>'));
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_ur_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
</script>
</th>
</tr>
</thead>
<tbody id="tbmbrsb">
</tbody>
</table>
<input type="button" id="btnnewcircle" value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
</fieldset>
</form>
<script>
$(document).ready(function () {
$("#btnnewuser").click(addUser);
$("#btnnewcircle").click(addCircle);
});
</script>
</asp:Content>