Mercurial > hg > extraction-interface
comparison interface/js/check_sections_details.js @ 1:ef6d0c6a13d7
(1)Add 'sort_by' time entry in main page. (check_sections.php)
Modify check_sections_details page to have level3 option.
(2)Modify map to have default dataset loaded.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 21 Jan 2015 10:49:44 +0100 |
parents | b12c99b7c3f0 |
children | f196939ccc03 |
comparison
equal
deleted
inserted
replaced
0:b12c99b7c3f0 | 1:ef6d0c6a13d7 |
---|---|
139 } | 139 } |
140 function initLevel(){//init the column level, turn it into select element | 140 function initLevel(){//init the column level, turn it into select element |
141 //level | 141 //level |
142 var levelObj=$("<div/>").addClass("editLevel").append("<select/>"); | 142 var levelObj=$("<div/>").addClass("editLevel").append("<select/>"); |
143 $(".entry").append(levelObj); | 143 $(".entry").append(levelObj); |
144 $(".editLevel select").append("<option value='1'>1evel 1</option>"); | 144 $(".editLevel select").append("<option value='1'>level 1</option>"); |
145 $(".editLevel select").append("<option value='2'>1evel 2</option>"); | 145 $(".editLevel select").append("<option value='2'>level 2</option>"); |
146 for(var i=1; i<=2; i++){ | 146 $(".editLevel select").append("<option value='3'>level 3</option>"); |
147 for(var i=1; i<=3; i++){ | |
147 $("div.level"+i+" .editLevel select").val(i); | 148 $("div.level"+i+" .editLevel select").val(i); |
148 } | 149 } |
149 | 150 |
150 $(".editLevel select").change(function(){//add classes for text indent, to control layout style | 151 $(".editLevel select").change(function(){//add classes for text indent, to control layout style |
151 var entryObj=$(this).parent().parent(); | 152 var entryObj=$(this).parent().parent(); |
153 if(entryObj.hasClass("level1")){ | 154 if(entryObj.hasClass("level1")){ |
154 className="level1"; | 155 className="level1"; |
155 } | 156 } |
156 if(entryObj.hasClass("level2")){ | 157 if(entryObj.hasClass("level2")){ |
157 className="level2"; | 158 className="level2"; |
159 } | |
160 if(entryObj.hasClass("level3")){ | |
161 className="level3"; | |
158 } | 162 } |
159 entryObj.removeClass(className); | 163 entryObj.removeClass(className); |
160 entryObj.addClass("level"+$(this).val()); | 164 entryObj.addClass("level"+$(this).val()); |
161 }); | 165 }); |
162 } | 166 } |
289 } | 293 } |
290 function saveBook(version){ | 294 function saveBook(version){ |
291 var sectionArray=collectSectionArray(); | 295 var sectionArray=collectSectionArray(); |
292 var bookId=$(".entry").first().children(".hiddenInfo").children(".booksId").html(); | 296 var bookId=$(".entry").first().children(".hiddenInfo").children(".booksId").html(); |
293 var editor=$("#saveBook .editor").val(); | 297 var editor=$("#saveBook .editor").val(); |
298 console.log("editor:"+editor); | |
299 | |
294 var version=version; | 300 var version=version; |
295 $("#loading").show(); | 301 $("#loading").show(); |
296 $.post("edit_section_db.php", // use ajax to post to a php then wait for return | 302 $.post("edit_section_db.php", // use ajax to post to a php then wait for return |
297 {//post data | 303 {//post data |
298 command:"write", | 304 command:"write", |
305 version:version, | |
306 editor:editor, | |
299 bookId:bookId, | 307 bookId:bookId, |
300 sectionArray:sectionArray, | 308 sectionArray:sectionArray |
301 version:version, | |
302 editor:editor | |
303 }, | 309 }, |
304 function(data){//things to do after edit_section_db is done | 310 function(data){//things to do after edit_section_db is done |
305 if(data=="Succeeded."){ | 311 if(data=="Succeeded."){ |
306 saving=1; | 312 saving=1; |
307 var hideDeletedChecked=$(".hideDeleted input:checkbox").is(":checked");//get the previous setting for checked | 313 var hideDeletedChecked=$(".hideDeleted input:checkbox").is(":checked");//get the previous setting for checked |
311 reg = /[^\?]+/g; | 317 reg = /[^\?]+/g; |
312 href = reg.exec(href); | 318 href = reg.exec(href); |
313 href=href+"?book_id="+bookId+"&"+count+"&hideDeletedChecked="+hideDeletedChecked+"&editor="+editor; | 319 href=href+"?book_id="+bookId+"&"+count+"&hideDeletedChecked="+hideDeletedChecked+"&editor="+editor; |
314 location.href=href; //refresh the page to load the sections saved in db | 320 location.href=href; //refresh the page to load the sections saved in db |
315 }else{ | 321 }else{ |
322 console.log("db not succeeded."); | |
316 | 323 |
317 } | 324 } |
318 }, | 325 }, |
319 "json" | 326 "json" |
320 ); | 327 ); |