Skip to content

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

boostrap refactoring move taggroups up and down move tags with drag & drop between taggroups bugfix for listing directories with wrond enconding

uggrock19a0eedf20ac
diff --git a/build.number b/build.number
index 1d44fe6b9..00db9ca37 100644
--- a/build.number
+++ b/build.number
@@ -1,3 +1,3 @@
-#Build Number for ANT. Do not edit!
-#Tue May 07 16:47:27 CEST 2013
-build.number=1313
+#Build Number for ANT. Do not edit!
+#Tue May 07 16:47:27 CEST 2013
+build.number=1313
diff --git a/data/css/tagspaces.less b/data/css/tagspaces.less
index faa27779b..28dbde9b8 100644
--- a/data/css/tagspaces.less
+++ b/data/css/tagspaces.less
@@ -148,15 +148,12 @@ li hr {
}
// @baseTagColor;
-
.tagButton {
padding: 0px 2px 0px 2px;
// background: #008000 !important;
color: white !important;
margin: 1px;
border-color: transparent;
-// font-weight: normal !important;
-// font-size: @tagFontSize;
z-index: 9999;
}
@@ -357,7 +354,7 @@ span.dynatree-icon {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
-.tagGroupTitle:hover {
+.tagGroupTitle:hover, .tagGroupTitle:active, .tagGroupTitle:focus {
text-decoration: none;
color: gray;
}
diff --git a/data/ext/perspectiveDefault/extension.js b/data/ext/perspectiveDefault/extension.js
index 23c66d14b..c80c990d4 100644
--- a/data/ext/perspectiveDefault/extension.js
+++ b/data/ext/perspectiveDefault/extension.js
@@ -8,7 +8,7 @@ define(function(require, exports, module) {
var extensionTitle = "Standard"
var extensionID = "perspectiveDefault"; // ID should be equal to the directory name where the ext. is located
var extensionType = "view";
- var extensionIcon = "ui-icon-tag";
+ var extensionIcon = "icon-tags";
var extensionVersion = "1.0";
var extensionManifestVersion = 1;
var extensionLicense = "AGPL";
@@ -31,8 +31,6 @@ define(function(require, exports, module) {
UI = new extUI.ExtUI(extensionID);
UI.buildUI();
UI.initTable();
- UI.initFileFilter();
- UI.initButtons();
});
}
diff --git a/data/ext/perspectiveDefault/perspectiveUI.js b/data/ext/perspectiveDefault/perspectiveUI.js
index b48b44439..bc011fadc 100644
--- a/data/ext/perspectiveDefault/perspectiveUI.js
+++ b/data/ext/perspectiveDefault/perspectiveUI.js
@@ -152,7 +152,6 @@ console.debug("Loading UI for perspectiveDefault");
this.viewToolbar.append($("<div >", {
class: "btn-group",
"data-toggle": "buttons-checkbox",
- disabled: false,
})
.append($("<button>", {
class: "btn btn-small",
@@ -177,7 +176,7 @@ console.debug("Loading UI for perspectiveDefault");
.append( $("<i>", { class: "icon-tags", }) )
//.append("Tags")
)
- ) // end button group
+ ) // end button group
// Filter
this.viewToolbar.append($("<span>", {
@@ -189,6 +188,22 @@ console.debug("Loading UI for perspectiveDefault");
id: this.extensionID+"FilterBox",
})))
+ // Filter functionality
+ $("#"+this.extensionID+"FilterBox").keyup(function() {
+ self.fileTable.fnFilter(this.value);
+ console.debug("Filter to value: "+this.value);
+ });
+
+ $('#'+this.extensionID+"FilterBox").wrap('<span id="resetFilter" />').after($('<span/>').click(function() {
+ $(this).prev('input').val('').focus();
+ self.fileTable.fnFilter( "" );
+ }));
+
+ $( "#clearFilterButton" )
+ .click(function() {
+ $( "#filterBox" ).val( "" );
+ self.fileTable.fnFilter( "" );
+ });
this.viewContainer.append($("<table>", {
cellpadding: "0",
@@ -198,7 +213,7 @@ console.debug("Loading UI for perspectiveDefault");
class: "table",
id: this.extensionID+"FileTable",
}));
-
+
}
ExtUI.prototype.initTable = function() {
@@ -441,36 +456,6 @@ console.debug("Loading UI for perspectiveDefault");
}
this.showTags = !this.showTags;
}
-
- ExtUI.prototype.initButtons = function() {
- var self = this;
- $( "#clearFilterButton" ).button({
- text: false,
- disabled: false,
- icons: {
- primary: "ui-icon-close"
- }
- })
- .click(function() {
- $( "#filterBox" ).val( "" );
- self.fileTable.fnFilter( "" );
- });
- }
-
- ExtUI.prototype.initFileFilter = function() {
- var self = this;
-
- // Filter functionality
- $("#"+this.extensionID+"FilterBox").keyup(function() {
- self.fileTable.fnFilter(this.value);
- console.debug("Filter to value: "+this.value);
- });
-
- $('#'+this.extensionID+"FilterBox").wrap('<span id="resetFilter" />').after($('<span/>').click(function() {
- $(this).prev('input').val('').focus();
- self.fileTable.fnFilter( "" );
- }));
- }
ExtUI.prototype.handleElementActivation = function() {
console.debug("Entering element activation handler...");
diff --git a/data/ext/perspectiveGraph/extension.js b/data/ext/perspectiveGraph/extension.js
index 29d3427f6..04386c494 100644
--- a/data/ext/perspectiveGraph/extension.js
+++ b/data/ext/perspectiveGraph/extension.js
@@ -7,13 +7,13 @@ define(function(require, exports, module) {
console.debug("Loading perspectiveGraph");
- exports.Title = "Graph"
- exports.ID = "perspectiveGraph"; // ID should be equal to the directory name where the ext. is located
- exports.Type = "view";
- exports.Icon = "ui-icon-shuffle";
- exports.Version = "1.0";
- exports.ManifestVersion = 1;
- exports.License = "AGPL";
+ var extensionTitle = "Graph"
+ var extensionID = "perspectiveGraph"; // ID should be equal to the directory name where the ext. is located
+ var extensionType = "view";
+ var extensionIcon = "icon-leaf";
+ var extensionVersion = "1.0";
+ var extensionManifestVersion = 1;
+ var extensionLicense = "AGPL";
var TSCORE = require("tscore");
@@ -23,7 +23,7 @@ define(function(require, exports, module) {
var viewMode = "files" // tags
- var extensionDirectory = TSCORE.Config.getExtensionPath()+"/"+exports.ID;
+ var extensionDirectory = TSCORE.Config.getExtensionPath()+"/"+extensionID;
var graphMode = "treeMap" // tree
@@ -176,18 +176,17 @@ define(function(require, exports, module) {
};
exports.init = function init() {
- console.debug("Initializing View "+exports.ID);
+ console.debug("Initializing View "+extensionID);
- viewContainer = $("#"+exports.ID+"Container");
- viewToolbar = $("#"+exports.ID+"Toolbar");
- viewFooter = $("#"+exports.ID+"Footer");
+ viewContainer = $("#"+extensionID+"Container");
+ viewToolbar = $("#"+extensionID+"Toolbar");
+ viewFooter = $("#"+extensionID+"Footer");
viewContainer.empty();
viewToolbar.empty();
viewFooter.empty();
- initContextMenus();
- initButtons();
+ initUI();
require([
extensionDirectory+'/d3/d3.js',
@@ -197,9 +196,9 @@ define(function(require, exports, module) {
}
exports.load = function load() {
- console.debug("Loading View "+exports.ID);
+ console.debug("Loading View "+extensionID);
- $( "#"+exports.ID+"ReIndexButton" ).button( "enable" );
+ $( "#"+extensionID+"ReIndexButton" ).button( "enable" );
TSCORE.hideLoadingAnimation();
}
@@ -209,7 +208,7 @@ define(function(require, exports, module) {
width = viewContainer.width();
height = viewContainer.height();
- svg = d3.select("#"+exports.ID+"Container")
+ svg = d3.select("#"+extensionID+"Container")
.append("svg")
.attr("width", width)
.attr("height", height)
@@ -390,13 +389,13 @@ define(function(require, exports, module) {
reDraw();
- $( "#"+exports.ID+"ReIndexButton" ).button( "enable" );
+ $( "#"+extensionID+"ReIndexButton" ).removeClass( "disabled" );
TSCORE.hideLoadingAnimation();
}
exports.setFileFilter = function setFileFilter(filter) {
- $( "#"+exports.ID+"FilterBox").val(filter);
- fileTable.fnFilter(filter);
+ //$( "#"+extensionID+"FilterBox").val(filter);
+ //fileTable.fnFilter(filter);
}
exports.clearSelectedFiles = function() {
@@ -406,126 +405,73 @@ define(function(require, exports, module) {
});
}
- var initButtons = function() {
- viewToolbar.append($("<span>", {
- style: "float: right; margin: 0px; padding: 0px;",
- }).append($("<input>", {
- type: "filter",
- // autocomplete: "off", // Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'off'
- title: "This filter applies to current directory without subdirectories.",
- id: exports.ID+"FilterBox",
- })));
-
- // Filter functionality
- $("#"+exports.ID+"FilterBox").keyup(function() {
- // TODO filter action here
- console.debug("Filter to value: "+this.value);
- });
-
- $('#'+exports.ID+"FilterBox").wrap('<span id="resetFilter" />').after($('<span/>').click(function() {
- $(this).prev('input').val('').focus();
- // TODO filter action here
- }));
-
- $( "#clearFilterButton" ).button({
- text: false,
- disabled: false,
- icons: {
- primary: "ui-icon-close"
- }
- })
- .click(function() {
- $( "#filterBox" ).val( "" );
- fileTable.fnFilter( "" );
- });
-
- viewToolbar.append($("<button>", {
- text: "Scan Directory",
- disabled: true,
- title: "Generate File System Tree",
- id: exports.ID+"ReIndexButton",
- }));
-
- $( "#"+exports.ID+"ReIndexButton" ).button({
- text: true,
- icons: {
- primary: "ui-icon-refresh"
- }
- })
- .click(function() {
- $( "#"+exports.ID+"ReIndexButton" ).button( "disable" );
- TSCORE.IO.createDirectoryTree(TSCORE.currentPath);
- });
-
- /* viewToolbar.append($("<label>", {
- for: exports.ID+"ModeSwitcher",
- text: "Mode",
- }));*/
-
- var modeSwitcher = viewToolbar.append($("<span>", {
- id: exports.ID+"ModeSwitcher",
- }));
-
- modeSwitcher.append($("<input>", {
- type: "radio",
- name: "modeSwitcher",
- checked: true,
- id: exports.ID+"TreeMapMode",
- }));
-
- modeSwitcher.append($("<label>", {
- for: exports.ID+"TreeMapMode",
- text: "TreeMap",
- }));
-
- modeSwitcher.append($("<input>", {
- type: "radio",
- name: "modeSwitcher",
- id: exports.ID+"TreeMode",
- }));
-
- modeSwitcher.append($("<label>", {
- for: exports.ID+"TreeMode",
- text: "Tree",
- }));
-
- $( "#"+exports.ID+"TreeMapMode" ).button({
- text: true,
- })
- .click(function() {
- graphMode = "treeMap"
- reDraw();
- })
-
- $( "#"+exports.ID+"TreeMode" ).button({
- text: true,
- })
- .click(function() {
- graphMode = "tree"
- reDraw();
- })
-
- modeSwitcher.buttonset();
+ var initUI = function() {
+
+ viewToolbar.append($("<div >", {
+ class: "btn-group",
+ })
+ .append($("<button>", {
+ class: "btn btn-small",
+ title: "Generate index tree of the current directory",
+ id: extensionID+"ReIndexButton",
+ })
+ .click(function() {
+ $( "#"+extensionID+"ReIndexButton" ).addClass( "disabled" );
+ TSCORE.IO.createDirectoryTree(TSCORE.currentPath);
+ })
+ .append( $("<i>", { class: "icon-retweet", }) )
+ .append(" Scan")
+ )
+
+ ) // end button group
+
+ viewToolbar.append($("<div >", {
+ class: "btn-group",
+ "data-toggle": "buttons-checkbox",
+ })
+ .append($("<button>", {
+ class: "btn btn-small",
+ title: "Activate Treemap Mode",
+ id: extensionID+"TreeMapMode",
+ })
+ .click(function() {
+ graphMode = "treeMap"
+ reDraw();
+ })
+ .append( $("<i>", { class: "icon-th-large", }) )
+ .append(" TreeMap")
+ )
+
+ .append($("<button>", {
+ class: "btn btn-small",
+ title: "Activate Tree Mode",
+ id: extensionID+"TreeMode",
+ })
+ .click(function() {
+ graphMode = "tree"
+ reDraw();
+ })
+ .append( $("<i>", { class: "icon-indent-left", }) )
+ .append(" Tree")
+ )
+ ) // end button group
+
}
- var initContextMenus = function() {
- $( "#fileTitleMenu" ).menu({
- select: function( event, ui ) {
- var commandName = ui.item.attr( "action" );
- switch (commandName) {
- case "openFile":
- TSCORE.FileOpener.openFile(TSCORE.selectedFiles[0]);
- break;
- case "addTag":
- console.debug("Adding tag...");
- $("#tags").val("");
- $( "#dialogAddTags" ).dialog( "open" );
- break;
- default:
- break;
- }
- }
- });
- }
-
+ // Vars
+ exports.Title = extensionTitle;
+ exports.ID = extensionID;
+ exports.Type = extensionType;
+ exports.Icon = extensionIcon;
+ exports.Version = extensionVersion;
+ exports.ManifestVersion = extensionManifestVersion;
+ exports.License = extensionLicense;
+
+ // Methods
+// exports.init = init;
+// exports.load = load;
+// exports.setFileFilter = setFileFilter;
+// exports.clearSelectedFiles = clearSelectedFiles;
+// exports.getNextFile = getNextFile;
+// exports.getPrevFile = getPrevFile;
});
\ No newline at end of file
diff --git a/data/ext/perspectiveRiver/extension.js b/data/ext/perspectiveRiver/extension.js
index ec1e49a2f..865e8e2f0 100644
--- a/data/ext/perspectiveRiver/extension.js
+++ b/data/ext/perspectiveRiver/extension.js
@@ -10,7 +10,7 @@ define(function(require, exports, module) {
exports.Title = "River View"
exports.ID = "perspectiveRiver"; // ID should be equal to the directory name where the ext. is located
exports.Type = "view";
- exports.Icon = "ui-icon-video";
+ exports.Icon = "icon-film";
var TSCORE = require("tscore");
@@ -73,12 +73,7 @@ define(function(require, exports, module) {
}
var initButtons = function() {
- $( "#"+exports.ID+"CreateFileButton" ).button({
- text: true,
- icons: {
- primary: "ui-icon-document"
- }
- })
+ $( "#"+exports.ID+"CreateFileButton" )
.click(function() {
$( "#dialog-filecreate" ).dialog( "open" );
});
diff --git a/data/ext/perspectiveThumb/extension.js b/data/ext/perspectiveThumb/extension.js
index 27c1241f9..6e319a3e2 100644
--- a/data/ext/perspectiveThumb/extension.js
+++ b/data/ext/perspectiveThumb/extension.js
@@ -10,7 +10,7 @@ define(function(require, exports, module) {
exports.Title = "Thumbs"
exports.ID = "perspectiveThumb"; // ID should be equal to the directory name where the ext. is located
exports.Type = "view";
- exports.Icon = "ui-icon-image";
+ exports.Icon = "icon-picture";
var TSCORE = require("tscore");
@@ -65,7 +65,6 @@ define(function(require, exports, module) {
});
initButtons();
- initContextMenus();
}
exports.load = function load() {
@@ -110,31 +109,5 @@ define(function(require, exports, module) {
$( "#dialog-filecreate" ).dialog( "open" );
});
}
-
- var initContextMenus = function() {
- $( "#fileMenu1" ).menu({
- select: function( event, ui ) {
- var commandName = ui.item.attr( "action" );
- switch (commandName) {
- case "renameFile":
- $( this ).hide();
- console.debug("Renaming file...");
- $( "#dialog-filerename" ).dialog( "open" );
- break;
- case "deleteFile":
- $( this ).hide();
- console.debug("Deleting file...");
- $( "#dialog-confirmdelete" ).dialog( "open" );
- break;
- case "closeMenu":
- $( this ).hide();
- break;
- default:
- break;
- }
- $( this ).hide();
- }
- });
- }
});
\ No newline at end of file
diff --git a/data/index.html b/data/index.html
index e09ef650d..2bb9dc77d 100644
--- a/data/index.html
+++ b/data/index.html
@@ -25,9 +25,9 @@
<span id="loadingAnimation">&nbsp;</span>
<div class="btn-toolbar pull-right" style="margin: 0px;">
<div id="viewSwitcher" class="btn-group" data-toggle="buttons-radio"></div>
- <a id="testAlertButton" role="button" class="btn btn-small" title="Options Dialog" ><i class="icon-adjust"></i> Test Alerts</a>
- <a id="openOptions" href="#dialogOptions" role="button" class="btn btn-small" title="Options Dialog" data-toggle="modal"><i class="icon-wrench"></i> Options</a>
- <a id="openAboutBox" data-placement="bottom" href="#dialogAbout" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-comment"></i> About</a>
+ <!--a id="testAlertButton" role="button" class="btn btn-small" title="Options Dialog" ><i class="icon-adjust"></i> Test Alerts</a-->
+ <button id="openOptions" href="#dialogOptions" role="button" class="btn btn-small" title="Options Dialog" data-toggle="modal"><i class="icon-wrench"></i> Options</button>
+ <button id="openAboutBox" data-placement="bottom" href="#dialogAbout" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-comment"></i> About</button>
<!--button id="toggleLeftPanel" class="btn btn-small" title="Toggle Leftpanel"><i class="icon-list"></i>&nbsp;</button-->
</div>
</div>
@@ -70,7 +70,8 @@
<div class="east-south" style="padding: 0">
</div>
</div>
-
+</div>
+<div id="helpers" style="display: none;">
<div id="dialog-filecreate" class="modal hide" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
@@ -82,9 +83,9 @@
<label class="control-label" for="fileTypeChooser">Filetype</label>
<div class="controls">
<div class="btn-group" data-toggle="buttons-radio" name="fileTypeChooser">
- <button id="txtFileTypeButton" data-toggle="tooltip" title="Create a plain text file" name="fileTypeRadio" class="btn">TXT</button>
- <button id="mdFileTypeButton" data-toggle="tooltip" title="Create a MarkDown file" name="fileTypeRadio" class="btn">MD</button>
- <button id="htmlFileTypeButton" data-toggle="tooltip" title="Create a HTML file" name="fileTypeRadio" class="btn">HTML</button>
+ <button id="txtFileTypeButton" role="button" title="Create a plain text file" class="btn">TXT</button>
+ <button id="mdFileTypeButton" role="button" title="Create a MarkDown file" class="btn">MD</button>
+ <button id="htmlFileTypeButton" role="button" title="Create a HTML file" class="btn">HTML</button>
</div>
</div>
</div>
@@ -127,13 +128,13 @@
<div class="control-group">
<label class="control-label" for="connectionName">Connection Name</label>
<div class="controls">
- <input type="text" name="connectionName" id="connectionName" />
+ <input type="text" name="connectionName" id="connectionName" placeholder="Example: My Documents" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="folderLocation">Folder Location</label>
<div class="controls">
- <input type="text" name="folderLocation" id="folderLocation" placeholder="c:\users\ugg\documents" />
+ <input type="text" name="folderLocation" id="folderLocation" placeholder="Example: c:\users\ugg\documents" />
<button id="selectLocalDirectory" class="btn" title="Select local folder"><i class="icon-folder-open"></i></button>
</div>
</div>
@@ -177,9 +178,8 @@
</form>
</div>
<div class="modal-footer">
- <button class="btn" id="aboutDialogSettings">Advanced Settings</button>
- <button class="btn" id="aboutDialogBack">Back</button>
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
+ <button class="btn" id="aboutDialogBack">Apply</button>
</div>
</div>
@@ -206,17 +206,7 @@
<input type="text" name="renamedFileName" id="renamedFileName" style="display: inline; width: 100%;" />
</fieldset>
</form>
- </div>
-
- <div id="dialog-smarttag" title="Add smart tag">
- <p class="validateTips">All form fields are required.</p>
- <form action="javascript:void(0);">
- <fieldset>
- <label for="name">Smart tag name</label>
- <input type="text" name="smartTagName" id="smartTagName" />
- </fieldset>
- </form>
- </div>
+ </div>
<div id="dialogAddTags" title="Add Tags">
<p class="validateTips">All form fields are required.</p>
@@ -247,22 +237,6 @@
</form>
</div>
- <div id="dialog-confirmdelete" title="Delete selected files?">
- <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
- </div>
-
- <div id="dialog-confirmtagremove" title="Remove tag?">
- <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Do you really want to remove this tag?</p>
- </div>
-
- <div id="dialog-confirmtagdelete" title="Delete tag?">
- <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Do you really want to delete this tag from the taggroup?</p>
- </div>
-
- <div id="dialog-confirmtaggroupdelete" title="Delete taggroup?">
- <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Do you really want to delete this taggroup?</p>
- </div>
-
<div id="dialog-tagedit" title="Edit Tag">
<p class="validateTips">All form fields are required.</p>
<form action="javascript:void(0);">
@@ -300,10 +274,7 @@
<p>
<label for="name">Name</label>
<input type="text" name="name" id="newTagGroupName" />
- </p><!--p>
- <label for="key">Key(unique key of 3 letters)</label>
- <input type="text" name="key" id="newTagGroupKey" />
- </p-->
+ </p>
</fieldset>
</form>
</div>
@@ -313,43 +284,44 @@
<ul id="tagSuggestionsMenu" class="dropdown-menu has-tip anchor-right"></ul>
<ul id="fileMenu" class="dropdown-menu has-tip">
- <li action="addTag" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-tag"></span>Add Tags</a></li>
- <li action="openFile" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-plus"></span>Open File</a></li>
- <li action="openDirectory" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-folder-open"></span>Show containing folder</a></li>
- <li action="renameFile" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-pencil"></span>Raname File</a></li>
- <li action="deleteFile" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Delete File</a></li>
+ <li action="addTag" title=""><a href="#"><i class="icon-tag"></i> Add Tags</a></li>
+ <li action="openFile" title=""><a href="#"><i class="icon-share-alt"></i> Open File</a></li>
+ <li action="openDirectory" title=""><a href="#"><i class="icon-folder-open"></i> Show containing folder</a></li>
+ <li action="renameFile" title=""><a href="#"><i class="icon-pencil"></i> Raname File</a></li>
+ <li action="deleteFile" title=""><a href="#"><i class="icon-trash"></i> Delete File</a></li>
</ul>
<ul id="extensionMenu" class="dropdown-menu has-tip anchor-right">
- <li action="addTagAsFilter" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-search"></span>Set As Filter</a></li>
+ <li action="addTagAsFilter" title=""><a href="#"><i class="icon-filter"></i> Set As Filter</a></li>
</ul>
<ul id="tagMenu" class="dropdown-menu has-tip anchor-right">
- <li action="addTagAsFilter" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-search"></span>Set As Filter</a></li>
- <li action="editTag" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-pencil"></span>Edit Tag</a></li>
- <li action="removeTag" title=""><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Remove Tag</a></li>
+ <li action="addTagAsFilter" title=""><a href="#"><i class="icon-filter"></i> Set As Filter</a></li>
+ <li action="editTag" title=""><a href="#"><i class="icon-pencil"></i> Edit Tag</a></li>
+ <li action="removeTag" title=""><a href="#"><i class="icon-trash"></i> Remove Tag</a></li>
</ul>
<ul id="tagTreeMenu" class="dropdown-menu has-tip">
- <li action="addTagToFile" title="Add current tag to the selected files"><a href="javascript:void(0);"><span class="ui-icon ui-icon-tag"></span>Tag Selected Files</a></li>
- <li action="addTagAsFilter" title="Set current tag as a filter criteria"><a href="javascript:void(0);"><span class="ui-icon ui-icon-search"></span>Set As Filter</a></li>
- <li action="editTag" title="Edit current tag"><a href="javascript:void(0);"><span class="ui-icon ui-icon-wrench"></span>Edit</a></li>
- <li action="deleteTag" title="Delete the tag from the taggroup"><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Delete</a></li>
+ <li action="addTagToFile" title="Add current tag to the selected files"><a href="#"><i class="icon-tag"></i> Tag Selected Files</a></li>
+ <li action="addTagAsFilter" title="Set current tag as a filter criteria"><a href="#"><i class="icon-filter"></i> Set As Filter</a></li>
+ <li action="editTag" title="Edit current tag"><a href="#"><i class="icon-pencil"></i> Edit</a></li>
+ <li action="deleteTag" title="Delete the tag from the taggroup"><a href="#"><i class="icon-trash"></i> Delete</a></li>
</ul>
<ul id="tagGroupMenu" class="dropdown-menu has-tip">
- <!--li action="toggleTagGroup" title="Opens or Close the selected tagroup"><a href="javascript:void(0);">Toggle Taggroup</a></li-->
- <li action="createNewTag" title="Creates new tag"><a href="javascript:void(0);"><span class="ui-icon ui-icon-tag"></span>Create Tag</a></li>
- <!--li action="duplicateTagGroup" title="Duplicate current tagroup"><a href="javascript:void(0);"><span class="ui-icon ui-icon-copy"></span>Duplicate Taggroup</a></li-->
- <li action="createTagGroup" title="Create new tagroup"><a href="javascript:void(0);"><span class="ui-icon ui-icon-copy"></span>Create Taggroup</a></li>
- <li action="editTagGroup" title="Edit current tagroup"><a href="javascript:void(0);"><span class="ui-icon ui-icon-wrench"></span>Edit Taggroup</a></li>
- <li action="deleteTagGroup" title="Delete current tagroup"><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Delete Taggroup</a></li>
+ <li action="createNewTag" title="Creates new tag"><a href="#"><i class="icon-tag"></i> Create Tag</a></li>
+ <!--li action="duplicateTagGroup" title="Duplicate current tagroup"><a href="#"><i class="icon-plus-sign"></i> Duplicate Taggroup</a></li-->
+ <li action="createTagGroup" title="Create new tagGroup"><a href="#"><i class="icon-tags"></i> Create Taggroup</a></li>
+ <li action="moveUpTagGroup" title="Move current TagGroup one position up"><a href="#"><i class="icon-arrow-up"></i> Move TagGroup Up</a></li>
+ <li action="moveDownTagGroup" title="Move current TagGroup one position down"><a href="#"><i class="icon-arrow-down"></i> Move TagGroup Down</a></li>
+ <li action="editTagGroup" title="Edit Current tagGroup"><a href="#"><i class="icon-pencil"></i> Edit Taggroup</a></li>
+ <li action="deleteTagGroup" title="Delete Current TagGroup"><a href="#"><i class="icon-trash"></i> Delete Taggroup</a></li>
</ul>
<ul id="directoryMenu" class="dropdown-menu has-tip">
- <li action="reloadDirectory" title="Reload directory"><a href="javascript:void(0);"><span class="ui-icon ui-icon-refresh"></span>Reload Directory</a></li>
- <li action="createDirectory" title="Creates a new subdirectory"><a href="javascript:void(0);"><span class="ui-icon ui-icon-document"></span>New Subdirectory</a></li>
- <li action="openDirectory" title="Opens the directoriy in the default file browser"><a href="javascript:void(0);"><span class="ui-icon ui-icon-folder-open"></span>Show Folder</a></li>
+ <li action="reloadDirectory" title="Reload directory"><a href="#"><i class="icon-refresh"></i> Reload Directory</a></li>
+ <li action="createDirectory" title="Creates a new subdirectory"><a href="#"><i class="icon-folder-close"></i> New Subdirectory</a></li>
+ <li action="openDirectory" title="Opens the directoriy in the default file browser"><a href="#"><i class="icon-folder-open"></i> Show Folder</a></li>
</ul>
</div>
</body>
diff --git a/data/js/core.api.js b/data/js/core.api.js
index 906df60db..747c6cfe1 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -75,6 +75,7 @@ define(function(require, exports, module) {
$( "#loading" ).hide();
$( "#container" ).show();
+ $( "#helpers" ).show();
hideLoadingAnimation();
// TODO check if document.ready is really needed
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index 11ea8d1da..b42b11c14 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -31,7 +31,7 @@ define(function(require, exports, module) {
'<h4>' + title +'</h4>' +
'</div>' +
'<div class="modal-body">' +
- '<h6>' + message + '</h6>' +
+ '' + message + '' +
'</div>' +
'<div class="modal-footer">' +
'<a href="#" id="okButton" class="btn btn-primary">Ok</a>' +
@@ -56,7 +56,7 @@ define(function(require, exports, module) {
'<h4>' + title +'</h4>' +
'</div>' +
'<div class="modal-body">' +
- '<h6>' + message + '</h6>' +
+ '' + message + '' +
'</div>' +
'<div class="modal-footer">' +
'<a href="#" class="btn" data-dismiss="modal">Cancel</a>' +
@@ -165,23 +165,6 @@ define(function(require, exports, module) {
$( "#renamedFileName" ).val(TSCORE.TagUtils.extractFileName(TSCORE.selectedFiles[0]));
}
});
-
- $( "#dialog-confirmdelete" ).dialog({
- autoOpen: false,
- resizable: false,
- height:140,
- modal: true,
- buttons: {
- "Delete all items": function() {
- TSCORE.IO.deleteElement(TSCORE.selectedFiles[0]);
- $( this ).dialog( "close" );
- TSCORE.IO.listDirectory(TSCORE.currentPath);
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- });
$( "#tagTypeRadio" ).buttonset();
@@ -272,7 +255,41 @@ define(function(require, exports, module) {
$("#settingsPlainJSON").hide();
editor.set(TSCORE.Config.Settings);
}
- });
+ });
+
+ $( "#fileMenu" ).menu({
+ select: function( event, ui ) {
+ var commandName = ui.item.attr( "action" );
+ switch (commandName) {
+ case "addTag":
+ TSCORE.showAddTagsDialog();
+ break;
+ case "openFile":
+ TSCORE.FileOpener.openFile(TSCORE.selectedFiles[0]);
+ break;
+ case "openDirectory":
+ TSCORE.IO.openDirectory(TSCORE.currentPath);
+ break;
+ case "renameFile":
+ console.debug("Renaming file...");
+ $( "#dialog-filerename" ).dialog( "open" );
+ break;
+ case "deleteFile":
+ console.debug("Deleting file...");
+ TSCORE.showConfirmDialog(
+ "Delete File(s)",
+ "These items will be permanently deleted and cannot be recovered. Are you sure?",
+ function() {
+ TSCORE.IO.deleteElement(TSCORE.selectedFiles[0]);
+ TSCORE.IO.listDirectory(TSCORE.currentPath);
+ }
+ );
+ break;
+ default:
+ break;
+ }
+ }
+ });
}
var hideAllDropDownMenus = function() {
diff --git a/data/js/directories.ui.js b/data/js/directories.ui.js
index d937c07d8..e9d0e3a0c 100644
--- a/data/js/directories.ui.js
+++ b/data/js/directories.ui.js
@@ -60,12 +60,11 @@ define(function(require, exports, module) {
.hover(function() { $(this).toggleClass("ui-state-hover"); })
// Add plus button to h3
.append($("<span>", {
- class: "ui-icon ui-icon-triangle-1-e",
+ class: "icon-chevron-right", // icon-chevron-down
style: "position:relative!important; display:inline-block;",
})
.click(function() {
$(this)
- // .toggleClass("ui-icon-triangle-1-s")
.parent().toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").end()
.parent().next().toggleClass("ui-accordion-content-active").toggle();
return false;
@@ -95,7 +94,7 @@ define(function(require, exports, module) {
)
// Add settings button to h3
.append($("<span>", {
- class: "ui-icon ui-icon-gear",
+ class: "icon-cog",
key: directoryHistory[i].key,
title: "Directorys options",
style: "float: right!important; position:relative!important; vertical-align: middle; display:inline-block;",
@@ -369,12 +368,16 @@ define(function(require, exports, module) {
for (var i=0; i < favoritesList.length; i++) {
$( "#favoritesList" ).append(
$('<li>', { title: favoritesList[i].path, name: favoritesList[i].name}).append(
- $('<a>', { href: "javascript:void(0);", text: favoritesList[i].name} )));
+ $('<a>', { href: "#"} ).append(
+ "<i class='icon-briefcase'></i>"
+ ).append(
+ " "+favoritesList[i].name
+ )));
};
$( "#favoritesList" ).append('<li><hr></li>');
- $( "#favoritesList" ).append('<li name="createFavorite" id="createNewLocation" ><a href="javascript:void(0);"><span class="ui-icon ui-icon-document"></span>New Location</a></li>');
- // $( "#favoritesList" ).append('<li name="editFavorite"><a href="javascript:void(0);"><span class="ui-icon ui-icon-pencil"></span>Edit Location</a></li>');
- $( "#favoritesList" ).append('<li name="deleteFavorite"><a href="javascript:void(0);"><span class="ui-icon ui-icon-trash"></span>Remove Location</a></li>');
+ $( "#favoritesList" ).append('<li name="createFavorite" id="createNewLocation" ><a href="#"><i class="icon-magnet"></i> New Location</a></li>');
+ // $( "#favoritesList" ).append('<li name="editFavorite"><a href="javascript:void(0);"><i class="icon-pencil"></i> Edit Location</a></li>');
+ $( "#favoritesList" ).append('<li name="deleteFavorite"><a href="javascript:void(0);"><i class="icon-trash"></i> Remove Location</a></li>');
$( "#favoritesList" ).menu("destroy").menu({
select: function( event, ui ) {
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 727d050d9..efdd00bd2 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -180,11 +180,11 @@ define(function(require, exports, module) {
addTagSuggestionButton("#filetoolbox");
addCloseButton("#filetoolbox");
- // Add to dropdown
- //addFullScreenButton("#filetoolbox");
- //addOpenInWindowButton("#filetoolbox", filePath);
- //addEditButton("#filetoolbox", filePath);
- //addShowFullDetailsButton("#filetoolbox");
+ //TODO Add to dropdown
+ addFullScreenButton("#filetoolbox");
+ addOpenInWindowButton("#filetoolbox", filePath);
+ addEditButton("#filetoolbox", filePath);
+ addShowFullDetailsButton("#filetoolbox");
}
function initTagSuggestionMenu(filePath) {
@@ -273,19 +273,15 @@ define(function(require, exports, module) {
buttonDisabled = true;
}
var options;
- $( ""+container ).append('<button id="editDocument">Edit</button>');
- $( "#editDocument" ).button({
- text: true,
- icons: {
- primary: "ui-icon-wrench"
- },
- disabled: buttonDisabled
- })
- .focus(function() {
+ // Todo make use of buttonDisabled
+ $( ""+container ).append('<button id="editDocument" class="btn btn-small" title="Edit file"><i class="icon-pencil"></i> Edit</button>');
+ $( "#editDocument" ).focus(function() {
this.blur();
})
.click(function() {
- if ( $( this ).text() === "Edit" ) {
+ // TODO reenable edit
+ TSCORE.showAlertDialog("Edit button currently disabled.");
+ /*if ( $( this ).text() === "Edit" ) {
options = {
label: "Save&Close",
icons: {
@@ -304,48 +300,28 @@ define(function(require, exports, module) {
saveFile(filePath);
}
}
- $( this ).button( "option", options );
+ $( this ).button( "option", options );
+ */
});
}
function addShowFullDetailsButton(container) {
- $( ""+container ).append('<button id="showFullDetails">Full details</button>');
- $( "#showFullDetails" ).button({
- text: false,
- icons: {
- primary: "ui-icon-arrowthick-2-n-s"
- },
- disabled: false
- })
- .click(function() {
+ $( ""+container ).append('<button id="showFullDetails" class="btn btn-small" title="Show full file details"><i class="icon-list-alt"></i> Full details</button>');
+ $( "#showFullDetails" ).click(function() {
TSCORE.toggleFileDetails();
});
}
function addOpenInWindowButton(container, filePath) {
- $( ""+container ).append('<button id="openInNewWindow">Open in New Tab</button>');
- $( "#openInNewWindow" ).button({
- text: false,
- icons: {
- primary: "ui-icon-extlink"
- },
- disabled: false
- })
- .click(function() {
+ $( ""+container ).append('<button id="openInNewWindow" class="btn btn-small" title="Open file in a new tab"><i class="icon-share"></i> Open in New Tab</button>');
+ $( "#openInNewWindow" ).click(function() {
window.open("file:///"+filePath);
});
}
function addFullScreenButton(container) {
- $( ""+container ).append('<button id="startFullscreen">Fullscreen</button>');
- $( "#startFullscreen" ).button({
- text: false,
- icons: {
- primary: "ui-icon-arrow-4-diag"
- },
- disabled: false
- })
- .click(function() {
+ $( ""+container ).append('<button id="startFullscreen" class="btn btn-small" title="Open file in full screen"><i class="icon-fullscreen"></i> Fullscreen</button>');
+ $( "#startFullscreen" ).click(function() {
var docElm = $("#viewer")[0];
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
diff --git a/data/js/ioapi.mozilla.receiver.js b/data/js/ioapi.mozilla.receiver.js
index 2732e4207..205d72e1c 100644
--- a/data/js/ioapi.mozilla.receiver.js
+++ b/data/js/ioapi.mozilla.receiver.js
@@ -93,7 +93,7 @@ console.debug("Loading messaging.mozilla.js..");
break;
case "createDirectoryTree":
if(message.success){
- //console.debug("Directory tree: "+JSON.stringify(message.content));
+ console.debug("Directory tree: "+JSON.stringify(message.content));
TSCORE.ViewManager.updateTreeData(message.content);
} else {
TSCORE.updateLogger("Indexing directory failed");
diff --git a/data/js/perspective.manager.js b/data/js/perspective.manager.js
index bc41bb0a8..678594640 100644
--- a/data/js/perspective.manager.js
+++ b/data/js/perspective.manager.js
@@ -68,14 +68,16 @@ var initViewsUI = function(perspective) {
style: "width: 100%; height: 100%",
}).hide());
- // TODO Perspective Icon
$("#viewSwitcher").append($("<button>", {
- viewid: perspective.ID,
- text: perspective.Title,
- type: "button",
- class: "btn btn-small",
+ "viewid": perspective.ID,
+ "type": "button",
+ "class": "btn btn-small",
id: perspective.ID+"Button",
- }));
+ }).append($("<i>", {
+ "class": perspective.Icon
+ }))
+ .append(" "+perspective.Title)
+ );
// Adding event listener & icon to the radio button
$( "#"+perspective.ID+"Button" ).click(function() {
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index d828f5e7b..77e886b26 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -51,6 +51,10 @@ define(function(require, exports, module) {
"lastOpenedTSID": 0,
"lastOpenedDirectory": "",
"tagspacesList": [
+ {
+ "name": "Sandbox",
+ "path": "/media/z/TagSpaces/sandbox/"
+ },
],
"extensionsPath": "ext",
"extensions": [
@@ -59,6 +63,11 @@ define(function(require, exports, module) {
"enabled": "true",
"type": "view",
},
+ {
+ "id": "perspectiveGraph", // ID should be equal to the directory name where the extension is located
+ "enabled": "true",
+ "type": "view",
+ },
],
"supportedFileTypes": [
{ "type": "jpg", "viewer": "viewerBrowser", "editor": "false" },
@@ -131,7 +140,7 @@ define(function(require, exports, module) {
]
}
- exports.Setting = undefined;
+ exports.Settings = undefined;
var firstRun = false;
@@ -232,23 +241,9 @@ define(function(require, exports, module) {
return exports.Settings["lastOpenedDirectory"];
}
- var deleteTag = function(tagData) {
+ var getTagData = function(tagTitle, tagGroupKey) {
for(var i=0; i < exports.Settings["tagGroups"].length; i++) {
- if(exports.Settings["tagGroups"][i].key == tagData.parentKey) {
- for(var j=0; j < exports.Settings["tagGroups"][i]["children"].length; j++) {
- if(exports.Settings["tagGroups"][i]["children"][j].title == tagData.title) {
- exports.Settings["tagGroups"][i]["children"].splice(j, 1);
- break;
- }
- }
- }
- }
- exports.saveSettings();
- }
-
- var getTagData = function(tagTitle, parentKey) {
- for(var i=0; i < exports.Settings["tagGroups"].length; i++) {
- if(exports.Settings["tagGroups"][i].key == parentKey) {
+ if(exports.Settings["tagGroups"][i].key == tagGroupKey) {
for(var j=0; j < exports.Settings["tagGroups"][i]["children"].length; j++) {
if(exports.Settings["tagGroups"][i]["children"][j].title == tagTitle) {
return exports.Settings["tagGroups"][i]["children"][j];
@@ -276,7 +271,7 @@ define(function(require, exports, module) {
break;
}
}
- exports.saveSettings();
+ saveSettings();
}
var editTag = function(tagData, newTagName) {
@@ -290,20 +285,48 @@ define(function(require, exports, module) {
}
}
}
- exports.saveSettings();
+ saveSettings();
}
+
+ var deleteTag = function(tagData) {
+ for(var i=0; i < exports.Settings["tagGroups"].length; i++) {
+ if(exports.Settings["tagGroups"][i].key == tagData.parentKey) {
+ for(var j=0; j < exports.Settings["tagGroups"][i]["children"].length; j++) {
+ if(exports.Settings["tagGroups"][i]["children"][j].title == tagData.title) {
+ exports.Settings["tagGroups"][i]["children"].splice(j, 1);
+ break;
+ }
+ }
+ }
+ }
+ exports.saveSettings();
+ }
+
+ var moveTag = function(tagData, targetTagGroupKey) {
+ var targetTagGroupData = getTagGroupData(targetTagGroupKey);
+ if(createTag(targetTagGroupData, tagData.title)) {
+ deleteTag(tagData);
+ saveSettings();
+ }
+ }
var createTag = function(tagData, newTagName) {
var newTagModel = JSON.parse( JSON.stringify(tagTemplate) );
newTagModel.title = newTagName;
- for(var i=0; i < exports.Settings["tagGroups"].length; i++) {
- if(exports.Settings["tagGroups"][i].key == tagData.key) {
+ exports.Settings["tagGroups"].forEach(function (value, index) {
+ if(value.key == tagData.key) {
console.debug("Creating tag: "+JSON.stringify(newTagModel)+" with parent: "+tagData.key);
- exports.Settings["tagGroups"][i]["children"].push(newTagModel);
- break;
+ value["children"].forEach(function (value, index) {
+ if(value.title == newTagName) {
+ console.debug("Tag with the same name already exist in this group");
+ return false;
+ }
+ });
+ value["children"].push(newTagModel);
}
- }
- saveSettings();
+ })
+ saveSettings();
+ return true;
}
var editTagGroup = function(tagData, tagGroupName) {
@@ -341,8 +364,27 @@ define(function(require, exports, module) {
saveSettings();
}
- var moveTagGroup = function(tagData, tagGroupName) {
-
+ var moveTagGroup = function(tagData, direction) {
+ var targetPosition = undefined;
+ var currentPosition = undefined;
+ exports.Settings["tagGroups"].forEach(function (value, index) {
+ if(value.key == tagData.key) {
+ currentPosition = index;
+ }
+ });
+
+ if (direction == "up") targetPosition = currentPosition -1;
+ if (direction == "down") targetPosition = currentPosition +1;
+
+ // Check if target position is within the taggroups array range
+ if (targetPosition < 0 || targetPosition >= exports.Settings["tagGroups"].length || targetPosition == currentPosition) {
+ return false;
+ }
+
+ var tmpTagGroup = exports.Settings["tagGroups"][currentPosition];
+ exports.Settings["tagGroups"][currentPosition] = exports.Settings["tagGroups"][targetPosition];
+ exports.Settings["tagGroups"][targetPosition] = tmpTagGroup;
+ saveSettings();
}
var createFavorite = function(name, location) {
@@ -383,7 +425,7 @@ define(function(require, exports, module) {
var loadSettingsLocalStorage = function() {
try {
var tmpSettings = JSON.parse(localStorage.getItem('tagSpacesSettings'));
- console.debug("Settings: "+JSON.stringify(tmpSettings));
+ //console.debug("Settings: "+JSON.stringify(tmpSettings));
if(tmpSettings!=null) {
exports.Settings = tmpSettings;
} else {
@@ -391,6 +433,7 @@ define(function(require, exports, module) {
// the application runs for the first time.
firstRun = true;
}
+ console.debug("Loaded settings from local storage: "+JSON.stringify(exports.Settings));
} catch(ex) {
console.debug("Loading settings from local storage failed due exception: "+ex);
}
@@ -398,7 +441,8 @@ define(function(require, exports, module) {
// Save setting and Reloads the app
var saveSettings = function() {
- // Storing setting in the local storage for mozilla and chorme
+// console.debug("Settings:");
+ // Storing setting in the local storage of mozilla and chorme
localStorage.setItem('tagSpacesSettings', JSON.stringify(exports.Settings));
// Storing settings in mozilla native preferences
@@ -428,8 +472,10 @@ define(function(require, exports, module) {
exports.getTagGroupData = getTagGroupData;
exports.deleteTagGroup = deleteTagGroup;
exports.editTag = editTag;
- exports.createTag = createTag;
+ exports.createTag = createTag;
+ exports.moveTag = moveTag
exports.editTagGroup = editTagGroup;
+ exports.moveTagGroup = moveTagGroup;
exports.createTagGroup = createTagGroup;
exports.duplicateTagGroup = duplicateTagGroup;
exports.createFavorite = createFavorite;
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index 77d709637..95087e56a 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -34,21 +34,17 @@ define(function(require, exports, module) {
console.debug("Tag menu action: "+ui.item.attr( "action" )+" for tag: "+TSCORE.selectedTag);
switch (ui.item.attr( "action" )) {
case "addTagAsFilter":
- $( this ).hide();
$("#filterBox").val(TSCORE.selectedTag);
TSCORE.ViewManager.setFileFilter(TSCORE.selectedTag);
break;
case "addTagInTagGroup":
- $( this ).hide();
// TODO Finish add tag in group
break;
case "editTag":
- $( this ).hide();
$( "#newTag" ).val(TSCORE.selectedTag);
$( "#dialogEditTag" ).dialog( "open" );
break;
case "removeTag":
- $( this ).hide();
TSCORE.TagUtils.removeTag(TSCORE.selectedFiles[0],TSCORE.selectedTag);
break;
}
@@ -72,7 +68,14 @@ define(function(require, exports, module) {
$( "#dialog-tagedit" ).dialog( "open" );
break;
case "deleteTag":
- $( "#dialog-confirmtagdelete" ).dialog( "open" );
+ TSCORE.showConfirmDialog(
+ "Delete Tag",
+ "Do you want to delete this tag from the taggroup?",
+ function() {
+ TSCORE.Config.deleteTag(TSCORE.selectedTagData);
+ generateTagGroups();
+ }
+ );
break;
}
}
@@ -88,10 +91,25 @@ define(function(require, exports, module) {
$( "#dialog-tagcreate" ).dialog( "open" );
break;
case "deleteTagGroup":
- $( "#dialog-confirmtaggroupdelete" ).dialog( "open" );
+ TSCORE.showConfirmDialog(
+ "Delete TagGroup",
+ "Do you want to delete this taggroup?",
+ function() {
+ TSCORE.Config.deleteTagGroup(TSCORE.selectedTagData);
+ generateTagGroups();
+ }
+ );
break;
- case "createTagGroup":
- $( "#dialog-taggroupCreate" ).dialog( "open" );
+ case "createTagGroup":
+ $( "#dialog-taggroupCreate" ).dialog( "open" );
+ break;
+ case "moveUpTagGroup":
+ TSCORE.Config.moveTagGroup(TSCORE.selectedTagData, "up");
+ generateTagGroups();
+ break;
+ case "moveDownTagGroup":
+ TSCORE.Config.moveTagGroup(TSCORE.selectedTagData, "down");
+ generateTagGroups();
break;
case "editTagGroup":
$( "#tagGroupName" ).val(TSCORE.selectedTagData.title);
@@ -99,120 +117,10 @@ define(function(require, exports, module) {
break;
}
}
- });
-
- $( "#fileMenu" ).menu({
- select: function( event, ui ) {
- var commandName = ui.item.attr( "action" );
- switch (commandName) {
- case "addTag":
- TSCORE.showAddTagsDialog();
- break;
- case "openFile":
- TSCORE.FileOpener.openFile(TSCORE.selectedFiles[0]);
- break;
- case "openDirectory":
- TSCORE.IO.openDirectory(TSCORE.currentPath);
- break;
- case "renameFile":
- console.debug("Renaming file...");
- $( "#dialog-filerename" ).dialog( "open" );
- break;
- case "deleteFile":
- console.debug("Deleting file...");
- $( "#dialog-confirmdelete" ).dialog( "open" );
- break;
- default:
- break;
- }
- }
});
}
function initDialogs() {
- $( "#dialog-smarttag" ).dialog({
- autoOpen: false,
- height: 220,
- width: 450,
- modal: true,
- buttons: {
- "Add smart tag": function() {
- var bValid = true;
- allFields.removeClass( "ui-state-error" );
-
- //bValid = bValid && checkLength( smartTag, "tagname", 2, 40 );
- if ( bValid ) {
- for (var i=0; i < TSCORE.selectedFiles.length; i++) {
- TSCORE.TagUtils.writeTagsToFile(TSCORE.selectedFiles[i], [$( "#smartTagName" ).val()]);
- };
- $( this ).dialog( "close" );
- IOAPI.listDirectory(TSCORE.currentPath);
- }
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- allFields.val( "" ).removeClass( "ui-state-error" );
- },
- open: function() {
- $( "#renamedFileName" ).val(TSCORE.selectedFiles[0]);
- }
- });
-
- /* Currently not used
- $( "#dialog-confirmtagremove" ).dialog({
- autoOpen: false,
- resizable: false,
- height:140,
- modal: true,
- buttons: {
- "Remove": function() {
- TSCORE.TagUtils.removeTag(TSCORE.selectedTag);
- $( this ).dialog( "close" );
- IOAPI.listDirectory(TSCORE.currentPath);
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- }); */
-
- $( "#dialog-confirmtagdelete" ).dialog({
- autoOpen: false,
- resizable: false,
- height:140,
- modal: true,
- buttons: {
- "Delete": function() {
- TSCORE.Config.deleteTag(TSCORE.selectedTagData);
- generateTagGroups();
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- });
-
- $( "#dialog-confirmtaggroupdelete" ).dialog({
- autoOpen: false,
- resizable: false,
- height:140,
- modal: true,
- buttons: {
- "Delete": function() {
- TSCORE.Config.deleteTagGroup(TSCORE.selectedTagData);
- generateTagGroups();
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- }
- });
-
$( "#dialog-tagedit" ).dialog({
autoOpen: false,
resizable: false,
@@ -343,20 +251,20 @@ define(function(require, exports, module) {
}
});
}
- });
-
+ });
}
+
function generateTagGroups() {
console.debug("Generating TagGroups...");
$("#tagGroups").empty();
$("#tagGroups").addClass("accordion");
for(var i=0; i < TSCORE.Config.Settings["tagGroups"].length; i++) {
- // Code based on http://jsbin.com/eqape/1/edit
$("#tagGroups").append($("<div>", {
"class": "accordion-group"
})
.append($("<div>", {
"class": "accordion-heading",
+ "key": TSCORE.Config.Settings["tagGroups"][i].key,
})
.append($("<a>", {
"class": "tagGroupTitle",
@@ -364,19 +272,33 @@ define(function(require, exports, module) {
"data-target": "#tagButtons"+i,
"href": "#",
"text": TSCORE.Config.Settings["tagGroups"][i].title,
+ "key": TSCORE.Config.Settings["tagGroups"][i].key,
})
)
+ .droppable({
+ accept: '.tagButton',
+ hoverClass: "dirButtonActive",
+ drop: function( event, ui ) {
+ var tagGroupData = TSCORE.Config.getTagData(ui.draggable.attr("tag"), ui.draggable.attr("parentKey"));
+ tagGroupData.parentKey = ui.draggable.attr("parentKey");
+ var targetTagGroupKey = $(this).attr("key");
+ console.log("Moving tag: "+tagGroupData.title+" to "+targetTagGroupKey);
+ TSCORE.Config.moveTag(tagGroupData, targetTagGroupKey);
+ generateTagGroups();
+ }
+ })
.append($("<a>", {
"class": "dropdown-toggle pull-right",
+ "style": "padding-right: 4px;",
"role": "button",
"tag": TSCORE.Config.Settings["tagGroups"][i].title,
"key": TSCORE.Config.Settings["tagGroups"][i].key,
"title": "Taggroup options",
"href": "#"
- })
- .append("<b class='caret'></b>")
+ })
.dropdown( 'attach' , '#tagGroupMenu' )
+ .append("<b class='icon-cog'></b>")
.click( function(event) {
//console.debug("Clicked in taggroup setting");
TSCORE.selectedTag = $(this).attr("tag");
@@ -409,18 +331,18 @@ define(function(require, exports, module) {
"parentKey": TSCORE.Config.Settings["tagGroups"][i].key,
"title": "Opens context menu for "+TSCORE.Config.Settings["tagGroups"][i]["children"][j].title,
"text": TSCORE.Config.Settings["tagGroups"][i]["children"][j].title,
- })
- .draggable({
- "cancel": false,
- "appendTo": "body",
- "helper": "clone",
- "revert": true,
- })
+ })
.click( function() {
TSCORE.selectedTag = $(this).attr("tag");
TSCORE.selectedTagData = TSCORE.Config.getTagData($(this).attr("tag"), $(this).attr("parentKey"));
TSCORE.selectedTagData.parentKey = $(this).attr("parentKey");
})
+ .draggable({
+ "cancel": false,
+ "appendTo": "body",
+ "helper": "clone",
+ "revert": true,
+ })
.append( "<span class='caret'>" )
.dropdown( 'attach' , '#tagTreeMenu' )
);
diff --git a/lib/ioutils.js b/lib/ioutils.js
index b3a21b4e3..0400d056b 100644
--- a/lib/ioutils.js
+++ b/lib/ioutils.js
@@ -107,7 +107,7 @@ function directoryTree(dirPath) {
var dirList = filesIO.list(dirPath);
var directory = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
directory.initWithPath(dirPath);
- console.log("Directory "+JSON.stringify(directory));
+ //console.log("Directory "+JSON.stringify(directory));
tree["name"] = directory.leafName;
tree["type"] = "directory";
tree["lmdt"] = directory.lastModifiedTime;
@@ -115,20 +115,25 @@ function directoryTree(dirPath) {
tree["children"] = [];
for (var i=0; i < dirList.length; i++) {
- var path = filesIO.join(dirPath,dirList[i]);
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- file.initWithPath(path);
- if (file.isFile()) {
- tree["children"].push({
- "name": file.leafName,
- "type": "file",
- "size": file.fileSize,
- "lmdt": file.lastModifiedTime,
- "path": path
- });
- } else {
- tree["children"].push( directoryTree(path) );
- }
+ try {
+ var path = filesIO.join(dirPath,dirList[i]);
+ var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
+ file.initWithPath(path);
+ if (file.isFile()) {
+ tree["children"].push({
+ "name": file.leafName,
+ "type": "file",
+ "size": file.fileSize,
+ "lmdt": file.lastModifiedTime,
+ "path": path
+ });
+ } else {
+ tree["children"].push( directoryTree(path) );
+ }
+ } catch(ex) {
+ console.error("Filepath has a invalid encoding "+ex);
+ }
+
}
return tree;
} catch(ex) {
@@ -140,19 +145,23 @@ function scanDirectory(dirPath, index) {
try {
var dirList = filesIO.list(dirPath);
for (var i=0; i < dirList.length; i++) {
- var path = filesIO.join(dirPath,dirList[i]);
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- file.initWithPath(path);
- index.push({
- "name": file.leafName,
- "type": file.isFile()?"file":"directory",
- "size": file.fileSize,
- "lmdt": file.lastModifiedTime,
- "path": path
- });
- if (!file.isFile()) {
- scanDirectory(path, index);
- }
+ try {
+ var path = filesIO.join(dirPath,dirList[i]);
+ var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
+ file.initWithPath(path);
+ index.push({
+ "name": file.leafName,
+ "type": file.isFile()?"file":"directory",
+ "size": file.fileSize,
+ "lmdt": file.lastModifiedTime,
+ "path": path
+ });
+ if (!file.isFile()) {
+ scanDirectory(path, index);
+ }
+ } catch(ex) {
+ console.error("Filepath has a invalid encoding "+ex);
+ }
}
return index;
} catch(ex) {
@@ -167,16 +176,20 @@ exports.listDirectory = function listDirectory(dirPath, worker) {
var dirList = filesIO.list(dirPath);
var anotatedDirList = [];
for (var i=0; i < dirList.length; i++) {
- var path = filesIO.join(dirPath,dirList[i]);
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- file.initWithPath(filesIO.join(dirPath,dirList[i]));
- anotatedDirList.push({
- "name": file.leafName,
- "type": file.isFile()?"file":"directory",
- "size": file.fileSize,
- "lmdt": file.lastModifiedTime,
- "path": path
- });
+ try {
+ var path = filesIO.join(dirPath,dirList[i]);
+ var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
+ file.initWithPath(filesIO.join(dirPath,dirList[i]));
+ anotatedDirList.push({
+ "name": file.leafName,
+ "type": file.isFile()?"file":"directory",
+ "size": file.fileSize,
+ "lmdt": file.lastModifiedTime,
+ "path": path
+ });
+ } catch(ex) {
+ console.error("Filepath has a invalid encoding "+ex);
+ }
}
worker.postMessage({
"command": "listDirectory",
@@ -236,16 +249,21 @@ exports.getSubdirs = function getSubdirs(dirPath, worker) {
var dirList = filesIO.list(dirPath);
var anotatedDirList = [];
for (var i=0; i < dirList.length; i++) {
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- var fullPath = filesIO.join(dirPath,dirList[i]);
- file.initWithPath(fullPath);
- if(file.isFile() == false) {
- anotatedDirList.push({
- "title": file.leafName,
- "isFolder": true,
- "isLazy": true,
- "key": fullPath
- });
+ try {
+ var fullPath = filesIO.join(dirPath,dirList[i]);
+ var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
+ file.initWithPath(fullPath);
+ console.debug("File: "+file);
+ if(file.isFile() == false) {
+ anotatedDirList.push({
+ "title": file.leafName,
+ "isFolder": true,
+ "isLazy": true,
+ "key": fullPath
+ });
+ }
+ } catch(ex) {
+ console.error("Filepath has a invalid encoding "+ex);
}
}
worker.postMessage({