[0] | 1 | dotclear.postExpander = function(line) { |
---|
| 2 | var td = line.firstChild; |
---|
| 3 | |
---|
| 4 | var img = document.createElement('img'); |
---|
| 5 | img.src = dotclear.img_plus_src; |
---|
| 6 | img.alt = dotclear.img_plus_alt; |
---|
| 7 | img.className = 'expand'; |
---|
| 8 | $(img).css('cursor','pointer'); |
---|
| 9 | img.line = line; |
---|
[740] | 10 | img.onclick = function() { dotclear.viewPostContent(this,this.line); positionFooter(); }; |
---|
[0] | 11 | |
---|
| 12 | td.insertBefore(img,td.firstChild); |
---|
| 13 | }; |
---|
| 14 | |
---|
| 15 | dotclear.viewPostContent = function(img,line) { |
---|
| 16 | var postId = line.id.substr(1); |
---|
| 17 | var tr = document.getElementById('pe'+postId); |
---|
| 18 | |
---|
| 19 | if (!tr) { |
---|
| 20 | tr = document.createElement('tr'); |
---|
| 21 | tr.id = 'pe'+postId; |
---|
| 22 | var td = document.createElement('td'); |
---|
| 23 | td.colSpan = 8; |
---|
| 24 | td.className = 'expand'; |
---|
| 25 | tr.appendChild(td); |
---|
| 26 | |
---|
| 27 | img.src = dotclear.img_minus_src; |
---|
| 28 | img.alt = dotclear.img_minus_alt; |
---|
| 29 | |
---|
| 30 | // Get post content |
---|
| 31 | $.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) { |
---|
| 32 | var rsp = $(data).children('rsp')[0]; |
---|
| 33 | |
---|
| 34 | if (rsp.attributes[0].value == 'ok') { |
---|
| 35 | var post = $(rsp).find('post_display_content').text(); |
---|
| 36 | var post_excerpt = $(rsp).find('post_display_excerpt').text(); |
---|
| 37 | var res = ''; |
---|
| 38 | |
---|
| 39 | if (post) { |
---|
| 40 | if (post_excerpt) { |
---|
| 41 | res += post_excerpt + '<hr />'; |
---|
| 42 | } |
---|
| 43 | res += post; |
---|
| 44 | $(td).append(res); |
---|
| 45 | } |
---|
| 46 | } else { |
---|
| 47 | alert($(rsp).find('message').text()); |
---|
| 48 | } |
---|
| 49 | }); |
---|
| 50 | |
---|
| 51 | $(line).toggleClass('expand'); |
---|
| 52 | line.parentNode.insertBefore(tr,line.nextSibling); |
---|
| 53 | } |
---|
| 54 | else if (tr.style.display == 'none') |
---|
| 55 | { |
---|
| 56 | $(tr).toggle(); |
---|
| 57 | $(line).toggleClass('expand'); |
---|
| 58 | img.src = dotclear.img_minus_src; |
---|
| 59 | img.alt = dotclear.img_minus_alt; |
---|
| 60 | } |
---|
| 61 | else |
---|
| 62 | { |
---|
| 63 | $(tr).toggle(); |
---|
| 64 | $(line).toggleClass('expand'); |
---|
| 65 | img.src = dotclear.img_plus_src; |
---|
| 66 | img.alt = dotclear.img_plus_alt; |
---|
| 67 | } |
---|
| 68 | }; |
---|
| 69 | |
---|
| 70 | $(function() { |
---|
| 71 | $('#form-entries tr.line').each(function() { |
---|
| 72 | dotclear.postExpander(this); |
---|
| 73 | }); |
---|
| 74 | $('.checkboxes-helpers').each(function() { |
---|
| 75 | dotclear.checkboxesHelpers(this); |
---|
| 76 | }); |
---|
| 77 | $('#form-entries td input[type=checkbox]').enableShiftClick(); |
---|
| 78 | dotclear.postsActionsHelper(); |
---|
| 79 | }); |
---|