| 1 |
lars |
1 |
function add_ini_section()
|
|
|
2 |
{
|
|
|
3 |
jQuery('#ini-section-form').dialog('open');
|
|
|
4 |
return false;
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
function add_ini_value()
|
|
|
8 |
{
|
|
|
9 |
s_id=this.id.substr(4);
|
|
|
10 |
jQuery('#sect_name').val(s_id);
|
|
|
11 |
jQuery('#ini-value-form').dialog('open');
|
|
|
12 |
return false;
|
|
|
13 |
}
|
|
|
14 |
|
|
|
15 |
function del_section()
|
|
|
16 |
{
|
|
|
17 |
s_id=this.id.substr(4);
|
|
|
18 |
jQuery('#d_section').val(s_id);
|
|
|
19 |
jQuery('#d_section_out').html(s_id);
|
|
|
20 |
jQuery('#delete-ini-section-confirm').dialog('open');
|
|
|
21 |
return false;
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
function del_ini_key()
|
|
|
25 |
{
|
|
|
26 |
key_id=this.id.substr(5);
|
|
|
27 |
parts=this.id.split('__');
|
|
|
28 |
section=parts[1];
|
|
|
29 |
s_key=parts[2];
|
|
|
30 |
jQuery('#d_key').val(key_id);
|
|
|
31 |
jQuery('#d_key_out').html(s_key);
|
|
|
32 |
jQuery('#d_section_out_2').html(section);
|
|
|
33 |
jQuery('#delete-ini-key-confirm').dialog('open');
|
|
|
34 |
return false;
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
$(function()
|
|
|
38 |
{
|
|
|
39 |
jQuery('#ini-section-form').dialog('destroy');
|
|
|
40 |
jQuery('#ini-value-form').dialog('destroy');
|
|
|
41 |
jQuery('#delete-ini-section-confirm').dialog('destroy');
|
|
|
42 |
jQuery('#delete-ini-key-confirm').dialog('destroy');
|
|
|
43 |
jQuery('.del_section').click(del_section);
|
|
|
44 |
jQuery('.del_key').click(del_ini_key);
|
|
|
45 |
var s_name = $("#s_name"),
|
|
|
46 |
v_name = $("#v_name"),
|
|
|
47 |
s_v_name = $('#s_v_name'),
|
|
|
48 |
g_name = $('#g_name'),
|
|
|
49 |
ini_value_tips = $(".validateIniValueTips");
|
|
|
50 |
ini_section_tips = $(".validateIniSectionTips");
|
|
|
51 |
tips = $(".validateTips");
|
|
|
52 |
function updateTips(t) {
|
|
|
53 |
tips
|
|
|
54 |
.text(t)
|
|
|
55 |
.addClass('ui-state-highlight');
|
|
|
56 |
setTimeout(function() {
|
|
|
57 |
ini_section_tips.removeClass('ui-state-highlight', 1500);
|
|
|
58 |
}, 500);
|
|
|
59 |
}
|
|
|
60 |
function updateIniSectionTips(t) {
|
|
|
61 |
ini_section_tips
|
|
|
62 |
.text(t)
|
|
|
63 |
.addClass('ui-state-highlight');
|
|
|
64 |
setTimeout(function() {
|
|
|
65 |
ini_section_tips.removeClass('ui-state-highlight', 1500);
|
|
|
66 |
}, 500);
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
function add_lang_group()
|
|
|
70 |
{
|
|
|
71 |
jQuery('#lang_group_dialog').dialog('open');
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
function updateIniValueTips(t) {
|
|
|
75 |
ini_value_tips
|
|
|
76 |
.text(t)
|
|
|
77 |
.addClass('ui-state-highlight');
|
|
|
78 |
setTimeout(function() {
|
|
|
79 |
ini_value_tips.removeClass('ui-state-highlight', 1500);
|
|
|
80 |
}, 500);
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
function checkLength(o,n,min,max,o_name)
|
|
|
84 |
{
|
|
|
85 |
if ( o.val().length > max || o.val().length < min )
|
|
|
86 |
{
|
|
|
87 |
o.addClass('ui-state-error');
|
|
|
88 |
text="Länge des Feldes '" + n + "' muss zwischen "+min+" und "+max+" liegen.";
|
|
|
89 |
switch(o_name)
|
|
|
90 |
{
|
|
|
91 |
case "s_name":
|
|
|
92 |
updateIniSectionTips(text);
|
|
|
93 |
break;
|
|
|
94 |
case "v_name":
|
|
|
95 |
updateIniValueTips(text);
|
|
|
96 |
break;
|
|
|
97 |
default:
|
|
|
98 |
updateTips(text);
|
|
|
99 |
break;
|
|
|
100 |
}
|
|
|
101 |
return false;
|
|
|
102 |
}
|
|
|
103 |
else
|
|
|
104 |
{
|
|
|
105 |
return true;
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
jQuery('#add').click(add_ini_section);
|
|
|
111 |
jQuery('.add_ini_value').click(add_ini_value);
|
|
|
112 |
jQuery("#ini-section-form").dialog({
|
|
|
113 |
autoOpen: false,
|
|
|
114 |
height: "auto",
|
|
|
115 |
width: 400,
|
|
|
116 |
modal: true,
|
|
|
117 |
buttons: {
|
|
|
118 |
'neue Sektion erstellen': function() {
|
|
|
119 |
var bValid = true;
|
|
|
120 |
s_name.removeClass('ui-state-error');
|
|
|
121 |
v_name.removeClass('ui-state-error');
|
|
|
122 |
bValid = bValid && checkLength(s_name,"Sektionsname",1,255,'s_name');
|
|
|
123 |
bValid = bValid && checkLength(s_v_name,"Schlüsselname",1,255,'s_name');
|
|
|
124 |
if (bValid) {
|
|
|
125 |
section_name=s_name.val();
|
|
|
126 |
s_html='<tr id="head_'+section_name+'"><td class="links" colspan="2" align="center">'+section_name+'<img src="../dokumente/gfx/add.gif" id="add_'+section_name+'" class="add_ini_value" title="Wert hinzufügen"><img src="../dokumente/gfx/delete_record.gif" title="Sektion löschen" class="del_section" id="del_'+section_name+'"></td></tr><tr><td colspan="2"><table width="100%" id="'+section_name+'" cellpadding="3" cellspacing="0"><tr id="row_'+section_name+'__'+s_v_name.val()+'"><td class="links">'+s_v_name.val()+'<img src="../dokumente/gfx/delete_record.gif" id="del__'+section_name+'__'+s_v_name.val()+'" class="del_key" title="Wert löschen"></td><td class="rechts"><input type="text" name=ini['+section_name+']['+s_v_name.val()+']" value="" size="100"></td></tr></table></td></tr>';
|
|
|
127 |
$('#sections').append(s_html);
|
|
|
128 |
$('.add_ini_value').click(add_ini_value).css("cursor","pointer");
|
|
|
129 |
$('.del_key').click(del_ini_key).css("cursor","pointer");
|
|
|
130 |
$('.del_section').click(del_section).css("cursor","pointer");
|
|
|
131 |
$(this).dialog('close');
|
|
|
132 |
}
|
|
|
133 |
},
|
|
|
134 |
'Abbruch': function() {
|
|
|
135 |
$(this).dialog('close');
|
|
|
136 |
}
|
|
|
137 |
},
|
|
|
138 |
close: function() {
|
|
|
139 |
s_name.val('').removeClass('ui-state-error');
|
|
|
140 |
}
|
|
|
141 |
});
|
|
|
142 |
jQuery("#ini-value-form").dialog({
|
|
|
143 |
autoOpen: false,
|
|
|
144 |
height: "auto",
|
|
|
145 |
width: 400,
|
|
|
146 |
modal: true,
|
|
|
147 |
buttons: {
|
|
|
148 |
'neuen Wert erstellen': function() {
|
|
|
149 |
var bValid = true;
|
|
|
150 |
v_name.removeClass('ui-state-error');
|
|
|
151 |
bValid = bValid && checkLength(v_name,"Schlüsselname",1,255,'v_name');
|
|
|
152 |
if (bValid) {
|
|
|
153 |
sect_name=$('#sect_name').val();
|
|
|
154 |
if(sect_name!="none")
|
|
|
155 |
{
|
|
|
156 |
html='<tr id="row_'+sect_name+'__'+v_name.val()+'"><td class="links">'+v_name.val()+'<img src="../dokumente/gfx/delete_record.gif" id="del__'+sect_name+'__'+v_name.val()+'" class="del_key" title="Wert löschen"></td><td class="rechts"><input type="text" name=ini['+sect_name+']['+v_name.val()+']" value="" size="100"></td></tr>';
|
|
|
157 |
}
|
|
|
158 |
else
|
|
|
159 |
{
|
|
|
160 |
html='<tr id="row_'+sect_name+'__'+v_name.val()+'"><td class="links">'+v_name.val()+'<img src="../dokumente/gfx/delete_record.gif" id="del__'+sect_name+'__'+v_name.val()+'" class="del_key" title="Wert löschen"></td><td class="rechts"><input type="text" name=ini['+v_name.val()+']" value="" size="100"></td></tr>';
|
|
|
161 |
}
|
|
|
162 |
$('#'+sect_name).append(html);
|
|
|
163 |
$('.del_key').click(del_ini_key).css("cursor","pointer");
|
|
|
164 |
$(this).dialog('close');
|
|
|
165 |
}
|
|
|
166 |
},
|
|
|
167 |
'Abbruch': function() {
|
|
|
168 |
$(this).dialog('close');
|
|
|
169 |
}
|
|
|
170 |
},
|
|
|
171 |
close: function() {
|
|
|
172 |
v_name.val('').removeClass('ui-state-error');
|
|
|
173 |
}
|
|
|
174 |
});
|
|
|
175 |
|
|
|
176 |
$("#delete-ini-section-confirm").dialog({
|
|
|
177 |
resizable: false,
|
|
|
178 |
height:"auto",
|
|
|
179 |
width:400,
|
|
|
180 |
autoOpen:false,
|
|
|
181 |
modal: true,
|
|
|
182 |
buttons: {
|
|
|
183 |
'Sektion löschen': function() {
|
|
|
184 |
s_id=$('#d_section').val();
|
|
|
185 |
$('#row_'+s_id).remove();
|
|
|
186 |
$('#head_'+s_id).remove();
|
|
|
187 |
|
|
|
188 |
$(this).dialog('close');
|
|
|
189 |
},
|
|
|
190 |
'Abbruch': function() {
|
|
|
191 |
$(this).dialog('close');
|
|
|
192 |
}
|
|
|
193 |
}
|
|
|
194 |
});
|
|
|
195 |
$("#delete-ini-key-confirm").dialog({
|
|
|
196 |
resizable: false,
|
|
|
197 |
height:"auto",
|
|
|
198 |
width:400,
|
|
|
199 |
autoOpen:false,
|
|
|
200 |
modal: true,
|
|
|
201 |
buttons: {
|
|
|
202 |
'Schlüssel löschen': function() {
|
|
|
203 |
k_id=$('#d_key').val();
|
|
|
204 |
$('#row_'+k_id).remove();
|
|
|
205 |
|
|
|
206 |
$(this).dialog('close');
|
|
|
207 |
},
|
|
|
208 |
'Abbruch': function() {
|
|
|
209 |
$(this).dialog('close');
|
|
|
210 |
}
|
|
|
211 |
}
|
|
|
212 |
});
|
|
|
213 |
$('#new_lang_group').click(add_lang_group);
|
|
|
214 |
|
|
|
215 |
$('#lang_group_dialog').dialog({
|
|
|
216 |
resizable: false,
|
|
|
217 |
height:"auto",
|
|
|
218 |
width:400,
|
|
|
219 |
autoOpen:false,
|
|
|
220 |
modal: true,
|
|
|
221 |
buttons: {
|
|
|
222 |
'Gruppe erstellen': function() {
|
|
|
223 |
group_name=g_name.val();
|
|
|
224 |
var bValid = true;
|
|
|
225 |
g_name.removeClass('ui-state-error');
|
|
|
226 |
bValid = bValid && checkLength(g_name,"Gruppenname",1,255,'g_name');
|
|
|
227 |
if (bValid)
|
|
|
228 |
{
|
|
|
229 |
$('#groups').append('<option label="'+group_name+'" value="'+group_name+'" selected="selected">'+group_name+'</option>')
|
|
|
230 |
$(this).dialog('close');
|
|
|
231 |
}
|
|
|
232 |
},
|
|
|
233 |
'Abbruch': function() {
|
|
|
234 |
$(this).dialog('close');
|
|
|
235 |
}
|
|
|
236 |
}
|
|
|
237 |
});
|
|
|
238 |
});
|