2 December, 2007
I’ve been using Joseph Scott’s Edit-in-place (EIP) routine in the Topic Map Kid to help with modifying the various pieces of metadata in topics.
The problem comes when you start to use the same one file to apply to different to different topics with different editable fields. What I kept getting as a result was a set of errors when the layer to be edit-in-placeable wasn’t there.
I decided that the best way to work-around this issue was to just check to see if the layers existed before initialising them:
function testForObject(Id, Tag) {
var o = document.getElementById(Id);
if (o) {
if (Tag) {
if (o.tagName.toLowerCase() == Tag.toLowerCase()) {
return o;
}
}
else {
return o;
}
}
return null;
}
Event.observe(window, 'load', init, false);
function init() {
var topicID = document.getElementById('itemID');
var topicIDstr = topicID.innerHTML;
EditInPlace.defaults['type'] = ‘text’;
EditInPlace.defaults['save_url'] = ’some URL’;
var o = testForObject(”heading1″);
if (o) {
EditInPlace.makeEditable({
id: ‘heading1′,
ajax_data: {
api: ‘h1′,
itemID: topicIDstr
}
});
}
var o = testForObject(”gift-price”);
if (o) {
EditInPlace.makeEditable({
id: ‘gift-price’,
ajax_data: {
api: ‘changeGiftPrice’,
itemID: topicIDstr
}
});
}
}
If you plop this into your file then you won’t have those pesky javascript errors.M
No Comments » |
fckeditor | Tagged: ajax, edit-in-place, fckeditor |
Permalink
Posted by magia3e
2 December, 2007
I’ve been making updates to the topic maps engine, Topic Map Kid, in its current usage as a gifts register for Christmas. I noticed that when you press the ‘add gift’ button the page jumps unnaturally.
The easy way to fix this page jumping is to use ‘return false’ at the end of your javascript statement:
onclick=”javascript:addTopicRelationship(’{topic[@id=$item]/@id}’); return false”
M
No Comments » |
programming | Tagged: ajax, javascript, topic maps |
Permalink
Posted by magia3e
27 August, 2007
I’ve been playing with Topic Maps for a few years now. I like them. They’re an excellent way of representing how people think — which essentially involves relationships between things, rather than discrete categories of things. It’s also good for bringing connection to information that is disconnected. Got the same information in your records system, and in your web content system, and in your knowledge management system? A topic map can provide a way of connecting them all because it focuses on understanding how these ‘topics’ are inter-related.
My experience with Topic Maps led me to want to create an web engine for creating managing them. That, of course, led me to FCKEditor to edit a topic’s xHTML content, which invariably led me to look at AJAX for editing the content in place, rather than by using complex forms.
I’ve been asked a few times about presenting an example of FCKEditor and edit-in-place. I’ve even posted several articles on my thought process making FCKEditor work as an edit-in-place editor (at first here, then here and here). So, I figured I’d let the world see all this Topic Maps Engine work — I currently call it TopicMapKid (I was going to call it “Bob”, but certain friends didn’t think that name would catch on).
You can find the topic maps engine at www.topicmapkid.com
… maybe I should have a competition on what to call the topic maps engine … I’m sure I have a bottle of wine that’s worth a prize?
M
1 Comment |
fckeditor | Tagged: ajax, fckeditor, javascript, topic maps |
Permalink
Posted by magia3e