I did say I was going to explore this whole Mango plugin thing, right? Yeah, thought so.
Today I've got a cool little plugin for Mango
that adds a comments summary screen to the admin. I didn't like having
to sort of "dig" for my post comments, so here they are all on one
screen. It shows your 10 most recent posts and all comments to them.
Links are provided to edit or delete them, for quick access.
I think this one has the potential to become a pretty badass plugin,
but only through feedback from someone like yourself. So if there's
something you love, or hate, or think needs to be added, leave me a
comment and let me know.
Comment Whore is a Mango Blog plugin that adds a comment summary
screen to the main nav of Mango Admin. I made this because I didn't
like the interface for viewing and managing comments.
At the moment, it makes use of the existing edit and delete
functionality (for quickly deleting spam), with the caveat that after
editing or deleting, you're not taken back to the
comment whore screen (much to my own chagrin, I assure you!). This is a
very early rendition of what I hope will become an awesome plugin. I'd
really like to get some user feedback on what you would like to see
added or changed, so comment away!
BurntMango is a simple Mango Blog plugin that allows you to replace the feed urls that your blog readers see with the URLs provided by FeedBurner. It works with all skins that properly implement the Mango RSS/ATOM feed url tags. (Which should be all of them, right?)
It's always bothered me that CFSelect validation only worked for multiple-select (list) boxes, and that we were left to our own devices to validate single-select (drop down) inputs. A few weeks ago I found a comment on Ben Forta's Blog that describes how to override the default validation function to properly handle single selects. The one caveat is that, since by nature a single-select input will always have one option selected, you have to have one invalid option. Generally I make it display, "Choose One:" or something like that. The value must be "" (not even a space).
To override the validation function, simply include this in your JavaScript somewhere. I put it in my global JS include so I never have to think about whether or not I'll need it on a given page.
var _CF_hasValue_old = _CF_hasValue;
_CF_hasValue=function(_b,_c,_d){
if (_b.type == 'select-one'){
var bSelected = false;
for (var i=0; i<_b.options.length; i++){
if ( _b.options[i].selected == true && _b.options[i].value != '' )
{ bSelected = true; break; }
}
return bSelected;
}else{
return _CF_hasValue_old(_b,_c,_d);
}
}
Use it like so:
Again, I can't take credit for coding this. I found it on Ben's blog, and thought it should make its way into the various aggregators.
I figured since I was finally going to have some proper ColdFusion
hosting, I might as well check out the latest and greatest from our
various CFML blogging engines. I'd used BlogCFC in the past, so this time I decided to give Mango
a test drive. So far, I'm really liking it. Mango has an integrated
database setup and the option to import from WordPress exports and
BlogCFC. It's apparently got easy but powerful plugin support (which I
intend to explore soon), and is supposed to be one of the easier blogs
to skin -- again, something I intend to explore soon.
With some help from Laura in the Mango support forums,
I was able to work through some quirky import issues (pages that belong
to a category aren't supported in Mango, but apparently I had them in
WP -- this was throwing an error during import, should be fixed in an
upcoming release, I'm sure) and got all of my old posts and comments
imported. I managed to remember what my FeedBurner password was, so I
even managed to pull off the switch without upsetting continuity in
aggregators like ColdFusionBloggers, Feed Squirrel and AXNA. Although I have to apologize if it ends up causing doubles of anything.
Lastly, I also setup request forwarding from my previous host (on another of my domains still temporarily hosted there) to my new host and domain, pretty much just like Ray did when he moved to ColdFusionJedi.com. Since my old host didn't support SES urls, I had to use the ID from the url to lookup the post title and forward the url to this domain.
I've had some time over the last few days to start adding some of the "nice to have" features to a client site before delivering it, and one of those was the ability to upload product images and related PDFs, rather than having to teach them to always follow the naming scheme and how to use FTP. While testing my uploads in various browsers, I came across something I found to be very odd.
When you upload a PDF in IE, the file you receive has what I believe is the correct mime type: "application/pdf" however when you upload the same PDF file using the same code, in Firefox (tested in FF 2 and 3), the mime type is "application/download". I can't explain it. I have no idea why it's wrong. But it is, and consistently so. Could this be the one thing that is implemented correctly in IE and incorrectly in Firefox?
At any rate, it's a simple thing to accommodate. Note the accept attribute of the <CFFile> tag in the code sample below:
<cftry>
<cffile action="upload"
accept="application/download,application/pdf"
filefield="form.pdfUpload"
nameconflict="overwrite"
result="result"
destination="#expandPath('/path/to/save/your.pdf')#" />
<cfif variables.result.fileExisted neq "NO">
<cfset msg = "PDF was overwritten." />
<cfelse>
<cfset msg = "PDF was saved." />
</cfif>
<cfcatch type="application">
<cfif findNoCase("The MIME type of the uploaded file", cfcatch.message)>
<!--- invalid mime type --->
<cfset msg = "Invalid file type. Please only use a PDF file. File was not saved." />
</cfif>
</cfcatch>
</cftry>