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