зеркало из https://github.com/mozilla/gecko-dev.git
Fix bookmark and history menus. Bug 37078 r=pavlov
This commit is contained in:
Родитель
e2f9beb2da
Коммит
c566e998b6
|
@ -28,10 +28,19 @@ function debug(msg)
|
|||
//dump(msg+"\n");
|
||||
}
|
||||
|
||||
function Init() {
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
debug("adding controller to tree");
|
||||
tree.controllers.appendController(BookmarksController);
|
||||
var children = document.getElementById('treechildren-bookmarks');
|
||||
tree.selectItem(children.firstChild);
|
||||
tree.focus();
|
||||
}
|
||||
|
||||
var BookmarksController = {
|
||||
supportsCommand: function(command)
|
||||
{
|
||||
debug("in supports with " + command);
|
||||
debug("bookmarks in supports with " + command);
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_undo":
|
||||
|
@ -49,7 +58,7 @@ var BookmarksController = {
|
|||
},
|
||||
isCommandEnabled: function(command)
|
||||
{
|
||||
debug("in enabled with " + command);
|
||||
debug("bookmarks in enabled with " + command);
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_undo":
|
||||
|
@ -67,7 +76,7 @@ var BookmarksController = {
|
|||
},
|
||||
doCommand: function(command)
|
||||
{
|
||||
debug("in do with " + command);
|
||||
debug("bookmarks in do with " + command);
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_undo":
|
||||
|
@ -92,7 +101,7 @@ var BookmarksController = {
|
|||
},
|
||||
onEvent: function(event)
|
||||
{
|
||||
debug("in event");
|
||||
debug("bookmarks in event");
|
||||
// On blur events set the menu item texts back to the normal values
|
||||
/*if (event == 'blur' )
|
||||
{
|
||||
|
@ -102,19 +111,10 @@ var BookmarksController = {
|
|||
}
|
||||
};
|
||||
|
||||
function Init() {
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
debug("adding controller to tree");
|
||||
tree.controllers.appendController(BookmarksController);
|
||||
var children = document.getElementById('treechildren-bookmarks');
|
||||
tree.selectItem(children.firstChild);
|
||||
}
|
||||
|
||||
function CommandUpdate_Bookmarks()
|
||||
{
|
||||
debug("CommandUpdate_Bookmarks()");
|
||||
//goUpdateCommand('button_delete');
|
||||
|
||||
// get selection info from dir pane
|
||||
/*
|
||||
var oneAddressBookSelected = false;
|
||||
|
@ -132,7 +132,6 @@ function CommandUpdate_Bookmarks()
|
|||
goSetCommandEnabled('bm_cmd_find', true/*oneAddressBookSelected*/);
|
||||
}
|
||||
|
||||
|
||||
function copySelectionToClipboard()
|
||||
{
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
|
@ -429,7 +428,12 @@ function doDelete(promptFlag)
|
|||
|
||||
if (promptFlag == true)
|
||||
{
|
||||
var deleteStr = get_localized_string("DeleteItems");
|
||||
var deleteStr = '';
|
||||
if (select_list.length == 1) {
|
||||
deleteStr = get_localized_string("DeleteItem");
|
||||
} else {
|
||||
deleteStr = get_localized_string("DeleteItems");
|
||||
}
|
||||
var ok = confirm(deleteStr);
|
||||
if (!ok) return false;
|
||||
}
|
||||
|
@ -605,25 +609,134 @@ function OpenURL(event, node, root)
|
|||
return true;
|
||||
}
|
||||
|
||||
function doSort(sortColName)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return false;
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true")
|
||||
{
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else sortDirection = "ascending";
|
||||
function update_sort_menuitems(column, direction) {
|
||||
var unsorted_menuitem = document.getElementById("unsorted_menuitem");
|
||||
var sort_ascending = document.getElementById('sort_ascending');
|
||||
var sort_descending = document.getElementById('sort_descending');
|
||||
|
||||
if (direction == "natural") {
|
||||
unsorted_menuitem.setAttribute('checked','true');
|
||||
sort_ascending.setAttribute('disabled','true');
|
||||
sort_descending.setAttribute('disabled','true');
|
||||
sort_ascending.removeAttribute('checked');
|
||||
sort_descending.removeAttribute('checked');
|
||||
} else {
|
||||
sort_ascending.removeAttribute('disabled');
|
||||
sort_descending.removeAttribute('disabled');
|
||||
if (direction == "ascending") {
|
||||
sort_ascending.setAttribute('checked','true');
|
||||
} else {
|
||||
sort_descending.setAttribute('checked','true');
|
||||
}
|
||||
|
||||
var columns = document.getElementById('theColumns');
|
||||
var column_node = columns.firstChild;
|
||||
var column_name = column.id;
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (1) {
|
||||
var name = menuitem.getAttribute('column_id');
|
||||
debug("update: "+name)
|
||||
if (!name) break;
|
||||
if (column_name == name) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
break;
|
||||
}
|
||||
if ("true" == column_node.getAttribute("hidden")) {
|
||||
debug("disabled: " + name);
|
||||
item.setAttribute("disabled", "true");
|
||||
}
|
||||
menuitem = menuitem.nextSibling;
|
||||
column_node = column_node.nextSibling;
|
||||
}
|
||||
}
|
||||
enable_sort_menuitems();
|
||||
}
|
||||
|
||||
function enable_sort_menuitems() {
|
||||
var columns = document.getElementById('theColumns');
|
||||
var column_node = columns.firstChild;
|
||||
var head = document.getElementById('headRow');
|
||||
var tree_column = head.firstChild;
|
||||
var skip_column = document.getElementById('popupCell');
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (column_node) {
|
||||
if (skip_column != tree_column) {
|
||||
if ("true" == column_node.getAttribute("hidden")) {
|
||||
menuitem.setAttribute("disabled", "true");
|
||||
} else {
|
||||
menuitem.removeAttribute("disabled");
|
||||
}
|
||||
}
|
||||
menuitem = menuitem.nextSibling;
|
||||
tree_column = tree_column.nextSibling;
|
||||
column_node = column_node.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
function find_sort_column() {
|
||||
var columns = document.getElementById('theColumns');
|
||||
var column = columns.firstChild;
|
||||
while (column) {
|
||||
if ("true" == column.getAttribute('sortActive')) {
|
||||
return column;
|
||||
}
|
||||
column = column.nextSibling;
|
||||
}
|
||||
return columns.firstChild;
|
||||
}
|
||||
|
||||
function find_sort_direction(column) {
|
||||
if ("true" == column.getAttribute('sortActive')) {
|
||||
return column.getAttribute('sortDirection');
|
||||
} else {
|
||||
return "natural";
|
||||
}
|
||||
}
|
||||
|
||||
function SetSortDirection(direction)
|
||||
{
|
||||
debug("SetSortDirection("+direction+")");
|
||||
var current_column = find_sort_column();
|
||||
var current_direction = find_sort_direction(current_column);
|
||||
if (current_direction != direction) {
|
||||
sort_column(current_column, direction);
|
||||
}
|
||||
}
|
||||
|
||||
function SetSortColumn(column_name)
|
||||
{
|
||||
debug("SetSortColumn("+column_name+")");
|
||||
var current_column = find_sort_column();
|
||||
var current_direction = find_sort_direction(current_column);
|
||||
var column = document.getElementById(column_name);
|
||||
if (column != current_column || current_direction == "natural") {
|
||||
sort_column(column, "ascending");
|
||||
}
|
||||
}
|
||||
|
||||
function TriStateColumnSort(column_name)
|
||||
{
|
||||
debug("TriStateColumnSort("+column_name+")");
|
||||
var current_column = find_sort_column();
|
||||
var current_direction = find_sort_direction(current_column);
|
||||
var column = document.getElementById(column_name);
|
||||
if (!column) return false;
|
||||
var direction = "ascending";
|
||||
if (column == current_column) {
|
||||
if (current_direction == "ascending") {
|
||||
direction = "descending";
|
||||
} else if (current_direction == "descending") {
|
||||
direction = "natural";
|
||||
}
|
||||
}
|
||||
sort_column(column, direction);
|
||||
}
|
||||
|
||||
function sort_column(column, direction)
|
||||
{
|
||||
var isupports_uri = "component://netscape/rdf/xul-sort-service";
|
||||
var isupports = Components.classes[isupports_uri].getService();
|
||||
if (!isupports) return false;
|
||||
|
@ -631,15 +744,56 @@ function doSort(sortColName)
|
|||
if (!xulSortService) return false;
|
||||
try
|
||||
{
|
||||
xulSortService.Sort(node, sortResource, sortDirection);
|
||||
var sort_resource = column.getAttribute('resource');
|
||||
xulSortService.Sort(column, sort_resource, direction);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
debug("Exception calling xulSortService.Sort()");
|
||||
}
|
||||
update_sort_menuitems(column, direction);
|
||||
return false;
|
||||
}
|
||||
|
||||
function fillViewMenu(popup)
|
||||
{
|
||||
var fill_after = document.getElementById('fill_after_this_node');
|
||||
var fill_before = document.getElementById('fill_before_this_node');
|
||||
var columns = document.getElementById('theColumns');
|
||||
var head = document.getElementById('headRow');
|
||||
var skip_column = document.getElementById('popupCell');
|
||||
|
||||
if (fill_after.nextSibling == fill_before) {
|
||||
var name_template = get_localized_string("SortMenuItem");
|
||||
var tree_column = head.firstChild;
|
||||
var column_node = columns.firstChild;
|
||||
while (tree_column) {
|
||||
if (skip_column != tree_column) {
|
||||
// Construct an entry for each cell in the row.
|
||||
var column_name = tree_column.getAttribute("value");
|
||||
var item = document.createElement("menuitem");
|
||||
item.setAttribute("type", "radio");
|
||||
item.setAttribute("name", "sort_column");
|
||||
if (column_name == "") {
|
||||
column_name = tree_column.getAttribute("display");
|
||||
}
|
||||
var name = name_template.replace(/%NAME%/g, column_name);
|
||||
var id = column_node.id;
|
||||
item.setAttribute("value", name);
|
||||
item.setAttribute("oncommand", "SetSortColumn('"+id+"', true);");
|
||||
item.setAttribute("column_id", id);
|
||||
|
||||
popup.insertBefore(item, fill_before);
|
||||
}
|
||||
tree_column = tree_column.nextSibling;
|
||||
column_node = column_node.nextSibling;
|
||||
}
|
||||
}
|
||||
var sort_column = find_sort_column();
|
||||
var sort_direction = find_sort_direction(sort_column);
|
||||
update_sort_menuitems(sort_column, sort_direction);
|
||||
}
|
||||
|
||||
function fillContextMenu(name)
|
||||
{
|
||||
if (!name) return false;
|
||||
|
@ -891,8 +1045,9 @@ function doContextCmd(cmdName)
|
|||
(cmdName == NC + "command?cmd=deletebookmarkfolder") ||
|
||||
(cmdName == NC + "command?cmd=deletebookmarkseparator"))
|
||||
{
|
||||
var promptStr = get_localized_string("DeleteItems");
|
||||
if (!confirm(promptStr)) return false;
|
||||
return doDelete(true);
|
||||
//var promptStr = get_localized_string("DeleteItems");
|
||||
//if (!confirm(promptStr)) return false;
|
||||
}
|
||||
else if (cmdName == NC + "command?cmd=import")
|
||||
{
|
||||
|
@ -1107,3 +1262,42 @@ function get_localized_string(name) {
|
|||
var bundle = srGetStrBundle(uri);
|
||||
return bundle.GetStringFromName(name);
|
||||
}
|
||||
|
||||
//*==================================================
|
||||
// Handy debug routines
|
||||
//==================================================
|
||||
function dump_attributes(node,depth) {
|
||||
var attributes = node.attributes;
|
||||
var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | . ";
|
||||
|
||||
if (!attributes || attributes.length == 0) {
|
||||
debug(indent.substr(indent.length - depth*2) + "no attributes");
|
||||
}
|
||||
for (var ii=0; ii < attributes.length; ii++) {
|
||||
var attr = attributes.item(ii);
|
||||
debug(indent.substr(indent.length - depth*2) + attr.name +"="+attr.value);
|
||||
}
|
||||
}
|
||||
|
||||
function dump_tree(node) {
|
||||
dump_tree_recur(node, 0, 0);
|
||||
}
|
||||
|
||||
function dump_tree_recur(node, depth, index) {
|
||||
if (!node) {
|
||||
debug("dump_tree: node is null");
|
||||
}
|
||||
var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | + ";
|
||||
debug(indent.substr(indent.length - depth*2) + index + " " + node.nodeName);
|
||||
if (node.nodeName != "#text") {
|
||||
//debug(" id="+node.getAttribute('id'));
|
||||
dump_attributes(node, depth);
|
||||
}
|
||||
var kids = node.childNodes;
|
||||
for (var ii=0; ii < kids.length; ii++) {
|
||||
dump_tree_recur(kids[ii], depth + 1, ii);
|
||||
}
|
||||
}
|
||||
//==================================================
|
||||
// end of handy debug routines
|
||||
//==================================================*/
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
commandupdater="true"
|
||||
events="focus,tree-select"
|
||||
oncommandupdate="CommandUpdate_Bookmarks()"/>
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
<commandset id="globalEditMenuItems">
|
||||
<command id="bm_cmd_find" oncommand="return OpenBookmarksFind();"/>
|
||||
<command id="bm_cmd_properties" oncommand="return BookmarkProperties();"/>
|
||||
|
@ -68,7 +69,6 @@
|
|||
<broadcaster id="bm_cmd_saveas"/>
|
||||
<!-- Edit Menu -->
|
||||
<broadcaster id="cmd_undo"/>
|
||||
<broadcaster id="cmd_redo"/>
|
||||
<broadcaster id="cmd_cut"/>
|
||||
<broadcaster id="cmd_copy"/>
|
||||
<broadcaster id="cmd_paste"/>
|
||||
|
@ -87,7 +87,6 @@
|
|||
observes="bm_cmd_saveas"/>
|
||||
<!-- Edit Menu -->
|
||||
<key id="key_undo"/>
|
||||
<key id="key_redo"/>
|
||||
<key id="key_cut"/>
|
||||
<key id="key_copy"/>
|
||||
<key id="key_paste"/>
|
||||
|
@ -144,12 +143,37 @@
|
|||
</menu>
|
||||
|
||||
<menu id="menu_View">
|
||||
<menupopup>
|
||||
<menuitem value="&menuitem.newbookmarkfolder.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=setnewbookmarkfolder');" />
|
||||
<menuitem value="&menuitem.newinternetsearchfolder.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=setnewsearchfolder');" />
|
||||
<menuitem value="&menuitem.personaltoolbarfolder.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=setpersonaltoolbarfolder');" />
|
||||
<menupopup oncreate="fillViewMenu(this)">
|
||||
<menuitem type="radio" name="sort_column" id="unsorted_menuitem"
|
||||
value="&menuitem.view.unsorted.label;"
|
||||
oncommand="return SetSortDirection('natural');"/>
|
||||
<menuseparator id="fill_after_this_node" collapsed="true" />
|
||||
<menuseparator id="fill_before_this_node"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_ascending"
|
||||
value="&menuitem.view.ascending.label;"
|
||||
oncommand="return SetSortDirection('ascending');"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_descending"
|
||||
value="&menuitem.view.descending.label;"
|
||||
oncommand="return SetSortDirection('descending');"/>
|
||||
<menuseparator/>
|
||||
<menu value="&menuitem.view.show_columns.label;">
|
||||
<menupopup
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem value="&menuitem.newbookmarkfolder.label;"
|
||||
oncommand="return doContextCmd(NC+'command?cmd=setnewbookmarkfolder')"/>
|
||||
<menuitem value="&menuitem.newinternetsearchfolder.label;"
|
||||
oncommand="return doContextCmd(NC+'command?cmd=setnewsearchfolder')"/>
|
||||
<menuitem value="&menuitem.personaltoolbarfolder.label;"
|
||||
oncommand="return doContextCmd(NC+'command?cmd=setpersonaltoolbarfolder')"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tasksMenu" accesskey="t" />
|
||||
<menu id="menu_Help" accesskey="h" />
|
||||
|
||||
</menubar>
|
||||
</toolbox>
|
||||
|
||||
|
@ -207,7 +231,7 @@
|
|||
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading" />
|
||||
<treecell
|
||||
<treecell crop="center"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecell
|
||||
value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL"/>
|
||||
|
@ -226,31 +250,31 @@
|
|||
</template>
|
||||
|
||||
<treecolgroup id="theColumns">
|
||||
<treecol id="NameColumn" sortSeparators="true"
|
||||
persist="hidden width" width="4*"
|
||||
<treecol id="Name"
|
||||
sortSeparators="true" persist="hidden width" width="4*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="URLColumn" sortSeparators="true"
|
||||
persist="hidden width" width="4*"
|
||||
<treecol id="URL"
|
||||
sortSeparators="true" persist="hidden width" width="4*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#URL"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="ShortcutURLColumn" sortSeparators="true"
|
||||
persist="hidden width" width="1*"
|
||||
<treecol id="ShortcutURL"
|
||||
sortSeparators="true" persist="hidden width" width="1*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="DescriptionColumn" sortSeparators="true"
|
||||
persist="hidden width" width="1*"
|
||||
<treecol id="Description"
|
||||
sortSeparators="true" persist="hidden width" width="1*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#Description"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="LastVisitColumn" sortSeparators="true"
|
||||
persist="hidden width" width="1*"
|
||||
<treecol id="LastVisitDate"
|
||||
sortSeparators="true" persist="hidden width" width="1*"
|
||||
rdf:resource="http://home.netscape.com/WEB-rdf#LastVisitDate"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="AddedOnColumn" sortSeparators="true"
|
||||
persist="hidden width" width="1*"
|
||||
<treecol id="BookmarkAddDate"
|
||||
sortSeparators="true" persist="hidden width" width="1*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#BookmarkAddDate"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="LastModColumn" sortSeparators="true"
|
||||
persist="hidden width" width="1*"
|
||||
<treecol id="LastModifiedDate"
|
||||
sortSeparators="true" persist="hidden width" width="1*"
|
||||
rdf:resource="http://home.netscape.com/WEB-rdf#LastModifiedDate"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
|
||||
|
@ -258,25 +282,49 @@
|
|||
|
||||
<treehead>
|
||||
<treerow id="headRow">
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.name.label;" onclick="return doSort('NameColumn');" observes="NameColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.url.label;" onclick="return doSort('URLColumn');" observes="URLColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.shortcut.label;" onclick="return doSort('ShortcutURLColumn');" observes="ShortcutURLColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.description.label;" onclick="return doSort('DescriptionColumn');" observes="DescriptionColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.lastvisit.label;" onclick="return doSort('astVisitColumn');" observes="LastVisitColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.addedon.label;" onclick="return doSort('AddedOnColumn');" observes="AddedOnColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator" value="&tree.header.lastmod.label;" onclick="return doSort('LastModColumn');" observes="LastModColumn" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.name.label;"
|
||||
onclick="return TriStateColumnSort('Name');"
|
||||
observes="Name" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.url.label;"
|
||||
onclick="return TriStateColumnSort('URL');"
|
||||
observes="URL" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.shortcut.label;"
|
||||
onclick="return TriStateColumnSort('ShortcutURL');"
|
||||
observes="ShortcutURL" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.description.label;"
|
||||
onclick="return TriStateColumnSort('Description');"
|
||||
observes="Description" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.lastvisit.label;"
|
||||
onclick="return TriStateColumnSort('LastVisitDate');"
|
||||
observes="LastVisitDate" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.addedon.label;"
|
||||
onclick="return TriStateColumnSort('BookmarkAddDate');"
|
||||
observes="BookmarkAddDate" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.lastmod.label;"
|
||||
onclick="return TriStateColumnSort('LastModifiedDate');"
|
||||
observes="LastModifiedDate" />
|
||||
<treecell class="treecell-header" allowevents="true" id="popupCell">
|
||||
<menu>
|
||||
<image class="treecell-popup-icon"/>
|
||||
<menupopup popupanchor="bottomright"
|
||||
popupalign="topright"
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'), document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren id="treechildren-bookmarks" onclick="return OpenURL(event, event.target.parentNode.parentNode, 'bookmarksTree');"/>
|
||||
<treechildren id="treechildren-bookmarks"
|
||||
onclick="return OpenURL(event, event.target.parentNode.parentNode,
|
||||
'bookmarksTree');"/>
|
||||
</tree>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -50,7 +50,8 @@ NeedValidURL = Please enter a valid, fully qualified URL.
|
|||
SelectImport = Import bookmark file:
|
||||
EnterExport = Export bookmark file:
|
||||
|
||||
DeleteItems = Delete the selected item(s)?
|
||||
DeleteItem = Delete the selected item?
|
||||
DeleteItems = Delete the selected items?
|
||||
|
||||
WebPageUpdated = The following web page has been updated:
|
||||
WebPageTitle = Title:
|
||||
|
@ -62,3 +63,4 @@ pleaseEnterALocation = Please enter a location
|
|||
pleaseEnterADuration = Please enter a duration.
|
||||
pleaseSelectANotification = Please enter at least one notification method.
|
||||
|
||||
SortMenuItem = Sorted by %NAME%
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
<!ENTITY menuitem.properties.accesskey "o">
|
||||
<!ENTITY edit.properties.keybinding "e">
|
||||
|
||||
<!ENTITY menuitem.view.unsorted.label "Unsorted">
|
||||
<!ENTITY menuitem.view.ascending.label "A > Z Sort Order">
|
||||
<!ENTITY menuitem.view.descending.label "Z > A Sort Order">
|
||||
<!ENTITY menuitem.view.show_columns.label "Show columns">
|
||||
<!ENTITY menuitem.newbookmarkfolder.label "Set as New Bookmark Folder">
|
||||
<!ENTITY menuitem.newinternetsearchfolder.label "Set as New Internet Search Folder">
|
||||
<!ENTITY menuitem.personaltoolbarfolder.label "Set as Personal Toolbar Folder">
|
||||
|
|
|
@ -1,97 +1,83 @@
|
|||
// -*- Mode: Java -*-
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
function doSort(sortColName)
|
||||
// The history window uses JavaScript in bookmarks.js too.
|
||||
|
||||
function debug(msg)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return(false);
|
||||
// Uncomment for noise
|
||||
//dump(msg+"\n");
|
||||
}
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true")
|
||||
function HistoryInit() {
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
debug("adding controller to tree");
|
||||
tree.controllers.appendController(HistoryController);
|
||||
var children = document.getElementById('treechildren-bookmarks');
|
||||
tree.selectItem(children.firstChild);
|
||||
tree.focus();
|
||||
}
|
||||
|
||||
var HistoryController = {
|
||||
supportsCommand: function(command)
|
||||
{
|
||||
debug("history in supports with " + command);
|
||||
switch(command)
|
||||
{
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else sortDirection = "ascending";
|
||||
case "cmd_copy":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
// get RDF Core service
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore)
|
||||
{
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
rdfCore.Init("RDFCore");
|
||||
}
|
||||
// sort!!!
|
||||
rdfCore.doSort(node, sortResource, sortDirection);
|
||||
return(false);
|
||||
}
|
||||
|
||||
// lifted from bookmarks.js
|
||||
var htmlInput = null;
|
||||
var saveNode = null;
|
||||
var newValue = "";
|
||||
var timerID = null;
|
||||
var gEditNode = null;
|
||||
function OpenURL(event, node)
|
||||
{
|
||||
// clear any single-click/edit timeouts
|
||||
if (timerID != null)
|
||||
},
|
||||
isCommandEnabled: function(command)
|
||||
{
|
||||
gEditNode = null;
|
||||
clearTimeout(timerID);
|
||||
timerID = null;
|
||||
}
|
||||
|
||||
if (node.getAttribute('container') == "true")
|
||||
debug("history in enabled with " + command);
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_copy":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
doCommand: function(command)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
var url = node.getAttribute('id');
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (url.substring(0, 3) == "NC:")
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
if (url.indexOf("file://") == 0)
|
||||
{
|
||||
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
var fileSys = rdf.GetDataSource("rdf:files");
|
||||
if (fileSys)
|
||||
{
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = fileSys.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
|
||||
// window.open(url,'history');
|
||||
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url ); // get right sized window
|
||||
return(true);
|
||||
}
|
||||
debug("history in do with " + command);
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_copy":
|
||||
doCopy();
|
||||
break;
|
||||
case "cmd_delete":
|
||||
doDelete();
|
||||
break;
|
||||
case "cmd_selectAll":
|
||||
doSelectAll();
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -24,44 +24,120 @@
|
|||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/tasksOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/history/history.dtd" >
|
||||
|
||||
<window title="&historyWindowTitle.label;" id="bookmark-window" onunload="doUnload()"
|
||||
<window title="&historyWindowTitle.label;" id="bookmark-window"
|
||||
onload="HistoryInit();"
|
||||
onunload="doUnload()"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:web="http://home.netscape.com/WEB-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="500" height="400" x="20" y="20" persist="width height x y" orient="vertical"
|
||||
width="500" height="400" x="20" y="20" persist="width height x y"
|
||||
orient="vertical"
|
||||
ondraggesture="return TopLevelDrag(event);"
|
||||
windowtype="history:manager"
|
||||
>
|
||||
windowtype="history:manager">
|
||||
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarks.js"/>
|
||||
<script src="chrome://communicator/content/history/history.js"/>
|
||||
<script src="chrome://global/content/treePopups.js"/>
|
||||
<script src="chrome://global/content/strres.js"/>
|
||||
<script src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<menubar>
|
||||
<menu value="&fileMenu.label;">
|
||||
<menupopup>
|
||||
<menuitem value="&closeCmd.label;" oncommand="window.close()"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu value="&editMenu.label;">
|
||||
<menupopup>
|
||||
<menuitem value="&undoCmd.label;"/>
|
||||
<menuitem value="&redoCmd.label;"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="&cutCmd.label;"/>
|
||||
<menuitem value="©Cmd.label;"/>
|
||||
<menuitem value="&pasteCmd.label;"/>
|
||||
<menuitem value="&deleteCmd.label;"/>
|
||||
<menuitem value="&selAllCmd.label;"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="&findHisCmd.label;"/>
|
||||
<menuitem value="&findAgainCmd.label;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menubar>
|
||||
<commands id="commands">
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
<commandset id="globalEditMenuItems"/>
|
||||
</commands>
|
||||
|
||||
<broadcasterset id="broadcasterset">
|
||||
<!-- File Menu -->
|
||||
<broadcaster id="cmd_newNavigator"/>
|
||||
<broadcaster id="cmd_newMessage"/>
|
||||
<broadcaster id="cmd_newEditor"/>
|
||||
<broadcaster id="cmd_close" oncommand="window.close()"/>
|
||||
<broadcaster id="cmd_quit"/>
|
||||
<broadcaster id="bm_cmd_saveas"/>
|
||||
<!-- Edit Menu -->
|
||||
<broadcaster id="cmd_undo"/>
|
||||
<broadcaster id="cmd_copy"/>
|
||||
<broadcaster id="cmd_delete"/>
|
||||
<broadcaster id="cmd_selectAll"/>
|
||||
</broadcasterset>
|
||||
<keyset id="keyset">
|
||||
<!-- File Menu -->
|
||||
<key id="key_newNavigator"/>
|
||||
<key id="key_newMessage"/>
|
||||
<key id="key_newEditor"/>
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
<!-- Edit Menu -->
|
||||
<key id="key_undo"/>
|
||||
<key id="key_cut"/>
|
||||
<key id="key_copy"/>
|
||||
<key id="key_paste"/>
|
||||
<key id="key_delete"/>
|
||||
<key id="key_selectAll"/>
|
||||
</keyset>
|
||||
|
||||
<menubar>
|
||||
<menu id="menu_File">
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menu id="menu_New">
|
||||
<menupopup id="menu_NewPopup">
|
||||
<menuitem id="menu_newNavigator"/>
|
||||
<menuitem id="menu_newMessage"/>
|
||||
<menuitem id="cmd_newCard"/>
|
||||
<menuitem id="menu_newEditor"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_close"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="menu_Edit">
|
||||
<menupopup>
|
||||
<menuitem id="menu_undo" disabled="true" />
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_cut" disabled="true"/>
|
||||
<menuitem id="menu_copy"/>
|
||||
<menuitem id="menu_paste" disabled="true"/>
|
||||
<menuitem id="menu_delete"/>
|
||||
<menuitem id="menu_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="&findHisCmd.label;"/>
|
||||
<menuitem value="&findAgainCmd.label;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="menu_View">
|
||||
<menupopup oncreate="fillViewMenu(this)">
|
||||
<menuitem type="radio" name="sort_column" id="unsorted_menuitem"
|
||||
value="&menuitem.view.unsorted.label;"
|
||||
oncommand="return SetSortDirection('natural');"/>
|
||||
<menuseparator id="fill_after_this_node"/>
|
||||
<menuseparator id="fill_before_this_node"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_ascending"
|
||||
value="&menuitem.view.ascending.label;"
|
||||
oncommand="return SetSortDirection('ascending');"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_descending"
|
||||
value="&menuitem.view.descending.label;"
|
||||
oncommand="return SetSortDirection('descending');"/>
|
||||
<menuseparator/>
|
||||
<menu value="&menuitem.view.show_columns.label;">
|
||||
<menupopup
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tasksMenu" accesskey="t" />
|
||||
<menu id="menu_Help" accesskey="h" />
|
||||
</menubar>
|
||||
|
||||
<popupset>
|
||||
<popup id="contextual" oncreate="return fillContextMenu('contextual');" >
|
||||
|
@ -95,17 +171,47 @@
|
|||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol persist="width" id="NameColumn" sortSeparators="true" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol persist="width" id="URLColumn" sortSeparators="true" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecol persist="width" id="ShortcutURLColumn" sortSeparators="true" rdf:resource="http://home.netscape.com/NC-rdf#Date"/>
|
||||
<treecolgroup id="theColumns">
|
||||
<treecol id="Name"
|
||||
sortSeparators="true" persist="hidden width" width="4*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="URL"
|
||||
sortSeparators="true" persist="hidden width" width="4*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#URL"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="Date"
|
||||
sortSeparators="true" persist="hidden width" width="1*"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#Date"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
|
||||
</treecolgroup>
|
||||
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell class="treecell-header" value="&tree.header.name.label;" onclick="return doSort('NameColumn');" observes="NameColumn" />
|
||||
<treecell class="treecell-header" value="&tree.header.url.label;" onclick="return doSort('URLColumn');" observes="URLColumn" />
|
||||
<treecell class="treecell-header" value="&tree.header.date.label;" onclick="return doSort('DateColumn');" observes="DateColumn" />
|
||||
<treerow id="headRow">
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.name.label;"
|
||||
onclick="return TriStateColumnSort('Name');"
|
||||
observes="Name" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.url.label;"
|
||||
onclick="return TriStateColumnSort('URL');"
|
||||
observes="URL" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.date.label;"
|
||||
onclick="return TriStateColumnSort('Date');"
|
||||
observes="Date"/>
|
||||
<treecell class="treecell-header" allowevents="true" id="popupCell">
|
||||
<menu>
|
||||
<image class="treecell-popup-icon"/>
|
||||
<menupopup popupanchor="bottomright"
|
||||
popupalign="topright"
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'), document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren id="treechildren-bookmarks"/>
|
||||
</tree>
|
||||
|
||||
<box id="status-bar" style="max-height:1em;">
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
<!ENTITY selAllCmd.label "Select All">
|
||||
<!ENTITY findHisCmd.label "Find in History...">
|
||||
<!ENTITY findAgainCmd.label "Find Again...">
|
||||
<!ENTITY historyBySite.label "History By Site">
|
||||
<!ENTITY historyByDate.label "History By Date">
|
||||
<!ENTITY historyWindowTitle.label "History">
|
||||
<!ENTITY tree.header.name.label "Title">
|
||||
<!ENTITY tree.header.url.label "URL">
|
||||
<!ENTITY tree.header.date.label "Last Visited">
|
||||
<!ENTITY menuitem.view.unsorted.label "Unsorted">
|
||||
<!ENTITY menuitem.view.ascending.label "A > Z Sort Order">
|
||||
<!ENTITY menuitem.view.descending.label "Z > A Sort Order">
|
||||
<!ENTITY menuitem.view.show_columns.label "Show columns">
|
||||
|
|
Загрузка…
Ссылка в новой задаче