Commit 3374178f authored by Marcel's avatar Marcel
Browse files

Make the vispa object global as 'Vispa', adjust extensions except PxlBrowser and Terminal.

parent cc8489f1
var AugerOfflineExtension = ExtensionBase.extend({
init : function(vispa) {
this._super(vispa);
init : function() {
this._super();
this.name = 'augeroffline';
this.factories = {
full : new AugerOfflineFactory(this._vispa)
full : new AugerOfflineFactory()
};
}
});
var AugerOfflineFactory = ExtensionFactoryFull.extend({
init : function(vispa) {
this._super(vispa);
init : function() {
this._super();
var _this = this;
this.name = 'AugerOffline';
......@@ -114,7 +114,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
_logger.debug(index, "[" + moduleName + "," + extraInfo + "]");
});
$.ajax({
url : _this._vispa.urlHandler
url : Vispa.urlHandler
.dynamic("extensions/augeroffline/setModuleSequence"),
type : "POST",
data : JSON.stringify({
......@@ -128,7 +128,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
var _this = this;
var request = $
.ajax({
url : _this._vispa.urlHandler.dynamic("extensions/augeroffline/loadModuleSequence"),
url : Vispa.urlHandler.dynamic("extensions/augeroffline/loadModuleSequence"),
type : "POST",
data : {
path : "/home/cglaser/software/Offline/share/auger-offline/doc/ExampleApplications/RdHybridReconstruction/ModuleSequence.xml"
......@@ -241,7 +241,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
showModuleOptions: function(moduleName) {
var _this = this;
var request = $.ajax({
url : _this._vispa.urlHandler
url : Vispa.urlHandler
.dynamic("extensions/augeroffline/getModuleOptions"),
type : "POST",
data : {
......@@ -433,8 +433,8 @@ var AugerOfflineContent = ExtensionContentFull.extend({
init : function(vispa, config) {
this._super(vispa, config);
init : function(config) {
this._super(config);
var _this = this;
// attributes
......@@ -486,7 +486,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
if (changedModuleOptions.length > 0) {
_logger.debug(JSON.stringify(changedModuleOptions));
var request = $.ajax({
url : _this._vispa.urlHandler
url : Vispa.urlHandler
.dynamic("extensions/augeroffline/setModuleOptions"),
type : "POST",
data : JSON.stringify({
......@@ -559,7 +559,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
addModuleList: function(listOfModules, category, listModuleSequence) {
var _this = this;
var request = $.ajax({
url : _this._vispa.urlHandler
url : Vispa.urlHandler
.dynamic("extensions/augeroffline/getListOfModules"),
data: {
category: category
......@@ -599,7 +599,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
// this._config.backgroundColor);
var request = $
.ajax({
url : this._vispa.urlHandler.dynamic("extensions/augeroffline/initialize"),
url : Vispa.urlHandler.dynamic("extensions/augeroffline/initialize"),
type : "POST",
data : {
moduleConfig : $.parseJSON(this._config.moduleConfig)
......@@ -649,7 +649,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
var request_initialize =
$.ajax({
url : this._vispa.urlHandler.dynamic("extensions/augeroffline/initialize"),
url : Vispa.urlHandler.dynamic("extensions/augeroffline/initialize"),
type : "POST",
async: true,
data : JSON.stringify({
......@@ -675,7 +675,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
var AugerOfflinePath = "";
var request_userAugerOffline =
$.ajax({
url : _this._vispa.urlHandler.dynamic("extensions/augeroffline/get_auger_offline_path"),
url : Vispa.urlHandler.dynamic("extensions/augeroffline/get_auger_offline_path"),
type : "POST"
});
$.when(request_userAugerOffline)
......@@ -969,7 +969,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
// {command:"/bin/sleep 5", arguments: [], outputPath: ""},
];
_this._vispa.extensionManager.getFactory("jobsubmission", "jobmanagement")._create({jobs:jobs});
Vispa.extensionManager.getFactory("jobsubmission", "jobmanagement")._create({jobs:jobs});
}).css({
"padding" : 5
}).appendTo(divButton);
......@@ -992,7 +992,7 @@ var AugerOfflineContent = ExtensionContentFull.extend({
}
]);
_logger.debug("{command:executeOffline.py, optionList:"+optionList+"}");
_this._vispa.extensionManager.getFactory("jobdesigner", "jobmanagement")._create({command:"executeOffline.py", optionList:optionList});
Vispa.extensionManager.getFactory("jobdesigner", "jobmanagement")._create({command:"executeOffline.py", optionList:optionList});
}).css({
"padding" : 5
}).appendTo(divButton);
......
......@@ -171,43 +171,43 @@ var CodeEditor = Class.extend({
// the next commands are hardcoded and defined by the vispa gui
// preferenceView.toggle
{
bindKey: this.instance._vispa.preferenceView.settings.shortcut,
bindKey: Vispa.preferenceView.settings.shortcut,
exec: function() {
_this.instance._vispa.preferenceView.toggle();
Vispa.preferenceView.toggle();
}
},
// commandPalette.toggle
{
bindKey: this.instance._vispa.commandPalette.settings.shortcut,
bindKey: Vispa.commandPalette.settings.shortcut,
exec: function() {
_this.instance._vispa.commandPalette.toggle();
Vispa.commandPalette.toggle();
}
},
// workspaceManager.openConfigure
{
bindKey: this.instance._vispa.workspaceManager.settings.openShortcut,
bindKey: Vispa.workspaceManager.settings.openShortcut,
exec: function() {
_this.instance._vispa.workspaceManager.openConfigure();
Vispa.workspaceManager.openConfigure();
}
},
// extensionView.goToFullInstance
{
bindKey: this.instance._vispa.extensionView.settings.shortcuts.shiftLeft,
bindKey: Vispa.extensionView.settings.shortcuts.shiftLeft,
exec: function() {
_this.instance._vispa.extensionView.goToFullInstance(false);
Vispa.extensionView.goToFullInstance(false);
}
}, {
bindKey: this.instance._vispa.extensionView.settings.shortcuts.shiftRight,
bindKey: Vispa.extensionView.settings.shortcuts.shiftRight,
exec: function() {
_this.instance._vispa.extensionView.goToFullInstance(true);
Vispa.extensionView.goToFullInstance(true);
}
}];
// dynamically add the extensionView.goToFullInstance commands
$.each([1, 2, 3, 4, 5, 6, 7, 8, 9], function(i, key) {
cmds.push({
bindKey: $.Helpers.strFormat(_this.instance._vispa.extensionView.settings.shortcuts.shiftTemplate, key),
bindKey: $.Helpers.strFormat(Vispa.extensionView.settings.shortcuts.shiftTemplate, key),
exec: function() {
_this.instance._vispa.extensionView.goToFullInstance(key);
Vispa.extensionView.goToFullInstance(key);
}
});
});
......
var CodeEditorExtension = ExtensionBase.extend({
init: function(vispa) {
this._super(vispa);
init: function() {
this._super();
var _this = this;
this.name = 'codeeditor';
this.factories = {
full: new CodeEditorFullFactory(this._vispa)
full: new CodeEditorFullFactory()
};
}
});
var CodeEditorFullFactory = ExtensionFactoryFull.extend({
init: function(vispa) {
this._super(vispa);
init: function() {
this._super();
var _this = this;
this.defaultConfig = {
......@@ -70,8 +70,8 @@ var CodeEditorFullFactory = ExtensionFactoryFull.extend({
var CodeEditorFullContent = ExtensionContentFull.extend({
init: function(vispa, config, path) {
this._super(vispa, config);
init: function(config, path) {
this._super(config);
var _this = this;
this.menuEntries = [{
......
var DummyExtension = ExtensionBase.extend({
init: function(vispa) {
this._super(vispa);
init: function() {
this._super();
var _this = this;
this.name = 'dummy';
this.factories = {
full: new DummyFactory(this._vispa)
full: new DummyFactory()
};
}
});
var DummyFactory = ExtensionFactoryFull.extend({
init: function(vispa) {
this._super(vispa);
init: function() {
this._super();
var _this = this;
this.defaultConfig = {
......@@ -66,8 +66,8 @@ var DummyFactory = ExtensionFactoryFull.extend({
var DummyContent = ExtensionContentFull.extend({
init: function(vispa, config, path) {
this._super(vispa, config);
init: function(config, path) {
this._super(config);
var _this = this;
this.path = path;
......
......@@ -11,7 +11,7 @@ var FileBrowserActions = FileBaseActions.extend({
var ext = data.extension;
var path = data.path;
var handlers = this.owner.instance._vispa.extensionManager.getFileHandlers(ext, true);
var handlers = Vispa.extensionManager.getFileHandlers(ext, true);
if (handlers.length == 0) {
alert("Can not open File, because no Extension has been defined.")
......@@ -28,6 +28,6 @@ var FileBrowserActions = FileBaseActions.extend({
var url = $(location).attr('href');
url = encodeURI(url.slice(0,url.lastIndexOf("="))+"="+data.path);
$.Helpers.changeUrl(url);
this.owner.instance._vispa.pathBar.setValue(data.path);
Vispa.pathBar.setValue(data.path);
}
});
\ No newline at end of file
......@@ -3,7 +3,7 @@ var FileBrowser = FileBase.extend({
init: function(instance, path) {
// use urlHandler.dynamic as urlFormatter
var formatter = function(_path) {
return instance._vispa.urlHandler.dynamic(_path);
return Vispa.urlHandler.dynamic(_path);
}
this._super(path, formatter);
this.instance = instance;
......
var FileBrowserExtension = ExtensionBase.extend({
init: function(vispa) {
this._super(vispa);
init: function() {
this._super();
var _this = this;
this.name = 'filebrowser';
this.factories = {
full: new FileBrowserFactory(this._vispa)
full: new FileBrowserFactory()
};
}
});
var FileBrowserFactory = ExtensionFactoryFull.extend({
init: function(vispa) {
this._super(vispa);
init: function() {
this._super();
var _this = this;
this.defaultConfig = {};
......@@ -46,8 +46,8 @@ var FileBrowserFactory = ExtensionFactoryFull.extend({
var FileBrowserContent = ExtensionContentFull.extend({
init: function(vispa, config, path) {
this._super(vispa, config);
init: function(config, path) {
this._super(config);
var _this = this;
this.menuEntries = [
......
......@@ -46,9 +46,9 @@ var JobAjaxHandler = Class.extend({
// default is true
var basicrequest = {
type : 'POST',
url : this.owner.owner._vispa.extensionManager.getPath(this.owner.owner, controllermethod),
url : Vispa.extensionManager.getPath(this.owner.owner, controllermethod),
// url:
// vispa.extensionManager.getAjaxPath(_this.owner.owner._config._ext.name,
// Vispa.extensionManager.getAjaxPath(_this.owner.owner._config._ext.name,
// controllermethod),
async : (typeof async == 'undefined' ? true : async)
};
......
var JobmanagementExtension = ExtensionBase.extend({
init : function(vispa) {
this._super(vispa);
init : function() {
this._super();
var _this = this;
this.name = 'jobmanagement';
this.factories = {
jobdashboard : new JobDashboardFactory(this._vispa),
jobdesigner : new JobDesignerFactory(this._vispa),
jobsubmission : new JobSubmissionFactory(this._vispa)
jobdashboard : new JobDashboardFactory(),
jobdesigner : new JobDesignerFactory(),
jobsubmission : new JobSubmissionFactory()
};
}
});
var JobDashboardFactory = ExtensionFactoryFull.extend({
init : function(vispa) {
this._super(vispa);
init : function() {
this._super();
var _this = this;
this.name = 'JobDashboard';
......@@ -56,8 +56,8 @@ var JobDashboardFactory = ExtensionFactoryFull.extend({
var JobDashboardContent = ExtensionContentFull.extend({
init : function(vispa, config, path) {
this._super(vispa, config);
init : function(config, path) {
this._super(config);
var _this = this;
this.path = path;
......@@ -103,8 +103,8 @@ var JobDashboardContent = ExtensionContentFull.extend({
var JobSubmissionFactory = ExtensionFactoryFull.extend({
init : function(vispa) {
this._super(vispa);
init : function() {
this._super();
var _this = this;
this.name = 'JobSubmission';
......@@ -122,8 +122,8 @@ var JobSubmissionFactory = ExtensionFactoryFull.extend({
var JobSubmissionContent = ExtensionContentFull.extend({
init : function(vispa, config, args) {
this._super(vispa, config);
init : function(config, args) {
this._super(config);
var _this = this;
// deferred object
......@@ -158,8 +158,8 @@ var JobSubmissionContent = ExtensionContentFull.extend({
var JobDesignerFactory = ExtensionFactoryFull.extend({
init : function(vispa) {
this._super(vispa);
init : function() {
this._super();
var _this = this;
this.name = 'JobDesigner';
......@@ -177,8 +177,8 @@ var JobDesignerFactory = ExtensionFactoryFull.extend({
var JobDesignerContent = ExtensionContentFull.extend({
init : function(vispa, config, args) {
this._super(vispa, config);
init : function(config, args) {
this._super(config);
var _this = this;
this.args = args;
......@@ -366,7 +366,7 @@ var JobDesignerContent = ExtensionContentFull.extend({
/*
* enableSaveButton = function(){
* vispa.view.menus.getItem("toolbar-extmenu-content",
* Vispa.view.menus.getItem("toolbar-extmenu-content",
* "Save").set("disabled", false); },
*/
......
......@@ -834,7 +834,7 @@ var JobDesignerTabView = Class
});
});
var tabExtension_instance = vispa.extensionManager.createInstance('jobmanagement', 'jobSubmissionTab', {
var tabExtension_instance = Vispa.extensionManager.createInstance('jobmanagement', 'jobSubmissionTab', {
dfd : dfd,
jobs : jobs
});
......
var CommandPalette = VispaModule.extend({
init: function(vispa, config) {
init: function(config) {
this.defaultConfig = {
autoSuggest: {
descr: 'Show suggestions when the search field is empty?',
......@@ -8,7 +8,7 @@ var CommandPalette = VispaModule.extend({
value: true
}
};
this._super(vispa, 'commandPalette', this.defaultConfig, config);
this._super('commandPalette', this.defaultConfig, config);
// attributes
this.preferenceSettings = {priority: 6};
......@@ -172,7 +172,7 @@ var CommandPalette = VispaModule.extend({
if (empty) {
return this;
}
this.vispa.view.hideFrames();
Vispa.view.hideFrames();
var position = ['center', $('#header').height() + this.settings.headerOffset];
$(this.nodes.dialog).dialog('option', 'position', position).dialog('close').dialog('open');
window.setTimeout(function() {
......
var ExtensionManager = VispaModule.extend({
init: function(vispa, config, extensionConfig) {
init: function(config, extensionConfig) {
this.defaultConfig = {
reuseInstances: {
descr: 'When creating a new instance, use an existing one if they have the same identifier (i.e. path, etc)?',
......@@ -8,7 +8,7 @@ var ExtensionManager = VispaModule.extend({
value: true
}
};
this._super(vispa, 'extensionManager', this.defaultConfig, config);
this._super('extensionManager', this.defaultConfig, config);
// attributes
this.preferenceSettings = {
......@@ -83,7 +83,7 @@ var ExtensionManager = VispaModule.extend({
},
register: function(cls) {
extension = new cls(this.vispa);
extension = new cls();
if (!extension.name) {
var msg = 'Tried to register an Extension without a name!';
......@@ -200,7 +200,7 @@ var ExtensionManager = VispaModule.extend({
var show = true;
// don't show it if the current full instance has the same factory
// and the same identifier
var ci = this.getInstance(this.vispa.extensionView.workflow.currentFullInstance);
var ci = this.getInstance(Vispa.extensionView.workflow.currentFullInstance);
if (ci) {
if (ci._factory._id == targetInstance._factory._id && ci.getIdentifier() == identifier) {
show = false;
......@@ -316,7 +316,7 @@ var ExtensionManager = VispaModule.extend({
instance._shortcuts = $.Shortcuts(instance._id);
// create the view
var viewData = this.vispa.extensionView.addFullInstance(instance);
var viewData = Vispa.extensionView.addFullInstance(instance);
// store the view data in the instance
instance._viewData = viewData;
......@@ -338,12 +338,12 @@ var ExtensionManager = VispaModule.extend({
// 'full' instance
if (instance instanceof ExtensionContentFull) {
// is it visible?
if (this.vispa.extensionView.workflow.currentFullInstance == instance._id) {
$.History().push(this.vispa.urlHandler.dynamic('/'));
if (Vispa.extensionView.workflow.currentFullInstance == instance._id) {
$.History().push(Vispa.urlHandler.dynamic('/'));
}
// empty its shortcuts
instance._shortcuts.disable().empty();
this.vispa.extensionView.removeFullInstance(instance);
Vispa.extensionView.removeFullInstance(instance);
// remove the id from full instances
var idx = $.inArray(instance._id, this.instances.full);
......@@ -377,7 +377,7 @@ var ExtensionManager = VispaModule.extend({
instance = this.getInstance(instance);
if (instance instanceof ExtensionContentFull) {
// already shown?
if (this.vispa.extensionView.workflow.currentFullInstance == instance._id) {
if (Vispa.extensionView.workflow.currentFullInstance == instance._id) {
return this;
}
// call before show
......@@ -386,7 +386,7 @@ var ExtensionManager = VispaModule.extend({
}
// handle a currentFullInstance
var ci = this.getInstance(this.vispa.extensionView.workflow.currentFullInstance);
var ci = this.getInstance(Vispa.extensionView.workflow.currentFullInstance);
if (ci) {
// call beforeHide
if (ci.beforeHide() === false) {
......@@ -396,7 +396,7 @@ var ExtensionManager = VispaModule.extend({
ci._shortcuts.disable();
// hide
// 2. arg: fx, 3. arg: showWelcome
this.vispa.extensionView.hideFullInstance(ci, {
Vispa.extensionView.hideFullInstance(ci, {
duration: 0
}, false);
// call afterHide
......@@ -409,7 +409,7 @@ var ExtensionManager = VispaModule.extend({
}
// update the preference handler data
var obj = this.vispa.preferenceHandler.observables['extensions'][instance._factory._id]
var obj = Vispa.preferenceHandler.observables['extensions'][instance._factory._id]
// observable
obj.config = instance._config;
// apply callback
......@@ -421,7 +421,7 @@ var ExtensionManager = VispaModule.extend({
instance._shortcuts.enable();
// update the view
this.vispa.extensionView.showFullInstance(instance, {
Vispa.extensionView.showFullInstance(instance, {
duration: 0
});
......@@ -441,10 +441,10 @@ var ExtensionManager = VispaModule.extend({
instance = this.getInstance(instance);
// behavior depends on the instance type
if (!instance) {
this.vispa.extensionView.hideCurrentInstance(byUrl);
Vispa.extensionView.hideCurrentInstance(byUrl);
} else if (instance instanceof ExtensionContentFull) {
// visible now?
if (this.vispa.extensionView.workflow.currentFullInstance != instance._id) {
if (Vispa.extensionView.workflow.currentFullInstance != instance._id) {
return this;
}
// call beforeHide
......@@ -460,7 +460,7 @@ var ExtensionManager = VispaModule.extend({
instance._shortcuts.disable();
// hide
// 2. arg: fx, 3. arg: showWelcome
this.vispa.extensionView.hideFullInstance(instance, null, true);
Vispa.extensionView.hideFullInstance(instance, null, true);
// call afterHide
instance.afterHide();
}
......@@ -533,7 +533,7 @@ var ExtensionManager = VispaModule.extend({