mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-02-16 10:40:57 +00:00
Change script location.
Split js code. Added cache and changed loading mechanism for js sources.
This commit is contained in:
94
script/features/saved_graph_image_handler/index.js
Normal file
94
script/features/saved_graph_image_handler/index.js
Normal file
@@ -0,0 +1,94 @@
|
||||
doInclude ([
|
||||
include ("features/base_handler/index.js")
|
||||
])
|
||||
|
||||
/**
|
||||
* Save dialog Graph handler.
|
||||
*
|
||||
*/
|
||||
function SavedDialogGraphImageHandler(app)
|
||||
{
|
||||
BaseHandler.apply(this, arguments);
|
||||
this.message = "";
|
||||
this.imageName = "";
|
||||
}
|
||||
|
||||
// inheritance.
|
||||
SavedDialogGraphImageHandler.prototype = Object.create(BaseHandler.prototype);
|
||||
// First selected.
|
||||
SavedDialogGraphImageHandler.prototype.firstObject = null;
|
||||
// Path
|
||||
SavedDialogGraphImageHandler.prototype.pathObjects = null;
|
||||
// Objects.
|
||||
SavedDialogGraphImageHandler.prototype.objects = null;
|
||||
|
||||
SavedDialogGraphImageHandler.prototype.showDialogCallback = function (imageExtension)
|
||||
{
|
||||
var dialogButtons = {};
|
||||
|
||||
dialogButtons[g_close] = function() {
|
||||
$( this ).dialog( "close" );
|
||||
};
|
||||
|
||||
var fileLocation = "tmp/saved/" + this.imageName.substr(0, 2) + "/"+ this.imageName + "." + imageExtension
|
||||
|
||||
document.getElementById("showSavedImageGraph").src = "/" + fileLocation;
|
||||
document.getElementById("showSavedImageGraphRef").href = "/" + fileLocation;
|
||||
//document.getElementById("showSavedImageGraph").src = document.getElementById("showSavedImageGraph").src.replace(/tmp\/saved\/([A-Za-z]*)\/([A-Za-z]*).png/g, fileLocation);
|
||||
document.getElementById("ShareSavedImageGraph").innerHTML =
|
||||
document.getElementById("ShareSavedImageGraph").innerHTML.replace(/tmp\/saved\/([A-Za-z]*)\/([A-Za-z]*).png/g, fileLocation);
|
||||
|
||||
document.getElementById("SaveImageLinks").innerHTML =
|
||||
document.getElementById("SaveImageLinks").innerHTML.replace(/tmp\/saved\/([A-Za-z]*)\/([A-Za-z]*).png/g, fileLocation);
|
||||
|
||||
$( "#saveImageDialog" ).dialog({
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: "auto",
|
||||
modal: true,
|
||||
title: g_save_image_dialog,
|
||||
buttons: dialogButtons,
|
||||
dialogClass: 'EdgeDialog'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
SavedDialogGraphImageHandler.prototype.showWorkspace = function()
|
||||
{
|
||||
var object = this;
|
||||
var callback = function() {
|
||||
object.showDialogCallback("png");
|
||||
};
|
||||
|
||||
this.imageName = this.app.SaveGraphImageOnDisk(callback);
|
||||
}
|
||||
|
||||
SavedDialogGraphImageHandler.prototype.showFullgraph = function()
|
||||
{
|
||||
var object = this;
|
||||
var callback = function() {
|
||||
object.showDialogCallback("png");
|
||||
};
|
||||
|
||||
this.imageName = this.app.SaveFullGraphImageOnDisk(callback, false);
|
||||
}
|
||||
|
||||
SavedDialogGraphImageHandler.prototype.showPrint = function()
|
||||
{
|
||||
var object = this;
|
||||
var callback = function() {
|
||||
object.showDialogCallback("png");
|
||||
};
|
||||
|
||||
this.imageName = this.app.SaveFullGraphImageOnDisk(callback, true);
|
||||
}
|
||||
|
||||
SavedDialogGraphImageHandler.prototype.showSvg = function()
|
||||
{
|
||||
var object = this;
|
||||
var callback = function() {
|
||||
object.showDialogCallback("svg");
|
||||
};
|
||||
|
||||
this.imageName = this.app.SaveSVGGraphOnDisk(callback);
|
||||
}
|
||||
Reference in New Issue
Block a user