weathermap |
Subversion Repositories: |
Rev 13 | Rev 85 | |
---|---|---|
Line 2... | Line 2... | |
|
| |
var newWindow; |
var newWindow; | |
|
||
var helptexts = new Object; |
||
|
| |
// seed the help text. Done in a big lump here, so we could make a foreign language version someday. |
// seed the help text. Done in a big lump here, so we could make a foreign language version someday. | |
|
| |
helptexts.link_target |
var helptexts = { | |
= 'Where should Weathermap get data for this link? This can either be an RRD file, or an HTML with special comments in it (normally from MRTG).'; |
"link_target": 'Where should Weathermap get data for this link? This can either be an RRD file, or an HTML with special comments in it (normally from MRTG).', | |
helptexts.link_width = 'How wide the link arrow will be drawn, in pixels.'; |
"link_width": 'How wide the link arrow will be drawn, in pixels.', | |
helptexts.link_infourl |
"link_infourl": | |
= 'If you are using the \'overlib\' HTML style then this is the URL that will be opened when you click on the link'; |
'If you are using the \'overlib\' HTML style then this is the URL that will be opened when you click on the link', | |
helptexts.link_hover |
"link_hover": | |
= 'If you are using the \'overlib\' HTML style then this is the URL of the image that will be shown when you hover over the link'; |
'If you are using the \'overlib\' HTML style then this is the URL of the image that will be shown when you hover over the link', | |
"link_bandwidth_in": "The bandwidth from the first node to the second node", | ||
"link_bandwidth_out": "The bandwidth from the second node to the first node (if that is different)", | ||
"link_commentin": "The text that will appear alongside the link", | ||
"link_commentout": "The text that will appear alongside the link", | ||
|
| |
helptexts.tb_newfile = 'Change to a different file, or start creating a new one.'; |
"node_infourl": | |
helptexts.tb_addnode = 'Add a new node to the map'; |
'If you are using the \'overlib\' HTML style then this is the URL that will be opened when you click on the node', | |
helptexts.tb_addlink = 'Add a new link to the map, by joining two nodes together.'; |
"node_hover": | |
'If you are using the \'overlib\' HTML style then this is the URL of the image that will be shown when you hover over the node', | ||
"node_x": "How far from the left to position the node, in pixels", | ||
"node_y": "How far from the top to position the node, in pixels", | ||
"node_label": "The text that appears on the node", | ||
"node_new_name": "The name used for this node when defining links", | ||
|
| |
helptexts.hover_tb_newfile = 'Select a different map to edit, or start a new one.'; |
"tb_newfile": 'Change to a different file, or start creating a new one.', | |
"tb_addnode": 'Add a new node to the map', | ||
"tb_addlink": 'Add a new link to the map, by joining two nodes together.', | ||
|
| |
helptexts.link_default = 'This is where help appears for links'; |
||
helptexts.map_default = 'This is where help appears for maps'; |
||
helptexts.node_default = 'This is where help appears for nodes'; |
||
helptexts.tb_defaults = 'or click a Node or Link to edit it\'s properties'; |
||
|
| |
addEvent(window, 'load', initJS); |
"hover_tb_newfile": 'Select a different map to edit, or start a new one.', | |
addEvent(window, 'unload', cleanupJS); |
||
|
| |
function addEvent(obj, evType, fn) |
// These are the default text - what appears when nothing more interesting | |
{ |
// is happening. One for each dialog/location. | |
if (obj.addEventListener) |
"link_default": 'This is where help appears for links', | |
{ |
"map_default": 'This is where help appears for maps', | |
obj.addEventListener(evType, fn, false); |
"node_default": 'This is where help appears for nodes', | |
return true; |
"tb_default": 'or click a Node or Link to edit it\'s properties' | |
} |
}; | |
|
| |
else if (obj.attachEvent) |
jQuery(document).ready(initJS); | |
{ |
jQuery(document).unload(cleanupJS); | |
var r = obj.attachEvent("on" + evType, fn); |
||
return r; |
||
} |
||
|
||
else |
||
{ |
||
return false; |
||
} |
||
} |
||
|
| |
function initJS() |
function initJS() | |
{ |
{ | |
// check if DOM is available, if not, we'll stop here, leaving the warning showing |
// check if DOM is available, if not, we'll stop here, leaving the warning showing | |
if (!document.getElementById || !document.createTextNode || !document.getElementsByTagName) |
if (!document.getElementById || !document.createTextNode || !document.getElementsByTagName) | |
{ |
{ | |
// I'm pretty sure this is actually impossible now. | ||
return; |
return; | |
} |
} | |
|
| |
// check if there is a "No JavaScript" message |
// check if there is a "No JavaScript" message | |
var nojsmsg = document.getElementById('nojs'); |
jQuery("#nojs").hide(); | |
|
||
if (nojsmsg) |
||
{ |
||
nojsmsg.style.display = 'none'; |
||
} |
||
|
| |
// so that's the warning hidden, now let's show the content |
// so that's the warning hidden, now let's show the content | |
|
| |
// check if there is a "with JavaScript" div |
// check if there is a "with JavaScript" div | |
var jsmsg = document.getElementById('withjs'); |
jQuery("#withjs").show(); | |
|
||
if (jsmsg) |
||
{ |
||
jsmsg.style.display = 'block'; |
||
} |
||
|
| |
// if the xycapture element is there, then we are in the main edit screen |
// if the xycapture element is there, then we are in the main edit screen | |
if (document.getElementById('xycapture')) |
if (document.getElementById('xycapture')) | |
{ |
{ | |
attach_click_events(); |
attach_click_events(); | |
Line 92... | Line 78... | |
// This should be cleaning up all the handlers we added in initJS, to avoid killing |
// This should be cleaning up all the handlers we added in initJS, to avoid killing | |
// IE/Win and Safari (at least) over a period of time with memory leaks. |
// IE/Win and Safari (at least) over a period of time with memory leaks. | |
|
| |
} |
} | |
|
| |
function attach_help_events() |
||
{ |
||
var helps; |
||
|
| |
// add an onblur/onfocus handler to all the visible <input> items |
||
helps = document.getElementsByTagName('input'); |
||
|
| |
for (i = 0; i < helps.length; ++i) |
function attach_click_events() | |
{ |
{ | |
if (helps[i].getAttribute('type') != 'hidden') |
||
{ |
||
addEvent(helps[i], 'focus', help_handler); |
||
addEvent(helps[i], 'blur', help_handler); |
||
} |
||
} |
||
|
| |
if (6 == 8) |
jQuery("area[id^=LINK:]").attr("href","#").click(click_handler); | |
{ |
jQuery("area[id^=NODE:]").attr("href","#").click(click_handler); | |
// add an onmousein/onmouseout handler to the toolbar buttons |
jQuery("area[id^=TIMES]").attr("href","#").click(position_timestamp); | |
helps = document.getElementsByTagName('li'); |
jQuery("area[id^=LEGEN]").attr("href","#").click(position_legend); | |
|
| |
for (i = 0; i < helps.length; ++i) |
if(fromplug===1) | |
{ |
{ | |
// alert(helps[i].id.slice(0,3)); |
jQuery("#tb_newfile").click( function() {window.location = "weathermap-cacti-plugin-mgmt.php";} ) | |
//alert(helps[i].className); |
||
if (helps[i].className == 'tb_active') |
||
{ // alert(helps[i].id); |
||
addEvent(helps[i], 'mouseover', mouse_help_handler); |
||
addEvent(helps[i], 'mouseout', mouse_help_handler); |
||
// alert('Attaching to ' + helps[i].className); |
||
} |
||
} |
||
} |
||
} |
} | |
|
else | |
function attach_click_events() |
||
{ |
{ | |
var alt, i; |
jQuery("#tb_newfile").click(new_file); | |
var areas, type; |
} | |
|
| |
areas = document.getElementsByTagName('area'); |
jQuery("#tb_addnode").click(add_node); | |
jQuery("#tb_mapprops").click(map_properties); | ||
jQuery("#tb_mapstyle").click(map_style); | ||
|
| |
for (i = 0; i < areas.length; ++i) |
jQuery("#tb_addlink").click(add_link); | |
{ |
jQuery("#tb_poslegend").click(position_first_legend); | |
alt = areas[i].getAttribute('alt'); |
jQuery("#tb_postime").click(position_timestamp); | |
type = alt.slice(0, 5); |
jQuery("#tb_colours").click(manage_colours); | |
|
| |
if (type == 'LINK:' || type == 'NODE:') |
jQuery("#tb_manageimages").click(manage_images); | |
{ |
jQuery("#tb_prefs").click(prefs); | |
// we add the href so that the browser adds a 'hand' cursor |
||
areas[i].setAttribute('href', '#'); |
||
// and the click_handler does the actual work |
||
addEvent(areas[i], 'click', click_handler); |
||
} |
||
|
| |
if (type == 'TIMES') |
jQuery("#node_move").click(move_node); | |
{ |
jQuery("#node_delete").click(delete_node); | |
areas[i].setAttribute('href', '#'); |
jQuery("#node_clone").click(clone_node); | |
addEvent(areas[i], 'click', position_timestamp); |
jQuery("#node_edit").click(edit_node); | |
} |
||
|
| |
if (type == 'LEGEN') |
jQuery("#link_delete").click(delete_link); | |
{ |
jQuery("#link_edit").click(edit_link); | |
areas[i].setAttribute('href', '#'); |
||
addEvent(areas[i], 'click', position_legend); |
||
} |
||
} |
||
|
| |
addEvent(document.getElementById('tb_newfile'), 'click', new_file); |
jQuery("#link_vert").click(align_link_v); | |
addEvent(document.getElementById('tb_addnode'), 'click', add_node); |
jQuery("#link_horiz").click(align_link_h); | |
addEvent(document.getElementById('tb_mapprops'), 'click', map_properties); |
jQuery("#link_via").click(via_link); | |
addEvent(document.getElementById('tb_mapstyle'), 'click', map_style); |
| |
|
jQuery('.wm_submit').click(do_submit); | |
addEvent(document.getElementById('tb_addlink'), 'click', add_link); |
jQuery('.wm_cancel').click(cancel_op); | |
addEvent(document.getElementById('tb_poslegend'), 'click', position_first_legend); |
||
addEvent(document.getElementById('tb_postime'), 'click', position_timestamp); |
||
addEvent(document.getElementById('tb_colours'), 'click', manage_colours); |
||
addEvent(document.getElementById('tb_manageimages'), 'click', manage_images); |
||
addEvent(document.getElementById('tb_prefs'), 'click', prefs); |
||
|
||
addEvent(document.getElementById('tb_node_cancel'), 'click', cancel_op); |
||
addEvent(document.getElementById('tb_node_submit'), 'click', do_submit); |
||
addEvent(document.getElementById('node_move'), 'click', move_node); |
||
addEvent(document.getElementById('node_delete'), 'click', delete_node); |
||
|
||
addEvent(document.getElementById('tb_link_cancel'), 'click', cancel_op); |
||
addEvent(document.getElementById('tb_link_submit'), 'click', do_submit); |
||
addEvent(document.getElementById('link_delete'), 'click', delete_link); |
||
|
||
addEvent(document.getElementById('tb_map_cancel'), 'click', cancel_op); |
||
addEvent(document.getElementById('tb_map_submit'), 'click', do_submit); |
||
|
||
addEvent(document.getElementById('tb_mapstyle_cancel'), 'click', cancel_op); |
||
addEvent(document.getElementById('tb_mapstyle_submit'), 'click', do_submit); |
||
|
||
addEvent(document.getElementById('tb_colours_cancel'), 'click', cancel_op); |
||
addEvent(document.getElementById('tb_colours_submit'), 'click', do_submit); |
||
|
||
addEvent(document.getElementById('tb_images_cancel'), 'click', cancel_op); |
||
addEvent(document.getElementById('tb_images_submit'), 'click', do_submit); |
||
|
||
var cp = document.getElementById('link_cactipick'); |
||
addEvent(cp, 'click', cactipicker); |
||
cp.setAttribute('href', '#'); |
||
|
| |
cp = document.getElementById('node_cactipick'); |
jQuery('#link_cactipick').click(cactipicker).attr("href","#"); | |
addEvent(cp, 'click', nodecactipicker); |
jQuery('#node_cactipick').click(nodecactipicker).attr("href","#"); | |
cp.setAttribute('href', '#'); |
| |
jQuery('#xycapture').mouseover(function(event) {coord_capture(event);}); | ||
jQuery('#xycapture').mousemove(function(event) {coord_update(event);}); | ||
jQuery('#xycapture').mouseout(function(event) {coord_release(event);}); | ||
| ||
} |
} | |
|
| |
// used by the cancel button on each of the properties dialogs |
// used by the cancel button on each of the properties dialogs | |
function cancel_op() |
function cancel_op() | |
{ |
{ | |
hide_all_dialogs(); |
hide_all_dialogs(); | |
document.frmMain.action.value = ''; |
jQuery("#action").val(""); | |
} |
} | |
|
| |
function help_handler(e) |
function help_handler(e) | |
{ |
{ | |
var el; |
||
|
| |
if (window.event && window.event.srcElement) |
var objectid = jQuery(this).attr('id'); | |
{ |
var section = objectid.slice(0, objectid.indexOf('_')); | |
el = window.event.srcElement; |
var target = section + '_help'; | |
} |
var helptext = "undefined"; | |
|
| |
if (e && e.target) |
if (helptexts[objectid]) { | |
{ |
helptext = helptexts[objectid]; | |
el = e.target; |
} | |
} |
||
|
| |
if (!el) |
if ((e.type == 'blur') || (e.type == 'mouseout')) { | |
{ |
| |
return; |
helptext = helptexts[section + '_default']; | |
} |
||
|
| |
var objectid = el.id; |
if (helptext == 'undefined') { | |
|
||
if ((e.type == 'focus') || (e.type == 'mouseover')) |
||
{ |
||
if (helptexts[objectid]) |
||
{ |
||
var help = helptexts[objectid]; |
||
var target = objectid.slice(0, objectid.indexOf('_')) + '_help'; |
||
|
||
document.getElementById(target).firstChild.nodeValue = help; |
||
|
||
// alert(target); |
||
} |
||
} |
||
|
||
if ((e.type == 'blur') || (e.type == 'mouseout')) |
||
{ |
||
// alert('blurred - figure out default, and apply it.'); |
||
|
||
var section = objectid.slice(0, objectid.indexOf('_')); |
||
var target = section + '_help'; |
||
var help = helptexts[section + '_default']; |
||
|
||
if (help == 'undefined') |
||
{ |
||
alert('OID is: ' + objectid + ' and target is:' + target + ' and section is: ' + section); |
alert('OID is: ' + objectid + ' and target is:' + target + ' and section is: ' + section); | |
} |
} | |
|
| |
document.getElementById(target).firstChild.nodeValue = help; |
||
} |
} | |
} |
||
|
| |
function mouse_help_handler(e) |
if(helptext != "undefined") { | |
{ |
jQuery("#" + target).text(helptext); | |
var el; |
||
|
||
// alert('ddd'); |
||
|
||
if (window.event && window.event.srcElement) |
||
{ |
||
el = window.event.srcElement; |
||
} |
} | |
|
| |
if (e && e.target) |
||
{ |
||
el = e.target; |
||
} |
||
|
||
if (!el) |
||
{ |
||
return; |
||
} |
||
|
||
var objectid = el.firstChild.id; |
||
|
||
if ((e.type == 'focus') || (e.type == 'mouseover')) |
||
{ |
||
if (helptexts[objectid]) |
||
{ |
||
var help = helptexts[objectid]; |
||
var target = objectid.slice(0, objectid.indexOf('_')) + '_help'; |
||
|
||
document.getElementById(target).firstChild.nodeValue = help; |
||
|
||
// alert(target); |
||
} |
||
} |
||
|
||
if ((e.type == 'blur') || (e.type == 'mouseout')) |
||
{ |
||
// alert('blurred - figure out default, and apply it.'); |
||
|
||
var section = objectid.slice(0, objectid.indexOf('_')); |
||
var target = section + '_help'; |
||
var help = helptexts[section + '_default']; |
||
|
||
if (help == 'undefined') |
||
{ |
||
alert('OID is: ' + objectid + ' and target is:' + target + ' and section is: ' + section); |
||
} |
||
|
||
document.getElementById(target).firstChild.nodeValue = help; |
||
} |
||
} |
} | |
|
| |
// Any clicks in the imagemap end up here. |
// Any clicks in the imagemap end up here. | |
function click_handler(e) |
function click_handler(e) | |
{ |
{ | |
var el; |
| |
var alt, objectname, objecttype; |
var alt, objectname, objecttype, objectid; | |
|
| |
if (window.event && window.event.srcElement) |
// alt = el.getAttribute('alt'); | |
{ |
alt = jQuery(this).attr("id"); | |
el = window.event.srcElement; |
||
} |
||
|
||
if (e && e.target) |
||
{ |
||
el = e.target; |
||
} |
||
|
||
if (!el) |
||
{ |
||
return; |
||
} |
||
|
||
alt = el.getAttribute('alt'); |
||
|
| |
objecttype = alt.slice(0, 4); |
objecttype = alt.slice(0, 4); | |
objectname = alt.slice(5, alt.length); |
objectname = alt.slice(5, alt.length); | |
objectid = objectname.slice(0,objectname.length-2); | ||
|
| |
// if we're not in a mode yet... |
// if we're not in a mode yet... | |
if (document.frmMain.action.value === '') |
if (document.frmMain.action.value === '') | |
{ |
{ | |
|
| |
// if we're waiting for a node specifically (e.g. "make link") then ignore links here |
// if we're waiting for a node specifically (e.g. "make link") then ignore links here | |
if (objecttype == 'NODE') |
if (objecttype == 'NODE') | |
{ |
{ | |
show_node(objectname); |
// chop off the suffix | |
// objectid = objectname.slice(0,objectname.length-2); | ||
objectname = NodeIDs[objectid]; | ||
show_node(objectname); | ||
} |
} | |
|
| |
if (objecttype == 'LINK') |
if (objecttype == 'LINK') | |
{ |
{ | |
show_link(objectname); |
// chop off the suffix | |
// objectid = objectname.slice(0,objectname.length-2); | ||
objectname = LinkIDs[objectid]; | ||
show_link(objectname); | ||
} |
} | |
} |
} | |
|
| |
// we've got a command queued, so do the appropriate thing |
// we've got a command queued, so do the appropriate thing | |
else |
else | |
{ |
{ | |
if (objecttype == 'NODE' && document.getElementById('action').value == 'add_link') |
if (objecttype == 'NODE' && document.getElementById('action').value == 'add_link') | |
{ |
{ | |
document.getElementById('param').value = objectname; |
document.getElementById('param').value = NodeIDs[objectid]; | |
document.frmMain.submit(); |
document.frmMain.submit(); | |
} |
} | |
|
| |
else if (objecttype == 'NODE' && document.getElementById('action').value == 'add_link2') |
else if (objecttype == 'NODE' && document.getElementById('action').value == 'add_link2') | |
{ |
{ | |
document.getElementById('param').value = objectname; |
document.getElementById('param').value = NodeIDs[objectid]; | |
document.frmMain.submit(); |
document.frmMain.submit(); | |
} |
} | |
|
| |
else |
else | |
{ |
{ | |
Line 393... | Line 241... | |
function cactipicker() |
function cactipicker() | |
{ |
{ | |
// make sure it isn't already opened |
// make sure it isn't already opened | |
if (!newWindow || newWindow.closed) |
if (!newWindow || newWindow.closed) | |
{ |
{ | |
newWindow = window.open("", "cactipicker", "status,scrollbars=yes,height=400,width=400"); |
newWindow = window.open("", "cactipicker", "scrollbars=1,status=1,height=400,width=400,resizable=1"); | |
} |
} | |
|
| |
else if (newWindow.focus) |
else if (newWindow.focus) | |
{ |
{ | |
// window is already open and focusable, so bring it to the front |
// window is already open and focusable, so bring it to the front | |
newWindow.focus(); |
newWindow.focus(); | |
} |
} | |
|
| |
// newWindow.location = "cacti-pick.php?command=link_step1"; | ||
newWindow.location = "cacti-pick.php?command=link_step1"; |
newWindow.location = "cacti-pick.php?command=link_step1"; | |
} |
} | |
|
| |
|
| |
function nodecactipicker() |
function nodecactipicker() | |
{ |
{ | |
// make sure it isn't already opened |
// make sure it isn't already opened | |
if (!newWindow || newWindow.closed) |
if (!newWindow || newWindow.closed) | |
{ |
{ | |
newWindow = window.open("", "cactipicker", "status,scrollbars=yes,height=400,width=400"); |
newWindow = window.open("", "cactipicker", "scrollbars=1,status=1,height=400,width=400,resizable=1"); | |
} |
} | |
|
| |
else if (newWindow.focus) |
else if (newWindow.focus) | |
{ |
{ | |
// window is already open and focusable, so bring it to the front |
// window is already open and focusable, so bring it to the front | |
Line 457... | Line 306... | |
show_dialog('dlgImages'); |
show_dialog('dlgImages'); | |
} |
} | |
|
| |
function prefs() |
function prefs() | |
{ |
{ | |
alert("Not Yet"); |
hide_all_dialogs(); | |
document.getElementById('action').value = "editor_settings"; | ||
show_dialog('dlgEditorSettings'); | ||
} |
} | |
|
| |
function default_toolbar() |
function default_toolbar() | |
{ |
{ | |
} |
} | |
Line 510... | Line 361... | |
{ |
{ | |
document.getElementById('action').value = "delete_node"; |
document.getElementById('action').value = "delete_node"; | |
document.frmMain.submit(); |
document.frmMain.submit(); | |
} |
} | |
} |
} | |
| ||
function clone_node() | ||
{ | ||
document.getElementById('action').value = "clone_node"; | ||
document.frmMain.submit(); | ||
} | ||
| ||
function edit_node() | ||
{ | ||
document.getElementById('action').value = "edit_node"; | ||
show_itemtext('node',document.frmMain.node_name.value); | ||
// document.frmMain.submit(); | ||
} | ||
| ||
function edit_link() | ||
{ | ||
document.getElementById('action').value = "edit_link"; | ||
show_itemtext('link',document.frmMain.link_name.value); | ||
// document.frmMain.submit(); | ||
} | ||
|
| |
function move_node() |
function move_node() | |
{ |
{ | |
hide_dialog('dlgNodeProperties'); |
hide_dialog('dlgNodeProperties'); | |
document.getElementById('tb_help').innerText = 'Click on the map where you would like to move the node to.'; |
document.getElementById('tb_help').innerText = 'Click on the map where you would like to move the node to.'; | |
document.getElementById('action').value = "move_node"; |
document.getElementById('action').value = "move_node"; | |
mapmode('xy'); |
mapmode('xy'); | |
} |
} | |
|
| |
function via_link() | ||
{ | ||
hide_dialog('dlgLinkProperties'); | ||
document.getElementById('tb_help').innerText = 'Click on the map via which point you whant to redirect link.'; | ||
document.getElementById('action').value = "via_link"; | ||
mapmode('xy'); | ||
} | ||
| ||
function add_link() |
function add_link() | |
{ |
{ | |
document.getElementById('tb_help').innerText = 'Click on the first node for one end of the link.'; |
document.getElementById('tb_help').innerText = 'Click on the first node for one end of the link.'; | |
document.getElementById('action').value = "add_link"; |
document.getElementById('action').value = "add_link"; | |
mapmode('existing'); |
mapmode('existing'); | |
Line 542... | Line 421... | |
mapmode('existing'); |
mapmode('existing'); | |
|
| |
hide_all_dialogs(); |
hide_all_dialogs(); | |
document.getElementById('action').value = "set_map_properties"; |
document.getElementById('action').value = "set_map_properties"; | |
show_dialog('dlgMapProperties'); |
show_dialog('dlgMapProperties'); | |
document.getElementById('map_title').focus(); | ||
} |
} | |
|
| |
function map_style() |
function map_style() | |
{ |
{ | |
mapmode('existing'); |
mapmode('existing'); | |
|
| |
hide_all_dialogs(); |
hide_all_dialogs(); | |
document.getElementById('action').value = "set_map_style"; |
document.getElementById('action').value = "set_map_style"; | |
show_dialog('dlgMapStyle'); |
show_dialog('dlgMapStyle'); | |
document.getElementById('mapstyle_linklabels').focus(); | ||
} |
} | |
|
| |
function position_timestamp() |
function position_timestamp() | |
{ |
{ | |
document.getElementById('tb_help').innerText = 'Click on the map where you would like to put the timestamp.'; |
document.getElementById('tb_help').innerText = 'Click on the map where you would like to put the timestamp.'; | |
Line 588... | Line 469... | |
{ |
{ | |
return; |
return; | |
} |
} | |
|
| |
// we need to figure out WHICH legend, nowadays |
// we need to figure out WHICH legend, nowadays | |
alt = el.getAttribute('alt'); |
//alt = el.getAttribute('alt'); | |
alt = el.id; | ||
|
| |
// objecttype = alt.slice(0, 5); |
// objecttype = alt.slice(0, 5); | |
objectname = alt.slice(7, alt.length); |
objectname = alt.slice(7, alt.length); | |
|
| |
real_position_legend(objectname); |
real_position_legend(objectname); | |
Line 607... | Line 489... | |
{ |
{ | |
document.getElementById('tb_help').innerText = 'Click on the map where you would like to put the legend.'; |
document.getElementById('tb_help').innerText = 'Click on the map where you would like to put the legend.'; | |
document.getElementById('action').value = "place_legend"; |
document.getElementById('action').value = "place_legend"; | |
document.getElementById('param').value = scalename; |
document.getElementById('param').value = scalename; | |
mapmode('xy'); |
mapmode('xy'); | |
} | ||
| ||
function show_itemtext(itemtype,name) | ||
{ | ||
var found = -1; | ||
mapmode('existing'); | ||
| ||
hide_all_dialogs(); | ||
| ||
// $('#dlgNodeProperties').block(); | ||
| ||
// $.blockUI.defaults.elementMessage = 'Please Wait'; | ||
| ||
jQuery('textarea#item_configtext').val(''); | ||
| ||
if(itemtype==='node') | ||
{ | ||
jQuery('#action').val('set_node_config'); | ||
} | ||
| ||
if(itemtype==='link') | ||
{ | ||
jQuery('#action').val('set_link_config'); | ||
} | ||
show_dialog('dlgTextEdit'); | ||
| ||
// $('#item_configtext').block(); | ||
| ||
jQuery.ajax( { type: "GET", | ||
url: 'editor.php', | ||
data: {action: 'fetch_config', | ||
item_type: itemtype, | ||
item_name: name, | ||
mapname: document.frmMain.mapname.value}, | ||
success: function(text) { | ||
jQuery('#item_configtext').val(text); | ||
document.getElementById('item_configtext').focus(); | ||
// jQuery('#dlgTextEdit').unblock(); | ||
} | ||
} ); | ||
} |
} | |
|
| |
function show_node(name) |
function show_node(name) | |
{ |
{ | |
var found = -1; |
var found = -1; | |
Line 623... | Line 545... | |
if (mynode) |
if (mynode) | |
{ |
{ | |
document.frmMain.action.value = "set_node_properties"; |
document.frmMain.action.value = "set_node_properties"; | |
document.frmMain.node_name.value = name; |
document.frmMain.node_name.value = name; | |
document.frmMain.node_new_name.value = name; |
document.frmMain.node_new_name.value = name; | |
| ||
document.frmMain.node_x.value = mynode.x; | ||
document.frmMain.node_y.value = mynode.y; | ||
|
| |
document.frmMain.node_name.value = mynode.name; |
document.frmMain.node_name.value = mynode.name; | |
document.frmMain.node_new_name.value = mynode.name; |
document.frmMain.node_new_name.value = mynode.name; | |
document.frmMain.node_label.value = mynode.label; |
document.frmMain.node_label.value = mynode.label; | |
document.frmMain.node_infourl.value = mynode.infourl; |
document.frmMain.node_infourl.value = mynode.infourl; | |
document.frmMain.node_hover.value = mynode.overliburl; |
document.frmMain.node_hover.value = mynode.overliburl; | |
|
| |
if(mynode.iconfile != '') |
if(mynode.iconfile != '') | |
{ |
{ | |
document.frmMain.node_iconfilename.value = mynode.iconfile; |
// console.log(mynode.iconfile.substring(0,2)); | |
if(mynode.iconfile.substring(0,2)=='::') | ||
{ | ||
document.frmMain.node_iconfilename.value = '--AICON--'; | ||
} | ||
else | ||
{ | ||
document.frmMain.node_iconfilename.value = mynode.iconfile; | ||
} | ||
} |
} | |
else |
else | |
{ |
{ | |
document.frmMain.node_iconfilename.value = '--NONE--'; |
document.frmMain.node_iconfilename.value = '--NONE--'; | |
} |
} | |
|
||
|
| |
// save this here, just in case they choose delete_node or move_node |
// save this here, just in case they choose delete_node or move_node | |
document.getElementById('param').value = mynode.name; |
document.getElementById('param').value = mynode.name; | |
|
| |
show_dialog('dlgNodeProperties'); |
show_dialog('dlgNodeProperties'); | |
document.getElementById('node_new_name').focus(); | ||
} |
} | |
} |
} | |
|
| |
function show_link(name) |
function show_link(name) | |
{ |
{ | |
Line 679... | Line 612... | |
} |
} | |
|
| |
document.frmMain.link_infourl.value = mylink.infourl; |
document.frmMain.link_infourl.value = mylink.infourl; | |
document.frmMain.link_hover.value = mylink.overliburl; |
document.frmMain.link_hover.value = mylink.overliburl; | |
|
| |
document.frmMain.link_commentin.value = mylink.commentin; | ||
document.frmMain.link_commentout.value = mylink.commentout; | ||
document.frmMain.link_commentposin.value = mylink.commentposin; | ||
document.frmMain.link_commentposout.value = mylink.commentposout; | ||
| ||
// if that didn't "stick", then we need to add the special value | ||
if( jQuery('#link_commentposout').val() != mylink.commentposout) | ||
{ | ||
jQuery('#link_commentposout').prepend("<option selected value='" + mylink.commentposout + "'>" + mylink.commentposout + "%</option>"); | ||
} | ||
| ||
if( jQuery('#link_commentposin').val() != mylink.commentposin) | ||
{ | ||
jQuery('#link_commentposin').prepend("<option selected value='" + mylink.commentposin + "'>" + mylink.commentposin + "%</option>"); | ||
} | ||
| ||
document.getElementById('link_nodename1').firstChild.nodeValue = mylink.a; |
document.getElementById('link_nodename1').firstChild.nodeValue = mylink.a; | |
document.getElementById('link_nodename1a').firstChild.nodeValue = mylink.a; |
document.getElementById('link_nodename1a').firstChild.nodeValue = mylink.a; | |
document.getElementById('link_nodename1b').firstChild.nodeValue = mylink.a; |
document.getElementById('link_nodename1b').firstChild.nodeValue = mylink.a; | |
|
| |
document.getElementById('link_nodename2').firstChild.nodeValue = mylink.b; |
document.getElementById('link_nodename2').firstChild.nodeValue = mylink.b; | |
Line 690... | Line 639... | |
document.getElementById('param').value = mylink.name; |
document.getElementById('param').value = mylink.name; | |
|
| |
document.frmMain.action.value = "set_link_properties"; |
document.frmMain.action.value = "set_link_properties"; | |
|
| |
show_dialog('dlgLinkProperties'); |
show_dialog('dlgLinkProperties'); | |
document.getElementById('link_bandwidth_in').focus(); | ||
} |
} | |
} |
} | |
|
| |
function show_dialog(dlg) |
function show_dialog(dlg) | |
{ |
{ | |
Line 712... | Line 662... | |
function hide_all_dialogs() |
function hide_all_dialogs() | |
{ |
{ | |
hide_dialog('dlgMapProperties'); |
hide_dialog('dlgMapProperties'); | |
hide_dialog('dlgMapStyle'); |
hide_dialog('dlgMapStyle'); | |
hide_dialog('dlgLinkProperties'); |
hide_dialog('dlgLinkProperties'); | |
hide_dialog('dlgTextEdit'); | ||
hide_dialog('dlgNodeProperties'); |
hide_dialog('dlgNodeProperties'); | |
hide_dialog('dlgColours'); |
hide_dialog('dlgColours'); | |
hide_dialog('dlgImages'); |
hide_dialog('dlgImages'); | |
hide_dialog('dlgEditorSettings'); | ||
} |
} | |
|
| |
function ElementPosition(param){ | ||
var x=0, y=0; | ||
var obj = (typeof param == "string") ? document.getElementById(param) : param; | ||
if (obj) { | ||
x = obj.offsetLeft; | ||
y = obj.offsetTop; | ||
var body = document.getElementsByTagName('body')[0]; | ||
while (obj.offsetParent && obj!=body){ | ||
x += obj.offsetParent.offsetLeft; | ||
y += obj.offsetParent.offsetTop; | ||
obj = obj.offsetParent; | ||
} | ||
} | ||
this.x = x; | ||
this.y = y; | ||
} | ||
| ||
function coord_capture(event) | ||
{ | ||
// $('#tb_coords').html('+++'); | ||
} | ||
| ||
function coord_update(event) | ||
{ | ||
var cursorx = event.pageX; | ||
var cursory = event.pageY; | ||
| ||
// Adjust for coords relative to the image, not the document | ||
var p = new ElementPosition('xycapture'); | ||
cursorx -= p.x; | ||
cursory -= p.y; | ||
cursory++; // fudge to make coords match results from imagemap (not sure why this is needed) | ||
| ||
jQuery('#tb_coords').html('Position<br />'+ cursorx + ', ' + cursory); | ||
} | ||
| ||
function coord_release(event) | ||
{ | ||
jQuery('#tb_coords').html('Position<br />---, ---'); | ||
} | ||
| ||
function align_link_h() | ||
{ | ||
document.getElementById('action').value = "link_align_horizontal"; | ||
document.frmMain.submit(); | ||
} | ||
| ||
function align_link_v() | ||
{ | ||
document.getElementById('action').value = "link_align_vertical"; | ||
document.frmMain.submit(); | ||
} | ||
| ||
function attach_help_events() | ||
{ | ||
// add an onblur/onfocus handler to all the visible <input> items | ||
| ||
jQuery("input").focus(help_handler).blur(help_handler); | ||
} |