init import from old mailr project (http://svn.littlegreen.org/mailr/trunk)
This commit is contained in:
commit
51b79e7298
640 changed files with 34651 additions and 0 deletions
52
public/javascripts/contact_choose.js
Executable file
52
public/javascripts/contact_choose.js
Executable file
|
@ -0,0 +1,52 @@
|
|||
|
||||
var fieldTo = ""
|
||||
var fieldToc = ""
|
||||
var fieldCC = ""
|
||||
var fieldBCC = ""
|
||||
|
||||
function respondTo(str) {
|
||||
if (fieldTo == "") fieldTo += str
|
||||
else fieldTo += "," + str
|
||||
}
|
||||
|
||||
function respondTo(str, contactId) {
|
||||
if (fieldTo == "") fieldTo += str
|
||||
else fieldTo += "," + str
|
||||
|
||||
if (fieldToc == "") fieldToc += contactId
|
||||
else fieldToc += "," + contactId
|
||||
}
|
||||
|
||||
function respondCC(str) {
|
||||
if (fieldCC == "") fieldCC += str
|
||||
else fieldCC += "," + str
|
||||
}
|
||||
|
||||
function respondBCC(str) {
|
||||
if (fieldBCC == "") fieldBCC += str
|
||||
else fieldBCC += "," + str
|
||||
}
|
||||
|
||||
function respondToCaller() {
|
||||
if (window.opener) {
|
||||
doc = window.opener.document;
|
||||
setAddrField(getFormFieldPoint(doc, 'mail_to'), fieldTo);
|
||||
setAddrField(getFormFieldPoint(doc, 'mail_toc'), fieldToc);
|
||||
setAddrField(getFormFieldPoint(doc, 'mail_cc'), fieldCC);
|
||||
setAddrField(getFormFieldPoint(doc, 'mail_bcc'), fieldBCC);
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
function getFormFieldPoint(doc, id) {
|
||||
if ( doc.getElementById ) elem = doc.getElementById( id );
|
||||
else if ( doc.all ) elem = doc.eval( "document.all." + id );
|
||||
return elem
|
||||
}
|
||||
|
||||
function setAddrField(fld, value) {
|
||||
if (value != "") {
|
||||
if (fld.value == "") fld.value = value;
|
||||
else fld.value += "," + value;
|
||||
}
|
||||
}
|
708
public/javascripts/controls.js
vendored
Normal file
708
public/javascripts/controls.js
vendored
Normal file
|
@ -0,0 +1,708 @@
|
|||
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
||||
// (c) 2005 Jon Tirsen (http://www.tirsen.com)
|
||||
// Contributors:
|
||||
// Richard Livsey
|
||||
// Rahul Bhargava
|
||||
// Rob Wills
|
||||
//
|
||||
// See scriptaculous.js for full license.
|
||||
|
||||
// Autocompleter.Base handles all the autocompletion functionality
|
||||
// that's independent of the data source for autocompletion. This
|
||||
// includes drawing the autocompletion menu, observing keyboard
|
||||
// and mouse events, and similar.
|
||||
//
|
||||
// Specific autocompleters need to provide, at the very least,
|
||||
// a getUpdatedChoices function that will be invoked every time
|
||||
// the text inside the monitored textbox changes. This method
|
||||
// should get the text for which to provide autocompletion by
|
||||
// invoking this.getToken(), NOT by directly accessing
|
||||
// this.element.value. This is to allow incremental tokenized
|
||||
// autocompletion. Specific auto-completion logic (AJAX, etc)
|
||||
// belongs in getUpdatedChoices.
|
||||
//
|
||||
// Tokenized incremental autocompletion is enabled automatically
|
||||
// when an autocompleter is instantiated with the 'tokens' option
|
||||
// in the options parameter, e.g.:
|
||||
// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
|
||||
// will incrementally autocomplete with a comma as the token.
|
||||
// Additionally, ',' in the above example can be replaced with
|
||||
// a token array, e.g. { tokens: [',', '\n'] } which
|
||||
// enables autocompletion on multiple tokens. This is most
|
||||
// useful when one of the tokens is \n (a newline), as it
|
||||
// allows smart autocompletion after linebreaks.
|
||||
|
||||
var Autocompleter = {}
|
||||
Autocompleter.Base = function() {};
|
||||
Autocompleter.Base.prototype = {
|
||||
baseInitialize: function(element, update, options) {
|
||||
this.element = $(element);
|
||||
this.update = $(update);
|
||||
this.hasFocus = false;
|
||||
this.changed = false;
|
||||
this.active = false;
|
||||
this.index = 0;
|
||||
this.entryCount = 0;
|
||||
|
||||
if (this.setOptions)
|
||||
this.setOptions(options);
|
||||
else
|
||||
this.options = options || {};
|
||||
|
||||
this.options.paramName = this.options.paramName || this.element.name;
|
||||
this.options.tokens = this.options.tokens || [];
|
||||
this.options.frequency = this.options.frequency || 0.4;
|
||||
this.options.minChars = this.options.minChars || 1;
|
||||
this.options.onShow = this.options.onShow ||
|
||||
function(element, update){
|
||||
if(!update.style.position || update.style.position=='absolute') {
|
||||
update.style.position = 'absolute';
|
||||
Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
|
||||
}
|
||||
Effect.Appear(update,{duration:0.15});
|
||||
};
|
||||
this.options.onHide = this.options.onHide ||
|
||||
function(element, update){ new Effect.Fade(update,{duration:0.15}) };
|
||||
|
||||
if (typeof(this.options.tokens) == 'string')
|
||||
this.options.tokens = new Array(this.options.tokens);
|
||||
|
||||
this.observer = null;
|
||||
|
||||
this.element.setAttribute('autocomplete','off');
|
||||
|
||||
Element.hide(this.update);
|
||||
|
||||
Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
|
||||
Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
show: function() {
|
||||
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
|
||||
if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && (Element.getStyle(this.update, 'position')=='absolute')) {
|
||||
new Insertion.After(this.update,
|
||||
'<iframe id="' + this.update.id + '_iefix" '+
|
||||
'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
|
||||
'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
|
||||
this.iefix = $(this.update.id+'_iefix');
|
||||
}
|
||||
if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
|
||||
},
|
||||
|
||||
fixIEOverlapping: function() {
|
||||
Position.clone(this.update, this.iefix);
|
||||
this.iefix.style.zIndex = 1;
|
||||
this.update.style.zIndex = 2;
|
||||
Element.show(this.iefix);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.stopIndicator();
|
||||
if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
|
||||
if(this.iefix) Element.hide(this.iefix);
|
||||
},
|
||||
|
||||
startIndicator: function() {
|
||||
if(this.options.indicator) Element.show(this.options.indicator);
|
||||
},
|
||||
|
||||
stopIndicator: function() {
|
||||
if(this.options.indicator) Element.hide(this.options.indicator);
|
||||
},
|
||||
|
||||
onKeyPress: function(event) {
|
||||
if(this.active)
|
||||
switch(event.keyCode) {
|
||||
case Event.KEY_TAB:
|
||||
case Event.KEY_RETURN:
|
||||
this.selectEntry();
|
||||
Event.stop(event);
|
||||
case Event.KEY_ESC:
|
||||
this.hide();
|
||||
this.active = false;
|
||||
Event.stop(event);
|
||||
return;
|
||||
case Event.KEY_LEFT:
|
||||
case Event.KEY_RIGHT:
|
||||
return;
|
||||
case Event.KEY_UP:
|
||||
this.markPrevious();
|
||||
this.render();
|
||||
if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
|
||||
return;
|
||||
case Event.KEY_DOWN:
|
||||
this.markNext();
|
||||
this.render();
|
||||
if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
|
||||
return;
|
||||
}
|
||||
else
|
||||
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN)
|
||||
return;
|
||||
|
||||
this.changed = true;
|
||||
this.hasFocus = true;
|
||||
|
||||
if(this.observer) clearTimeout(this.observer);
|
||||
this.observer =
|
||||
setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
|
||||
},
|
||||
|
||||
onHover: function(event) {
|
||||
var element = Event.findElement(event, 'LI');
|
||||
if(this.index != element.autocompleteIndex)
|
||||
{
|
||||
this.index = element.autocompleteIndex;
|
||||
this.render();
|
||||
}
|
||||
Event.stop(event);
|
||||
},
|
||||
|
||||
onClick: function(event) {
|
||||
var element = Event.findElement(event, 'LI');
|
||||
this.index = element.autocompleteIndex;
|
||||
this.selectEntry();
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onBlur: function(event) {
|
||||
// needed to make click events working
|
||||
setTimeout(this.hide.bind(this), 250);
|
||||
this.hasFocus = false;
|
||||
this.active = false;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
if(this.entryCount > 0) {
|
||||
for (var i = 0; i < this.entryCount; i++)
|
||||
this.index==i ?
|
||||
Element.addClassName(this.getEntry(i),"selected") :
|
||||
Element.removeClassName(this.getEntry(i),"selected");
|
||||
|
||||
if(this.hasFocus) {
|
||||
this.show();
|
||||
this.active = true;
|
||||
}
|
||||
} else this.hide();
|
||||
},
|
||||
|
||||
markPrevious: function() {
|
||||
if(this.index > 0) this.index--
|
||||
else this.index = this.entryCount-1;
|
||||
},
|
||||
|
||||
markNext: function() {
|
||||
if(this.index < this.entryCount-1) this.index++
|
||||
else this.index = 0;
|
||||
},
|
||||
|
||||
getEntry: function(index) {
|
||||
return this.update.firstChild.childNodes[index];
|
||||
},
|
||||
|
||||
getCurrentEntry: function() {
|
||||
return this.getEntry(this.index);
|
||||
},
|
||||
|
||||
selectEntry: function() {
|
||||
this.active = false;
|
||||
this.updateElement(this.getCurrentEntry());
|
||||
},
|
||||
|
||||
updateElement: function(selectedElement) {
|
||||
if (this.options.updateElement) {
|
||||
this.options.updateElement(selectedElement);
|
||||
return;
|
||||
}
|
||||
|
||||
var value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
|
||||
var lastTokenPos = this.findLastToken();
|
||||
if (lastTokenPos != -1) {
|
||||
var newValue = this.element.value.substr(0, lastTokenPos + 1);
|
||||
var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
|
||||
if (whitespace)
|
||||
newValue += whitespace[0];
|
||||
this.element.value = newValue + value;
|
||||
} else {
|
||||
this.element.value = value;
|
||||
}
|
||||
this.element.focus();
|
||||
|
||||
if (this.options.afterUpdateElement)
|
||||
this.options.afterUpdateElement(this.element, selectedElement);
|
||||
},
|
||||
|
||||
updateChoices: function(choices) {
|
||||
if(!this.changed && this.hasFocus) {
|
||||
this.update.innerHTML = choices;
|
||||
Element.cleanWhitespace(this.update);
|
||||
Element.cleanWhitespace(this.update.firstChild);
|
||||
|
||||
if(this.update.firstChild && this.update.firstChild.childNodes) {
|
||||
this.entryCount =
|
||||
this.update.firstChild.childNodes.length;
|
||||
for (var i = 0; i < this.entryCount; i++) {
|
||||
var entry = this.getEntry(i);
|
||||
entry.autocompleteIndex = i;
|
||||
this.addObservers(entry);
|
||||
}
|
||||
} else {
|
||||
this.entryCount = 0;
|
||||
}
|
||||
|
||||
this.stopIndicator();
|
||||
|
||||
this.index = 0;
|
||||
this.render();
|
||||
}
|
||||
},
|
||||
|
||||
addObservers: function(element) {
|
||||
Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
|
||||
Event.observe(element, "click", this.onClick.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
onObserverEvent: function() {
|
||||
this.changed = false;
|
||||
if(this.getToken().length>=this.options.minChars) {
|
||||
this.startIndicator();
|
||||
this.getUpdatedChoices();
|
||||
} else {
|
||||
this.active = false;
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
|
||||
getToken: function() {
|
||||
var tokenPos = this.findLastToken();
|
||||
if (tokenPos != -1)
|
||||
var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
|
||||
else
|
||||
var ret = this.element.value;
|
||||
|
||||
return /\n/.test(ret) ? '' : ret;
|
||||
},
|
||||
|
||||
findLastToken: function() {
|
||||
var lastTokenPos = -1;
|
||||
|
||||
for (var i=0; i<this.options.tokens.length; i++) {
|
||||
var thisTokenPos = this.element.value.lastIndexOf(this.options.tokens[i]);
|
||||
if (thisTokenPos > lastTokenPos)
|
||||
lastTokenPos = thisTokenPos;
|
||||
}
|
||||
return lastTokenPos;
|
||||
}
|
||||
}
|
||||
|
||||
Ajax.Autocompleter = Class.create();
|
||||
Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
|
||||
initialize: function(element, update, url, options) {
|
||||
this.baseInitialize(element, update, options);
|
||||
this.options.asynchronous = true;
|
||||
this.options.onComplete = this.onComplete.bind(this);
|
||||
this.options.defaultParams = this.options.parameters || null;
|
||||
this.url = url;
|
||||
},
|
||||
|
||||
getUpdatedChoices: function() {
|
||||
entry = encodeURIComponent(this.options.paramName) + '=' +
|
||||
encodeURIComponent(this.getToken());
|
||||
|
||||
this.options.parameters = this.options.callback ?
|
||||
this.options.callback(this.element, entry) : entry;
|
||||
|
||||
if(this.options.defaultParams)
|
||||
this.options.parameters += '&' + this.options.defaultParams;
|
||||
|
||||
new Ajax.Request(this.url, this.options);
|
||||
},
|
||||
|
||||
onComplete: function(request) {
|
||||
this.updateChoices(request.responseText);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// The local array autocompleter. Used when you'd prefer to
|
||||
// inject an array of autocompletion options into the page, rather
|
||||
// than sending out Ajax queries, which can be quite slow sometimes.
|
||||
//
|
||||
// The constructor takes four parameters. The first two are, as usual,
|
||||
// the id of the monitored textbox, and id of the autocompletion menu.
|
||||
// The third is the array you want to autocomplete from, and the fourth
|
||||
// is the options block.
|
||||
//
|
||||
// Extra local autocompletion options:
|
||||
// - choices - How many autocompletion choices to offer
|
||||
//
|
||||
// - partialSearch - If false, the autocompleter will match entered
|
||||
// text only at the beginning of strings in the
|
||||
// autocomplete array. Defaults to true, which will
|
||||
// match text at the beginning of any *word* in the
|
||||
// strings in the autocomplete array. If you want to
|
||||
// search anywhere in the string, additionally set
|
||||
// the option fullSearch to true (default: off).
|
||||
//
|
||||
// - fullSsearch - Search anywhere in autocomplete array strings.
|
||||
//
|
||||
// - partialChars - How many characters to enter before triggering
|
||||
// a partial match (unlike minChars, which defines
|
||||
// how many characters are required to do any match
|
||||
// at all). Defaults to 2.
|
||||
//
|
||||
// - ignoreCase - Whether to ignore case when autocompleting.
|
||||
// Defaults to true.
|
||||
//
|
||||
// It's possible to pass in a custom function as the 'selector'
|
||||
// option, if you prefer to write your own autocompletion logic.
|
||||
// In that case, the other options above will not apply unless
|
||||
// you support them.
|
||||
|
||||
Autocompleter.Local = Class.create();
|
||||
Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
|
||||
initialize: function(element, update, array, options) {
|
||||
this.baseInitialize(element, update, options);
|
||||
this.options.array = array;
|
||||
},
|
||||
|
||||
getUpdatedChoices: function() {
|
||||
this.updateChoices(this.options.selector(this));
|
||||
},
|
||||
|
||||
setOptions: function(options) {
|
||||
this.options = Object.extend({
|
||||
choices: 10,
|
||||
partialSearch: true,
|
||||
partialChars: 2,
|
||||
ignoreCase: true,
|
||||
fullSearch: false,
|
||||
selector: function(instance) {
|
||||
var ret = []; // Beginning matches
|
||||
var partial = []; // Inside matches
|
||||
var entry = instance.getToken();
|
||||
var count = 0;
|
||||
|
||||
for (var i = 0; i < instance.options.array.length &&
|
||||
ret.length < instance.options.choices ; i++) {
|
||||
|
||||
var elem = instance.options.array[i];
|
||||
var foundPos = instance.options.ignoreCase ?
|
||||
elem.toLowerCase().indexOf(entry.toLowerCase()) :
|
||||
elem.indexOf(entry);
|
||||
|
||||
while (foundPos != -1) {
|
||||
if (foundPos == 0 && elem.length != entry.length) {
|
||||
ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
|
||||
elem.substr(entry.length) + "</li>");
|
||||
break;
|
||||
} else if (entry.length >= instance.options.partialChars &&
|
||||
instance.options.partialSearch && foundPos != -1) {
|
||||
if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
|
||||
partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
|
||||
elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
|
||||
foundPos + entry.length) + "</li>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foundPos = instance.options.ignoreCase ?
|
||||
elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
|
||||
elem.indexOf(entry, foundPos + 1);
|
||||
|
||||
}
|
||||
}
|
||||
if (partial.length)
|
||||
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
|
||||
return "<ul>" + ret.join('') + "</ul>";
|
||||
}
|
||||
}, options || {});
|
||||
}
|
||||
});
|
||||
|
||||
// AJAX in-place editor
|
||||
//
|
||||
// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
|
||||
|
||||
Ajax.InPlaceEditor = Class.create();
|
||||
Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
|
||||
Ajax.InPlaceEditor.prototype = {
|
||||
initialize: function(element, url, options) {
|
||||
this.url = url;
|
||||
this.element = $(element);
|
||||
|
||||
this.options = Object.extend({
|
||||
okText: "ok",
|
||||
cancelText: "cancel",
|
||||
savingText: "Saving...",
|
||||
clickToEditText: "Click to edit",
|
||||
okText: "ok",
|
||||
rows: 1,
|
||||
onComplete: function(transport, element) {
|
||||
new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
|
||||
},
|
||||
onFailure: function(transport) {
|
||||
alert("Error communicating with the server: " + transport.responseText.stripTags());
|
||||
},
|
||||
callback: function(form) {
|
||||
return Form.serialize(form);
|
||||
},
|
||||
handleLineBreaks: true,
|
||||
loadingText: 'Loading...',
|
||||
savingClassName: 'inplaceeditor-saving',
|
||||
loadingClassName: 'inplaceeditor-loading',
|
||||
formClassName: 'inplaceeditor-form',
|
||||
highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
|
||||
highlightendcolor: "#FFFFFF",
|
||||
externalControl: null,
|
||||
ajaxOptions: {}
|
||||
}, options || {});
|
||||
|
||||
if(!this.options.formId && this.element.id) {
|
||||
this.options.formId = this.element.id + "-inplaceeditor";
|
||||
if ($(this.options.formId)) {
|
||||
// there's already a form with that name, don't specify an id
|
||||
this.options.formId = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.externalControl) {
|
||||
this.options.externalControl = $(this.options.externalControl);
|
||||
}
|
||||
|
||||
this.originalBackground = Element.getStyle(this.element, 'background-color');
|
||||
if (!this.originalBackground) {
|
||||
this.originalBackground = "transparent";
|
||||
}
|
||||
|
||||
this.element.title = this.options.clickToEditText;
|
||||
|
||||
this.onclickListener = this.enterEditMode.bindAsEventListener(this);
|
||||
this.mouseoverListener = this.enterHover.bindAsEventListener(this);
|
||||
this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
|
||||
Event.observe(this.element, 'click', this.onclickListener);
|
||||
Event.observe(this.element, 'mouseover', this.mouseoverListener);
|
||||
Event.observe(this.element, 'mouseout', this.mouseoutListener);
|
||||
if (this.options.externalControl) {
|
||||
Event.observe(this.options.externalControl, 'click', this.onclickListener);
|
||||
Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
|
||||
Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
|
||||
}
|
||||
},
|
||||
enterEditMode: function() {
|
||||
if (this.saving) return;
|
||||
if (this.editing) return;
|
||||
this.editing = true;
|
||||
this.onEnterEditMode();
|
||||
if (this.options.externalControl) {
|
||||
Element.hide(this.options.externalControl);
|
||||
}
|
||||
Element.hide(this.element);
|
||||
this.createForm();
|
||||
this.element.parentNode.insertBefore(this.form, this.element);
|
||||
Field.focus(this.editField);
|
||||
// stop the event to avoid a page refresh in Safari
|
||||
if (arguments.length > 1) {
|
||||
Event.stop(arguments[0]);
|
||||
}
|
||||
},
|
||||
createForm: function() {
|
||||
this.form = document.createElement("form");
|
||||
this.form.id = this.options.formId;
|
||||
Element.addClassName(this.form, this.options.formClassName)
|
||||
this.form.onsubmit = this.onSubmit.bind(this);
|
||||
|
||||
this.createEditField();
|
||||
|
||||
if (this.options.textarea) {
|
||||
var br = document.createElement("br");
|
||||
this.form.appendChild(br);
|
||||
}
|
||||
|
||||
okButton = document.createElement("input");
|
||||
okButton.type = "submit";
|
||||
okButton.value = this.options.okText;
|
||||
this.form.appendChild(okButton);
|
||||
|
||||
cancelLink = document.createElement("a");
|
||||
cancelLink.href = "#";
|
||||
cancelLink.appendChild(document.createTextNode(this.options.cancelText));
|
||||
cancelLink.onclick = this.onclickCancel.bind(this);
|
||||
this.form.appendChild(cancelLink);
|
||||
},
|
||||
hasHTMLLineBreaks: function(string) {
|
||||
if (!this.options.handleLineBreaks) return false;
|
||||
return string.match(/<br/i) || string.match(/<p>/i);
|
||||
},
|
||||
convertHTMLLineBreaks: function(string) {
|
||||
return string.replace(/<br>/gi, "\n").replace(/<br\/>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<p>/gi, "");
|
||||
},
|
||||
createEditField: function() {
|
||||
var text;
|
||||
if(this.options.loadTextURL) {
|
||||
text = this.options.loadingText;
|
||||
} else {
|
||||
text = this.getText();
|
||||
}
|
||||
|
||||
if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
|
||||
this.options.textarea = false;
|
||||
var textField = document.createElement("input");
|
||||
textField.type = "text";
|
||||
textField.name = "value";
|
||||
textField.value = text;
|
||||
textField.style.backgroundColor = this.options.highlightcolor;
|
||||
var size = this.options.size || this.options.cols || 0;
|
||||
if (size != 0) textField.size = size;
|
||||
this.editField = textField;
|
||||
} else {
|
||||
this.options.textarea = true;
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.name = "value";
|
||||
textArea.value = this.convertHTMLLineBreaks(text);
|
||||
textArea.rows = this.options.rows;
|
||||
textArea.cols = this.options.cols || 40;
|
||||
this.editField = textArea;
|
||||
}
|
||||
|
||||
if(this.options.loadTextURL) {
|
||||
this.loadExternalText();
|
||||
}
|
||||
this.form.appendChild(this.editField);
|
||||
},
|
||||
getText: function() {
|
||||
return this.element.innerHTML;
|
||||
},
|
||||
loadExternalText: function() {
|
||||
Element.addClassName(this.form, this.options.loadingClassName);
|
||||
this.editField.disabled = true;
|
||||
new Ajax.Request(
|
||||
this.options.loadTextURL,
|
||||
Object.extend({
|
||||
asynchronous: true,
|
||||
onComplete: this.onLoadedExternalText.bind(this)
|
||||
}, this.options.ajaxOptions)
|
||||
);
|
||||
},
|
||||
onLoadedExternalText: function(transport) {
|
||||
Element.removeClassName(this.form, this.options.loadingClassName);
|
||||
this.editField.disabled = false;
|
||||
this.editField.value = transport.responseText.stripTags();
|
||||
},
|
||||
onclickCancel: function() {
|
||||
this.onComplete();
|
||||
this.leaveEditMode();
|
||||
return false;
|
||||
},
|
||||
onFailure: function(transport) {
|
||||
this.options.onFailure(transport);
|
||||
if (this.oldInnerHTML) {
|
||||
this.element.innerHTML = this.oldInnerHTML;
|
||||
this.oldInnerHTML = null;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onSubmit: function() {
|
||||
// onLoading resets these so we need to save them away for the Ajax call
|
||||
var form = this.form;
|
||||
var value = this.editField.value;
|
||||
|
||||
// do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
|
||||
// which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
|
||||
// to be displayed indefinitely
|
||||
this.onLoading();
|
||||
|
||||
new Ajax.Updater(
|
||||
{
|
||||
success: this.element,
|
||||
// don't update on failure (this could be an option)
|
||||
failure: null
|
||||
},
|
||||
this.url,
|
||||
Object.extend({
|
||||
parameters: this.options.callback(form, value),
|
||||
onComplete: this.onComplete.bind(this),
|
||||
onFailure: this.onFailure.bind(this)
|
||||
}, this.options.ajaxOptions)
|
||||
);
|
||||
// stop the event to avoid a page refresh in Safari
|
||||
if (arguments.length > 1) {
|
||||
Event.stop(arguments[0]);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
onLoading: function() {
|
||||
this.saving = true;
|
||||
this.removeForm();
|
||||
this.leaveHover();
|
||||
this.showSaving();
|
||||
},
|
||||
showSaving: function() {
|
||||
this.oldInnerHTML = this.element.innerHTML;
|
||||
this.element.innerHTML = this.options.savingText;
|
||||
Element.addClassName(this.element, this.options.savingClassName);
|
||||
this.element.style.backgroundColor = this.originalBackground;
|
||||
Element.show(this.element);
|
||||
},
|
||||
removeForm: function() {
|
||||
if(this.form) {
|
||||
if (this.form.parentNode) Element.remove(this.form);
|
||||
this.form = null;
|
||||
}
|
||||
},
|
||||
enterHover: function() {
|
||||
if (this.saving) return;
|
||||
this.element.style.backgroundColor = this.options.highlightcolor;
|
||||
if (this.effect) {
|
||||
this.effect.cancel();
|
||||
}
|
||||
Element.addClassName(this.element, this.options.hoverClassName)
|
||||
},
|
||||
leaveHover: function() {
|
||||
if (this.options.backgroundColor) {
|
||||
this.element.style.backgroundColor = this.oldBackground;
|
||||
}
|
||||
Element.removeClassName(this.element, this.options.hoverClassName)
|
||||
if (this.saving) return;
|
||||
this.effect = new Effect.Highlight(this.element, {
|
||||
startcolor: this.options.highlightcolor,
|
||||
endcolor: this.options.highlightendcolor,
|
||||
restorecolor: this.originalBackground
|
||||
});
|
||||
},
|
||||
leaveEditMode: function() {
|
||||
Element.removeClassName(this.element, this.options.savingClassName);
|
||||
this.removeForm();
|
||||
this.leaveHover();
|
||||
this.element.style.backgroundColor = this.originalBackground;
|
||||
Element.show(this.element);
|
||||
if (this.options.externalControl) {
|
||||
Element.show(this.options.externalControl);
|
||||
}
|
||||
this.editing = false;
|
||||
this.saving = false;
|
||||
this.oldInnerHTML = null;
|
||||
this.onLeaveEditMode();
|
||||
},
|
||||
onComplete: function(transport) {
|
||||
this.leaveEditMode();
|
||||
this.options.onComplete.bind(this)(transport, this.element);
|
||||
},
|
||||
onEnterEditMode: function() {},
|
||||
onLeaveEditMode: function() {},
|
||||
dispose: function() {
|
||||
if (this.oldInnerHTML) {
|
||||
this.element.innerHTML = this.oldInnerHTML;
|
||||
}
|
||||
this.leaveEditMode();
|
||||
Event.stopObserving(this.element, 'click', this.onclickListener);
|
||||
Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
|
||||
Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
|
||||
if (this.options.externalControl) {
|
||||
Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
|
||||
Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
|
||||
Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
|
||||
}
|
||||
}
|
||||
};
|
516
public/javascripts/dragdrop.js
vendored
Normal file
516
public/javascripts/dragdrop.js
vendored
Normal file
|
@ -0,0 +1,516 @@
|
|||
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// Element.Class part Copyright (c) 2005 by Rick Olson
|
||||
//
|
||||
// See scriptaculous.js for full license.
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var Droppables = {
|
||||
drops: [],
|
||||
|
||||
remove: function(element) {
|
||||
this.drops = this.drops.reject(function(d) { return d.element==element });
|
||||
},
|
||||
|
||||
add: function(element) {
|
||||
element = $(element);
|
||||
var options = Object.extend({
|
||||
greedy: true,
|
||||
hoverclass: null
|
||||
}, arguments[1] || {});
|
||||
|
||||
// cache containers
|
||||
if(options.containment) {
|
||||
options._containers = [];
|
||||
var containment = options.containment;
|
||||
if((typeof containment == 'object') &&
|
||||
(containment.constructor == Array)) {
|
||||
containment.each( function(c) { options._containers.push($(c)) });
|
||||
} else {
|
||||
options._containers.push($(containment));
|
||||
}
|
||||
}
|
||||
|
||||
Element.makePositioned(element); // fix IE
|
||||
options.element = element;
|
||||
|
||||
this.drops.push(options);
|
||||
},
|
||||
|
||||
isContained: function(element, drop) {
|
||||
var parentNode = element.parentNode;
|
||||
return drop._containers.detect(function(c) { return parentNode == c });
|
||||
},
|
||||
|
||||
isAffected: function(pX, pY, element, drop) {
|
||||
return (
|
||||
(drop.element!=element) &&
|
||||
((!drop._containers) ||
|
||||
this.isContained(element, drop)) &&
|
||||
((!drop.accept) ||
|
||||
(Element.Class.has_any(element, drop.accept))) &&
|
||||
Position.within(drop.element, pX, pY) );
|
||||
},
|
||||
|
||||
deactivate: function(drop) {
|
||||
if(drop.hoverclass)
|
||||
Element.Class.remove(drop.element, drop.hoverclass);
|
||||
this.last_active = null;
|
||||
},
|
||||
|
||||
activate: function(drop) {
|
||||
if(this.last_active) this.deactivate(this.last_active);
|
||||
if(drop.hoverclass)
|
||||
Element.Class.add(drop.element, drop.hoverclass);
|
||||
this.last_active = drop;
|
||||
},
|
||||
|
||||
show: function(event, element) {
|
||||
if(!this.drops.length) return;
|
||||
var pX = Event.pointerX(event);
|
||||
var pY = Event.pointerY(event);
|
||||
Position.prepare();
|
||||
|
||||
var i = this.drops.length-1; do {
|
||||
var drop = this.drops[i];
|
||||
if(this.isAffected(pX, pY, element, drop)) {
|
||||
if(drop.onHover)
|
||||
drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
|
||||
if(drop.greedy) {
|
||||
this.activate(drop);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} while (i--);
|
||||
|
||||
if(this.last_active) this.deactivate(this.last_active);
|
||||
},
|
||||
|
||||
fire: function(event, element) {
|
||||
if(!this.last_active) return;
|
||||
Position.prepare();
|
||||
|
||||
if (this.isAffected(Event.pointerX(event), Event.pointerY(event), element, this.last_active))
|
||||
if (this.last_active.onDrop)
|
||||
this.last_active.onDrop(element, this.last_active.element, event);
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
if(this.last_active)
|
||||
this.deactivate(this.last_active);
|
||||
}
|
||||
}
|
||||
|
||||
var Draggables = {
|
||||
observers: [],
|
||||
addObserver: function(observer) {
|
||||
this.observers.push(observer);
|
||||
},
|
||||
removeObserver: function(element) { // element instead of obsever fixes mem leaks
|
||||
this.observers = this.observers.reject( function(o) { return o.element==element });
|
||||
},
|
||||
notify: function(eventName, draggable) { // 'onStart', 'onEnd'
|
||||
this.observers.invoke(eventName, draggable);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var Draggable = Class.create();
|
||||
Draggable.prototype = {
|
||||
initialize: function(element) {
|
||||
var options = Object.extend({
|
||||
handle: false,
|
||||
starteffect: function(element) {
|
||||
new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7});
|
||||
},
|
||||
reverteffect: function(element, top_offset, left_offset) {
|
||||
var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
|
||||
new Effect.MoveBy(element, -top_offset, -left_offset, {duration:dur});
|
||||
},
|
||||
endeffect: function(element) {
|
||||
new Effect.Opacity(element, {duration:0.2, from:0.7, to:1.0});
|
||||
},
|
||||
zindex: 1000,
|
||||
revert: false
|
||||
}, arguments[1] || {});
|
||||
|
||||
this.element = $(element);
|
||||
if(options.handle && (typeof options.handle == 'string'))
|
||||
this.handle = Element.Class.childrenWith(this.element, options.handle)[0];
|
||||
|
||||
if(!this.handle) this.handle = $(options.handle);
|
||||
if(!this.handle) this.handle = this.element;
|
||||
|
||||
Element.makePositioned(this.element); // fix IE
|
||||
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
this.originalLeft = this.currentLeft();
|
||||
this.originalTop = this.currentTop();
|
||||
this.originalX = this.element.offsetLeft;
|
||||
this.originalY = this.element.offsetTop;
|
||||
|
||||
this.options = options;
|
||||
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
|
||||
this.eventMouseDown = this.startDrag.bindAsEventListener(this);
|
||||
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
|
||||
this.eventMouseMove = this.update.bindAsEventListener(this);
|
||||
this.eventKeypress = this.keyPress.bindAsEventListener(this);
|
||||
|
||||
this.registerEvents();
|
||||
},
|
||||
destroy: function() {
|
||||
Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
|
||||
this.unregisterEvents();
|
||||
},
|
||||
registerEvents: function() {
|
||||
Event.observe(document, "mouseup", this.eventMouseUp);
|
||||
Event.observe(document, "mousemove", this.eventMouseMove);
|
||||
Event.observe(document, "keypress", this.eventKeypress);
|
||||
Event.observe(this.handle, "mousedown", this.eventMouseDown);
|
||||
},
|
||||
unregisterEvents: function() {
|
||||
//if(!this.active) return;
|
||||
//Event.stopObserving(document, "mouseup", this.eventMouseUp);
|
||||
//Event.stopObserving(document, "mousemove", this.eventMouseMove);
|
||||
//Event.stopObserving(document, "keypress", this.eventKeypress);
|
||||
},
|
||||
currentLeft: function() {
|
||||
return parseInt(this.element.style.left || '0');
|
||||
},
|
||||
currentTop: function() {
|
||||
return parseInt(this.element.style.top || '0')
|
||||
},
|
||||
startDrag: function(event) {
|
||||
if(Event.isLeftClick(event)) {
|
||||
|
||||
// abort on form elements, fixes a Firefox issue
|
||||
var src = Event.element(event);
|
||||
if(src.tagName && (
|
||||
src.tagName=='INPUT' ||
|
||||
src.tagName=='SELECT' ||
|
||||
src.tagName=='BUTTON' ||
|
||||
src.tagName=='TEXTAREA')) return;
|
||||
|
||||
// this.registerEvents();
|
||||
this.active = true;
|
||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||
var offsets = Position.cumulativeOffset(this.element);
|
||||
this.offsetX = (pointer[0] - offsets[0]);
|
||||
this.offsetY = (pointer[1] - offsets[1]);
|
||||
Event.stop(event);
|
||||
}
|
||||
},
|
||||
finishDrag: function(event, success) {
|
||||
// this.unregisterEvents();
|
||||
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
|
||||
if(this.options.ghosting) {
|
||||
Position.relativize(this.element);
|
||||
Element.remove(this._clone);
|
||||
this._clone = null;
|
||||
}
|
||||
|
||||
if(success) Droppables.fire(event, this.element);
|
||||
Draggables.notify('onEnd', this);
|
||||
|
||||
var revert = this.options.revert;
|
||||
if(revert && typeof revert == 'function') revert = revert(this.element);
|
||||
|
||||
if(revert && this.options.reverteffect) {
|
||||
this.options.reverteffect(this.element,
|
||||
this.currentTop()-this.originalTop,
|
||||
this.currentLeft()-this.originalLeft);
|
||||
} else {
|
||||
this.originalLeft = this.currentLeft();
|
||||
this.originalTop = this.currentTop();
|
||||
}
|
||||
|
||||
if(this.options.zindex)
|
||||
this.element.style.zIndex = this.originalZ;
|
||||
|
||||
if(this.options.endeffect)
|
||||
this.options.endeffect(this.element);
|
||||
|
||||
|
||||
Droppables.reset();
|
||||
},
|
||||
keyPress: function(event) {
|
||||
if(this.active) {
|
||||
if(event.keyCode==Event.KEY_ESC) {
|
||||
this.finishDrag(event, false);
|
||||
Event.stop(event);
|
||||
}
|
||||
}
|
||||
},
|
||||
endDrag: function(event) {
|
||||
if(this.active && this.dragging) {
|
||||
this.finishDrag(event, true);
|
||||
Event.stop(event);
|
||||
}
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
},
|
||||
draw: function(event) {
|
||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||
var offsets = Position.cumulativeOffset(this.element);
|
||||
offsets[0] -= this.currentLeft();
|
||||
offsets[1] -= this.currentTop();
|
||||
var style = this.element.style;
|
||||
if((!this.options.constraint) || (this.options.constraint=='horizontal'))
|
||||
style.left = (pointer[0] - offsets[0] - this.offsetX) + "px";
|
||||
if((!this.options.constraint) || (this.options.constraint=='vertical'))
|
||||
style.top = (pointer[1] - offsets[1] - this.offsetY) + "px";
|
||||
if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
|
||||
},
|
||||
update: function(event) {
|
||||
if(this.active) {
|
||||
if(!this.dragging) {
|
||||
var style = this.element.style;
|
||||
this.dragging = true;
|
||||
|
||||
if(Element.getStyle(this.element,'position')=='')
|
||||
style.position = "relative";
|
||||
|
||||
if(this.options.zindex) {
|
||||
this.options.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
|
||||
style.zIndex = this.options.zindex;
|
||||
}
|
||||
|
||||
if(this.options.ghosting) {
|
||||
this._clone = this.element.cloneNode(true);
|
||||
Position.absolutize(this.element);
|
||||
this.element.parentNode.insertBefore(this._clone, this.element);
|
||||
}
|
||||
|
||||
Draggables.notify('onStart', this);
|
||||
if(this.options.starteffect) this.options.starteffect(this.element);
|
||||
}
|
||||
|
||||
Droppables.show(event, this.element);
|
||||
this.draw(event);
|
||||
if(this.options.change) this.options.change(this);
|
||||
|
||||
// fix AppleWebKit rendering
|
||||
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
|
||||
|
||||
Event.stop(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var SortableObserver = Class.create();
|
||||
SortableObserver.prototype = {
|
||||
initialize: function(element, observer) {
|
||||
this.element = $(element);
|
||||
this.observer = observer;
|
||||
this.lastValue = Sortable.serialize(this.element);
|
||||
},
|
||||
onStart: function() {
|
||||
this.lastValue = Sortable.serialize(this.element);
|
||||
},
|
||||
onEnd: function() {
|
||||
Sortable.unmark();
|
||||
if(this.lastValue != Sortable.serialize(this.element))
|
||||
this.observer(this.element)
|
||||
}
|
||||
}
|
||||
|
||||
var Sortable = {
|
||||
sortables: new Array(),
|
||||
options: function(element){
|
||||
element = $(element);
|
||||
return this.sortables.detect(function(s) { return s.element == element });
|
||||
},
|
||||
destroy: function(element){
|
||||
element = $(element);
|
||||
this.sortables.findAll(function(s) { return s.element == element }).each(function(s){
|
||||
Draggables.removeObserver(s.element);
|
||||
s.droppables.each(function(d){ Droppables.remove(d) });
|
||||
s.draggables.invoke('destroy');
|
||||
});
|
||||
this.sortables = this.sortables.reject(function(s) { return s.element == element });
|
||||
},
|
||||
create: function(element) {
|
||||
element = $(element);
|
||||
var options = Object.extend({
|
||||
element: element,
|
||||
tag: 'li', // assumes li children, override with tag: 'tagname'
|
||||
dropOnEmpty: false,
|
||||
tree: false, // fixme: unimplemented
|
||||
overlap: 'vertical', // one of 'vertical', 'horizontal'
|
||||
constraint: 'vertical', // one of 'vertical', 'horizontal', false
|
||||
containment: element, // also takes array of elements (or id's); or false
|
||||
handle: false, // or a CSS class
|
||||
only: false,
|
||||
hoverclass: null,
|
||||
ghosting: false,
|
||||
format: null,
|
||||
onChange: function() {},
|
||||
onUpdate: function() {}
|
||||
}, arguments[1] || {});
|
||||
|
||||
// clear any old sortable with same element
|
||||
this.destroy(element);
|
||||
|
||||
// build options for the draggables
|
||||
var options_for_draggable = {
|
||||
revert: true,
|
||||
ghosting: options.ghosting,
|
||||
constraint: options.constraint,
|
||||
handle: options.handle };
|
||||
|
||||
if(options.starteffect)
|
||||
options_for_draggable.starteffect = options.starteffect;
|
||||
|
||||
if(options.reverteffect)
|
||||
options_for_draggable.reverteffect = options.reverteffect;
|
||||
else
|
||||
if(options.ghosting) options_for_draggable.reverteffect = function(element) {
|
||||
element.style.top = 0;
|
||||
element.style.left = 0;
|
||||
};
|
||||
|
||||
if(options.endeffect)
|
||||
options_for_draggable.endeffect = options.endeffect;
|
||||
|
||||
if(options.zindex)
|
||||
options_for_draggable.zindex = options.zindex;
|
||||
|
||||
// build options for the droppables
|
||||
var options_for_droppable = {
|
||||
overlap: options.overlap,
|
||||
containment: options.containment,
|
||||
hoverclass: options.hoverclass,
|
||||
onHover: Sortable.onHover,
|
||||
greedy: !options.dropOnEmpty
|
||||
}
|
||||
|
||||
// fix for gecko engine
|
||||
Element.cleanWhitespace(element);
|
||||
|
||||
options.draggables = [];
|
||||
options.droppables = [];
|
||||
|
||||
// make it so
|
||||
|
||||
// drop on empty handling
|
||||
if(options.dropOnEmpty) {
|
||||
Droppables.add(element,
|
||||
{containment: options.containment, onHover: Sortable.onEmptyHover, greedy: false});
|
||||
options.droppables.push(element);
|
||||
}
|
||||
|
||||
(this.findElements(element, options) || []).each( function(e) {
|
||||
// handles are per-draggable
|
||||
var handle = options.handle ?
|
||||
Element.Class.childrenWith(e, options.handle)[0] : e;
|
||||
options.draggables.push(
|
||||
new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
|
||||
Droppables.add(e, options_for_droppable);
|
||||
options.droppables.push(e);
|
||||
});
|
||||
|
||||
// keep reference
|
||||
this.sortables.push(options);
|
||||
|
||||
// for onupdate
|
||||
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
|
||||
|
||||
},
|
||||
|
||||
// return all suitable-for-sortable elements in a guaranteed order
|
||||
findElements: function(element, options) {
|
||||
if(!element.hasChildNodes()) return null;
|
||||
var elements = [];
|
||||
$A(element.childNodes).each( function(e) {
|
||||
if(e.tagName && e.tagName==options.tag.toUpperCase() &&
|
||||
(!options.only || (Element.Class.has(e, options.only))))
|
||||
elements.push(e);
|
||||
if(options.tree) {
|
||||
var grandchildren = this.findElements(e, options);
|
||||
if(grandchildren) elements.push(grandchildren);
|
||||
}
|
||||
});
|
||||
|
||||
return (elements.length>0 ? elements.flatten() : null);
|
||||
},
|
||||
|
||||
onHover: function(element, dropon, overlap) {
|
||||
if(overlap>0.5) {
|
||||
Sortable.mark(dropon, 'before');
|
||||
if(dropon.previousSibling != element) {
|
||||
var oldParentNode = element.parentNode;
|
||||
element.style.visibility = "hidden"; // fix gecko rendering
|
||||
dropon.parentNode.insertBefore(element, dropon);
|
||||
if(dropon.parentNode!=oldParentNode)
|
||||
Sortable.options(oldParentNode).onChange(element);
|
||||
Sortable.options(dropon.parentNode).onChange(element);
|
||||
}
|
||||
} else {
|
||||
Sortable.mark(dropon, 'after');
|
||||
var nextElement = dropon.nextSibling || null;
|
||||
if(nextElement != element) {
|
||||
var oldParentNode = element.parentNode;
|
||||
element.style.visibility = "hidden"; // fix gecko rendering
|
||||
dropon.parentNode.insertBefore(element, nextElement);
|
||||
if(dropon.parentNode!=oldParentNode)
|
||||
Sortable.options(oldParentNode).onChange(element);
|
||||
Sortable.options(dropon.parentNode).onChange(element);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onEmptyHover: function(element, dropon) {
|
||||
if(element.parentNode!=dropon) {
|
||||
dropon.appendChild(element);
|
||||
}
|
||||
},
|
||||
|
||||
unmark: function() {
|
||||
if(Sortable._marker) Element.hide(Sortable._marker);
|
||||
},
|
||||
|
||||
mark: function(dropon, position) {
|
||||
// mark on ghosting only
|
||||
var sortable = Sortable.options(dropon.parentNode);
|
||||
if(sortable && !sortable.ghosting) return;
|
||||
|
||||
if(!Sortable._marker) {
|
||||
Sortable._marker = $('dropmarker') || document.createElement('DIV');
|
||||
Element.hide(Sortable._marker);
|
||||
Element.Class.add(Sortable._marker, 'dropmarker');
|
||||
Sortable._marker.style.position = 'absolute';
|
||||
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
|
||||
}
|
||||
var offsets = Position.cumulativeOffset(dropon);
|
||||
Sortable._marker.style.top = offsets[1] + 'px';
|
||||
if(position=='after') Sortable._marker.style.top = (offsets[1]+dropon.clientHeight) + 'px';
|
||||
Sortable._marker.style.left = offsets[0] + 'px';
|
||||
Element.show(Sortable._marker);
|
||||
},
|
||||
|
||||
serialize: function(element) {
|
||||
element = $(element);
|
||||
var sortableOptions = this.options(element);
|
||||
var options = Object.extend({
|
||||
tag: sortableOptions.tag,
|
||||
only: sortableOptions.only,
|
||||
name: element.id,
|
||||
format: sortableOptions.format || /^[^_]*_(.*)$/
|
||||
}, arguments[1] || {});
|
||||
return $(this.findElements(element, options) || []).collect( function(item) {
|
||||
return (encodeURIComponent(options.name) + "[]=" +
|
||||
encodeURIComponent(item.id.match(options.format) ? item.id.match(options.format)[1] : ''));
|
||||
}).join("&");
|
||||
}
|
||||
}
|
1101
public/javascripts/effects.js
vendored
Normal file
1101
public/javascripts/effects.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
349
public/javascripts/effects2.js
Normal file
349
public/javascripts/effects2.js
Normal file
|
@ -0,0 +1,349 @@
|
|||
// Copyright (c) 2005 Thomas Fuchs (http://mir.aculo.us)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Effect2 = {}
|
||||
|
||||
/* ------------- transitions ------------- */
|
||||
|
||||
Effect2.Transitions = {}
|
||||
Effect2.Transitions.linear = function(pos) {
|
||||
return pos;
|
||||
}
|
||||
Effect2.Transitions.sinoidal = function(pos) {
|
||||
return (-Math.cos(pos*Math.PI)/2) + 0.5;
|
||||
}
|
||||
Effect2.Transitions.reverse = function(pos) {
|
||||
return 1-pos;
|
||||
}
|
||||
Effect2.Transitions.flicker = function(pos) {
|
||||
return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random(0.25);
|
||||
}
|
||||
Effect2.Transitions.wobble = function(pos) {
|
||||
return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
|
||||
}
|
||||
|
||||
/* ------------- core effects ------------- */
|
||||
|
||||
Effect2.Base = function() {};
|
||||
Effect2.Base.prototype = {
|
||||
setOptions: function(options) {
|
||||
this.options = {
|
||||
transition: Effect2.Transitions.sinoidal,
|
||||
duration: 1.0, // seconds
|
||||
fps: 25.0, // max. 100fps
|
||||
sync: false, // true for combining
|
||||
from: 0.0,
|
||||
to: 1.0
|
||||
}.extend(options || {});
|
||||
},
|
||||
start: function(options) {
|
||||
this.setOptions(options || {});
|
||||
this.currentFrame = 0;
|
||||
this.startOn = new Date().getTime();
|
||||
this.finishOn = this.startOn + (this.options.duration*1000);
|
||||
if(this.options.beforeStart) this.options.beforeStart(this);
|
||||
if(!this.options.sync) this.loop();
|
||||
},
|
||||
loop: function() {
|
||||
timePos = new Date().getTime();
|
||||
if(timePos >= this.finishOn) {
|
||||
this.render(this.options.to);
|
||||
if(this.finish) this.finish();
|
||||
if(this.options.afterFinish) this.options.afterFinish(this);
|
||||
return;
|
||||
}
|
||||
pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
|
||||
frame = Math.round(pos * this.options.fps * this.options.duration);
|
||||
if(frame > this.currentFrame) {
|
||||
this.render(pos);
|
||||
this.currentFrame = frame;
|
||||
}
|
||||
this.timeout = setTimeout(this.loop.bind(this), 10);
|
||||
},
|
||||
render: function(pos) {
|
||||
if(this.options.transition) pos = this.options.transition(pos);
|
||||
pos = pos * (this.options.to-this.options.from);
|
||||
pos += this.options.from;
|
||||
if(this.options.beforeUpdate) this.options.beforeUpdate(this);
|
||||
if(this.update) this.update(pos);
|
||||
if(this.options.afterUpdate) this.options.afterUpdate(this);
|
||||
},
|
||||
cancel: function() {
|
||||
if(this.timeout) clearTimeout(this.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
Effect2.Parallel = Class.create();
|
||||
Effect2.Parallel.prototype = (new Effect2.Base()).extend({
|
||||
initialize: function(effects) {
|
||||
this.effects = effects || [];
|
||||
this.start(arguments[1]);
|
||||
},
|
||||
update: function(position) {
|
||||
for (var i = 0; i < this.effects.length; i++)
|
||||
this.effects[i].render(position);
|
||||
},
|
||||
finish: function(position) {
|
||||
for (var i = 0; i < this.effects.length; i++)
|
||||
if(this.effects[i].finish) this.effects[i].finish(position);
|
||||
}
|
||||
});
|
||||
|
||||
Effect2.Opacity = Class.create();
|
||||
Effect2.Opacity.prototype = (new Effect2.Base()).extend({
|
||||
initialize: function() {
|
||||
this.element = $(arguments[0] || document.rootElement);
|
||||
options = {
|
||||
from: 0.0,
|
||||
to: 1.0
|
||||
}.extend(arguments[1] || {});
|
||||
this.start(options);
|
||||
},
|
||||
update: function(position) {
|
||||
this.setOpacity(position);
|
||||
},
|
||||
setOpacity: function(opacity) {
|
||||
opacity = (opacity == 1) ? 0.99999 : opacity;
|
||||
this.element.style.opacity = opacity;
|
||||
this.element.style.filter = "alpha(opacity:"+opacity*100+")";
|
||||
}
|
||||
});
|
||||
|
||||
Effect2.MoveBy = Class.create();
|
||||
Effect2.MoveBy.prototype = (new Effect2.Base()).extend({
|
||||
initialize: function(element, toTop, toLeft) {
|
||||
this.element = $(element);
|
||||
this.originalTop =
|
||||
this.element.style.top ? parseFloat(this.element.style.top) : 0;
|
||||
this.originalLeft =
|
||||
this.element.style.left ? parseFloat(this.element.style.left) : 0;
|
||||
this.toTop = toTop;
|
||||
this.toLeft = toLeft;
|
||||
if(this.element.style.position == "")
|
||||
this.element.style.position = "relative";
|
||||
this.start(arguments[3]);
|
||||
},
|
||||
update: function(position) {
|
||||
topd = this.toTop * position + this.originalTop;
|
||||
leftd = this.toLeft * position + this.originalLeft;
|
||||
this.setPosition(topd, leftd);
|
||||
},
|
||||
setPosition: function(topd, leftd) {
|
||||
this.element.style.top = topd + "px";
|
||||
this.element.style.left = leftd + "px";
|
||||
}
|
||||
});
|
||||
|
||||
Effect2.Scale = Class.create();
|
||||
Effect2.Scale.prototype = (new Effect2.Base()).extend({
|
||||
initialize: function(element, percent) {
|
||||
this.element = $(element)
|
||||
options = {
|
||||
scaleX: true,
|
||||
scaleY: true,
|
||||
scaleContent: true,
|
||||
scaleFromCenter: false,
|
||||
scaleMode: 'box', // 'box' or 'contents'
|
||||
scaleFrom: 100.0
|
||||
}.extend(arguments[2] || {});
|
||||
this.originalTop = this.element.offsetTop;
|
||||
this.originalLeft = this.element.offsetLeft;
|
||||
if (this.element.style.fontSize=="") this.sizeEm = 1.0;
|
||||
if (this.element.style.fontSize && this.element.style.fontSize.indexOf("em")>0)
|
||||
this.sizeEm = parseFloat(this.element.style.fontSize);
|
||||
this.factor = (percent/100.0) - (options.scaleFrom/100.0);
|
||||
if(options.scaleMode=='box') {
|
||||
this.originalHeight = this.element.clientHeight;
|
||||
this.originalWidth = this.element.clientWidth;
|
||||
} else
|
||||
if(options.scaleMode=='contents') {
|
||||
this.originalHeight = this.element.scrollHeight;
|
||||
this.originalWidth = this.element.scrollWidth;
|
||||
}
|
||||
this.start(options);
|
||||
},
|
||||
|
||||
update: function(position) {
|
||||
currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
|
||||
if(this.options.scaleContent && this.sizeEm)
|
||||
this.element.style.fontSize = this.sizeEm*currentScale + "em";
|
||||
this.setDimensions(
|
||||
this.originalWidth * currentScale,
|
||||
this.originalHeight * currentScale);
|
||||
},
|
||||
|
||||
setDimensions: function(width, height) {
|
||||
if(this.options.scaleX) this.element.style.width = width + 'px';
|
||||
if(this.options.scaleY) this.element.style.height = height + 'px';
|
||||
if(this.options.scaleFromCenter) {
|
||||
topd = (height - this.originalHeight)/2;
|
||||
leftd = (width - this.originalWidth)/2;
|
||||
if(this.element.style.position=='absolute') {
|
||||
if(this.options.scaleY) this.element.style.top = this.originalTop-topd + "px";
|
||||
if(this.options.scaleX) this.element.style.left = this.originalLeft-leftd + "px";
|
||||
} else {
|
||||
if(this.options.scaleY) this.element.style.top = -topd + "px";
|
||||
if(this.options.scaleX) this.element.style.left = -leftd + "px";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* ------------- prepackaged effects ------------- */
|
||||
|
||||
Effect2.Fade = function(element) {
|
||||
options = {
|
||||
from: 1.0,
|
||||
to: 0.0,
|
||||
afterFinish: function(effect)
|
||||
{ Element.hide(effect.element);
|
||||
effect.setOpacity(1); }
|
||||
}.extend(arguments[1] || {});
|
||||
new Effect2.Opacity(element,options);
|
||||
}
|
||||
|
||||
Effect2.Appear = function(element) {
|
||||
options = {
|
||||
from: 0.0,
|
||||
to: 1.0,
|
||||
beforeStart: function(effect)
|
||||
{ effect.setOpacity(0);
|
||||
Element.show(effect.element); },
|
||||
afterUpdate: function(effect)
|
||||
{ Element.show(effect.element); }
|
||||
}.extend(arguments[1] || {});
|
||||
new Effect2.Opacity(element,options);
|
||||
}
|
||||
|
||||
Effect2.Puff = function(element) {
|
||||
new Effect2.Parallel(
|
||||
[ new Effect2.Scale(element, 200, { sync: true, scaleFromCenter: true }),
|
||||
new Effect2.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ],
|
||||
{ duration: 1.0,
|
||||
afterUpdate: function(effect)
|
||||
{ effect.effects[0].element.style.position = 'absolute'; },
|
||||
afterFinish: function(effect)
|
||||
{ Element.hide(effect.effects[0].element); }
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Effect2.BlindUp = function(element) {
|
||||
$(element).style.overflow = 'hidden';
|
||||
new Effect2.Scale(element, 0,
|
||||
{ scaleContent: false,
|
||||
scaleX: false,
|
||||
afterFinish: function(effect)
|
||||
{ Element.hide(effect.element) }
|
||||
}.extend(arguments[1] || {})
|
||||
);
|
||||
}
|
||||
|
||||
Effect2.BlindDown = function(element) {
|
||||
$(element).style.height = '0px';
|
||||
$(element).style.overflow = 'hidden';
|
||||
Element.show(element);
|
||||
new Effect2.Scale(element, 100,
|
||||
{ scaleContent: false,
|
||||
scaleX: false,
|
||||
scaleMode: 'contents',
|
||||
scaleFrom: 0
|
||||
}.extend(arguments[1] || {})
|
||||
);
|
||||
}
|
||||
|
||||
Effect2.SwitchOff = function(element) {
|
||||
new Effect2.Appear(element,
|
||||
{ duration: 0.4,
|
||||
transition: Effect2.Transitions.flicker,
|
||||
afterFinish: function(effect)
|
||||
{ effect.element.style.overflow = 'hidden';
|
||||
new Effect2.Scale(effect.element, 1,
|
||||
{ duration: 0.3, scaleFromCenter: true,
|
||||
scaleX: false, scaleContent: false,
|
||||
afterUpdate: function(effect) {
|
||||
if(effect.element.style.position=="")
|
||||
effect.element.style.position = 'relative'; },
|
||||
afterFinish: function(effect) { Element.hide(effect.element); }
|
||||
} )
|
||||
}
|
||||
} )
|
||||
}
|
||||
|
||||
Effect2.DropOut = function(element) {
|
||||
new Effect2.Parallel(
|
||||
[ new Effect2.MoveBy(element, 100, 0, { sync: true }),
|
||||
new Effect2.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ],
|
||||
{ duration: 0.5,
|
||||
afterFinish: function(effect)
|
||||
{ Element.hide(effect.effects[0].element); }
|
||||
});
|
||||
}
|
||||
|
||||
Effect2.Shake = function(element) {
|
||||
new Effect2.MoveBy(element, 0, 20,
|
||||
{ duration: 0.05, afterFinish: function(effect) {
|
||||
new Effect2.MoveBy(effect.element, 0, -40,
|
||||
{ duration: 0.1, afterFinish: function(effect) {
|
||||
new Effect2.MoveBy(effect.element, 0, 40,
|
||||
{ duration: 0.1, afterFinish: function(effect) {
|
||||
new Effect2.MoveBy(effect.element, 0, -40,
|
||||
{ duration: 0.1, afterFinish: function(effect) {
|
||||
new Effect2.MoveBy(effect.element, 0, 40,
|
||||
{ duration: 0.1, afterFinish: function(effect) {
|
||||
new Effect2.MoveBy(effect.element, 0, -20,
|
||||
{ duration: 0.05, afterFinish: function(effect) {
|
||||
}}) }}) }}) }}) }}) }});
|
||||
}
|
||||
|
||||
Effect2.SlideDown = function(element) {
|
||||
$(element).style.height = '0px';
|
||||
$(element).style.overflow = 'hidden';
|
||||
$(element).firstChild.style.position = 'relative';
|
||||
Element.show(element);
|
||||
new Effect2.Scale(element, 100,
|
||||
{ scaleContent: false,
|
||||
scaleX: false,
|
||||
scaleMode: 'contents',
|
||||
scaleFrom: 0,
|
||||
afterUpdate: function(effect)
|
||||
{ effect.element.firstChild.style.bottom =
|
||||
(effect.originalHeight - effect.element.clientHeight) + 'px'; }
|
||||
}.extend(arguments[1] || {})
|
||||
);
|
||||
}
|
||||
|
||||
Effect2.SlideUp = function(element) {
|
||||
$(element).style.overflow = 'hidden';
|
||||
$(element).firstChild.style.position = 'relative';
|
||||
Element.show(element);
|
||||
new Effect2.Scale(element, 0,
|
||||
{ scaleContent: false,
|
||||
scaleX: false,
|
||||
afterUpdate: function(effect)
|
||||
{ effect.element.firstChild.style.bottom =
|
||||
(effect.originalHeight - effect.element.clientHeight) + 'px'; },
|
||||
afterFinish: function(effect)
|
||||
{ Element.hide(effect.element); }
|
||||
}.extend(arguments[1] || {})
|
||||
);
|
||||
}
|
1
public/javascripts/global.js
Normal file
1
public/javascripts/global.js
Normal file
|
@ -0,0 +1 @@
|
|||
function changeLoc(loc){window.location=loc}function getCookie(name){var prefix=name+"=";var cStr=document.cookie;var start=cStr.indexOf(prefix);if(start==-1){return null;}var end=cStr.indexOf(";",start+prefix.length);if(end==-1){end=cStr.length;}var value=cStr.substring(start+prefix.length,end);return unescape(value);}function setCookie(name,value,expiration){document.cookie=name+"="+value+"; expires="+expiration;}function toggleCheckbox(checkBox){var element=document.getElementById(checkBox.id);if(element.value=="1"||element.checked){element.checked=false;element.value="0";}else{element.checked=true;element.value="1";}}function toggleChkbox(checkBox){if(checkBox.checked){checkBox.checked=true;}else{checkBox.checked=false;}}function toggle_list(id){ul="ul_"+id;img="img_"+id;hid="h_"+id;ulElement=document.getElementById(ul);imgElement=document.getElementById(img);hiddenElement=document.getElementById(hid);if(ulElement){if(ulElement.className=='closed'){ulElement.className="open";imgElement.src="/images/list_opened.gif";hiddenElement.value="1"}else{ulElement.className="closed";imgElement.src="/images/list_closed.gif";hiddenElement.value="0"}}}function toggle_layer(id){lElement=document.getElementById(id);imgElement=document.getElementById("img_"+id);if(lElement){if(lElement.className=='closed'){lElement.className="open";imgElement.src="/images/list_opened.gif";return true;}else{lElement.className="closed";imgElement.src="/images/list_closed.gif";return false;}}return true;}function toggle_layer_status(id){lElement=document.getElementById(id);if(lElement){if(lElement.className=='closed'){return false;}else{return true;}}return true;}function toggle_text(id){if(document.getElementById)elem=document.getElementById(id);else if(document.all)elem=eval("document.all."+id);else return false;if(!elem)return true;elemStyle=elem.style;if(elemStyle.display!="block"){elemStyle.display="block"}else{elemStyle.display="none"}return true;}function getFF(id){if(document.getElementById)elem=document.getElementById(id);else if(document.all)elem=document.eval("document.all."+id);return elem}function setFF(id,value){if(getFF(id))getFF(id).value=value;}function setCFF(id){if(getFF(id))getFF(id).checked=true;}function updateSUFromC(btnName){var suem=getCookie('_cdf_em');var sueg=getCookie('_cdf_gr');if(suem!=""&&suem!=null&&suem!="undefined"){setFF('sup_email',suem);setFF('signup_submit_button',btnName);}if(sueg&&sueg!=""){if(sueg.indexOf(",")<0&&sueg!=""){gr_id=sueg;setCFF('supgr_'+gr_id);}else while((i=sueg.indexOf(","))>=0){gr_id=sueg.substring(0,i);sueg=sueg.substring(i+1);setCFF('supgr_'+gr_id);}if(sueg.indexOf(",")<0&&sueg!=""){gr_id=sueg;setCFF('supgr_'+gr_id);}}}function updateLUEfC(){var suem=getCookie('_cdf_em');if(suem!=""&&suem!=null&&suem!="undefined"){setFF('login_user_email',suem);}}function replaceHRFST(ifrm){var o=ifrm;var w=null;if(o.contentWindow){w=o.contentWindow;}else if(window.frames&&window.frames[o.id].window){w=window.frames[o.id];}else return;var doc=w.document;if(!doc.getElementsByTagName)return;var anchors=doc.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href"))anchor.target="_top";}iHeight=doc.body.scrollHeight;ifrm.style.height=iHeight+"px"}function rs(n,u,w,h,x){args="width="+w+",height="+h+",resizable=yes,scrollbars=yes,status=0";remote=window.open(u,n,args);if(remote!=null&&remote.opener==null)remote.opener=self;if(x==1)return remote;}function wizard_step_onclick(direction,alt_url){if(document.forms[0]){direction_elem='';if(document.getElementById){direction_elem=document.getElementById('wiz_dir');}else if(document.all){direction_elem=document.eval("document.all.wiz_dir");}if(direction_elem){direction_elem.value=direction;}if(document.forms[0].onsubmit){document.forms[0].onsubmit();}document.forms[0].submit();}else{window.location=alt_url;}}function toggle_adtype(ad_type){toggle_text('upload_banner_label');toggle_text('upload_banner');toggle_text('radio1_label');toggle_text('radio1');toggle_text('radio2_label');toggle_text('radio2');toggle_text('adtitle_label');toggle_text('adtitle');toggle_text('adtext_label');toggle_text('adtext');toggle_text('banner_size_label');toggle_text('banner_size');}function show_date_as_local_time(){var spans=document.getElementsByTagName('span');for(var i=0;i<spans.length;i++)if(spans[i].className.match(/\bLOCAL_TIME\b/i)){system_date=new Date(Date.parse(spans[i].innerHTML));if(system_date.getHours()>=12){adds=' PM';h=system_date.getHours()-12;}else{adds=' AM';h=system_date.getHours();}spans[i].innerHTML=h+":"+(system_date.getMinutes()+"").replace(/\b(\d)\b/g,'0$1')+adds;}}function PopupPic(sPicURL,sWidth,sHeight){window.open("/popup.htm?"+sPicURL,"","resizable=1,HEIGHT="+sHeight+",WIDTH="+sWidth+",scrollbars=yes");}function open_link(target,location){if(target=='blank'){window.open(location);}else{window.top.location=location;}}
|
201
public/javascripts/global_src.js
Normal file
201
public/javascripts/global_src.js
Normal file
|
@ -0,0 +1,201 @@
|
|||
function changeLoc(loc) { window.location = loc }
|
||||
function getCookie(name) {
|
||||
var prefix = name + "=";
|
||||
var cStr = document.cookie;
|
||||
var start = cStr.indexOf(prefix);
|
||||
if (start==-1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var end = cStr.indexOf(";", start+prefix.length);
|
||||
if (end==-1) { end=cStr.length; }
|
||||
|
||||
var value=cStr.substring(start+prefix.length, end);
|
||||
return unescape(value);
|
||||
}
|
||||
function setCookie(name, value, expiration) {
|
||||
document.cookie = name+"="+value+"; expires="+expiration;
|
||||
}
|
||||
function toggleCheckbox(checkBox) {
|
||||
var element = document.getElementById(checkBox.id);
|
||||
if (element.value == "1" || element.checked) {
|
||||
element.checked = false;
|
||||
element.value = "0";
|
||||
} else {
|
||||
element.checked = true;
|
||||
element.value = "1";
|
||||
}
|
||||
}
|
||||
function toggleChkbox(checkBox) {
|
||||
if (checkBox.checked) {
|
||||
checkBox.checked = true;
|
||||
} else {
|
||||
checkBox.checked = false;
|
||||
}
|
||||
}
|
||||
function toggle_list(id){
|
||||
ul = "ul_" + id;
|
||||
img = "img_" + id;
|
||||
hid = "h_" + id;
|
||||
ulElement = document.getElementById(ul);
|
||||
imgElement = document.getElementById(img);
|
||||
hiddenElement = document.getElementById(hid);
|
||||
if (ulElement){
|
||||
if (ulElement.className == 'closed'){
|
||||
ulElement.className = "open";
|
||||
imgElement.src = "/images/list_opened.gif";
|
||||
hiddenElement.value = "1"
|
||||
}else{
|
||||
ulElement.className = "closed";
|
||||
imgElement.src = "/images/list_closed.gif";
|
||||
hiddenElement.value = "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
function toggle_layer(id) {
|
||||
lElement = document.getElementById(id);
|
||||
imgElement = document.getElementById("img_" + id);
|
||||
if (lElement){
|
||||
if (lElement.className == 'closed'){
|
||||
lElement.className = "open";
|
||||
imgElement.src = "/images/list_opened.gif";
|
||||
return true;
|
||||
}else{
|
||||
lElement.className = "closed";
|
||||
imgElement.src = "/images/list_closed.gif";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function toggle_layer_status(id) {
|
||||
lElement = document.getElementById(id);
|
||||
if (lElement){
|
||||
if (lElement.className == 'closed'){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function toggle_text(id){
|
||||
if ( document.getElementById )
|
||||
elem = document.getElementById( id );
|
||||
else if ( document.all )
|
||||
elem = eval( "document.all." + id );
|
||||
else
|
||||
return false;
|
||||
|
||||
if(!elem) return true;
|
||||
|
||||
elemStyle = elem.style;
|
||||
if ( elemStyle.display != "block" ) {
|
||||
elemStyle.display = "block"
|
||||
} else {
|
||||
elemStyle.display = "none"
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function getFF(id) {
|
||||
if ( document.getElementById ) elem = document.getElementById( id );
|
||||
else if ( document.all ) elem = document.eval( "document.all." + id );
|
||||
return elem
|
||||
}
|
||||
function setFF(id, value) {if(getFF(id))getFF(id).value=value;}
|
||||
function setCFF(id) {if(getFF(id))getFF(id).checked=true;}
|
||||
function updateSUFromC(btnName) {
|
||||
var suem = getCookie('_cdf_em');var sueg = getCookie('_cdf_gr');
|
||||
if (suem != "" && suem != null && suem != "undefined") { setFF('sup_email', suem); setFF('signup_submit_button',btnName); }
|
||||
|
||||
if (sueg && sueg != "") {
|
||||
if (sueg.indexOf(",") < 0 && sueg != "") { gr_id = sueg; setCFF('supgr_'+gr_id);
|
||||
} else while ((i = sueg.indexOf(",")) >= 0) { gr_id = sueg.substring(0,i); sueg = sueg.substring(i+1); setCFF('supgr_'+gr_id); }
|
||||
if (sueg.indexOf(",") < 0 && sueg != "") { gr_id = sueg; setCFF('supgr_'+gr_id);}
|
||||
}
|
||||
}
|
||||
function updateLUEfC() {
|
||||
var suem = getCookie('_cdf_em');
|
||||
if (suem != "" && suem != null && suem != "undefined") { setFF('login_user_email', suem); }
|
||||
}
|
||||
function replaceHRFST(ifrm) {
|
||||
var o = ifrm;
|
||||
var w = null;
|
||||
if (o.contentWindow) {
|
||||
// For IE5.5 and IE6
|
||||
w = o.contentWindow;
|
||||
} else if (window.frames && window.frames[o.id].window) {
|
||||
w = window.frames[o.id];
|
||||
} else return;
|
||||
var doc = w.document;
|
||||
if (!doc.getElementsByTagName) return;
|
||||
var anchors = doc.getElementsByTagName("a");
|
||||
for (var i=0; i<anchors.length; i++) {
|
||||
var anchor = anchors[i];
|
||||
if (anchor.getAttribute("href")) anchor.target = "_top";
|
||||
}
|
||||
iHeight = doc.body.scrollHeight;
|
||||
ifrm.style.height = iHeight + "px"
|
||||
}
|
||||
function rs(n,u,w,h,x){
|
||||
args="width="+w+",height="+h+",resizable=yes,scrollbars=yes,status=0";
|
||||
remote=window.open(u,n,args);
|
||||
if(remote != null && remote.opener == null) remote.opener = self;
|
||||
if(x == 1) return remote;
|
||||
}
|
||||
function wizard_step_onclick(direction, alt_url) {
|
||||
if(document.forms[0]) {
|
||||
direction_elem='';
|
||||
|
||||
if ( document.getElementById ) {
|
||||
direction_elem = document.getElementById( 'wiz_dir' );
|
||||
} else if ( document.all ) {
|
||||
direction_elem = document.eval( "document.all.wiz_dir");
|
||||
}
|
||||
if(direction_elem) {
|
||||
direction_elem.value = direction;
|
||||
}
|
||||
if (document.forms[0].onsubmit) {
|
||||
document.forms[0].onsubmit();
|
||||
}
|
||||
document.forms[0].submit();
|
||||
} else {
|
||||
window.location=alt_url;
|
||||
}
|
||||
}
|
||||
function toggle_adtype(ad_type){
|
||||
toggle_text('upload_banner_label');
|
||||
toggle_text('upload_banner');
|
||||
toggle_text('radio1_label');
|
||||
toggle_text('radio1');
|
||||
toggle_text('radio2_label');
|
||||
toggle_text('radio2');
|
||||
toggle_text('adtitle_label');
|
||||
toggle_text('adtitle');
|
||||
toggle_text('adtext_label');
|
||||
toggle_text('adtext');
|
||||
toggle_text('banner_size_label');
|
||||
toggle_text('banner_size');
|
||||
|
||||
}
|
||||
function show_date_as_local_time() {
|
||||
var spans = document.getElementsByTagName('span');
|
||||
for (var i=0; i<spans.length; i++)
|
||||
if (spans[i].className.match(/\bLOCAL_TIME\b/i)) {
|
||||
system_date = new Date(Date.parse(spans[i].innerHTML));
|
||||
if (system_date.getHours() >= 12) { adds = ' PM'; h = system_date.getHours() - 12; }
|
||||
else { adds = ' AM'; h = system_date.getHours(); }
|
||||
spans[i].innerHTML = h + ":" + (system_date.getMinutes()+"").replace(/\b(\d)\b/g, '0$1') + adds;
|
||||
}
|
||||
}
|
||||
function PopupPic(sPicURL,sWidth,sHeight) {
|
||||
window.open( "/popup.htm?"+sPicURL, "", "resizable=1,HEIGHT="+sHeight+",WIDTH="+sWidth+",scrollbars=yes");
|
||||
}
|
||||
|
||||
function open_link(target, location){
|
||||
if (target == 'blank'){
|
||||
window.open(location);
|
||||
} else {
|
||||
window.top.location = location;
|
||||
}
|
||||
}
|
21
public/javascripts/htmlstyle.js
Executable file
21
public/javascripts/htmlstyle.js
Executable file
|
@ -0,0 +1,21 @@
|
|||
var config = new HTMLArea.Config(); // create a new configuration object
|
||||
// having all the default values
|
||||
config.width = '520px';
|
||||
config.pageStyle =
|
||||
'body { font-family: verdana,sans-serif; font-size: 12px } ';
|
||||
|
||||
config.toolbar = [
|
||||
[ "fontname", "fontsize","formatblock","bold", "italic", "underline", "separator", "insertimage", "createlink"],
|
||||
["justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "forecolor", "hilitecolor", "separator", "popupeditor", "htmlmode"]
|
||||
];
|
||||
config.statusBar = false;
|
||||
|
||||
var configView = new HTMLArea.Config(); // create a new configuration object
|
||||
// having all the default values
|
||||
configView.width = '670px';
|
||||
configView.pageStyle =
|
||||
'body { font-family: verdana,sans-serif; font-size: 12px } ';
|
||||
|
||||
configView.toolbar = [];
|
||||
configView.statusBar = false;
|
||||
configView.readonly = true;
|
76
public/javascripts/jstrim.pl
Executable file
76
public/javascripts/jstrim.pl
Executable file
|
@ -0,0 +1,76 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
jsTrim("prototype_src.js", "prototype.js");
|
||||
jsTrim("global_src.js", "global.js");
|
||||
#jsTrim("jscripts/tiny_mce/themes/simple/editor_template_src.js", "jscripts/tiny_mce/themes/simple/editor_template.js");
|
||||
#jsTrim("jscripts/tiny_mce/themes/default/editor_template_src.js", "jscripts/tiny_mce/themes/default/editor_template.js");
|
||||
#jsTrim("jscripts/tiny_mce/themes/advanced/editor_template_src.js", "jscripts/tiny_mce/themes/advanced/editor_template.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/advhr/editor_plugin_src.js", "jscripts/tiny_mce/plugins/advhr/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js", "jscripts/tiny_mce/plugins/advimage/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/advlink/editor_plugin_src.js", "jscripts/tiny_mce/plugins/advlink/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/emotions/editor_plugin_src.js", "jscripts/tiny_mce/plugins/emotions/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/flash/editor_plugin_src.js", "jscripts/tiny_mce/plugins/flash/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/iespell/editor_plugin_src.js", "jscripts/tiny_mce/plugins/iespell/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js", "jscripts/tiny_mce/plugins/insertdatetime/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/preview/editor_plugin_src.js", "jscripts/tiny_mce/plugins/preview/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/print/editor_plugin_src.js", "jscripts/tiny_mce/plugins/print/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/save/editor_plugin_src.js", "jscripts/tiny_mce/plugins/save/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js", "jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/zoom/editor_plugin_src.js", "jscripts/tiny_mce/plugins/zoom/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/table/editor_plugin_src.js", "jscripts/tiny_mce/plugins/table/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js", "jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/paste/editor_plugin_src.js", "jscripts/tiny_mce/plugins/paste/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js", "jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js");
|
||||
#jsTrim("jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js", "jscripts/tiny_mce/plugins/directionality/editor_plugin.js");
|
||||
|
||||
sub jsTrim {
|
||||
my $inFile = $_[0];
|
||||
my $outFile = $_[1];
|
||||
my $comment = '';
|
||||
my $content = '';
|
||||
|
||||
# Load input file
|
||||
open(FILE, "<$inFile");
|
||||
undef $/;
|
||||
$content = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
if ($content =~ s#^\s*(/\*.*?\*/)##s or $content =~ s#^\s*(//.*?)\n\s*[^/]##s) {
|
||||
$comment = "$1\n";
|
||||
}
|
||||
|
||||
local $^W;
|
||||
|
||||
# removing C/C++ - style comments:
|
||||
$content =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs;
|
||||
|
||||
# save string literals
|
||||
my @strings = ();
|
||||
$content =~ s/("(\\.|[^"\\])*"|'(\\.|[^'\\])*')/push(@strings, "$1");'__CMPRSTR_'.$#strings.'__';/egs;
|
||||
|
||||
# remove C-style comments
|
||||
$content =~ s#/\*.*?\*/##gs;
|
||||
# remove C++-style comments
|
||||
$content =~ s#//.*?\n##gs;
|
||||
# removing leading/trailing whitespace:
|
||||
#$content =~ s#(?:(?:^|\n)\s+|\s+(?:$|\n))##gs;
|
||||
# removing newlines:
|
||||
#$content =~ s#\r?\n##gs;
|
||||
|
||||
# removing other whitespace (between operators, etc.) (regexp-s stolen from Mike Hall's JS Crunchinator)
|
||||
$content =~ s/\s+/ /gs; # condensing whitespace
|
||||
#$content =~ s/^\s(.*)/$1/gs; # condensing whitespace
|
||||
#$content =~ s/(.*)\s$/$1/gs; # condensing whitespace
|
||||
$content =~ s/\s([\x21\x25\x26\x28\x29\x2a\x2b\x2c\x2d\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x5b\x5d\x5c\x7b\x7c\x7d\x7e])/$1/gs;
|
||||
$content =~ s/([\x21\x25\x26\x28\x29\x2a\x2b\x2c\x2d\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x5b\x5d\x5c\x7b\x7c\x7d\x7e])\s/$1/gs;
|
||||
|
||||
# restore string literals
|
||||
$content =~ s/__CMPRSTR_([0-9]+)__/$strings[$1]/egs;
|
||||
|
||||
# Write to ouput file
|
||||
open(FILE, ">$outFile");
|
||||
flock(FILE, 2);
|
||||
seek(FILE, 0, 2);
|
||||
print FILE $comment, $content;
|
||||
close(FILE);
|
||||
}
|
1724
public/javascripts/prototype.js
vendored
Normal file
1724
public/javascripts/prototype.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
521
public/javascripts/prototype_src.js
vendored
Normal file
521
public/javascripts/prototype_src.js
vendored
Normal file
|
@ -0,0 +1,521 @@
|
|||
var Prototype = {
|
||||
Version: '1.2.1'
|
||||
};
|
||||
|
||||
var Class = {
|
||||
create: function() {
|
||||
return function() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var Abstract = new Object();
|
||||
Object.prototype.extend = function(object) {
|
||||
for (property in object) {
|
||||
this[property] = object[property];
|
||||
}
|
||||
return this;
|
||||
};
|
||||
Function.prototype.bind = function(object) {
|
||||
var method = this;
|
||||
return function() {
|
||||
method.apply(object, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
Function.prototype.bindAsEventListener = function(object) {
|
||||
var method = this;
|
||||
return function(event) {
|
||||
method.call(object, event || window.event);
|
||||
}
|
||||
};
|
||||
|
||||
Number.prototype.toColorPart = function() {
|
||||
var digits = this.toString(16);
|
||||
if (this < 16) return '0' + digits;
|
||||
return digits;
|
||||
};
|
||||
|
||||
var Try = {
|
||||
these: function() {
|
||||
var returnValue;
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var lambda = arguments[i];
|
||||
try {
|
||||
returnValue = lambda();
|
||||
break;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
};
|
||||
|
||||
var PeriodicalExecuter = Class.create();
|
||||
PeriodicalExecuter.prototype = {
|
||||
initialize: function(callback, frequency) {
|
||||
this.callback = callback;
|
||||
this.frequency = frequency;
|
||||
this.currentlyExecuting = false;
|
||||
|
||||
this.registerCallback();
|
||||
},
|
||||
|
||||
registerCallback: function() {
|
||||
setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
|
||||
},
|
||||
|
||||
onTimerEvent: function() {
|
||||
if (!this.currentlyExecuting) {
|
||||
try {
|
||||
this.currentlyExecuting = true;
|
||||
this.callback();
|
||||
} finally {
|
||||
this.currentlyExecuting = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.registerCallback();
|
||||
}
|
||||
};
|
||||
function $() {
|
||||
var elements = new Array();
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = arguments[i];
|
||||
if (typeof element == 'string')
|
||||
element = document.getElementById(element);
|
||||
|
||||
if (arguments.length == 1)
|
||||
return element;
|
||||
|
||||
elements.push(element);
|
||||
}
|
||||
|
||||
return elements;
|
||||
};
|
||||
if (!Array.prototype.push) {
|
||||
Array.prototype.push = function() {
|
||||
var startLength = this.length;
|
||||
for (var i = 0; i < arguments.length; i++)
|
||||
this[startLength + i] = arguments[i];
|
||||
return this.length;
|
||||
};
|
||||
};
|
||||
|
||||
if (!Function.prototype.apply) {
|
||||
// Based on code from http://www.youngpup.net/
|
||||
Function.prototype.apply = function(object, parameters) {
|
||||
var parameterStrings = new Array();
|
||||
if (!object) object = window;
|
||||
if (!parameters) parameters = new Array();
|
||||
|
||||
for (var i = 0; i < parameters.length; i++)
|
||||
parameterStrings[i] = 'x[' + i + ']';
|
||||
|
||||
object.__apply__ = this;
|
||||
var result = eval('obj.__apply__(' +
|
||||
parameterStrings[i].join(', ') + ')');
|
||||
object.__apply__ = null;
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
var Ajax = {
|
||||
getTransport: function() {
|
||||
return Try.these(
|
||||
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
||||
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
|
||||
function() {return new XMLHttpRequest()}
|
||||
) || false;
|
||||
},
|
||||
|
||||
emptyFunction: function() {}
|
||||
};
|
||||
|
||||
Ajax.Base = function() {};
|
||||
Ajax.Base.prototype = {
|
||||
setOptions: function(options) {
|
||||
this.options = {
|
||||
method: 'post',
|
||||
asynchronous: true,
|
||||
parameters: ''
|
||||
}.extend(options || {});
|
||||
}
|
||||
};
|
||||
|
||||
Ajax.Request = Class.create();
|
||||
Ajax.Request.Events =
|
||||
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
||||
|
||||
Ajax.Request.prototype = (new Ajax.Base()).extend({
|
||||
initialize: function(url, options) {
|
||||
this.transport = Ajax.getTransport();
|
||||
this.setOptions(options);
|
||||
|
||||
try {
|
||||
if (this.options.method == 'get')
|
||||
url += '?' + this.options.parameters + '&_=';
|
||||
|
||||
this.transport.open(this.options.method, url,
|
||||
this.options.asynchronous);
|
||||
|
||||
if (this.options.asynchronous) {
|
||||
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
||||
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
|
||||
}
|
||||
|
||||
this.transport.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
this.transport.setRequestHeader('X-Prototype-Version', Prototype.Version);
|
||||
|
||||
if (this.options.method == 'post') {
|
||||
this.transport.setRequestHeader('Connection', 'close');
|
||||
this.transport.setRequestHeader('Content-type',
|
||||
'application/x-www-form-urlencoded');
|
||||
}
|
||||
|
||||
this.transport.send(this.options.method == 'post' ?
|
||||
this.options.parameters + '&_=' : null);
|
||||
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
|
||||
onStateChange: function() {
|
||||
var readyState = this.transport.readyState;
|
||||
if (readyState != 1)
|
||||
this.respondToReadyState(this.transport.readyState);
|
||||
},
|
||||
|
||||
respondToReadyState: function(readyState) {
|
||||
var event = Ajax.Request.Events[readyState];
|
||||
(this.options['on' + event] || Ajax.emptyFunction)(this.transport);
|
||||
}
|
||||
});
|
||||
|
||||
Ajax.Updater = Class.create();
|
||||
Ajax.Updater.prototype = (new Ajax.Base()).extend({
|
||||
initialize: function(container, url, options) {
|
||||
this.container = $(container);
|
||||
this.setOptions(options);
|
||||
|
||||
if (this.options.asynchronous) {
|
||||
this.onComplete = this.options.onComplete;
|
||||
this.options.onComplete = this.updateContent.bind(this);
|
||||
}
|
||||
|
||||
this.request = new Ajax.Request(url, this.options);
|
||||
|
||||
if (!this.options.asynchronous)
|
||||
this.updateContent();
|
||||
},
|
||||
|
||||
updateContent: function() {
|
||||
if (this.options.insertion) {
|
||||
new this.options.insertion(this.container,
|
||||
this.request.transport.responseText);
|
||||
} else {
|
||||
this.container.innerHTML = this.request.transport.responseText;
|
||||
}
|
||||
|
||||
if (this.onComplete) {
|
||||
setTimeout((function() {this.onComplete(this.request)}).bind(this), 10);
|
||||
}
|
||||
}
|
||||
});
|
||||
var Field = {
|
||||
clear: function() {
|
||||
for (var i = 0; i < arguments.length; i++)
|
||||
$(arguments[i]).value = '';
|
||||
},
|
||||
|
||||
focus: function(element) {
|
||||
$(element).focus();
|
||||
},
|
||||
|
||||
present: function() {
|
||||
for (var i = 0; i < arguments.length; i++)
|
||||
if ($(arguments[i]).value == '') return false;
|
||||
return true;
|
||||
},
|
||||
|
||||
select: function(element) {
|
||||
$(element).select();
|
||||
},
|
||||
|
||||
activate: function(element) {
|
||||
$(element).focus();
|
||||
$(element).select();
|
||||
}
|
||||
};
|
||||
var Form = {
|
||||
serialize: function(form) {
|
||||
var elements = Form.getElements($(form));
|
||||
var queryComponents = new Array();
|
||||
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var queryComponent = Form.Element.serialize(elements[i]);
|
||||
if (queryComponent)
|
||||
queryComponents.push(queryComponent);
|
||||
}
|
||||
|
||||
return queryComponents.join('&');
|
||||
},
|
||||
|
||||
getElements: function(form) {
|
||||
form = $(form);
|
||||
var elements = new Array();
|
||||
|
||||
for (tagName in Form.Element.Serializers) {
|
||||
var tagElements = form.getElementsByTagName(tagName);
|
||||
for (var j = 0; j < tagElements.length; j++)
|
||||
elements.push(tagElements[j]);
|
||||
}
|
||||
return elements;
|
||||
},
|
||||
|
||||
disable: function(form) {
|
||||
var elements = Form.getElements(form);
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var element = elements[i];
|
||||
element.blur();
|
||||
element.disable = 'true';
|
||||
}
|
||||
},
|
||||
|
||||
focusFirstElement: function(form) {
|
||||
form = $(form);
|
||||
var elements = Form.getElements(form);
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var element = elements[i];
|
||||
if (element.type != 'hidden' && !element.disabled) {
|
||||
Field.activate(element);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
reset: function(form) {
|
||||
$(form).reset();
|
||||
}
|
||||
};
|
||||
|
||||
Form.Element = {
|
||||
serialize: function(element) {
|
||||
element = $(element);
|
||||
var method = element.tagName.toLowerCase();
|
||||
var parameter = Form.Element.Serializers[method](element);
|
||||
|
||||
if (parameter)
|
||||
return encodeURIComponent(parameter[0]) + '=' +
|
||||
encodeURIComponent(parameter[1]);
|
||||
},
|
||||
|
||||
getValue: function(element) {
|
||||
element = $(element);
|
||||
var method = element.tagName.toLowerCase();
|
||||
var parameter = Form.Element.Serializers[method](element);
|
||||
|
||||
if (parameter)
|
||||
return parameter[1];
|
||||
}
|
||||
};
|
||||
|
||||
Form.Element.Serializers = {
|
||||
input: function(element) {
|
||||
switch (element.type.toLowerCase()) {
|
||||
case 'hidden':
|
||||
case 'password':
|
||||
case 'text':
|
||||
return Form.Element.Serializers.textarea(element);
|
||||
case 'checkbox':
|
||||
case 'radio':
|
||||
return Form.Element.Serializers.inputSelector(element);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
inputSelector: function(element) {
|
||||
if (element.checked)
|
||||
return [element.name, element.value];
|
||||
},
|
||||
|
||||
textarea: function(element) {
|
||||
return [element.name, element.value];
|
||||
},
|
||||
|
||||
select: function(element) {
|
||||
var index = element.selectedIndex;
|
||||
var value = element.options[index].value || element.options[index].text;
|
||||
return [element.name, (index >= 0) ? value : ''];
|
||||
}
|
||||
};
|
||||
|
||||
var $F = Form.Element.getValue;
|
||||
|
||||
Abstract.TimedObserver = function() {};
|
||||
Abstract.TimedObserver.prototype = {
|
||||
initialize: function(element, frequency, callback) {
|
||||
this.frequency = frequency;
|
||||
this.element = $(element);
|
||||
this.callback = callback;
|
||||
|
||||
this.lastValue = this.getValue();
|
||||
this.registerCallback();
|
||||
},
|
||||
|
||||
registerCallback: function() {
|
||||
setTimeout(this.onTimerEvent.bind(this), this.frequency * 1000);
|
||||
},
|
||||
|
||||
onTimerEvent: function() {
|
||||
var value = this.getValue();
|
||||
if (this.lastValue != value) {
|
||||
this.callback(this.element, value);
|
||||
this.lastValue = value;
|
||||
}
|
||||
|
||||
this.registerCallback();
|
||||
}
|
||||
};
|
||||
|
||||
Form.Element.Observer = Class.create();
|
||||
Form.Element.Observer.prototype = (new Abstract.TimedObserver()).extend({
|
||||
getValue: function() {
|
||||
return Form.Element.getValue(this.element);
|
||||
}
|
||||
});
|
||||
|
||||
Form.Observer = Class.create();
|
||||
Form.Observer.prototype = (new Abstract.TimedObserver()).extend({
|
||||
getValue: function() {
|
||||
return Form.serialize(this.element);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementsByClassName = function(className) {
|
||||
var children = document.getElementsByTagName('*') || document.all;
|
||||
var elements = new Array();
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
var classNames = child.className.split(' ');
|
||||
for (var j = 0; j < classNames.length; j++) {
|
||||
if (classNames[j] == className) {
|
||||
elements.push(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return elements;
|
||||
};
|
||||
|
||||
var Element = {
|
||||
toggle: function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = $(arguments[i]);
|
||||
element.style.display =
|
||||
(element.style.display == 'none' ? '' : 'none');
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = $(arguments[i]);
|
||||
element.style.display = 'none';
|
||||
}
|
||||
},
|
||||
|
||||
show: function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = $(arguments[i]);
|
||||
element.style.display = '';
|
||||
}
|
||||
},
|
||||
|
||||
remove: function(element) {
|
||||
element = $(element);
|
||||
element.parentNode.removeChild(element);
|
||||
},
|
||||
|
||||
getHeight: function(element) {
|
||||
element = $(element);
|
||||
return element.offsetHeight;
|
||||
}
|
||||
};
|
||||
|
||||
var Toggle = new Object();
|
||||
Toggle.display = Element.toggle;
|
||||
|
||||
Abstract.Insertion = function(adjacency) {
|
||||
this.adjacency = adjacency;
|
||||
};
|
||||
|
||||
Abstract.Insertion.prototype = {
|
||||
initialize: function(element, content) {
|
||||
this.element = $(element);
|
||||
this.content = content;
|
||||
|
||||
if (this.adjacency && this.element.insertAdjacentHTML) {
|
||||
this.element.insertAdjacentHTML(this.adjacency, this.content);
|
||||
} else {
|
||||
this.range = this.element.ownerDocument.createRange();
|
||||
if (this.initializeRange) this.initializeRange();
|
||||
this.fragment = this.range.createContextualFragment(this.content);
|
||||
this.insertContent();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var Insertion = new Object();
|
||||
|
||||
Insertion.Before = Class.create();
|
||||
Insertion.Before.prototype = (new Abstract.Insertion('beforeBegin')).extend({
|
||||
initializeRange: function() {
|
||||
this.range.setStartBefore(this.element);
|
||||
},
|
||||
|
||||
insertContent: function() {
|
||||
this.element.parentNode.insertBefore(this.fragment, this.element);
|
||||
}
|
||||
});
|
||||
|
||||
Insertion.Top = Class.create();
|
||||
Insertion.Top.prototype = (new Abstract.Insertion('afterBegin')).extend({
|
||||
initializeRange: function() {
|
||||
this.range.selectNodeContents(this.element);
|
||||
this.range.collapse(true);
|
||||
},
|
||||
|
||||
insertContent: function() {
|
||||
this.element.insertBefore(this.fragment, this.element.firstChild);
|
||||
}
|
||||
});
|
||||
|
||||
Insertion.Bottom = Class.create();
|
||||
Insertion.Bottom.prototype = (new Abstract.Insertion('beforeEnd')).extend({
|
||||
initializeRange: function() {
|
||||
this.range.selectNodeContents(this.element);
|
||||
this.range.collapse(this.element);
|
||||
},
|
||||
|
||||
insertContent: function() {
|
||||
this.element.appendChild(this.fragment);
|
||||
}
|
||||
});
|
||||
|
||||
Insertion.After = Class.create();
|
||||
Insertion.After.prototype = (new Abstract.Insertion('afterEnd')).extend({
|
||||
initializeRange: function() {
|
||||
this.range.setStartAfter(this.element);
|
||||
},
|
||||
|
||||
insertContent: function() {
|
||||
this.element.parentNode.insertBefore(this.fragment,
|
||||
this.element.nextSibling);
|
||||
}
|
||||
});
|
47
public/javascripts/scriptaculous.js
Normal file
47
public/javascripts/scriptaculous.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var Scriptaculous = {
|
||||
Version: '1.5_rc3',
|
||||
require: function(libraryName) {
|
||||
// inserting via DOM fails in Safari 2.0, so brute force approach
|
||||
document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
|
||||
},
|
||||
load: function() {
|
||||
if((typeof Prototype=='undefined') ||
|
||||
parseFloat(Prototype.Version.split(".")[0] + "." +
|
||||
Prototype.Version.split(".")[1]) < 1.4)
|
||||
throw("script.aculo.us requires the Prototype JavaScript framework >= 1.4.0");
|
||||
var scriptTags = document.getElementsByTagName("script");
|
||||
for(var i=0;i<scriptTags.length;i++) {
|
||||
if(scriptTags[i].src && scriptTags[i].src.match(/scriptaculous\.js(\?.*)?$/)) {
|
||||
var path = scriptTags[i].src.replace(/scriptaculous\.js(\?.*)?$/,'');
|
||||
this.require(path + 'effects.js');
|
||||
this.require(path + 'dragdrop.js');
|
||||
this.require(path + 'controls.js');
|
||||
this.require(path + 'slider.js');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Scriptaculous.load();
|
258
public/javascripts/slider.js
Normal file
258
public/javascripts/slider.js
Normal file
|
@ -0,0 +1,258 @@
|
|||
// Copyright (c) 2005 Marty Haught
|
||||
//
|
||||
// See scriptaculous.js for full license.
|
||||
|
||||
if(!Control) var Control = {};
|
||||
Control.Slider = Class.create();
|
||||
|
||||
// options:
|
||||
// axis: 'vertical', or 'horizontal' (default)
|
||||
// increment: (default: 1)
|
||||
// step: (default: 1)
|
||||
//
|
||||
// callbacks:
|
||||
// onChange(value)
|
||||
// onSlide(value)
|
||||
Control.Slider.prototype = {
|
||||
initialize: function(handle, track, options) {
|
||||
this.handle = $(handle);
|
||||
this.track = $(track);
|
||||
|
||||
this.options = options || {};
|
||||
|
||||
this.axis = this.options.axis || 'horizontal';
|
||||
this.increment = this.options.increment || 1;
|
||||
this.step = parseInt(this.options.step) || 1;
|
||||
this.value = 0;
|
||||
|
||||
var defaultMaximum = Math.round(this.track.offsetWidth / this.increment);
|
||||
if(this.isVertical()) defaultMaximum = Math.round(this.track.offsetHeight / this.increment);
|
||||
|
||||
this.maximum = this.options.maximum || defaultMaximum;
|
||||
this.minimum = this.options.minimum || 0;
|
||||
|
||||
// Will be used to align the handle onto the track, if necessary
|
||||
this.alignX = parseInt (this.options.alignX) || 0;
|
||||
this.alignY = parseInt (this.options.alignY) || 0;
|
||||
|
||||
// Zero out the slider position
|
||||
this.setCurrentLeft(Position.cumulativeOffset(this.track)[0] - Position.cumulativeOffset(this.handle)[0] + this.alignX);
|
||||
this.setCurrentTop(this.trackTop() - Position.cumulativeOffset(this.handle)[1] + this.alignY);
|
||||
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
|
||||
this.originalLeft = this.currentLeft();
|
||||
this.originalTop = this.currentTop();
|
||||
this.originalZ = parseInt(this.handle.style.zIndex || "0");
|
||||
|
||||
// Prepopulate Slider value
|
||||
this.setSliderValue(parseInt(this.options.sliderValue) || 0);
|
||||
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
this.disabled = false;
|
||||
|
||||
// FIXME: use css
|
||||
this.handleImage = $(this.options.handleImage) || false;
|
||||
this.handleDisabled = this.options.handleDisabled || false;
|
||||
this.handleEnabled = false;
|
||||
if(this.handleImage)
|
||||
this.handleEnabled = this.handleImage.src || false;
|
||||
|
||||
if(this.options.disabled)
|
||||
this.setDisabled();
|
||||
|
||||
// Value Array
|
||||
this.values = this.options.values || false; // Add method to validate and sort??
|
||||
|
||||
Element.makePositioned(this.handle); // fix IE
|
||||
|
||||
this.eventMouseDown = this.startDrag.bindAsEventListener(this);
|
||||
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
|
||||
this.eventMouseMove = this.update.bindAsEventListener(this);
|
||||
this.eventKeypress = this.keyPress.bindAsEventListener(this);
|
||||
|
||||
Event.observe(this.handle, "mousedown", this.eventMouseDown);
|
||||
Event.observe(document, "mouseup", this.eventMouseUp);
|
||||
Event.observe(document, "mousemove", this.eventMouseMove);
|
||||
Event.observe(document, "keypress", this.eventKeypress);
|
||||
},
|
||||
dispose: function() {
|
||||
Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
|
||||
Event.stopObserving(document, "mouseup", this.eventMouseUp);
|
||||
Event.stopObserving(document, "mousemove", this.eventMouseMove);
|
||||
Event.stopObserving(document, "keypress", this.eventKeypress);
|
||||
},
|
||||
setDisabled: function(){
|
||||
this.disabled = true;
|
||||
if(this.handleDisabled)
|
||||
this.handleImage.src = this.handleDisabled;
|
||||
},
|
||||
setEnabled: function(){
|
||||
this.disabled = false;
|
||||
if(this.handleEnabled)
|
||||
this.handleImage.src = this.handleEnabled;
|
||||
},
|
||||
currentLeft: function() {
|
||||
return parseInt(this.handle.style.left || '0');
|
||||
},
|
||||
currentTop: function() {
|
||||
return parseInt(this.handle.style.top || '0');
|
||||
},
|
||||
setCurrentLeft: function(left) {
|
||||
this.handle.style.left = left +"px";
|
||||
},
|
||||
setCurrentTop: function(top) {
|
||||
this.handle.style.top = top +"px";
|
||||
},
|
||||
trackLeft: function(){
|
||||
return Position.cumulativeOffset(this.track)[0];
|
||||
},
|
||||
trackTop: function(){
|
||||
return Position.cumulativeOffset(this.track)[1];
|
||||
},
|
||||
getNearestValue: function(value){
|
||||
if(this.values){
|
||||
var i = 0;
|
||||
var offset = Math.abs(this.values[0] - value);
|
||||
var newValue = this.values[0];
|
||||
|
||||
for(i=0; i < this.values.length; i++){
|
||||
var currentOffset = Math.abs(this.values[i] - value);
|
||||
if(currentOffset < offset){
|
||||
newValue = this.values[i];
|
||||
offset = currentOffset;
|
||||
}
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
setSliderValue: function(sliderValue){
|
||||
// First check our max and minimum and nearest values
|
||||
sliderValue = this.getNearestValue(sliderValue);
|
||||
if(sliderValue > this.maximum) sliderValue = this.maximum;
|
||||
if(sliderValue < this.minimum) sliderValue = this.minimum;
|
||||
var offsetDiff = (sliderValue - (this.value||this.minimum)) * this.increment;
|
||||
|
||||
if(this.isVertical()){
|
||||
this.setCurrentTop(offsetDiff + this.currentTop());
|
||||
} else {
|
||||
this.setCurrentLeft(offsetDiff + this.currentLeft());
|
||||
}
|
||||
this.value = sliderValue;
|
||||
this.updateFinished();
|
||||
},
|
||||
minimumOffset: function(){
|
||||
return(this.isVertical() ?
|
||||
this.trackTop() + this.alignY :
|
||||
this.trackLeft() + this.alignX);
|
||||
},
|
||||
maximumOffset: function(){
|
||||
return(this.isVertical() ?
|
||||
this.trackTop() + this.alignY + (this.maximum - this.minimum) * this.increment :
|
||||
this.trackLeft() + this.alignX + (this.maximum - this.minimum) * this.increment);
|
||||
},
|
||||
isVertical: function(){
|
||||
return (this.axis == 'vertical');
|
||||
},
|
||||
startDrag: function(event) {
|
||||
if(Event.isLeftClick(event)) {
|
||||
if(!this.disabled){
|
||||
this.active = true;
|
||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||
var offsets = Position.cumulativeOffset(this.handle);
|
||||
this.offsetX = (pointer[0] - offsets[0]);
|
||||
this.offsetY = (pointer[1] - offsets[1]);
|
||||
this.originalLeft = this.currentLeft();
|
||||
this.originalTop = this.currentTop();
|
||||
}
|
||||
Event.stop(event);
|
||||
}
|
||||
},
|
||||
update: function(event) {
|
||||
if(this.active) {
|
||||
if(!this.dragging) {
|
||||
var style = this.handle.style;
|
||||
this.dragging = true;
|
||||
if(style.position=="") style.position = "relative";
|
||||
style.zIndex = this.options.zindex;
|
||||
}
|
||||
this.draw(event);
|
||||
// fix AppleWebKit rendering
|
||||
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
|
||||
Event.stop(event);
|
||||
}
|
||||
},
|
||||
draw: function(event) {
|
||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||
var offsets = Position.cumulativeOffset(this.handle);
|
||||
|
||||
offsets[0] -= this.currentLeft();
|
||||
offsets[1] -= this.currentTop();
|
||||
|
||||
// Adjust for the pointer's position on the handle
|
||||
pointer[0] -= this.offsetX;
|
||||
pointer[1] -= this.offsetY;
|
||||
var style = this.handle.style;
|
||||
|
||||
if(this.isVertical()){
|
||||
if(pointer[1] > this.maximumOffset())
|
||||
pointer[1] = this.maximumOffset();
|
||||
if(pointer[1] < this.minimumOffset())
|
||||
pointer[1] = this.minimumOffset();
|
||||
|
||||
// Increment by values
|
||||
if(this.values){
|
||||
this.value = this.getNearestValue(Math.round((pointer[1] - this.minimumOffset()) / this.increment) + this.minimum);
|
||||
pointer[1] = this.trackTop() + this.alignY + (this.value - this.minimum) * this.increment;
|
||||
} else {
|
||||
this.value = Math.round((pointer[1] - this.minimumOffset()) / this.increment) + this.minimum;
|
||||
}
|
||||
style.top = pointer[1] - offsets[1] + "px";
|
||||
} else {
|
||||
if(pointer[0] > this.maximumOffset()) pointer[0] = this.maximumOffset();
|
||||
if(pointer[0] < this.minimumOffset()) pointer[0] = this.minimumOffset();
|
||||
// Increment by values
|
||||
if(this.values){
|
||||
this.value = this.getNearestValue(Math.round((pointer[0] - this.minimumOffset()) / this.increment) + this.minimum);
|
||||
pointer[0] = this.trackLeft() + this.alignX + (this.value - this.minimum) * this.increment;
|
||||
} else {
|
||||
this.value = Math.round((pointer[0] - this.minimumOffset()) / this.increment) + this.minimum;
|
||||
}
|
||||
style.left = (pointer[0] - offsets[0]) + "px";
|
||||
}
|
||||
if(this.options.onSlide) this.options.onSlide(this.value);
|
||||
},
|
||||
endDrag: function(event) {
|
||||
if(this.active && this.dragging) {
|
||||
this.finishDrag(event, true);
|
||||
Event.stop(event);
|
||||
}
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
},
|
||||
finishDrag: function(event, success) {
|
||||
this.active = false;
|
||||
this.dragging = false;
|
||||
this.handle.style.zIndex = this.originalZ;
|
||||
this.originalLeft = this.currentLeft();
|
||||
this.originalTop = this.currentTop();
|
||||
this.updateFinished();
|
||||
},
|
||||
updateFinished: function() {
|
||||
if(this.options.onChange) this.options.onChange(this.value);
|
||||
},
|
||||
keyPress: function(event) {
|
||||
if(this.active && !this.disabled) {
|
||||
switch(event.keyCode) {
|
||||
case Event.KEY_ESC:
|
||||
this.finishDrag(event, false);
|
||||
Event.stop(event);
|
||||
break;
|
||||
}
|
||||
if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
|
||||
}
|
||||
}
|
||||
}
|
35
public/javascripts/webmail.js
Executable file
35
public/javascripts/webmail.js
Executable file
|
@ -0,0 +1,35 @@
|
|||
function chooseContacts() {
|
||||
rs('', '/contacts/contact/list?mode=choose',550,480,0);
|
||||
}
|
||||
|
||||
function setBulk() {
|
||||
if (getFormField("mail_bulk").checked) getFormField("set_bulk").value = "set_bulk"
|
||||
document.forms['composeMail'].submit();
|
||||
}
|
||||
|
||||
function getFormField(id) {
|
||||
if ( document.getElementById ) elem = document.getElementById( id );
|
||||
else if ( document.all ) elem = document.eval( "document.all." + id );
|
||||
return elem;
|
||||
}
|
||||
|
||||
function toggle_msg_operations(setc) {
|
||||
var isOpened = toggle_layer('msgops');
|
||||
if (setc) setCookie("_wmlmo", ( isOpened ? "opened" : "closed"), 1000000);
|
||||
}
|
||||
|
||||
function toggle_msg_search(setc) {
|
||||
var isOpened = toggle_layer('msg_search');
|
||||
if (setc) setCookie("_wmlms", (isOpened ? "opened" : "closed"), 1000000);
|
||||
}
|
||||
|
||||
function checkAll(theForm) { // check all the checkboxes in the list
|
||||
for (var i=0;i<theForm.elements.length;i++) {
|
||||
var e = theForm.elements[i];
|
||||
var eName = e.name;
|
||||
if (eName != 'allbox' &&
|
||||
(e.type.indexOf("checkbox") == 0)) {
|
||||
e.checked = theForm.allbox.checked;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue