mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@288 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
23e5e5635e
commit
726c3ced08
3 changed files with 74 additions and 12 deletions
|
|
@ -46,6 +46,8 @@
|
|||
<div>
|
||||
<input type="button" value="{$lang->cmd_move_up}" onclick="doEditDefaultValue(this, 'up', '{$val->id}');return false;" />
|
||||
<input type="button" value="{$lang->cmd_move_down}" onclick="doEditDefaultValue(this, 'down', '{$val->id}');return false;" />
|
||||
<input type="button" value="{$lang->cmd_add_indent}" onclick="doEditDefaultValue(this, 'add_indent', '{$val->id}',{$val->maxdepth});return false;" />
|
||||
<input type="button" value="{$lang->cmd_remove_indent}" onclick="doEditDefaultValue(this, 'remove_indent', '{$val->id}');return false;" />
|
||||
<input type="button" value="{$lang->cmd_delete}" onclick="doEditDefaultValue(this, 'delete', '{$val->id}');return false;" />
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -53,8 +55,8 @@
|
|||
<!--@end-->
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="button" value="{$lang->cmd_back}" onclick="history.back()" />
|
||||
<input type="submit" value="{$lang->cmd_next}" />
|
||||
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('act','dispContent')}'" />
|
||||
<input type="submit" value="{$lang->cmd_registration}" />
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
function doEditDefaultValue(obj, cmd, menu_id) {
|
||||
function doEditDefaultValue(obj, cmd, menu_id, max_depth) {
|
||||
var listup_obj = xGetElementById('default_value_listup_'+menu_id);
|
||||
var item_obj = xGetElementById('default_value_item_'+menu_id);
|
||||
var idx = listup_obj.selectedIndex;
|
||||
var lng = listup_obj.options.length;
|
||||
var val = item_obj.value;
|
||||
var val = 1;
|
||||
var text = item_obj.value;
|
||||
switch(cmd) {
|
||||
case 'insert' :
|
||||
if(!val) return;
|
||||
var opt = new Option(val, val, false, true);
|
||||
if(!text) return;
|
||||
var opt = new Option(text, val, false, true);
|
||||
listup_obj.options[listup_obj.length] = opt;
|
||||
item_obj.value = '';
|
||||
item_obj.focus();
|
||||
|
|
@ -16,29 +17,86 @@ function doEditDefaultValue(obj, cmd, menu_id) {
|
|||
if(lng < 2 || idx<1) return;
|
||||
|
||||
var value1 = listup_obj.options[idx].value;
|
||||
var text1 = listup_obj.options[idx].text;
|
||||
var depth1 = getDepth(listup_obj.options[idx]);
|
||||
|
||||
var value2 = listup_obj.options[idx-1].value;
|
||||
listup_obj.options[idx] = new Option(value2,value2,false,false);
|
||||
listup_obj.options[idx-1] = new Option(value1,value1,false,true);
|
||||
var text2 = listup_obj.options[idx-1].text;
|
||||
var depth2 = getDepth(listup_obj.options[idx-1]);
|
||||
|
||||
listup_obj.options[idx] = new Option(text2,value2,false,false);
|
||||
setDepth(listup_obj.options[idx], depth1);
|
||||
|
||||
listup_obj.options[idx-1] = new Option(text1,value1,false,true);
|
||||
setDepth(listup_obj.options[idx-1], depth2);
|
||||
break;
|
||||
case 'down' :
|
||||
if(lng < 2 || idx == lng-1) return;
|
||||
|
||||
var value1 = listup_obj.options[idx].value;
|
||||
var text1 = listup_obj.options[idx].text;
|
||||
var depth1 = getDepth(listup_obj.options[idx]);
|
||||
|
||||
var value2 = listup_obj.options[idx+1].value;
|
||||
listup_obj.options[idx] = new Option(value2,value2,false,false);
|
||||
listup_obj.options[idx+1] = new Option(value1,value1,false,true);
|
||||
var text2 = listup_obj.options[idx+1].text;
|
||||
var depth2 = getDepth(listup_obj.options[idx+1]);
|
||||
|
||||
listup_obj.options[idx] = new Option(text2,value2,false,false);
|
||||
setDepth(listup_obj.options[idx], depth1);
|
||||
|
||||
listup_obj.options[idx+1] = new Option(text1,value1,false,true);
|
||||
setDepth(listup_obj.options[idx+1], depth2);
|
||||
break;
|
||||
case 'delete' :
|
||||
listup_obj.remove(idx);
|
||||
if(idx==0) listup_obj.selectedIndex = 0;
|
||||
else listup_obj.selectedIndex = idx-1;
|
||||
break;
|
||||
case 'add_indent' :
|
||||
if(lng<2||idx<1) return;
|
||||
|
||||
var opt_cur = listup_obj.options[idx];
|
||||
var opt_up = listup_obj.options[idx-1];
|
||||
|
||||
var cur_depth = getDepth(opt_cur);
|
||||
var up_depth = getDepth(opt_up);
|
||||
|
||||
if(up_depth >= cur_depth) addDepth(opt_cur, max_depth);
|
||||
break;
|
||||
case 'remove_indent' :
|
||||
var opt_cur = listup_obj.options[idx];
|
||||
removeDepth(opt_cur);
|
||||
break;
|
||||
}
|
||||
|
||||
var value_list = new Array();
|
||||
for(var i=0;i<listup_obj.options.length;i++) {
|
||||
value_list[value_list.length] = listup_obj.options[i].value;
|
||||
}
|
||||
|
||||
//xGetElementById('fo_layout').default_value.value = value_list.join('|@|');
|
||||
}
|
||||
|
||||
function getDepth(obj) {
|
||||
var pl = obj.style.paddingLeft;
|
||||
if(!pl) return 0;
|
||||
var depth = parseInt(pl);
|
||||
return depth/20;
|
||||
}
|
||||
|
||||
function setDepth(obj, depth) {
|
||||
obj.style.paddingLeft = (depth*20)+'px';
|
||||
}
|
||||
|
||||
function addDepth(obj, max_depth) {
|
||||
max_depth=5;
|
||||
var depth = getDepth(obj);
|
||||
var depth = depth + 1;
|
||||
if(depth>=max_depth) return;
|
||||
obj.style.paddingLeft = (depth*20)+'px';
|
||||
}
|
||||
|
||||
function removeDepth(obj) {
|
||||
var depth = getDepth(obj);
|
||||
var depth = depth - 1;
|
||||
if(depth<0) return;
|
||||
obj.style.paddingLeft = (depth*20)+'px';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue