Skip to content

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

adding directory browser

Ilian1ed1e85563a7
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index cd95302c8..0157c43de 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -90,7 +90,7 @@ define(function(require, exports, module) {
console.log("Deleting file...");
TSCORE.showConfirmDialog(
"Delete File(s)",
- "The file: "+filePath+" will be permanently deleted and cannot be recovered. Are you sure?",
+ "The file \""+filePath+"\" will be permanently deleted and cannot be recovered. Are you sure?",
function() {
TSCORE.IO.deleteElement(TSCORE.selectedFiles[0]);
}
@@ -106,14 +106,13 @@ define(function(require, exports, module) {
require([
"text!templates/OptionsDialog.html",
"tsoptions",
- ], function(uiTPL, options) {
+ ], function(uiTPL, controller) {
if($("#dialogOptions").length < 1) {
var uiTemplate = Handlebars.compile( uiTPL );
$('body').append(uiTemplate());
- options.initUI();
+ controller.initUI();
}
- options.reInitUI();
- $('#dialogOptions').modal('show');
+ controller.reInitUI();
});
};
@@ -171,7 +170,7 @@ define(function(require, exports, module) {
if(index == 0) {
fileTags = value;
} else {
- fileTags = fileTags + TSCORE.TagUtils.tagDelimiter + value;
+ fileTags = fileTags + TSCORE.Config.getTagDelimiter() + value;
}
});
@@ -179,7 +178,7 @@ define(function(require, exports, module) {
if(fileTags.length < 1) {
fileTags = TSCORE.TagUtils.formatDateTime4Tag(new Date());
} else {
- fileTags = fileTags + TSCORE.TagUtils.tagDelimiter + TSCORE.TagUtils.formatDateTime4Tag(new Date());
+ fileTags = fileTags + TSCORE.Config.getTagDelimiter() + TSCORE.TagUtils.formatDateTime4Tag(new Date());
}
}
@@ -187,7 +186,7 @@ define(function(require, exports, module) {
fileTags = TSCORE.TagUtils.beginTagContainer + fileTags + TSCORE.TagUtils.endTagContainer;
}
- var fileName = TSCORE.currentPath+TSCORE.TagUtils.DIR_SEPARATOR+$( "#newFileName" ).val()+fileTags+"."+fileType;
+ var fileName = TSCORE.currentPath+TSCORE.dirSeparator+$( "#newFileName" ).val()+fileTags+"."+fileType;
TSCORE.IO.saveTextFile(fileName,fileContent);
TSCORE.IO.listDirectory(TSCORE.currentPath);
@@ -202,7 +201,7 @@ define(function(require, exports, module) {
var containingDir = TSCORE.TagUtils.extractContainingDirectoryPath(TSCORE.selectedFiles[0]);
TSCORE.IO.renameFile(
$( "#renamedFileName" ).attr("filepath"),
- containingDir+TSCORE.TagUtils.DIR_SEPARATOR+$( "#renamedFileName" ).val()
+ containingDir+TSCORE.dirSeparator+$( "#renamedFileName" ).val()
);
}
});
@@ -375,9 +374,8 @@ define(function(require, exports, module) {
// Search UI END
- // Handle external links
- $("#openUservoice")
- .click(function(evt) {
+ // Handle external links _system is important in cordova
+ /* $("#openUservoice").on('click', function () {
window.open("https://tagspaces.uservoice.com/forums/213931-general","_system");
});
@@ -389,7 +387,13 @@ define(function(require, exports, module) {
$("#openTwitter")
.click(function(evt) {
window.open("https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftagspaces.org%2F&text=Organize%20your%20files%20with%20@tagspaces","_system");
- });
+ });*/
+
+ $('#contactUs').popover({
+ placement: 'top',
+ content: document.getElementById("contactUsContent").innerHTML,
+ html: true
+ });
// Hide drop downs by click and drag
$(document).click(function () {
@@ -420,6 +424,9 @@ define(function(require, exports, module) {
if(isFirefox) {
$("#openNatively").hide();
}
+ if(isNode) {
+ $("#fullscreenFile").hide();
+ }
};
var showContextMenu = function(menuId, sourceObject) {
@@ -447,6 +454,7 @@ define(function(require, exports, module) {
$('#directoryMenu').hide();
$('#tagMenu').hide();
$('#fileMenu').hide();
+ //$('.popover').hide();
};
var showLocationsPanel = function() {
diff --git a/data/js/directorybrowser.js b/data/js/directorybrowser.js
new file mode 100644
index 000000000..4fd4bf0e5
--- /dev/null
+++ b/data/js/directorybrowser.js
@@ -0,0 +1,66 @@
+/* Copyright (c) 2012-2014 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) {
+"use strict";
+
+ console.log("Loading directorybrowser.js ...");
+
+ var TSCORE = require("tscore");
+
+ function addPerspective(parent, perspectiveId) {
+ var perspectiveControl = $("<div class='form-inline'>")
+ .append($("<div class='input-group' style='width: 90%'>")
+ //.append($("<button class='btn btn-default' style='width: 10%' title='Remove Perspective'><i class='fa fa-ellipsis-v'></i></button>"))
+ .append($("<select class='form-control' style='width: 70%'></select>"))
+ .append($("<button class='btn btn-default' style='width: 40px' title='Remove Perspective'><i class='fa fa-times'></button>")
+ .click(function() {
+ $(this).parent().parent().remove();
+ })
+ )
+ );
+ //.append($("<button class='btn' title='Remove this extension'><i class='icon-arrow-up'></button>"))
+ //.append($("<button class='btn' title='Remove this extension'><i class='icon-arrow-down'></button>"))
+
+ generateSelectOptions(perspectiveControl.find("select"), TSCORE.Config.getPerspectiveExtensions(), perspectiveId);
+ parent.append(perspectiveControl);
+ }
+
+
+
+ function initUI() {
+
+ $('#addPerspectiveButton').click(function(e) {
+ // Fixes reloading of the application by click
+ e.preventDefault();
+
+ addPerspective($('#perspectiveList'), "");
+ });
+
+ $( "#startDir" ).click(function() {
+ TSCORE.IO.listSubDirectories("/media/z/TagSpaces");
+ });
+
+ $( "#selectDirectoryButton" ).click(function() {
+
+ });
+
+ }
+
+ function reInitUI(dirPath) {
+ // $("#extensionsPathInput").val(TSCORE.Config.getExtensionPath());
+
+ $('#directoryPath').empty();
+
+ $('#subdirectoriesArea').empty();
+
+ $('#directoryBrowserDialog').modal('show');
+ }
+
+
+
+ // Public Methods
+ exports.initUI = initUI;
+ exports.reInitUI = reInitUI;
+
+});
\ No newline at end of file
diff --git a/data/loader.js b/data/loader.js
index 8152ff3b4..7215ea432 100644
--- a/data/loader.js
+++ b/data/loader.js
@@ -14,7 +14,7 @@ if (PRODUCTION == "true") {
}
var isFirefox = document.URL.indexOf( 'resource://' ) >= 0;
-var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
+//var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
var isChrome = document.URL.indexOf( 'chrome-extension://' ) >= 0;
var isNode = undefined;
var isCordova = document.URL.indexOf( 'file:///android_asset' ) >= 0;
@@ -22,6 +22,7 @@ var isWeb = undefined;
var isOSX = navigator.appVersion.indexOf("Mac")!=-1;
var isWin = navigator.appVersion.indexOf("Win")!=-1;
+
// Check for running in node-webkit
try {
var fs = require('fs');
@@ -99,6 +100,7 @@ requirejs.config({
tspostioapi: 'js/postioapi',
tsioapi: IO_JS,
tsioapidropbox: 'js/ioapi.dropbox',
+ tsdirectorybrowser: 'js/directorybrowser',
},
shim: {
'underscore': { exports: '_' },
diff --git a/data/templates/DirectoryBrowserDialog.html b/data/templates/DirectoryBrowserDialog.html
new file mode 100644
index 000000000..83db98f0c
--- /dev/null
+++ b/data/templates/DirectoryBrowserDialog.html
@@ -0,0 +1,22 @@
+<div id="directoryBrowserDialog" class="modal" tabindex="-1" role="dialog" aria-hidden="true" style="z-index: 99999">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h4 id="directoryBrowserDialogTitle">Select Directory</h4>
+ </div>
+ <div class="modal-body">
+ <div class="row" id="directoryPath">
+
+ </div>
+ <div class="row" id="subdirectoriesArea">
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button id="startDir" class="btn">Start Dir</button>
+ <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ <button id="selectDirectoryButton" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Ok</button>
+ </div>
+ </div><!-- /.modal-content -->
+ </div><!-- /.modal-dialog -->
+</div><!-- /.modal -->
\ No newline at end of file