1 | dotclear.viewPostContent = function(line,action) { |
---|
2 | var action = action || 'toggle'; |
---|
3 | var postId = $(line).attr('id').substr(1); |
---|
4 | var tr = document.getElementById('pe'+postId); |
---|
5 | |
---|
6 | if ( !tr && ( action == 'toggle' || action == 'open' ) ) { |
---|
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); |
---|
13 | |
---|
14 | // Get post content |
---|
15 | $.get('services.php',{f:'getPostById', id: postId, post_type: ''},function(data) { |
---|
16 | var rsp = $(data).children('rsp')[0]; |
---|
17 | |
---|
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 = ''; |
---|
22 | |
---|
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 | }); |
---|
34 | |
---|
35 | $(line).addClass('expand'); |
---|
36 | line.parentNode.insertBefore(tr,line.nextSibling); |
---|
37 | } |
---|
38 | else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) |
---|
39 | { |
---|
40 | $(tr).css('display', 'table-row'); |
---|
41 | $(line).addClass('expand'); |
---|
42 | } |
---|
43 | else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) |
---|
44 | { |
---|
45 | $(tr).css('display', 'none'); |
---|
46 | $(line).removeClass('expand'); |
---|
47 | } |
---|
48 | }; |
---|
49 | |
---|
50 | $(function() { |
---|
51 | // Entry type switcher |
---|
52 | $('#type').change(function() { |
---|
53 | this.form.submit(); |
---|
54 | }); |
---|
55 | |
---|
56 | $.expandContent({ |
---|
57 | line:$('#form-entries tr:not(.line)'), |
---|
58 | lines:$('#form-entries tr.line'), |
---|
59 | callback:dotclear.viewPostContent |
---|
60 | }); |
---|
61 | $('.checkboxes-helpers').each(function() { |
---|
62 | dotclear.checkboxesHelpers(this,undefined,'#form-entries td input[type=checkbox]','#form-entries #do-action'); |
---|
63 | }); |
---|
64 | $('#form-entries td input[type=checkbox]').enableShiftClick(); |
---|
65 | dotclear.condSubmit('#form-entries td input[type=checkbox]','#form-entries #do-action'); |
---|
66 | dotclear.postsActionsHelper(); |
---|
67 | }); |
---|