2

Ok, my question's not as broad as it seems, to summarize 8 months effort on my part:

I create chunks of re-usable, extensible XHTML which degrades gracefully and is all kinds of awesome. Most of my code chunks are provided a Javascript interaction layer, and are styled with CSS. I set to work pulling my code chunks into Dreamweaver as 'Snippets' but they're unintelligent chunks of text. Also, once inserted, my beautiful code chunks get mangled by the non-techies who are the ones actually using Dreamweaver.

Also, because they're unintelligent snippets, I have a line of Javascript which configures the code chunks when initialised - see this post for further detail on my approach. But currently I have to replicate a single code chunk as many times as there are configuration options (so each 'snippet' may only differ from another of the same type by ONE config value). This is incredibly lame, it works, but its lame and time-consuming for me to re-deploy a bunch of snippets and hard for my team to remember all the variations.

So I have a series of requirements, to my mind, as the most likely things to solve in any system I put my chunks into:

  1. The inserted code is not modified at insertion time, by the system
  2. The code to be inserted needs to allow config options
  3. I'd be overjoyed if, once inserted, the only editable parts are text nodes
  4. Copy and pasting these whole objects
  5. A clean interface from which to choose from my range of code chunks

It's a serious list of requirements I presume, much searching led me to Kompoze and its 'Smart widgets' which, according to a random post from 2004, suggests XUL files can be created and extensions can be made which sounds vaguely like what I want. The text editor itself was less prone to destruction, when compared to Dreamweaver.

So yeah, I've chased too many rabbits on this one, keen as for a solution whether Software+extension, or Webapp.

EDIT: Btw, it did occur to me to investigate a highly customised TinyMCE instance, but I don't know feasible that is, and unless there's some sweet backend available, I'm stuck with local editing of files for now - not even on a web server...

To my mind the best answer to this question will solve most of the above, and provide some general workflow advice alongside the suggestion(s).

Community
  • 1
  • 1
danjah
  • 2,939
  • 2
  • 30
  • 47
  • What you are describing sounds exactly like server control for ASP.NET. You can control markup and not let anyone change it. You can have configuration options as properties. You can expose text nodes to be editable by user. You can copy and paste markup to add those controls. Auto-complete interface in Visual Studio is clean enough if you just add all of your controls to a separate assembly. Probably not what you want, though. – Ilya Volodin Nov 22 '10 at 23:22
  • Wow, yeah different league altogether, but the more I approach this subject, the deeper solutions tend to get... Is there a cheap demo of the above system for me to easily enough check out? I'd guess not, but if there is one going it might conceptually provide some insight, thanks :) – danjah Nov 22 '10 at 23:35
  • 1
    Well, ASP.NET is a free system that runs on IIS Server (part of Windows 7 Professional and above, Windows Vista Professional and above or any Windows Server products). You can also use Mono to run ASP.NET on Linux systems. You check out a tutorial on how to build server controls here: http://www.4guysfromrolla.com/articles/102903-1.aspx. At the very bottom of the page, you can see a consumable markup that you would use to insert server control onto the page. Looks a lot like what you are describing above. – Ilya Volodin Nov 24 '10 at 03:54

3 Answers3

2

I would go with a solution based around the excellent markItUp! editor. It's very simple to extend it to cope with the requirements you have. You can add sophisticated logic, and it's nice and shiny.

I'd probably combine it with Jeditable for the inline node editing, and build the whole thing on top of Django, for ease and convenience. Completely customisable, surprisingly easy to work with, portable and cross-platform, and easy to set-up for off-line use. Oh, and all free and open-source.

simon
  • 15,344
  • 5
  • 45
  • 67
0

What do you think of this approach:

<div class="thing">
    <elements... />
    <script type="text/javascript">
      document.write('<span id="thing' + thingNo + '"></span>')
      new Thing().init({ id:'thing'+thingNo; });
      thingNo += 1;
    </script>
</div>

Of course, you'll have to change Thing().init so that it would initialize the parent (instead of current) node.

mtelis
  • 654
  • 1
  • 6
  • 10
  • Ok, i like, but back to this question :P – danjah Nov 17 '10 at 20:40
  • Actually, this wasn't ideal, thinking back, because I needed to reference instantiated objects - am I able to do that when creating via "new Class().method()"? Any readers should know that this answer and chain of comments is mostly unrelated to the actual question being asked here. – danjah Nov 22 '10 at 22:35
0

Have you considered server-side includes where the directive is either a generated page or a shell command? E.g.:

<!--#include virtual="./activePage.aspx?withParam1=something&amp;param2=somethingelse" -->

or

<!--#exec cmd="shellCommand -withParams" -->

You can reuse the same page or command, and provide parameters specific to each usage in each XHTML page.

Dour High Arch
  • 21,513
  • 29
  • 75
  • 90