| [2525] | 1 | dotclear.viewPostContent = function(line,action) { |
|---|
| [1639] | 2 | var action = action || 'toggle'; |
|---|
| [2525] | 3 | var postId = $(line).attr('id').substr(1); |
|---|
| [0] | 4 | var tr = document.getElementById('pe'+postId); |
|---|
| [2566] | 5 | |
|---|
| [1639] | 6 | if ( !tr && ( action == 'toggle' || action == 'open' ) ) { |
|---|
| [0] | 7 | tr = document.createElement('tr'); |
|---|
| 8 | tr.id = 'pe'+postId; |
|---|
| 9 | var td = document.createElement('td'); |
|---|
| 10 | td.colSpan = 8; |
|---|
| 11 | td.className = 'expand'; |
|---|
| 12 | tr.appendChild(td); |
|---|
| [2566] | 13 | |
|---|
| [0] | 14 | // Get post content |
|---|
| 15 | $.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) { |
|---|
| 16 | var rsp = $(data).children('rsp')[0]; |
|---|
| [2566] | 17 | |
|---|
| [0] | 18 | if (rsp.attributes[0].value == 'ok') { |
|---|
| 19 | var post = $(rsp).find('post_display_content').text(); |
|---|
| 20 | var post_excerpt = $(rsp).find('post_display_excerpt').text(); |
|---|
| 21 | var res = ''; |
|---|
| [2566] | 22 | |
|---|
| [0] | 23 | if (post) { |
|---|
| 24 | if (post_excerpt) { |
|---|
| 25 | res += post_excerpt + '<hr />'; |
|---|
| 26 | } |
|---|
| 27 | res += post; |
|---|
| 28 | $(td).append(res); |
|---|
| 29 | } |
|---|
| 30 | } else { |
|---|
| 31 | alert($(rsp).find('message').text()); |
|---|
| 32 | } |
|---|
| 33 | }); |
|---|
| [2566] | 34 | |
|---|
| [1639] | 35 | $(line).addClass('expand'); |
|---|
| [0] | 36 | line.parentNode.insertBefore(tr,line.nextSibling); |
|---|
| 37 | } |
|---|
| [1640] | 38 | else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) |
|---|
| [0] | 39 | { |
|---|
| [1639] | 40 | $(tr).css('display', 'table-row'); |
|---|
| 41 | $(line).addClass('expand'); |
|---|
| [0] | 42 | } |
|---|
| [1640] | 43 | else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) |
|---|
| [0] | 44 | { |
|---|
| [1639] | 45 | $(tr).css('display', 'none'); |
|---|
| 46 | $(line).removeClass('expand'); |
|---|
| [0] | 47 | } |
|---|
| 48 | }; |
|---|
| 49 | |
|---|
| 50 | $(function() { |
|---|
| [995] | 51 | // Entry type switcher |
|---|
| [2811] | 52 | $('#type').change(function() { |
|---|
| [995] | 53 | this.form.submit(); |
|---|
| 54 | }); |
|---|
| 55 | |
|---|
| [2531] | 56 | $.expandContent({ |
|---|
| 57 | line:$('#form-entries tr:not(.line)'), |
|---|
| 58 | lines:$('#form-entries tr.line'), |
|---|
| 59 | callback:dotclear.viewPostContent |
|---|
| [0] | 60 | }); |
|---|
| 61 | $('.checkboxes-helpers').each(function() { |
|---|
| [3182] | 62 | dotclear.checkboxesHelpers(this,undefined,'#form-entries td input[type=checkbox]','#form-entries #do-action'); |
|---|
| [0] | 63 | }); |
|---|
| 64 | $('#form-entries td input[type=checkbox]').enableShiftClick(); |
|---|
| [3182] | 65 | dotclear.condSubmit('#form-entries td input[type=checkbox]','#form-entries #do-action'); |
|---|
| [0] | 66 | dotclear.postsActionsHelper(); |
|---|
| [2525] | 67 | }); |
|---|