ContentEditable Area
Anyway it got me thinking, i dont want to build a whole administration side, i just want a user to be able to go in and edit small bits of text when they are logged in. So i've been playing for the last half hour or so and got the following. Its a bare bones idea to a pluggin that i'm thinking about for FB4. Basically if you use content variables then you can make a <div> region which has a class attribute begining ="edit editable. It does this by adding contentEditable="true" when the content variable is passed (and of course you are logged in), it also highlights the area with a red border and makes it editable (to IE only).
<cfset editable = "true">
\n<cfsavecontent variable="q">
\n<div id="myId" class="editBody">test</div>
\n</cfsavecontent>
\n<cfscript>
\n if(editAble){
\n edString = 'style="border:1px solid red" contentEditable="true"';
\n reDiv = '(<div)[ \\w\\_"=:;]*(class="edit)[ \\w\\_"=:;]*>';
\n
\n if(reFind(reDiv, q)){
\n q = replaceNoCase(q, 'class="edit', edString&' class="edit', "ALL");
\n }
\n }
\n writeOutput(q);
\n</cfscript>
My next problem is the submiting the page bit???\n<cfsavecontent variable="q">
\n<div id="myId" class="editBody">test</div>
\n</cfsavecontent>
\n<cfscript>
\n if(editAble){
\n edString = 'style="border:1px solid red" contentEditable="true"';
\n reDiv = '(<div)[ \\w\\_"=:;]*(class="edit)[ \\w\\_"=:;]*>';
\n
\n if(reFind(reDiv, q)){
\n q = replaceNoCase(q, 'class="edit', edString&' class="edit', "ALL");
\n }
\n }
\n writeOutput(q);
\n</cfscript>