/* * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ var sect_count=0; var sect_active=-1; var cont_sect=[]; var sect_count=0; var itm_count=0; var itm_active=-1; var cont_tmpids=0; var itm_tmpids=0; // ------------------------------------------------ // Sections // ------------------------------------------------ function cont_get_sect_index(id) { var i; for(i=0; i'+ text +''); $('#input_2_sect_list').append(o); $("#input_2_sect").val(""); } function cont_sect_rename() { console.log(JSON.stringify(cont_sect)); var i = cont_get_sect_index(sect_active); $("#input_2_sect_"+sect_active).html($('#input_2_sect_rename').val()); cont_sect[i].title=$('#input_2_sect_rename').val(); console.log(JSON.stringify(cont_sect)); console.log("\n\n"); } // ------------------------------------------------ // Items // ------------------------------------------------ function cont_get_itm_index(sect, id) { var i; for(i=0; i')); } } function cont_itm_select(x) { var y = false; if(x==itm_active) return; $("#input_2_itm_list a").removeClass("active"); $("#input_2_itm_"+x).addClass('active'); if(itm_active==-1) y=true; itm_active=x; cont_itm_show(); $('#input_2_content_list').hide(); $('#input_2_content_list').show(400); } function cont_itm_up() { if(itm_active<0) return 0; var i; var sect = cont_get_sect_index(itm_active); console.log(JSON.stringify(cont_sect)); for(i=1; i'+ text+''); $('#input_2_itm_list').append(o) if(obj==null) cont_sect[sect].sections.push({"id" : id, "name" :text, "content" : "", "date" : "", "more" : "", "location" : "", "date" : "", "profiles" : [] }); $("#input_2_itm").val(""); } // --------------------------------- // Contenu // --------------------------------- function cont_cont_rename() { var sect = cont_get_sect_index(sect_active); var itm = cont_get_itm_index(sect, itm_active); cont_sect[sect].sections[itm].name=$("#input_2_itm_rename").val(); $("#input_2_itm_"+itm_active).html($("#input_2_itm_rename").val()); } function cont_cont_save() { var sect = cont_get_sect_index(sect_active); var itm = cont_get_itm_index(sect, itm_active); var i; var reg = get_regs(); cont_sect[sect].sections[itm].name=$("#input_2_itm_rename").val(); cont_sect[sect].sections[itm].content=$("#input_2_itm_title").val(); cont_sect[sect].sections[itm].date=$("#input_2_itm_date").val(); cont_sect[sect].sections[itm].location=$("#input_2_itm_location").val(); cont_sect[sect].sections[itm].more=$("#input_2_itm_more").val(); $('#input_2_content_list').hide(400); $("#input_2_itm_list a").removeClass("active"); cont_sect[sect].sections[itm].profiles=[]; for(i=0; i