Checkpoint commit on Positions

This commit is contained in:
Rick Falkvinge
2015-04-10 22:38:30 +02:00
parent c6f20afe91
commit ecda65e153
7 changed files with 182 additions and 24 deletions
+5
View File
@@ -155,4 +155,9 @@ public class DataV5Base : Page
{
return input.Replace ("\"", "\\\"").Replace (" ", " ").Trim();
}
public string JavascriptEscape(string input)
{
return CommonV5.JavascriptEscape(input);
}
}
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Positions_AssignmentDuration" xml:space="preserve">
<value>Assignment duration (extendable)</value>
</data>
<data name="Positions_AssignmentExpires" xml:space="preserve">
<value>Expires</value>
<comment>The date a position assignment autoterminates</comment>
</data>
<data name="Positions_AssignMorePerson" xml:space="preserve">
<value>Assign one more person...</value>
<comment>To an existing position that accepts multiple people (like "assistants")</comment>
</data>
<data name="Positions_AssignPerson" xml:space="preserve">
<value>Assign person...</value>
</data>
<data name="Positions_AssignPersonToPosition" xml:space="preserve">
<value>Assign this person to position</value>
</data>
<data name="Positions_ModalHeader" xml:space="preserve">
<value>Assign person as &lt;span id='{0}_modalPositionName'&gt;...&lt;/span&gt;</value>
<comment>Header for new assignment dialog</comment>
</data>
<data name="Positions_Vacant" xml:space="preserve">
<value>(vacant)</value>
<comment>For unassigned positions</comment>
</data>
</root>
-15
View File
@@ -572,10 +572,6 @@
<value>Year {0}</value>
<comment>As in "the year X".</comment>
</data>
<data name="Swarm_Vacant" xml:space="preserve">
<value>(vacant)</value>
<comment>For unassigned positions</comment>
</data>
<data name="Global_DefineToEnable" xml:space="preserve">
<value>define to enable</value>
<comment>shown as watermark on some edit boxes</comment>
@@ -681,17 +677,6 @@
<data name="Swarm_AssignedPerson" xml:space="preserve">
<value>Assigned Person</value>
</data>
<data name="Swarm_AssignmentExpires" xml:space="preserve">
<value>Expires</value>
<comment>The date a position assignment autoterminates</comment>
</data>
<data name="Swarm_AssignMorePerson" xml:space="preserve">
<value>Assign one more person...</value>
<comment>To an existing position that accepts multiple people (like "assistants")</comment>
</data>
<data name="Swarm_AssignPerson" xml:space="preserve">
<value>Assign person...</value>
</data>
<data name="Swarm_Position" xml:space="preserve">
<value>Position</value>
</data>
+9 -3
View File
@@ -18,6 +18,7 @@ namespace Swarmops.Frontend.Automation
// If level if system-wide, execute this block. Also, move the data to the real place, please
JsonPositions rootPositions = new JsonPositions();
_customCookieClass = Request["CustomCookie"]; // may be null and that's ok
Tree<Position> systemPositions = Positions.ForSystem().Tree;
@@ -42,7 +43,7 @@ namespace Swarmops.Frontend.Automation
PositionAssignments assignments = position.Assignments;
string expires = string.Empty;
string assignedName = Resources.Global.Swarm_Vacant + " <a href='#' class='LocalAssignPerson'>" + Resources.Global.Swarm_AssignPerson + "</a>" ;
string assignedName = string.Format("{0} <a href='#' positionId='{3}' positionName='{4}' class='{1} LocalAssignPerson'>{2}</a>", Resources.Controls.Swarm.Positions_Vacant, _customCookieClass, Resources.Controls.Swarm.Positions_AssignPerson, position.Identity, JavascriptEscape(position.Localized()));
if (assignments.Count > 0)
{
@@ -86,8 +87,11 @@ namespace Swarmops.Frontend.Automation
// finally, if the assigned count is less than max count, add a "assign another person" link
elements.Add ("{" + element + "}");
string addPerson = "<a href='#' class='LocalAssignPerson'>" +
Resources.Global.Swarm_AssignMorePerson + "</a>";
string addPerson =
string.Format (
"<a href='#' positionId='{1}' positionName='{2}' class='{3} LocalAssignPerson'>{0}</a>",
Resources.Controls.Swarm.Positions_AssignMorePerson, position.Identity,
JavascriptEscape (position.Localized()), _customCookieClass);
element =
String.Format(
@@ -107,6 +111,8 @@ namespace Swarmops.Frontend.Automation
return "[" + String.Join(",", elements.ToArray()) + "]";
}
private string _customCookieClass;
private class JsonPosition
{
public JsonPosition()
+4
View File
@@ -116,6 +116,10 @@
$('span#<%= this.ClientID %>_SpanPeople span input.textbox-text').animate({ backgroundColor: "#FFFFFF" }, 250);
}
function <%=this.ClientID %>_clear() {
<%=this.ClientID%>_val('');
<%=this.ClientID%>_avatarUrl('');
}
</script>
+14 -5
View File
@@ -10,14 +10,23 @@
onLoadSuccess: function () {
$('.LocalAssignPerson').click(function () {
<%= this.DropPerson.ClientID%>_val('');
currentPosition = $(this).attr("positionId");
$('#<%= this.ClientID %>_modalPositionName').text(decodeURIComponent($(this).attr("positionName")));
<%= this.DropPerson.ClientID%>_clear();
<%= this.DialogAdd.ClientID %>_open();
});
}
// TODO: RowStyler
});
$('#<%=this.ClientID%>_buttonAssign').click(function() {
alert("foo!");
});
});
var currentPosition = '';
</script>
@@ -41,15 +50,15 @@
<Swarmops5:ModalDialog id="DialogAdd" runat="server">
<DialogCode>
<h2>Assigning to ASDSADASDASDASD</h2>
<h2><asp:Label runat="server" ID="LabelModalHeader"/></h2>
<div class="entryFields">
<Swarmops5Workaround:ComboPeople ID="DropPerson" runat="server" />&#8203;<br/>
<asp:DropDownList ID="DropDuration" runat="server" />&#8203;<br/>
<input type="button" class="buttonAccentColor" value="Assign"/>
<input type="button" id="<%=this.ClientID %>_buttonAssign" class="buttonAccentColor" value="Assign"/>
</div>
<div class="entryLabels">
Assign this person to the position:<br/>
Assignment duration:
<asp:Label ID="LabelAssignPersonTo" runat="server" /><br/>
<asp:Label ID="LabelAssignmentDuration" runat="server" />
</div>
</DialogCode>
</Swarmops5:ModalDialog>
@@ -27,9 +27,13 @@ namespace Swarmops.Frontend.Controls.v5.Swarm
this.LiteralHeaderAction.Text = Resources.Global.Global_Action;
this.LiteralHeaderName.Text = Resources.Global.Swarm_AssignedPerson;
this.LiteralHeaderPosition.Text = Resources.Global.Swarm_Position;
this.LiteralHeaderExpires.Text = Resources.Global.Swarm_AssignmentExpires;
this.LiteralHeaderExpires.Text = Resources.Controls.Swarm.Positions_AssignmentExpires;
this.LiteralHeaderMinMax.Text = Resources.Global.Global_MinMax;
this.LabelAssignPersonTo.Text = Resources.Controls.Swarm.Positions_AssignPersonToPosition;
this.LabelAssignmentDuration.Text = Resources.Controls.Swarm.Positions_AssignmentDuration;
this.LabelModalHeader.Text = String.Format (Resources.Controls.Swarm.Positions_ModalHeader, this.ClientID);
this.DropDuration.Items.Add (new ListItem(Resources.Global.Timespan_Selection_OneMonth, "1"));
this.DropDuration.Items.Add(new ListItem(Resources.Global.Timespan_Selection_TwoMonths, "2"));
this.DropDuration.Items.Add(new ListItem(Resources.Global.Timespan_Selection_ThreeMonths, "3"));