* Copyright: See COPYING files that comes with this distribution
********************************************************************************/
-function ta_onfocus(obj) {
- obj.setAttribute('rows', '10');
-}
-
-function ta_onblur(obj) {
- obj.setAttribute('rows', '2');
-}
-
function text_onfocus(object,val) {
if(object.value == val)
object.value = '';
function createActionSelect(data,base) {
var i,j;
var select = document.createElement("select");
+ var sel = 0;
select.name = base+'[0]';
- for(i=0, j=0; i<actions_list.length; i++)
- if(actions_list[i])
- select.options[j++] = new Option(actions_list[i],i,false,(data==i));
-
- select.setAttribute("onchange", "changeRow(this,actions_func)");
+ for(i=0, j=0; i<actions_list.length; i++) {
+ if(data==i) sel = j;
+ if(actions_list[i]) select.options[j++] = new Option(actions_list[i],i,false,(data==i));
+ }
- if(select.selectedIndex<0)
- select.selectedIndex = 0;
+ select.selectedIndex = sel;
+ select.onchange = function () { changeRow(this,actions_func); };
+
return select;
}
var del = document.createElement("input");
del.setAttribute("type", "submit");
del.setAttribute("value", "Del");
- del.setAttribute("onclick", "parentNode.parentNode.removeChild(parentNode)");
+ del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
div.appendChild(del);
div.appendChild(document.createTextNode(" "));
function createMatchSelect(data,base) {
var i,j;
var select = document.createElement("select");
+ var sel = 0;
select.name = base+'[0]';
- for(i=0, j=0; i<matches_list.length; i++)
- if(matches_list[i])
- select.options[j++] = new Option(matches_list[i],i,false,(data==i));
+ for(i=0, j=0; i<matches_list.length; i++) {
+ if(data==i) sel = j;
+ if(matches_list[i]) select.options[j++] = new Option(matches_list[i],i,false,(data==i));
+ }
- select.setAttribute("onchange", "changeRow(this,matches_func)");
+ select.selectedIndex = sel;
+ select.onchange = function () { changeRow(this,matches_func); };
- if(select.selectedIndex<0)
- select.selectedIndex = 0;
return select;
}
var del = document.createElement("input");
del.setAttribute("type", "submit");
del.setAttribute("value", "Del");
- del.setAttribute("onclick", "parentNode.parentNode.removeChild(parentNode)");
+ del.onclick = function () { del.parentNode.parentNode.removeChild(del.parentNode); };
div.appendChild(del);
div.appendChild(document.createTextNode(" "));
function to_js() {
$res = "function(Node, data) {\n"
. " var i,j;\n"
+ . " var sel = 0;\n"
. " var select = document.createElement('select');\n"
. " select.setAttribute('name', Node.name+'[1]');\n"
. "\n"
- . " for(i=0,j=0; i<mail_pool.length; i++)\n"
+ . " for(i=0,j=0; i<mail_pool.length; i++) {\n"
+ . " if(data[1]==i) sel = j;\n"
. " if(mail_pool[i])\n"
. " select.options[j++] = new Option(mail_pool[i],i,false,(data[1]==i));\n"
+ . " }\n"
+ . " select.selectedIndex = sel;\n"
. "\n"
. " Node.appendChild(document.createTextNode(' email : '));\n"
. " Node.appendChild(select);\n"