MT InlineEditor 1.1

This new version introduces inline editing for comments by the commenters. A cookie is set when the person hits the post button on the comment form. The cookie is set to expire in 5 minutes so the person must make any edits within five minutes.

Download MT-InlineEditor_1.1.zip. Preserve the directories in the zip starting from your root MT directory (therefore files in the extlib/ folder in the zip go into MT's extlib/ directory and mt-ie-cookiecheck.php goes into your root mt directory etc.)

For every blog you want this enabled on, you will need to create two index templates of the two text files in the zip (mt-inlineeditor.php and mt-inlineeditor.js) I've used MT Tags in those templates so they should work without any modification. They must be static index templates. Follow these instructions to enable inline editing for entries.

To enable inline editing for comments, add the following to the section of every page that has a comment form, this code from the remember me module must also be present.

<script type="text/javascript" language="javascript">
<!--
function edit_comment() {
    var now = new Date();
var comment_count = <MTEntryCommentCount> + 1;
    var comment_id = '<MTEntryID>-' + comment_count;
    fixDate(now);
    now.setTime(now.getTime() + 5 * 60 * 1000);
       setCookie('comment-' + comment_id, comment_id, now, '/', '', '');
}
//-->
</script>

Next replace your post button with the following

<script type="text/javascript" language="javascript">
<!--
function edit_comment() {
    var now = new Date();
var comment_count = <MTEntryCommentCount> + 1;
    var comment_id = '<MTEntryID>-' + comment_count;
    fixDate(now);
    now.setTime(now.getTime() + 5 * 60 * 1000);
       setCookie('comment-' + comment_id, comment_id, now, '/', '', '');
}
//-->
</script>
<input style="font-weight: bold;" type="submit" name="post"
    tabindex="6" value="&nbsp;Post&nbsp;" id="post"  onclick="edit_comment(); return true;" />

Next wherever you list the comments, add the following after your starting tag

<script type="text/javascript" language="javascript">
<!--
function edit_comment() {
    var now = new Date();
var comment_count = <MTEntryCommentCount> + 1;
    var comment_id = '<MTEntryID>-' + comment_count;
    fixDate(now);
    now.setTime(now.getTime() + 5 * 60 * 1000);
       setCookie('comment-' + comment_id, comment_id, now, '/', '', '');
}
//-->
</script>
<input style="font-weight: bold;" type="submit" name="post"
    tabindex="6" value="&nbsp;Post&nbsp;" id="post"  onclick="edit_comment(); return true;" />
<div id="comment-<MTCommentID>">

amd close it prior to your end tag. Finally wherever you want the link to start editing the comment to appear, add the tag . You'll also need this code to be present on for MTInlineCommentEditLink to work -- it normally is!

In a future version I may consider a patch for MTCommentFields.

Thanks to Brad Choate for help with the PHP

6 Comments

samanoo said:
on Apr 10, 2005 11:57 AM | Reply

hi :) :)

gvtexas said:
on Apr 11, 2005 10:28 AM | Reply

Getting this error:

Smarty error: [in mt:20 line 51]: syntax error: unrecognized tag 'MTInlineEditLink' (Smarty_Compiler.class.php, line 556)

I believe I followed everything correctly. MT3.15. Dynamic publishing (but i made the two index templates static), and I'm only setting this up for entries.

?

thanks, Gary

Arvind Satyanarayan said:
on Apr 11, 2005 10:43 AM | Reply

As I mentioned in the previous entry, for dynamic publishing you don't enter the tag, you add

<script type="text/javascript" language="Javascript" src="<MTCGIPath>/mt-inlineeditor.cgi?id=<MTEntryID>&blog_id=<MTBlogID>"></script>

instead of the tag.

gvtexas said:
on Apr 12, 2005 5:53 AM | Reply

Ah, of course. Misunderstood which tag wasn't needed. Thanks! Works great now...except clicking on "more options" yields a page not found error. The resulting URL looks mangled:

http://www.domain.com/scgi-bin/http://www.domain.com/scgi-bin/ ?_mode=view&type=entry&id=11&blog_id=2

(I forced the line kick here, but as you see it's doubling the CGIpath and losing the mt.cgi in the URL.)

salguod said:
on Apr 26, 2005 9:35 AM | Reply

I've been trying to install this and I keep getting errors upon rebuilding. I'm running MT 3.15, but my templates & CSS are based on 2.661. When following the instructions and rebuilding my individual archives, I get no 'edit' link and I get this error during rebuild:

Use of uninitialized value in concatenation (.) or string at /homepages/.../movabletype/plugins/mt-inlineeditor.pl line 12.
Any idea what I'm doing wrong?

Jenna said:
on May 23, 2005 11:29 PM | Reply

The download link seems to be broken.

Leave a comment

Preview