~katiekitty/+junk/wordpress-byet

« back to all changes in this revision

Viewing changes to wp-admin/js/inline-edit-post.dev.js

  • Committer: kserver
  • Date: 2010-05-15 01:16:36 UTC
  • Revision ID: kserver@kserver-desktop-20100515011636-mnr1j7t637suptdq
Wordpress 2.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
                t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
9
9
                t.what = '#'+t.type+'-';
10
10
 
11
 
                // get all editable rows
12
 
                t.rows = $('tr.iedit');
13
 
 
14
11
                // prepare the edit rows
15
12
                qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); });
16
13
                bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); });
31
28
                });
32
29
 
33
30
                // add events
34
 
                t.addEvents(t.rows);
 
31
                $('a.editinline').live('click', function() { inlineEditPost.edit(this); return false; });
35
32
 
36
33
                $('#bulk-title-div').parents('fieldset').after(
37
34
                        $('#inline-edit fieldset.inline-edit-categories').clone()
76
73
                $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
77
74
        },
78
75
 
79
 
        addEvents : function(r) {
80
 
                r.each(function() {
81
 
                        var row = $(this);
82
 
                        $('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
83
 
                });
84
 
        },
85
 
 
86
76
        setBulk : function() {
87
 
                var te = '', type = this.type, tax;
 
77
                var te = '', type = this.type, tax, c = true;
88
78
                this.revert();
89
79
 
90
80
                $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length);
93
83
 
94
84
                $('tbody th.check-column input[type="checkbox"]').each(function(i){
95
85
                        if ( $(this).attr('checked') ) {
 
86
                                c = false;
96
87
                                var id = $(this).val(), theTitle;
97
88
                                theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle;
98
89
                                te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>';
99
90
                        }
100
91
                });
101
92
 
 
93
                if ( c )
 
94
                        return this.revert();
 
95
 
102
96
                $('#bulk-titles').html(te);
103
97
                $('#bulk-titles a').click(function() {
104
98
                        var id = $(this).attr('id').substr(1);
136
130
 
137
131
                // populate the data
138
132
                rowData = $('#inline_'+id);
 
133
                if ( !$(':input[name="post_author"] option[value=' + $('.post_author', rowData).text() + ']', editRow).val() ) {
 
134
                        // author no longer has edit caps, so we need to add them to the list of authors
 
135
                        $(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>');
 
136
                }
 
137
 
139
138
                for ( f = 0; f < fields.length; f++ ) {
140
139
                        $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() );
141
140
                }
191
190
        },
192
191
 
193
192
        save : function(id) {
194
 
                var params, fields;
 
193
                var params, fields, page = $('.post_status_page').val() || '';
195
194
 
196
195
                if( typeof(id) == 'object' )
197
196
                        id = this.getId(id);
202
201
                        action: 'inline-save',
203
202
                        post_type: this.type,
204
203
                        post_ID: id,
205
 
                        edit_date: 'true'
 
204
                        edit_date: 'true',
 
205
                        post_status: page
206
206
                };
207
207
 
208
 
                fields = $('#edit-'+id+' :input').fieldSerialize();
 
208
                fields = $('#edit-'+id+' :input').serialize();
209
209
                params = fields + '&' + $.param(params);
210
210
 
211
211
                // make ajax request
217
217
                                        if ( -1 != r.indexOf('<tr') ) {
218
218
                                                $(inlineEditPost.what+id).remove();
219
219
                                                $('#edit-'+id).before(r).remove();
220
 
 
221
 
                                                var row = $(inlineEditPost.what+id);
222
 
                                                row.hide();
223
 
 
224
 
                                                if ( 'draft' == $('input[name="post_status"]').val() )
225
 
                                                        row.find('td.column-comments').hide();
226
 
 
227
 
                                                inlineEditPost.addEvents(row);
228
 
                                                row.fadeIn();
 
220
                                                $(inlineEditPost.what+id).hide().fadeIn();
229
221
                                        } else {
230
222
                                                r = r.replace( /<.[^<>]*?>/g, '' );
231
223
                                                $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');