mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 15:26:12 +00:00
95 lines
2.9 KiB
JavaScript
95 lines
2.9 KiB
JavaScript
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);
|
|
}
|