Skip to content

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

updating the OCRO perspective

Ilian85c6ada4c92b
diff --git a/data/ext/perspectiveOCRO/controller.js b/data/ext/perspectiveOCRO/controller.js
index deb18a65e..6b5c2c789 100644
--- a/data/ext/perspectiveOCRO/controller.js
+++ b/data/ext/perspectiveOCRO/controller.js
@@ -13,6 +13,7 @@ define(function(require, exports, module) {
var supportedFileTypesThumbs = ['jpg','jpeg','png','gif','bmp','svg'];
var supportedFileTypesViewing = ['jpg','jpeg','png','gif','bmp','svg','pdf','url','website','xls','xlsx','dxf','avi'];
+ var ocSearchPath = '/oc/index.php/search/ajax/search.php?query=';
var thumbFolder = ".ts";
var thumbExt = ".jpg";
@@ -33,6 +34,12 @@ define(function(require, exports, module) {
var load = function () {
console.log("Loading data in "+extensionID);
+ // Show home screen if user in the root of the location and no search query
+ if((TSCORE.currentLocationObject.path === TSCORE.currentPath) && (TSCORE.Search.nextQuery.length < 1)) {
+ showHomeScreen();
+ return true;
+ }
+
// Load new filtered data
searchResults = TSCORE.Search.searchData(TSCORE.fileList, TSCORE.Search.nextQuery);
@@ -88,19 +95,31 @@ define(function(require, exports, module) {
}
};
+ var showHomeScreen = function() {
+ $viewContainer.children().remove();
+ $viewContainer.append(templates.homeScreen({"id":extensionID}));
+
+ $viewContainer.find(".dirNavigator").each(function() {
+ var dirPath = $(this).attr("data-path");
+ $(this).click(function () {
+ TSCORE.navigateToDirectory(TSCORE.currentLocationObject.path+TSCORE.dirSeparator+dirPath);
+ })
+ });
+ };
+
var createFileContext = function(title, filePath, fileExt, fileTags) {
var fileName = TSCORE.TagUtils.extractFileNameWithoutExt(filePath);
var fileContainingPath = TSCORE.TagUtils.extractContainingDirectoryPath(filePath);
//var tmbPath = fileContainingPath+TSCORE.dirSeparator+thumbFolder+TSCORE.dirSeparator+fileName+thumbExt;
- var webdavPath = "owncloud6/remote.php/webdav";
+ var webdavPath = "oc/remote.php/webdav";
var fileID = filePath.substring(filePath.indexOf(webdavPath)+webdavPath.length,filePath.length);
//var tmbPath = location.protocol+"//"+location.host+"/owncloud6/index.php/core/preview.png?file="+fileID;
// thumbnail from the gallery plugin, user name have to be specified
- var tmbPath = location.protocol+"//"+location.host+"/owncloud6/index.php/apps/gallery/ajax/thumbnail.php?file=na"+fileID+"&square=1";
+ var tmbPath = location.protocol+"//"+location.host+"/oc/index.php/apps/gallery/ajax/thumbnail.php?file=na"+fileID+"&square=1";
if(isCordova || isWeb) {
@@ -187,7 +206,7 @@ define(function(require, exports, module) {
filename;
$.ajax({
- url: location.protocol+"//"+location.host+'/owncloud6/index.php/search/ajax/search.php?query='+query,
+ url: location.protocol+"//"+location.host+ocSearchPath+query,
type: 'GET'
})
.done(function(data) {
@@ -214,6 +233,7 @@ define(function(require, exports, module) {
exports.init = init;
exports.load = load;
exports.searchOC = searchOC;
+ exports.showHomeScreen = showHomeScreen;
// exports.clearSelectedFiles = clearSelectedFiles;
exports.getNextFile = getNextFile;
exports.getPrevFile = getPrevFile;
diff --git a/data/ext/perspectiveOCRO/extension.js b/data/ext/perspectiveOCRO/extension.js
index c51a8dc7e..72615dd9a 100644
--- a/data/ext/perspectiveOCRO/extension.js
+++ b/data/ext/perspectiveOCRO/extension.js
@@ -41,23 +41,23 @@ define(function(require, exports, module) {
extensionDirectory+'/templates.js',
extensionDirectory+'/controller.js',
"text!"+extensionDirectory+"/DesktopTMPL.html",
- 'css!'+extensionDirectory+'/extension.css',
- 'css!'+extensionDirectory+'/fontello/css/fontello.css'
- ], function(tmpls, ctrl, desktoptmpl) {
+ "css!"+extensionDirectory+"/extension.css",
+ "css!"+extensionDirectory+"/fontello/css/fontello.css"
+ ], function(templates, ctrl, desktoptmpl) {
controller = ctrl;
// Adding UI blocks
- $viewToolbar.html(tmpls.mainToolBar({"id":extensionID}));
+ $viewToolbar.html(templates.mainToolBar({"id":extensionID}));
- var desktopTemplate = Handlebars.compile( desktoptmpl );
- $viewContainer.append(desktopTemplate());
+ templates.homeScreen = Handlebars.compile( desktoptmpl );
- $("body").append(tmpls.dialogOCSetting());
+ $("body").append(templates.dialogOCSetting());
- ctrl.init(extensionID,tmpls);
+ ctrl.init(extensionID,templates);
- initUI();
+ ctrl.showHomeScreen();
+ initUI();
});
}
@@ -162,11 +162,6 @@ define(function(require, exports, module) {
'</div>'
);
- var generateDesktop = function() {
- console.log("Generating Desktop "+JSON.stringify(TSCORE.locationDesktop));
- //$viewContainer.html(desktopTPML({"desktop":TSCORE.locationDesktop}));
- };
-
var clearSelectedFiles = function() {
};
@@ -204,6 +199,5 @@ define(function(require, exports, module) {
exports.getPrevFile = getPrevFile;
exports.removeFileUI = removeFileUI;
exports.updateFileUI = updateFileUI;
- exports.generateDesktop = generateDesktop;
-
+
});
\ No newline at end of file
diff --git a/data/ext/perspectiveOCRO/templates.js b/data/ext/perspectiveOCRO/templates.js
index d374a9464..6ed19cdd4 100644
--- a/data/ext/perspectiveOCRO/templates.js
+++ b/data/ext/perspectiveOCRO/templates.js
@@ -62,4 +62,7 @@ define(function(require, exports, module) {
'</ol>'
);
+ exports.homeScreen;
+
+
});
\ No newline at end of file