[2527] | 1 | dotclear.viewPostContent = function(line,action) { |
---|
[1884] | 2 | var action = action || 'toggle'; |
---|
[3182] | 3 | if ($(line).attr('id') == undefined) { return; } |
---|
| 4 | |
---|
[2527] | 5 | var postId = $(line).attr('id').substr(1); |
---|
[1882] | 6 | var tr = document.getElementById('pe'+postId); |
---|
[2566] | 7 | |
---|
[1884] | 8 | if ( !tr && ( action == 'toggle' || action == 'open' ) ) { |
---|
[1882] | 9 | tr = document.createElement('tr'); |
---|
| 10 | tr.id = 'pe'+postId; |
---|
| 11 | var td = document.createElement('td'); |
---|
| 12 | td.colSpan = 8; |
---|
| 13 | td.className = 'expand'; |
---|
| 14 | tr.appendChild(td); |
---|
[2566] | 15 | |
---|
[1882] | 16 | // Get post content |
---|
| 17 | $.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) { |
---|
| 18 | var rsp = $(data).children('rsp')[0]; |
---|
[2566] | 19 | |
---|
[1882] | 20 | if (rsp.attributes[0].value == 'ok') { |
---|
| 21 | var post = $(rsp).find('post_display_content').text(); |
---|
| 22 | var post_excerpt = $(rsp).find('post_display_excerpt').text(); |
---|
| 23 | var res = ''; |
---|
[2566] | 24 | |
---|
[1882] | 25 | if (post) { |
---|
| 26 | if (post_excerpt) { |
---|
| 27 | res += post_excerpt + '<hr />'; |
---|
| 28 | } |
---|
| 29 | res += post; |
---|
| 30 | $(td).append(res); |
---|
| 31 | } |
---|
| 32 | } else { |
---|
| 33 | alert($(rsp).find('message').text()); |
---|
| 34 | } |
---|
| 35 | }); |
---|
[2566] | 36 | |
---|
[1884] | 37 | $(line).addClass('expand'); |
---|
[1882] | 38 | line.parentNode.insertBefore(tr,line.nextSibling); |
---|
| 39 | } |
---|
[1884] | 40 | else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) |
---|
[1882] | 41 | { |
---|
[1884] | 42 | $(tr).css('display', 'table-row'); |
---|
| 43 | $(line).addClass('expand'); |
---|
[1882] | 44 | } |
---|
[1884] | 45 | else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) |
---|
[1882] | 46 | { |
---|
[1884] | 47 | $(tr).css('display', 'none'); |
---|
| 48 | $(line).removeClass('expand'); |
---|
[1882] | 49 | } |
---|
| 50 | }; |
---|
| 51 | |
---|
| 52 | $(function() { |
---|
[1884] | 53 | $('#pageslist tr.line').prepend('<td class="expander"></td>'); |
---|
[1882] | 54 | $('#form-entries tr:not(.line) th:first').attr('colspan',4); |
---|
[2531] | 55 | $.expandContent({ |
---|
| 56 | line:$('#form-entries tr:not(.line)'), |
---|
| 57 | lines:$('#form-entries tr.line'), |
---|
| 58 | callback:dotclear.viewPostContent |
---|
[1882] | 59 | }); |
---|
| 60 | $('.checkboxes-helpers').each(function() { |
---|
| 61 | p = $('<p></p>'); |
---|
| 62 | $(this).prepend(p); |
---|
[3182] | 63 | dotclear.checkboxesHelpers(p,undefined,'#pageslist td input[type=checkbox]','#form-entries #do-action'); |
---|
[1882] | 64 | }); |
---|
[1884] | 65 | $('#pageslist td input[type=checkbox]').enableShiftClick(); |
---|
[3182] | 66 | dotclear.condSubmit('#pageslist td input[type=checkbox]','#form-entries #do-action'); |
---|
[2566] | 67 | |
---|
[1884] | 68 | $("#pageslist tr.line td:not(.expander)").mousedown(function(){ |
---|
| 69 | $('#pageslist tr.line').each(function() { |
---|
| 70 | var td = this.firstChild; |
---|
| 71 | dotclear.viewPostContent(td.firstChild,td.firstChild.line,'close'); |
---|
| 72 | }); |
---|
| 73 | $('#pageslist tr:not(.line)').remove(); |
---|
| 74 | }); |
---|
[2566] | 75 | |
---|
[1882] | 76 | $("#pageslist").sortable({ |
---|
| 77 | cursor:'move', |
---|
| 78 | stop: function( event, ui ) { |
---|
| 79 | $("#pageslist tr td input.position").each(function(i) { |
---|
| 80 | $(this).val(i+1); |
---|
| 81 | }); |
---|
| 82 | } |
---|
| 83 | }); |
---|
| 84 | $("#pageslist tr").hover(function () { |
---|
| 85 | $(this).css({'cursor':'move'}); |
---|
| 86 | }, function () { |
---|
| 87 | $(this).css({'cursor':'auto'}); |
---|
| 88 | }); |
---|
| 89 | $("#pageslist tr td input.position").hide(); |
---|
| 90 | $("#pageslist tr td.handle").addClass('handler'); |
---|
[2566] | 91 | |
---|
[2058] | 92 | $("form input[type=submit]").click(function() { |
---|
| 93 | $("input[type=submit]", $(this).parents("form")).removeAttr("clicked"); |
---|
| 94 | $(this).attr("clicked", "true"); |
---|
| 95 | }) |
---|
[2566] | 96 | |
---|
[2058] | 97 | $('#form-entries').submit(function() { |
---|
| 98 | var action = $(this).find('select[name="action"]').val(); |
---|
| 99 | var checked = false; |
---|
| 100 | if ($("input[name=reorder][clicked=true]").val()) { |
---|
| 101 | return true; |
---|
| 102 | } |
---|
| 103 | $(this).find('input[name="entries[]"]').each(function() { |
---|
| 104 | if (this.checked) { |
---|
| 105 | checked = true; |
---|
| 106 | } |
---|
| 107 | }); |
---|
| 108 | |
---|
| 109 | if (!checked) { return false; } |
---|
| 110 | |
---|
| 111 | if (action == 'delete') { |
---|
| 112 | return window.confirm(dotclear.msg.confirm_delete_posts.replace('%s',$('input[name="entries[]"]:checked').size())); |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | return true; |
---|
| 116 | }); |
---|
[1882] | 117 | }); |
---|