Monotone-Parent: 4d5e83e68c9e02af7b7d7a38ef3b127962a84549
Monotone-Revision: 3e152eeda68e8af354608976f5301f766ec154be Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-11-13T18:46:00 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
ee3740dd33
commit
a5ef8abddb
|
@ -7,6 +7,9 @@
|
||||||
xmlns:rsrc="OGo:url"
|
xmlns:rsrc="OGo:url"
|
||||||
xmlns:label="OGo:label">
|
xmlns:label="OGo:label">
|
||||||
<script type="text/javascript" rsrc:src="UIxFreeBusyUserSelector.js"><!-- space --></script>
|
<script type="text/javascript" rsrc:src="UIxFreeBusyUserSelector.js"><!-- space --></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
freeBusySelectorId = '<var:string value="selectorId" />';
|
||||||
|
</script>
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
var:id="selectorId"
|
var:id="selectorId"
|
||||||
var:name="selectorId"
|
var:name="selectorId"
|
||||||
|
@ -73,9 +76,4 @@
|
||||||
/></label>
|
/></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
initializeFreeBusyUserSelector('<var:string value="selectorId" />');
|
|
||||||
disableAnchor($('FBStartTimeReplica_date').parentNode.childNodesWithTag('a')[0]);
|
|
||||||
disableAnchor($('FBEndTimeReplica_date').parentNode.childNodesWithTag('a')[0]);
|
|
||||||
</script>
|
|
||||||
</container>
|
</container>
|
||||||
|
|
|
@ -39,9 +39,7 @@
|
||||||
><input type="text"
|
><input type="text"
|
||||||
var:value="currentContactName"
|
var:value="currentContactName"
|
||||||
var:uid="currentContactId"
|
var:uid="currentContactId"
|
||||||
class="textField"
|
class="textField" /></td
|
||||||
onkeyup="onContactKeyUp(this, event);"
|
|
||||||
onblur="checkAttendee(this);" /></td
|
|
||||||
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
|
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
|
||||||
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
|
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
|
||||||
><td></td
|
><td></td
|
||||||
|
@ -50,8 +48,7 @@
|
||||||
</tr></var:foreach>
|
</tr></var:foreach>
|
||||||
<tr class="futureAttendee"
|
<tr class="futureAttendee"
|
||||||
><td class="attendees"><input type="text" class="textField"
|
><td class="attendees"><input type="text" class="textField"
|
||||||
readonly="readonly"
|
readonly="readonly" /></td
|
||||||
onclick="newAttendee(this);" /></td
|
|
||||||
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
|
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
|
||||||
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
|
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
|
||||||
><td></td
|
><td></td
|
||||||
|
@ -59,9 +56,7 @@
|
||||||
></var:foreach
|
></var:foreach
|
||||||
></tr>
|
></tr>
|
||||||
<tr class="attendeeModel"
|
<tr class="attendeeModel"
|
||||||
><td class="attendees"><input type="text" class="textField"
|
><td class="attendees"><input type="text" class="textField" /></td
|
||||||
onkeyup="onContactKeyUp(this, event);"
|
|
||||||
onblur="checkAttendee(this);" /></td
|
|
||||||
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
|
><var:foreach list="daysToDisplay" item="currentDayToDisplay"
|
||||||
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
|
><var:foreach list="hoursToDisplay" item="currentHourToDisplay"
|
||||||
><td></td
|
><td></td
|
||||||
|
|
|
@ -7,20 +7,35 @@ var requestField;
|
||||||
var awaitingFreeBusyRequests = new Array();
|
var awaitingFreeBusyRequests = new Array();
|
||||||
var freeBusySelectorId;
|
var freeBusySelectorId;
|
||||||
|
|
||||||
function onContactKeyUp(node, event) {
|
function onContactKeydown(event) {
|
||||||
if (!running) {
|
if (event.keyCode == 9) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (this.confirmedValue)
|
||||||
|
this.value = this.confirmedValue;
|
||||||
|
var row = this.parentNode.parentNode.nextSibling;
|
||||||
|
while (!(row instanceof HTMLTableRowElement))
|
||||||
|
row = row.nextSibling;
|
||||||
|
this.blur();
|
||||||
|
var input = row.cells[0].childNodesWithTag("input")[0];
|
||||||
|
if (input.readOnly)
|
||||||
|
newAttendee(null);
|
||||||
|
else {
|
||||||
|
input.focus();
|
||||||
|
input.select();
|
||||||
|
input.focussed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!running) {
|
||||||
if (event.keyCode == 8
|
if (event.keyCode == 8
|
||||||
|| event.keyCode == 32
|
|| event.keyCode == 32
|
||||||
|| event.keyCode > 47) {
|
|| event.keyCode > 47) {
|
||||||
log ("keycode: " + event.keyCode);
|
|
||||||
running = true;
|
running = true;
|
||||||
requestField = node;
|
requestField = this;
|
||||||
setTimeout("triggerRequest()", delay);
|
setTimeout("triggerRequest()", delay);
|
||||||
} else if (node.confirmedValue) {
|
}
|
||||||
log ("keycode: " + event.keyCode);
|
else if (this.confirmedValue) {
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
node.value = node.confirmedValue;
|
this.setSelectionRange(this.value.length, this.value.length);
|
||||||
node.setSelectionRange(node.value.length, node.value.length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,8 +53,7 @@ function triggerRequest() {
|
||||||
requestField);
|
requestField);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateResults(http)
|
function updateResults(http) {
|
||||||
{
|
|
||||||
if (http.readyState == 4) {
|
if (http.readyState == 4) {
|
||||||
if (http.status == 200) {
|
if (http.status == 200) {
|
||||||
var searchField = http.callbackData;
|
var searchField = http.callbackData;
|
||||||
|
@ -57,8 +71,12 @@ function updateResults(http)
|
||||||
searchField.value += ' >> ' + text[1];
|
searchField.value += ' >> ' + text[1];
|
||||||
}
|
}
|
||||||
searchField.confirmedValue = text[1];
|
searchField.confirmedValue = text[1];
|
||||||
var end = searchField.value.length;
|
if (searchField.focussed) {
|
||||||
searchField.setSelectionRange(start, end);
|
var end = searchField.value.length;
|
||||||
|
searchField.setSelectionRange(start, end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
searchField.value = text[1];
|
||||||
}
|
}
|
||||||
running = false;
|
running = false;
|
||||||
document.contactLookupAjaxRequest = null;
|
document.contactLookupAjaxRequest = null;
|
||||||
|
@ -140,27 +158,36 @@ function redisplayFreeBusyZone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function newAttendee(node)
|
function newAttendee(event)
|
||||||
{
|
{
|
||||||
var table = $("attendeesView").childNodesWithTag("div")[0].childNodesWithTag("table")[0];
|
var table = $("attendeesView").childNodesWithTag("div")[0].childNodesWithTag("table")[0];
|
||||||
var tbody = table.childNodesWithTag("tbody")[0];
|
var tbody = table.tBodies[0];
|
||||||
var model = tbody.rows[tbody.rows.length - 1];
|
var model = tbody.rows[tbody.rows.length - 1];
|
||||||
var newAttendeeRow = tbody.rows[tbody.rows.length - 2]
|
var newAttendeeRow = tbody.rows[tbody.rows.length - 2]
|
||||||
var newRow = model.cloneNode(true);
|
var newRow = model.cloneNode(true);
|
||||||
|
var input = newRow.cells[0].childNodesWithTag("input")[0];
|
||||||
|
input.setAttribute("autocomplete", "off");
|
||||||
newRow.setAttribute("class", "");
|
newRow.setAttribute("class", "");
|
||||||
tbody.insertBefore(newRow, newAttendeeRow);
|
tbody.insertBefore(newRow, newAttendeeRow);
|
||||||
newRow.childNodesWithTag("td")[0].childNodesWithTag("input")[0].focus();
|
input.serial = "pouet";
|
||||||
|
input.addEventListener("blur", checkAttendee, false);
|
||||||
|
input.addEventListener("keydown", onContactKeydown, false);
|
||||||
|
input.focus();
|
||||||
|
input.focussed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAttendee(node)
|
function checkAttendee()
|
||||||
{
|
{
|
||||||
var th = node.parentNode.parentNode;
|
this.focussed = false;
|
||||||
|
var th = this.parentNode.parentNode;
|
||||||
var tbody = th.parentNode;
|
var tbody = th.parentNode;
|
||||||
if (node.value.trim().length == 0)
|
if (this.value.trim().length == 0)
|
||||||
tbody.removeChild(th);
|
tbody.removeChild(th);
|
||||||
else if (!node.hasfreebusy) {
|
else if (!this.hasfreebusy) {
|
||||||
displayFreeBusyForNode(node);
|
if (this.confirmedValue)
|
||||||
node.hasfreebusy = true;
|
this.value = this.confirmedValue;
|
||||||
|
displayFreeBusyForNode(this);
|
||||||
|
this.hasfreebusy = true;
|
||||||
}
|
}
|
||||||
resetAttendeesValue();
|
resetAttendeesValue();
|
||||||
}
|
}
|
||||||
|
@ -246,16 +273,22 @@ function resetAttendeesValue()
|
||||||
currentInput.setAttribute("uid", null);
|
currentInput.setAttribute("uid", null);
|
||||||
}
|
}
|
||||||
uids.push(currentInput.uid);
|
uids.push(currentInput.uid);
|
||||||
|
currentInput.setAttribute("autocomplete", "off");
|
||||||
|
currentInput.addEventListener("keydown", onContactKeydown, false);
|
||||||
|
currentInput.addEventListener("blur", checkAttendee, false);
|
||||||
}
|
}
|
||||||
var input = $(freeBusySelectorId);
|
var input = $(freeBusySelectorId);
|
||||||
input.value = uids.join(",");
|
input.value = uids.join(",");
|
||||||
|
inputs[inputs.length - 2].setAttribute("autocomplete", "off");
|
||||||
|
inputs[inputs.length - 2].addEventListener("click", newAttendee, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeFreeBusyUserSelector(selectorId)
|
function initializeFreeBusyUserSelector()
|
||||||
{
|
{
|
||||||
freeBusySelectorId = selectorId;
|
|
||||||
resetAttendeesValue();
|
resetAttendeesValue();
|
||||||
resetAllFreeBusys();
|
resetAllFreeBusys();
|
||||||
|
disableAnchor($('FBStartTimeReplica_date').parentNode.childNodesWithTag('a')[0]);
|
||||||
|
disableAnchor($('FBEndTimeReplica_date').parentNode.childNodesWithTag('a')[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetAllFreeBusys()
|
function resetAllFreeBusys()
|
||||||
|
@ -332,3 +365,9 @@ function onTimeWidgetChange()
|
||||||
{
|
{
|
||||||
setTimeout("redisplayFreeBusyZone();", 1000);
|
setTimeout("redisplayFreeBusyZone();", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFreeBusyLoadHandler() {
|
||||||
|
initializeFreeBusyUserSelector();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("load", onFreeBusyLoadHandler, false);
|
||||||
|
|
Loading…
Reference in a new issue