Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Refactored view manager to perspective manager Removed text from the buttons in the default perspective Size of the message in the alert and confirm dialogs increased Showing alert message by switching perspectives with no location choosed

uggrock1d7f1fdc9060
diff --git a/data/ext/perspectiveDefault/extension.js b/data/ext/perspectiveDefault/extension.js
index 2acf988bf..52f6d4035 100644
--- a/data/ext/perspectiveDefault/extension.js
+++ b/data/ext/perspectiveDefault/extension.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013 The Tagspaces Authors. All rights reserved.
+/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
@@ -69,7 +69,7 @@ define(function(require, exports, module) {
}
console.log("Path: "+entry[4]);
});
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
console.debug("Next file: "+nextFilePath);
return nextFilePath;
}
@@ -88,7 +88,7 @@ define(function(require, exports, module) {
}
console.log("Path: "+entry[4]);
});
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
console.debug("Prev file: "+prevFilePath);
return prevFilePath;
}
diff --git a/data/ext/perspectiveDefault/perspectiveUI.js b/data/ext/perspectiveDefault/perspectiveUI.js
index 1c7d3ea5c..bed2d65d0 100644
--- a/data/ext/perspectiveDefault/perspectiveUI.js
+++ b/data/ext/perspectiveDefault/perspectiveUI.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013 The Tagspaces Authors. All rights reserved.
+/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
@@ -102,7 +102,7 @@ console.debug("Loading UI for perspectiveDefault");
self.handleElementActivation();
});
} else {
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
}
})
.append( "<input type='checkbox' style='margin-top: -3px;'>" )
@@ -117,7 +117,7 @@ console.debug("Loading UI for perspectiveDefault");
TSCORE.showFileCreateDialog();
})
.append( "<i class='icon-plus'>" )
- .append(" New")
+// .append(" New")
)
.append($("<button>", {
@@ -130,7 +130,7 @@ console.debug("Loading UI for perspectiveDefault");
TSCORE.IO.createDirectoryIndex(TSCORE.currentPath);
})
.append( $("<i>", { class: "icon-retweet", }) )
- .append(" Subdirs")
+// .append(" Subdirs")
)
.append($("<button>", {
@@ -142,7 +142,7 @@ console.debug("Loading UI for perspectiveDefault");
TSCORE.showAddTagsDialog();
})
.append( $("<i>", { class: "icon-tag", }) )
- .append(" Add Tag")
+// .append(" Add Tag")
)
.append($("<button>", {
@@ -212,7 +212,7 @@ console.debug("Loading UI for perspectiveDefault");
id: this.extensionID+"FilterBox",
placeholder: "Filter",
}).keyup(function() {
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
self.fileTable.fnFilter(this.value);
console.debug("Filter to value: "+this.value);
}))
@@ -301,7 +301,7 @@ console.debug("Loading UI for perspectiveDefault");
start: function() {
console.debug("Start selecting");
TSCORE.hideAllDropDownMenus();
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
},
stop: function(){
$(".ui-selected", this).each(function(){
@@ -348,7 +348,7 @@ console.debug("Loading UI for perspectiveDefault");
$(this).toggleClass("ui-selected");
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
TSCORE.selectedFiles.push(targetFilePath);
@@ -438,7 +438,7 @@ console.debug("Loading UI for perspectiveDefault");
}
ExtUI.prototype.selectFile = function(uiElement, filePath) {
- TSCORE.ViewManager.clearSelectedFiles();
+ TSCORE.PerspectiveManager.clearSelectedFiles();
$(uiElement).parent().parent().toggleClass("ui-selected");
diff --git a/data/js/core.api.js b/data/js/core.api.js
index 6fa84ad89..4885889a3 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Tagspaces Authors. All rights reserved.
+/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
define(function(require, exports, module) {
@@ -20,7 +20,7 @@ define(function(require, exports, module) {
var centerLayout = undefined;
var eastLayout = undefined;
- var currentPath = "";
+ var currentPath = undefined;
var currentView = undefined;
@@ -268,7 +268,7 @@ define(function(require, exports, module) {
// Proxying applications parts
exports.Config = tsSettings;
exports.IO = tsIOApi;
- exports.ViewManager = tsPersManager;
+ exports.PerspectiveManager = tsPersManager;
exports.TagUtils = tsTagUtils;
exports.FileOpener = tsFileOpener;
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index 07f77c6bf..bce029909 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -23,14 +23,14 @@ define(function(require, exports, module) {
'<a class="close" data-dismiss="modal" >&times;</a>' +
'<h4></h4>' +
'</div>' +
- '<div class="modal-body"></div>' +
+ '<div class="modal-body"><p class="lead"></p></div>' +
'<div class="modal-footer">' +
'<a href="#" id="okButton" class="btn btn-primary">Ok</a>' +
'</div>' +
'</div>');
alertModal.find('h4').text(title);
- alertModal.find('.modal-body').text(message);
+ alertModal.find('.lead').text(message);
alertModal.find('#okButton').click(function(event) {
alertModal.modal('hide');
});
@@ -48,7 +48,7 @@ define(function(require, exports, module) {
'<a class="close" data-dismiss="modal" >&times;</a>' +
'<h4></h4>' +
'</div>' +
- '<div class="modal-body"></div>' +
+ '<div class="modal-body"><p class="lead"></p></div>' +
'<div class="modal-footer">' +
'<a href="#" class="btn" data-dismiss="modal">Cancel</a>' +
'<a href="#" id="okButton" class="btn btn-primary">Ok</a>' +
@@ -56,7 +56,7 @@ define(function(require, exports, module) {
'</div>');
confirmModal.find('h4').text(title);
- confirmModal.find('.modal-body').text(message);
+ confirmModal.find('.lead').text(message);
confirmModal.find('#okButton').click(function(event) {
callback();
confirmModal.modal('hide');
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 38ea57b49..aeb6a09c1 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -285,11 +285,11 @@ define(function(require, exports, module) {
});
$( "#nextFileButton" ).click(function() {
- TSCORE.FileOpener.openFile(TSCORE.ViewManager.getNextFile(_openedFilePath));
+ TSCORE.FileOpener.openFile(TSCORE.PerspectiveManager.getNextFile(_openedFilePath));
});
$( "#prevFileButton" ).click(function() {
- TSCORE.FileOpener.openFile(TSCORE.ViewManager.getPrevFile(_openedFilePath));
+ TSCORE.FileOpener.openFile(TSCORE.PerspectiveManager.getPrevFile(_openedFilePath));
});
$( "#toggleFullWidthButton" ).click(function() {
diff --git a/data/js/ioapi.chrome.js b/data/js/ioapi.chrome.js
index 473d08e35..0b2c0f698 100644
--- a/data/js/ioapi.chrome.js
+++ b/data/js/ioapi.chrome.js
@@ -142,7 +142,7 @@ New:
"path": path
});
}
- TSCORE.ViewManager.updateFileBrowserData(anotatedDirList);
+ TSCORE.PerspectiveManager.updateFileBrowserData(anotatedDirList);
} catch(ex) {
console.error("Directory listing failed "+ex);
}
@@ -179,7 +179,7 @@ New:
exports.deleteElement = function(path) {
console.debug("Deleting: "+path);
-/* TSCORE.ViewManager.refreshFileListContainer();
+/* TSCORE.PerspectiveManager.refreshFileListContainer();
plugin.removeFile(path)*/
}
@@ -221,7 +221,7 @@ New:
console.debug("Creating directory index for: "+dirPath);
console.debug("Creating Directory Tree functionality not implemented on chrome yet!");
// TODO implement createDirectoryTree
- TSCORE.ViewManager.updateTreeData();
+ TSCORE.PerspectiveManager.updateTreeData();
}
});
diff --git a/data/js/ioapi.cordova.js b/data/js/ioapi.cordova.js
index a76629abb..a2db8f176 100644
--- a/data/js/ioapi.cordova.js
+++ b/data/js/ioapi.cordova.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Tagspaces Authors. All rights reserved.
+/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
console.debug("Loading ioapi.cordova.js..");
@@ -98,7 +98,7 @@ IOAPI.listDirectory = function(dirPath) {
try {
var dirList = IOAPI.plugin.listFiles(dirPath);
console.debug("Dir content: "+JSON.stringify(dirList));
- UIAPI.ViewManager.updateFileBrowserData(dirList);
+ UIAPI.PerspectiveManager.updateFileBrowserData(dirList);
} catch(ex) {
console.error("Directory listing failed "+ex);
}
diff --git a/data/js/ioapi.mozilla.receiver.js b/data/js/ioapi.mozilla.receiver.js
index 205d72e1c..e94bd71af 100644
--- a/data/js/ioapi.mozilla.receiver.js
+++ b/data/js/ioapi.mozilla.receiver.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Tagspaces Authors. All rights reserved.
+/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
// Activating browser specific IOAPI modul
@@ -46,7 +46,7 @@ console.debug("Loading messaging.mozilla.js..");
}
// TODO to be replaced with a function which replaced the
// renamed file in the model of the perspective
- TSCORE.ViewManager.refreshFileListContainer();
+ TSCORE.PerspectiveManager.refreshFileListContainer();
} else {
TSCORE.updateLogger("Rename failed");
}
@@ -78,7 +78,7 @@ console.debug("Loading messaging.mozilla.js..");
break;
case "listDirectory":
if(message.success){
- TSCORE.ViewManager.updateFileBrowserData(message.content);
+ TSCORE.PerspectiveManager.updateFileBrowserData(message.content);
} else {
TSCORE.updateLogger("List directory failed");
}
@@ -86,7 +86,7 @@ console.debug("Loading messaging.mozilla.js..");
case "indexDirectory":
if(message.success){
//console.debug("Directory Index: "+JSON.stringify(message.content));
- TSCORE.ViewManager.updateFileBrowserData(message.content);
+ TSCORE.PerspectiveManager.updateFileBrowserData(message.content);
} else {
TSCORE.updateLogger("Indexing directory failed");
}
@@ -94,7 +94,7 @@ console.debug("Loading messaging.mozilla.js..");
case "createDirectoryTree":
if(message.success){
console.debug("Directory tree: "+JSON.stringify(message.content));
- TSCORE.ViewManager.updateTreeData(message.content);
+ TSCORE.PerspectiveManager.updateTreeData(message.content);
} else {
TSCORE.updateLogger("Indexing directory failed");
}
@@ -114,7 +114,7 @@ console.debug("Loading messaging.mozilla.js..");
case "delete":
if(message.success){
TSCORE.updateLogger("Delete success");
- TSCORE.ViewManager.refreshFileListContainer();
+ TSCORE.PerspectiveManager.refreshFileListContainer();
} else {
TSCORE.updateLogger("Delete failed");
}
diff --git a/data/js/perspective.manager.js b/data/js/perspective.manager.js
index bcc23dabe..6ac75731c 100644
--- a/data/js/perspective.manager.js
+++ b/data/js/perspective.manager.js
@@ -166,6 +166,10 @@ var changeView = function (viewType) {
//Setting the current view
TSCORE.currentView = viewType;
+
+ if(TSCORE.currentPath == undefined) {
+ TSCORE.showAlertDialog("Please select first location from the dropdown on the left!");
+ }
for (var i=0; i < perspectives.length; i++) {
$( "#"+perspectives[i].ID+"Container" ).hide();
@@ -186,7 +190,7 @@ var changeView = function (viewType) {
}
// Clear the list with the selected files
- TSCORE.selectedFiles = [];
+ TSCORE.PerspectiveManager.clearSelectedFiles();
// Reset the filter by a view change
setFileFilter("");
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index caa4f97d3..c8204b9b5 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -10,12 +10,12 @@ define(function(require, exports, module) {
function initContextMenus() {
$( "#extMenuAddTagAsFilter" ).click( function() {
- TSCORE.ViewManager.setFileFilter(TSCORE.selectedTag);
+ TSCORE.PerspectiveManager.setFileFilter(TSCORE.selectedTag);
});
// Context menu for the tags in the file table and the file viewer
$( "#tagMenuAddTagAsFilter" ).click( function() {
- TSCORE.ViewManager.setFileFilter(TSCORE.selectedTag);
+ TSCORE.PerspectiveManager.setFileFilter(TSCORE.selectedTag);
});
$( "#tagMenuEditTag" ).click( function() {
@@ -33,7 +33,7 @@ define(function(require, exports, module) {
});
$( "#tagTreeMenuAddTagAsFilter" ).click( function() {
- TSCORE.ViewManager.setFileFilter(TSCORE.selectedTag);
+ TSCORE.PerspectiveManager.setFileFilter(TSCORE.selectedTag);
});
$( "#tagTreeMenuEditTag" ).click( function() {