Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

            function add_ini_section()
            {
                jQuery('#ini-section-form').dialog('open');    
                return false;
            }
            
            function add_ini_value()
            {
                s_id=this.id.substr(4);
                jQuery('#sect_name').val(s_id);
                jQuery('#ini-value-form').dialog('open');
                return false;
            }

            function del_section()
            {
                s_id=this.id.substr(4);
                jQuery('#d_section').val(s_id);
                jQuery('#d_section_out').html(s_id);
                jQuery('#delete-ini-section-confirm').dialog('open');
                return false;
            }
            
            function del_ini_key()
            {
                key_id=this.id.substr(5);
                parts=this.id.split('__');
                section=parts[1];
                s_key=parts[2];
                jQuery('#d_key').val(key_id);
                jQuery('#d_key_out').html(s_key);
                jQuery('#d_section_out_2').html(section);
                jQuery('#delete-ini-key-confirm').dialog('open');
                return false;
            }
            
            $(function() 
            {
                jQuery('#ini-section-form').dialog('destroy');
                jQuery('#ini-value-form').dialog('destroy');
                jQuery('#delete-ini-section-confirm').dialog('destroy');
                jQuery('#delete-ini-key-confirm').dialog('destroy');
                jQuery('.del_section').click(del_section);
                jQuery('.del_key').click(del_ini_key);
                var s_name = $("#s_name"),
                v_name = $("#v_name"),
                s_v_name = $('#s_v_name'),
                g_name = $('#g_name'),
                ini_value_tips = $(".validateIniValueTips");
                ini_section_tips = $(".validateIniSectionTips");
                tips = $(".validateTips");
                function updateTips(t) {
                    tips
                    .text(t)
                    .addClass('ui-state-highlight');
                    setTimeout(function() {
                        ini_section_tips.removeClass('ui-state-highlight', 1500);
                    }, 500);
                }
                function updateIniSectionTips(t) {
                    ini_section_tips
                    .text(t)
                    .addClass('ui-state-highlight');
                    setTimeout(function() {
                        ini_section_tips.removeClass('ui-state-highlight', 1500);
                    }, 500);
                }
                
                function add_lang_group()
                {
                    jQuery('#lang_group_dialog').dialog('open');
                }
                
                function updateIniValueTips(t) {
                    ini_value_tips
                    .text(t)
                    .addClass('ui-state-highlight');
                    setTimeout(function() {
                        ini_value_tips.removeClass('ui-state-highlight', 1500);
                    }, 500);
                }

                function checkLength(o,n,min,max,o_name) 
                {
                    if ( o.val().length > max || o.val().length < min ) 
                    {
                        o.addClass('ui-state-error');
                        text="Länge des Feldes '" + n + "' muss zwischen "+min+" und "+max+" liegen.";
                        switch(o_name)
                        {
                            case "s_name":
                                updateIniSectionTips(text);
                                break;
                            case "v_name":
                                updateIniValueTips(text);
                                break;
                            default:
                                updateTips(text);
                                break;
                        }
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }


                jQuery('#add').click(add_ini_section);
                jQuery('.add_ini_value').click(add_ini_value);
                jQuery("#ini-section-form").dialog({
                    autoOpen: false,
                    height: "auto",
                    width: 400,
                    modal: true,
                    buttons: {
                        'neue Sektion erstellen': function() {
                            var bValid = true;
                            s_name.removeClass('ui-state-error');
                            v_name.removeClass('ui-state-error');
                            bValid = bValid && checkLength(s_name,"Sektionsname",1,255,'s_name');
                            bValid = bValid && checkLength(s_v_name,"Schlüsselname",1,255,'s_name');
                            if (bValid) {
                                section_name=s_name.val();
                                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>';
                                $('#sections').append(s_html);
                                $('.add_ini_value').click(add_ini_value).css("cursor","pointer");
                                $('.del_key').click(del_ini_key).css("cursor","pointer");
                                $('.del_section').click(del_section).css("cursor","pointer");
                                $(this).dialog('close');
                            }
                        },
                        'Abbruch': function() {
                            $(this).dialog('close');
                        }
                    },
                    close: function() {
                        s_name.val('').removeClass('ui-state-error');
                    }
                });               
                jQuery("#ini-value-form").dialog({
                    autoOpen: false,
                    height: "auto",
                    width: 400,
                    modal: true,
                    buttons: {
                        'neuen Wert erstellen': function() {
                            var bValid = true;
                            v_name.removeClass('ui-state-error');
                            bValid = bValid && checkLength(v_name,"Schlüsselname",1,255,'v_name');
                            if (bValid) {
                                sect_name=$('#sect_name').val();
                                if(sect_name!="none")
                                {
                                    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>';
                                }
                                else
                                {
                                    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>';
                                }
                                $('#'+sect_name).append(html);
                                $('.del_key').click(del_ini_key).css("cursor","pointer");
                                $(this).dialog('close');
                            }
                        },
                        'Abbruch': function() {
                            $(this).dialog('close');
                        }
                    },
                    close: function() {
                        v_name.val('').removeClass('ui-state-error');
                    }
                });               

                $("#delete-ini-section-confirm").dialog({
                    resizable: false,
                    height:"auto",
                    width:400,
                    autoOpen:false,
                    modal: true,
                    buttons: {
                        'Sektion löschen': function() {
                            s_id=$('#d_section').val();
                            $('#row_'+s_id).remove();
                            $('#head_'+s_id).remove();

                            $(this).dialog('close');
                        },
                        'Abbruch': function() {
                            $(this).dialog('close');
                        }
                    }
                });
                $("#delete-ini-key-confirm").dialog({
                    resizable: false,
                    height:"auto",
                    width:400,
                    autoOpen:false,
                    modal: true,
                    buttons: {
                        'Schlüssel löschen': function() {
                            k_id=$('#d_key').val();
                            $('#row_'+k_id).remove();

                            $(this).dialog('close');
                        },
                        'Abbruch': function() {
                            $(this).dialog('close');
                        }
                    }
                });
                $('#new_lang_group').click(add_lang_group);
                
                $('#lang_group_dialog').dialog({
                    resizable: false,
                    height:"auto",
                    width:400,
                    autoOpen:false,
                    modal: true,
                    buttons: {
                        'Gruppe erstellen': function() {
                            group_name=g_name.val();
                            var bValid = true;
                            g_name.removeClass('ui-state-error');
                            bValid = bValid && checkLength(g_name,"Gruppenname",1,255,'g_name');
                            if (bValid) 
                            {
                                $('#groups').append('<option label="'+group_name+'" value="'+group_name+'" selected="selected">'+group_name+'</option>')
                                $(this).dialog('close');
                            }
                        },
                        'Abbruch': function() {
                            $(this).dialog('close');
                        }
                    }
                });
            });