Super Power Editing Mode Hack
Note: This hack is outdated with Movable Type 4.x. Your best bet is to move on…
Movable Type gives you an amazing amount of control over your content, but one of the things that it sorely lacks is the ability to make massive changes to all of your entries at once. Oh sure, you can edit the basics in power editing mode—categories, authors, dates and titles—but we want more. Being able to make massive changes to the extended, excerpt and keyword fields can become almost a necessity if, like me, you’re using those fields for something other than their original purpose.
For instance—Customer A is using MT to store course listings. The extended entry field contains the dates offered, the excerpt field holds the price and the keywords field stores the length of the class in days. Now, admitedly, the data could be altered using SQL, but MT’s biggest draw is its usability. So we need a hack that will list those fields for editing in our power editing list.
NOTE, PART THE FIRST: The following is a hack and will call for changes in core MT components. Make sure you’ve made the appropriate backups before trying this one out. Also, realize that if you upgrade your MT installation, these changes will be lost. (Which is a bad thing if your customer relies on this functionality.) Best suggestion is to add a AltTemplatePath ./alttmpl to your mt-config.cgi, create a /mt/alttmpl/cms directory and put your edited tempalte modules there. But then, you already knew that if you’re making drastic changes, right?
NOTE, PART DUEX: This specific hack will not work versions of MT previous to 3.2 (probably guessed that with the mt-config.cgi instruction). It’s doable with the older versions, but I’m not going to take time here explaining it when you really should have upgraded. Please email me if you really need help with the older versions. The major difference is that MT 3.2 moves all the power-editing functionality to a new template module called ‘entrytable.tmpl’, whereas before, the power-editing form was integrated with ‘listentries.tmpl’. The separation of it into its own template module makes perfect sense.
NOTE, PART THE LAST: Hopefully after all these caveats you’ve realized that this hack really needs to be tailored to your own use. I’m going to explain how I used it, but you’re big boys and girls—you can make adjustments as necessary.
Step 1: Changing the Entry Form: Editing ‘entry_table.tmpl’
As stated before, MT 3.2 moved the power-editing mode into the ‘entrytable.tmpl’ (located in /mt/tmpl/cms/) instead of previous versions where it was integrated with ‘listentries.tmpl’. It makes much more sense now, considering we’re not just ‘listing’, we’re editing as well.
In your ‘entry_table.tmpl’, find the part where your table headers are defined—somewhere around line 23. Scroll down until you find:
<th id="en-category"><MT_TRANS phrase="Category"></th>
<th id="en-date"><MT_TRANS phrase="Date"></th>
Right after this code (and before the ) insert the following lines:
<th id="en-text_more"><MT_TRANS phrase="Extended Entry"></th>
<th id="en-excerpt"><MT_TRANS phrase="Excerpt"></th>
<th id="en-keywords"><MT_TRANS phrase="Keywords">
This will add three columns after your date column any place your entries are listed. If I were creating this for my example site using MT to list courses offered, I could change the to simply “Dates Offered” (no quotes). Keep in mind, this will hurt accesibility because the MT_TRANS tag is inserting translatable titles, allowing multi-language support. Chances are though that if you’re customizing this screen you’re probably not too worried about that.
Next, we need to populate the columns with either editable input fields or the actual values themselves, depending on whether or not the list is being pulled from power-editing mode. In your ‘entry_table.tmpl”, look for the following (around line 118):
<td><TMPL_IF NAME=IS_EDITABLE><input name="created_on_<TMPL_VAR NAME=ID>" value="<TMPL_VAR NAME=CREATED_ON_TIME_FORMATTED>" /><TMPL_ELSE><span title="<TMPL_VAR NAME=CREATED_ON_TIME_FORMATTED>"><TMPL_IF NAME=CREATED_ON_RELATIVE><TMPL_IF NAME=DATES_RELATIVE><TMPL_VAR NAME=CREATED_ON_RELATIVE><TMPL_ELSE><TMPL_VAR NAME=CREATED_ON_FORMATTED></TMPL_IF><TMPL_ELSE><TMPL_VAR NAME=CREATED_ON_FORMATTED></TMPL_IF></span></TMPL_IF></td>
This is the code for the date column. Lets insert the following codes between the code you just found and the </tr> right after it:
<td><TMPL_IF NAME=IS_EDITABLE><input name="text_more_<TMPL_VAR NAME=ID>" value="<TMPL_VAR NAME=TEXT_MORE>" /><TMPL_ELSE><span title="<TMPL_VAR NAME=TEXT_MORE>"><TMPL_VAR NAME=TEXT_MORE></span></TMPL_IF></td>
<td><TMPL_IF NAME=IS_EDITABLE><input name="excerpt_<TMPL_VAR NAME=ID>" value="<TMPL_VAR NAME=EXCERPT>" /><TMPL_ELSE><span title="<TMPL_VAR NAME=EXCERPT>"><TMPL_VAR NAME=EXCERPT></span></TMPL_IF></td>
<td><TMPL_IF NAME=IS_EDITABLE><input name="keywords_<TMPL_VAR NAME=ID>" value="<TMPL_VAR NAME=KEYWORDS>" /><TMPL_ELSE><span title="<TMPL_VAR NAME=KEYWORDS>"><TMPL_VAR NAME=KEYWORDS></span></TMPL_IF></td>
Let’s pause for a moment and look at what’s happening here. Three columns are being inserted (beneath the headers we just created). A TMPL_IF tag is inserted because if we’re in power-editing mode, we want editable fields, if we’re simply looking at the entry list or the system overview, we just want values, no input fields. One important thing to note with our input fields—be sure to include the textmore or keywords_ with the <TMPL_VAR NAME=ID> attached no matter what you’ve named the column. This will be important for our next step because it’s how we tell MT which field and which entry to save changes to.
Go ahead and save your ‘entry_table.tmpl’ template module, preferable in your /mt/alttemplate/cms/ directory.
Step 2: Getting MT Ready to Save New Fields: Adding Variables to ‘CMS.pm’
Modifying core Perl modules should always be done carefully and with hesitation. The changes we’re making here aren’t taking any functionality away or even changing current functionality, we’re simply ADDING functionality. If you remove the custom entry table template module we created earlier, MT will function the same way it always has. At the very most, you’d notice a performance hit when saving via power editing mode, and if it matters enough to you you can just remove the following changes.
MT doesn’t expect extended entry, excerpt or keyword data to be passed to it from the power-editing mode, so we need to change that by adding those variables to the save_entries subroutine of ‘cms.pm’.
Open ‘/mt/lib/MT/App/CMS.pm’ and find the following lines (around line 5084):
sub save_entries {
my $app = shift;
my $perms = $app->{perms}
That’s the beginning of the subroutine. Scroll down about 20 lines until you see the following:
$entry->author_id($author_id ? $author_id : 0);
$entry->status(scalar $q->param('status_' . $id));
$entry->title(scalar $q->param('title_' . $id));
We want to add those values we included on the new power-editing template to this list so MT will actually save the data entered in those fields:
$entry->text_more(scalar $q->param('text_more_' . $id));
$entry->excerpt(scalar $q->param('excerpt_' . $id));
$entry->keywords(scalar $q->param('keywords_' . $id));
Save, upload and give it a try. Keep in mind, if your ‘Excerpt’ field is blank and your site configuration is set to auto create an excerpt with the first 250 words of your entry, the power-editing form could get LONG. For the example of my class, since I’m using the excerpt field for the price of the class, I’ve set the auto-excerpt to 0 words so if the field is left blank, it will stay blank.
As I mentioned earlier, this hack isn’t for every situation, but it’s perfect if you’re pushing the MT envelope and need the ability to edit more fields than is customary.
InterAction:
12 September 20052. Jesse:
Oh, by all means! My weakness is that I know how to hack, but haven't the first clue to getting a program to make these changes, so all of my suggestions are fleeting.
*sigh*
Actually, I can see how the changes could be made to the entry form with BIGPAPI, but how can you make those changes to CMS.pm to expect the additional variables? That seems like the hard part to me.
12 September 20053. Arvind:
Heh, you're in exactly the same position I was in January :) Movalog was all hacks at that time and then I progressed to plugins!
For the plugin, you would first insert checkboxes for the plugin settings on the plugin listing to enable each field. Next you would check the fields the users have selected and use BigPAPI to show the appropriate fields. Finally you would need to overwrite MT::App::CMS::save_entries with your stuff to save the new fields.
YourThoughts?
(Minutia)
- Author:Jesse
- Published:Sep 12, 2005
- Chapters:
- Previous:
- Next:
GetUpdated
ElseWhere
AllChapters
- 2 articles in the chapter Accessibility
- 6 articles in the chapter Announcements
- 4 articles in the chapter Blogging
- 7 articles in the chapter CMS
- 1 articles in the chapter Code
- 3 articles in the chapter CSS
- 15 articles in the chapter Design
- 4 articles in the chapter Downloads
- 1 articles in the chapter Freebies
- 1 articles in the chapter Gadgets
- 4 articles in the chapter Journeys
- 1 articles in the chapter Miscellany
- 59 articles in the chapter Movable Type
- 2 articles in the chapter Plugins
- 1 articles in the chapter Print
- 1 articles in the chapter Projects
- 2 articles in the chapter SEO
- 6 articles in the chapter Social Networking
- 1 articles in the chapter Standards
- 1 articles in the chapter Writing
BiteSize.blog
ReaderFavorites
- CSS Image Framing
- Tools of the Web Design Trade, Pt.1: Where to Begin
- Tools of the Web Design Trade, Pt.2: Building Trust
- 10 Tips For Creating Website Mockups In Photoshop
- Movable Type As A Desktop App
- Redesign, Part 1: The Logo
- Redesign, Part 2: Stylesheet Philosophy
- The Social Graph in Plain Language
- Writing Your Own Autobiography: The New Persistence of Information
- Designing eComm 2008


















12 September 20051. Arvind:
Hah, you beat me to it :) I was going to create a BigPAPI plugin (perhaps I still will if I have the time) to allow people to add everything on the entry screen onto the power edit mode.