2006-08-02 16:49:19 +00:00
|
|
|
/*
|
2006-08-30 06:00:44 +00:00
|
|
|
Zotero
|
2006-08-02 16:49:19 +00:00
|
|
|
Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA
|
|
|
|
http://chnm.gmu.edu/
|
|
|
|
*/
|
|
|
|
|
2006-08-30 07:05:57 +00:00
|
|
|
var ScholarItemPane = new function()
|
2006-05-30 19:24:57 +00:00
|
|
|
{
|
|
|
|
var _dynamicFields;
|
2006-06-07 16:19:56 +00:00
|
|
|
var _creatorTypeMenu;
|
|
|
|
var _beforeRow;
|
2006-06-26 12:58:22 +00:00
|
|
|
var _notesList;
|
2006-07-20 23:19:31 +00:00
|
|
|
var _linksBox;
|
2006-06-15 22:35:48 +00:00
|
|
|
var _notesLabel;
|
2006-06-07 16:19:56 +00:00
|
|
|
|
|
|
|
var _creatorCount;
|
2006-06-02 23:05:24 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var _loaded;
|
|
|
|
|
2006-05-30 19:24:57 +00:00
|
|
|
var _itemBeingEdited;
|
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
var _lastTabIndex;
|
|
|
|
var _tabDirection;
|
|
|
|
var _tabIndexMinCreators = 10;
|
|
|
|
var _tabIndexMaxCreators = 0;
|
|
|
|
var _tabIndexMinFields = 1000;
|
|
|
|
var _tabIndexMaxFields = 0;
|
|
|
|
|
2006-06-02 23:05:24 +00:00
|
|
|
this.onLoad = onLoad;
|
2006-05-30 19:24:57 +00:00
|
|
|
this.viewItem = viewItem;
|
2006-07-26 14:03:54 +00:00
|
|
|
this.loadPane = loadPane;
|
2006-06-19 15:45:32 +00:00
|
|
|
this.changeTypeTo = changeTypeTo;
|
2006-08-09 15:44:11 +00:00
|
|
|
this.onOpenURLClick = onOpenURLClick;
|
2006-06-07 16:19:56 +00:00
|
|
|
this.addCreatorRow = addCreatorRow;
|
2006-08-22 19:52:15 +00:00
|
|
|
this.disableButton = disableButton;
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
this.createValueElement = createValueElement;
|
2006-06-07 16:19:56 +00:00
|
|
|
this.removeCreator = removeCreator;
|
2006-06-06 19:53:27 +00:00
|
|
|
this.showEditor = showEditor;
|
2006-08-28 08:43:18 +00:00
|
|
|
this.handleKeyPress = handleKeyPress;
|
2006-06-06 19:53:27 +00:00
|
|
|
this.hideEditor = hideEditor;
|
2006-08-14 10:02:00 +00:00
|
|
|
this.getCreatorFields = getCreatorFields;
|
2006-06-09 15:52:40 +00:00
|
|
|
this.modifyCreator = modifyCreator;
|
2006-06-26 13:54:05 +00:00
|
|
|
this.removeNote = removeNote;
|
2006-06-15 22:35:48 +00:00
|
|
|
this.addNote = addNote;
|
2006-08-12 00:18:20 +00:00
|
|
|
this.removeAttachment = removeAttachment;
|
|
|
|
this.addAttachmentFromDialog = addAttachmentFromDialog;
|
|
|
|
this.addAttachmentFromPage = addAttachmentFromPage;
|
2006-05-30 19:24:57 +00:00
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
|
2006-06-02 23:05:24 +00:00
|
|
|
function onLoad()
|
2006-05-30 19:24:57 +00:00
|
|
|
{
|
2006-07-26 14:03:54 +00:00
|
|
|
_tabs = document.getElementById('scholar-view-tabs');
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
|
|
|
|
// Not in item pane, so skip the introductions
|
|
|
|
if (!_tabs)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-05-30 19:24:57 +00:00
|
|
|
_dynamicFields = document.getElementById('editpane-dynamic-fields');
|
2006-06-19 15:45:32 +00:00
|
|
|
_itemTypeMenu = document.getElementById('editpane-type-menu');
|
2006-06-07 16:19:56 +00:00
|
|
|
_creatorTypeMenu = document.getElementById('creatorTypeMenu');
|
2006-06-26 12:58:22 +00:00
|
|
|
_notesList = document.getElementById('editpane-dynamic-notes');
|
|
|
|
_notesLabel = document.getElementById('editpane-notes-label');
|
2006-08-12 00:18:20 +00:00
|
|
|
_attachmentsList = document.getElementById('editpane-dynamic-attachments');
|
|
|
|
_attachmentsLabel = document.getElementById('editpane-attachments-label');
|
2006-07-26 14:03:54 +00:00
|
|
|
_tagsBox = document.getElementById('editpane-tags');
|
|
|
|
_relatedBox = document.getElementById('editpane-related');
|
2006-06-07 16:19:56 +00:00
|
|
|
|
|
|
|
var creatorTypes = Scholar.CreatorTypes.getTypes();
|
|
|
|
for(var i = 0; i < creatorTypes.length; i++)
|
|
|
|
{
|
|
|
|
var menuitem = document.createElement("menuitem");
|
|
|
|
menuitem.setAttribute("label",Scholar.getString('creatorTypes.'+creatorTypes[i]['name']));
|
|
|
|
menuitem.setAttribute("typeid",creatorTypes[i]['id']);
|
|
|
|
if(creatorTypes[i]['id'] == 0)
|
|
|
|
menuitem.setAttribute("selected",true);
|
|
|
|
_creatorTypeMenu.appendChild(menuitem);
|
|
|
|
}
|
2006-05-30 19:24:57 +00:00
|
|
|
|
2006-06-19 15:45:32 +00:00
|
|
|
var itemTypes = Scholar.ItemTypes.getTypes();
|
|
|
|
for(var i = 0; i<itemTypes.length; i++)
|
2006-08-12 00:18:20 +00:00
|
|
|
if(itemTypes[i]['name'] != 'note' && itemTypes[i]['name'] != 'attachment')
|
2006-06-27 20:37:02 +00:00
|
|
|
_itemTypeMenu.appendItem(Scholar.getString("itemTypes."+itemTypes[i]['name']),itemTypes[i]['id']);
|
2006-06-19 15:45:32 +00:00
|
|
|
|
2006-05-30 19:24:57 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-06-02 23:05:24 +00:00
|
|
|
/*
|
2006-06-05 13:56:59 +00:00
|
|
|
* Loads an item
|
2006-06-02 23:05:24 +00:00
|
|
|
*/
|
2006-05-30 19:24:57 +00:00
|
|
|
function viewItem(thisItem)
|
2006-07-17 14:09:12 +00:00
|
|
|
{
|
2006-08-31 08:23:24 +00:00
|
|
|
// Force blur() when clicking off a textbox to another item in middle
|
|
|
|
// pane, since for some reason it's not being called automatically
|
|
|
|
if (_itemBeingEdited && _itemBeingEdited!=thisItem)
|
|
|
|
{
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
switch (_tabs.selectedIndex)
|
|
|
|
{
|
|
|
|
// Info
|
|
|
|
case 0:
|
|
|
|
var boxes = _dynamicFields.getElementsByTagName('textbox');
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Tags
|
|
|
|
case 3:
|
|
|
|
var boxes = document.getAnonymousNodes(_tagsBox)[0].getElementsByTagName('textbox');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-09-08 01:23:22 +00:00
|
|
|
if (boxes && boxes.length==1)
|
2006-08-31 08:23:24 +00:00
|
|
|
{
|
|
|
|
boxes[0].inputField.blur();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-05 13:56:59 +00:00
|
|
|
_itemBeingEdited = thisItem;
|
|
|
|
|
2006-08-22 07:01:21 +00:00
|
|
|
_loaded = {};
|
2006-07-26 14:03:54 +00:00
|
|
|
|
|
|
|
loadPane(_tabs.selectedIndex);
|
2006-06-05 13:56:59 +00:00
|
|
|
}
|
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
function loadPane(index)
|
2006-06-05 13:56:59 +00:00
|
|
|
{
|
2006-08-15 03:19:11 +00:00
|
|
|
//Scholar.debug('Loading item pane ' + index);
|
2006-08-28 08:43:18 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
if(_loaded[index])
|
2006-08-22 07:01:21 +00:00
|
|
|
{
|
2006-07-26 14:03:54 +00:00
|
|
|
return;
|
2006-08-22 07:01:21 +00:00
|
|
|
}
|
2006-07-26 14:03:54 +00:00
|
|
|
_loaded[index] = true;
|
|
|
|
|
2006-08-14 10:02:00 +00:00
|
|
|
// Info pane
|
2006-07-26 14:03:54 +00:00
|
|
|
if(index == 0)
|
|
|
|
{
|
|
|
|
while(_dynamicFields.hasChildNodes())
|
|
|
|
_dynamicFields.removeChild(_dynamicFields.firstChild);
|
2006-06-02 23:05:24 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
for(var i = 0, len = _itemTypeMenu.firstChild.childNodes.length; i < len; i++)
|
|
|
|
if(_itemTypeMenu.firstChild.childNodes[i].value == _itemBeingEdited.getType())
|
|
|
|
_itemTypeMenu.selectedIndex = i;
|
2006-06-19 15:45:32 +00:00
|
|
|
|
2006-07-31 22:35:14 +00:00
|
|
|
var fieldNames = new Array("title");
|
2006-07-26 14:03:54 +00:00
|
|
|
var fields = Scholar.ItemFields.getItemTypeFields(_itemBeingEdited.getField("itemTypeID"));
|
|
|
|
for(var i = 0; i<fields.length; i++)
|
|
|
|
fieldNames.push(Scholar.ItemFields.getName(fields[i]));
|
2006-07-31 22:35:14 +00:00
|
|
|
fieldNames.push("dateAdded","dateModified");
|
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
for(var i = 0; i<fieldNames.length; i++)
|
|
|
|
{
|
|
|
|
var editable = (!_itemBeingEdited.isPrimaryField(fieldNames[i]) || _itemBeingEdited.isEditableField(fieldNames[i]));
|
2006-08-14 03:19:01 +00:00
|
|
|
|
|
|
|
var val = _itemBeingEdited.getField(fieldNames[i]);
|
|
|
|
|
|
|
|
// Convert dates from UTC
|
|
|
|
if (fieldNames[i]=='dateAdded' || fieldNames[i]=='dateModified'){
|
|
|
|
val = Scholar.Date.sqlToDate(val, true).toLocaleString();
|
|
|
|
}
|
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
// Start tabindex at 1000 after creators
|
|
|
|
var tabindex = editable ? (i>0 ? _tabIndexMinFields + i : 1) : 0;
|
|
|
|
|
|
|
|
var valueElement = createValueElement(
|
|
|
|
val, editable ? fieldNames[i] : null, tabindex
|
|
|
|
);
|
|
|
|
|
|
|
|
_tabIndexMaxFields = Math.max(_tabIndexMaxFields, tabindex);
|
2006-08-14 03:19:01 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var label = document.createElement("label");
|
|
|
|
label.setAttribute("value",Scholar.getString("itemFields."+fieldNames[i])+":");
|
|
|
|
label.setAttribute("onclick","this.nextSibling.blur();");
|
2006-06-15 22:35:48 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
addDynamicRow(label,valueElement);
|
|
|
|
}
|
2006-06-05 13:56:59 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
//CREATORS:
|
|
|
|
_beforeRow = _dynamicFields.firstChild.nextSibling;
|
|
|
|
_creatorCount = 0;
|
|
|
|
if(_itemBeingEdited.numCreators() > 0)
|
2006-06-02 23:05:24 +00:00
|
|
|
{
|
2006-07-26 14:03:54 +00:00
|
|
|
for(var i = 0, len=_itemBeingEdited.numCreators(); i<len; i++)
|
|
|
|
{
|
|
|
|
var creator = _itemBeingEdited.getCreator(i);
|
|
|
|
addCreatorRow(creator['firstName'], creator['lastName'], creator['creatorTypeID']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-22 19:52:15 +00:00
|
|
|
// Add default row
|
2006-08-14 10:02:00 +00:00
|
|
|
addCreatorRow('', '', 1, true, true);
|
2006-06-02 23:05:24 +00:00
|
|
|
}
|
2006-08-28 08:43:18 +00:00
|
|
|
|
|
|
|
// Move to next or previous field if (shift-)tab was pressed
|
|
|
|
if (_tabDirection)
|
|
|
|
{
|
|
|
|
_focusNextField(_lastTabIndex, _tabDirection==-1);
|
|
|
|
}
|
2006-06-02 23:05:24 +00:00
|
|
|
}
|
2006-08-22 19:52:15 +00:00
|
|
|
|
|
|
|
// Notes pane
|
2006-07-26 14:03:54 +00:00
|
|
|
else if(index == 1)
|
2006-05-30 19:24:57 +00:00
|
|
|
{
|
2006-07-26 14:03:54 +00:00
|
|
|
while(_notesList.hasChildNodes())
|
|
|
|
_notesList.removeChild(_notesList.firstChild);
|
2006-06-15 22:35:48 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var notes = Scholar.Items.get(_itemBeingEdited.getNotes());
|
|
|
|
if(notes.length)
|
2006-06-26 12:58:22 +00:00
|
|
|
{
|
2006-07-26 14:03:54 +00:00
|
|
|
for(var i = 0; i < notes.length; i++)
|
|
|
|
{
|
|
|
|
var icon = document.createElement('image');
|
|
|
|
icon.setAttribute('src','chrome://scholar/skin/treeitem-note.png');
|
2006-06-26 13:54:05 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var label = document.createElement('label');
|
|
|
|
label.setAttribute('value',_noteToTitle(notes[i].getNote()));
|
2006-07-31 16:58:14 +00:00
|
|
|
label.setAttribute('flex','1'); //so that the long names will flex smaller
|
2006-07-26 14:03:54 +00:00
|
|
|
label.setAttribute('crop','end');
|
2006-06-26 13:54:05 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var box = document.createElement('box');
|
2006-07-31 20:35:22 +00:00
|
|
|
box.setAttribute('onclick',"ScholarPane.selectItem("+notes[i].getID()+");");
|
2006-07-26 14:03:54 +00:00
|
|
|
box.setAttribute('class','clicky');
|
|
|
|
box.appendChild(icon);
|
|
|
|
box.appendChild(label);
|
2006-06-26 13:54:05 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var removeButton = document.createElement('label');
|
|
|
|
removeButton.setAttribute("value","-");
|
|
|
|
removeButton.setAttribute("class","clicky");
|
|
|
|
removeButton.setAttribute("onclick","ScholarItemPane.removeNote("+notes[i].getID()+")");
|
2006-06-26 13:54:05 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
var row = document.createElement('row');
|
|
|
|
row.appendChild(box);
|
|
|
|
row.appendChild(removeButton);
|
2006-06-26 12:58:22 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
_notesList.appendChild(row);
|
|
|
|
}
|
2006-06-26 12:58:22 +00:00
|
|
|
}
|
2006-07-05 13:09:58 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
_updateNoteCount();
|
|
|
|
}
|
2006-08-22 19:52:15 +00:00
|
|
|
|
|
|
|
// Attachments pane
|
2006-07-26 14:03:54 +00:00
|
|
|
else if(index == 2)
|
|
|
|
{
|
2006-08-12 00:18:20 +00:00
|
|
|
while(_attachmentsList.hasChildNodes())
|
|
|
|
_attachmentsList.removeChild(_attachmentsList.firstChild);
|
2006-07-27 18:08:09 +00:00
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
var attachments = Scholar.Items.get(_itemBeingEdited.getAttachments());
|
|
|
|
if(attachments.length)
|
2006-07-27 18:08:09 +00:00
|
|
|
{
|
2006-08-12 00:18:20 +00:00
|
|
|
for(var i = 0; i < attachments.length; i++)
|
2006-07-27 18:08:09 +00:00
|
|
|
{
|
|
|
|
var icon = document.createElement('image');
|
2006-08-12 00:18:20 +00:00
|
|
|
var linkMode = attachments[i].getAttachmentLinkMode();
|
|
|
|
if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_FILE)
|
2006-07-31 20:35:22 +00:00
|
|
|
{
|
|
|
|
itemType = "-file";
|
|
|
|
}
|
2006-08-12 00:18:20 +00:00
|
|
|
else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_FILE)
|
2006-07-31 20:35:22 +00:00
|
|
|
{
|
|
|
|
itemType = "-link";
|
|
|
|
}
|
2006-08-12 00:18:20 +00:00
|
|
|
else if(linkMode == Scholar.Attachments.LINK_MODE_IMPORTED_URL)
|
2006-07-31 20:35:22 +00:00
|
|
|
{
|
|
|
|
itemType = "-snapshot";
|
|
|
|
}
|
2006-08-12 00:18:20 +00:00
|
|
|
else if(linkMode == Scholar.Attachments.LINK_MODE_LINKED_URL)
|
2006-07-31 20:35:22 +00:00
|
|
|
{
|
|
|
|
itemType = "-web-link";
|
|
|
|
}
|
|
|
|
icon.setAttribute('src','chrome://scholar/skin/treeitem-file'+itemType+'.png');
|
2006-07-27 18:08:09 +00:00
|
|
|
|
|
|
|
var label = document.createElement('label');
|
2006-08-12 00:18:20 +00:00
|
|
|
label.setAttribute('value',attachments[i].getField('title'));
|
2006-07-31 16:58:14 +00:00
|
|
|
label.setAttribute('flex','1'); //so that the long names will flex smaller
|
2006-07-27 18:08:09 +00:00
|
|
|
label.setAttribute('crop','end');
|
|
|
|
|
|
|
|
var box = document.createElement('box');
|
2006-08-12 00:18:20 +00:00
|
|
|
box.setAttribute('onclick',"ScholarPane.selectItem('"+attachments[i].getID()+"')");
|
2006-07-27 18:08:09 +00:00
|
|
|
box.setAttribute('class','clicky');
|
|
|
|
box.appendChild(icon);
|
|
|
|
box.appendChild(label);
|
|
|
|
|
|
|
|
var removeButton = document.createElement('label');
|
|
|
|
removeButton.setAttribute("value","-");
|
|
|
|
removeButton.setAttribute("class","clicky");
|
2006-08-12 00:18:20 +00:00
|
|
|
removeButton.setAttribute("onclick","ScholarItemPane.removeAttachment("+attachments[i].getID()+")");
|
2006-07-27 18:08:09 +00:00
|
|
|
|
|
|
|
var row = document.createElement('row');
|
|
|
|
row.appendChild(box);
|
|
|
|
row.appendChild(removeButton);
|
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
_attachmentsList.appendChild(row);
|
2006-07-27 18:08:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
_updateAttachmentCount();
|
2006-07-27 18:08:09 +00:00
|
|
|
|
2006-07-26 14:03:54 +00:00
|
|
|
}
|
2006-08-22 19:52:15 +00:00
|
|
|
|
|
|
|
// Tags pane
|
2006-07-26 14:03:54 +00:00
|
|
|
else if(index == 3)
|
|
|
|
{
|
|
|
|
_tagsBox.item = _itemBeingEdited;
|
|
|
|
}
|
2006-08-22 19:52:15 +00:00
|
|
|
|
|
|
|
// Related pane
|
2006-07-26 14:03:54 +00:00
|
|
|
else if(index == 4)
|
|
|
|
{
|
|
|
|
_relatedBox.item = _itemBeingEdited;
|
|
|
|
}
|
2006-05-30 19:24:57 +00:00
|
|
|
}
|
|
|
|
|
2006-06-19 15:45:32 +00:00
|
|
|
function changeTypeTo(id)
|
|
|
|
{
|
2006-06-21 23:22:37 +00:00
|
|
|
if(id != _itemBeingEdited.getType() && confirm(Scholar.getString('pane.item.changeType')))
|
2006-06-19 15:45:32 +00:00
|
|
|
{
|
|
|
|
_itemBeingEdited.setType(id);
|
|
|
|
_itemBeingEdited.save();
|
2006-08-11 15:48:26 +00:00
|
|
|
loadPane(0);
|
2006-06-19 15:45:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-09 15:44:11 +00:00
|
|
|
function onOpenURLClick()
|
|
|
|
{
|
|
|
|
window.open(Scholar.OpenURL.resolve(_itemBeingEdited));
|
|
|
|
}
|
|
|
|
|
2006-06-06 19:53:27 +00:00
|
|
|
function addDynamicRow(label, value, beforeElement)
|
2006-07-20 23:19:31 +00:00
|
|
|
{
|
2006-06-02 23:05:24 +00:00
|
|
|
var row = document.createElement("row");
|
|
|
|
row.appendChild(label);
|
2006-06-06 19:53:27 +00:00
|
|
|
row.appendChild(value);
|
|
|
|
if(beforeElement)
|
2006-06-07 16:19:56 +00:00
|
|
|
_dynamicFields.insertBefore(row, _beforeRow);
|
2006-06-06 19:53:27 +00:00
|
|
|
else
|
|
|
|
_dynamicFields.appendChild(row);
|
2006-06-02 23:05:24 +00:00
|
|
|
}
|
|
|
|
|
2006-08-14 10:02:00 +00:00
|
|
|
function addCreatorRow(firstName, lastName, typeID, unsaved, defaultRow)
|
2006-06-07 16:19:56 +00:00
|
|
|
{
|
2006-08-22 19:52:15 +00:00
|
|
|
// Disable the "+" button on previous rows
|
|
|
|
var elems = _dynamicFields.getElementsByAttribute('value', '+');
|
|
|
|
if (elems.length){
|
|
|
|
ScholarItemPane.disableButton(elems[elems.length-1]);
|
|
|
|
}
|
|
|
|
|
2006-06-07 16:19:56 +00:00
|
|
|
if(!firstName)
|
2006-08-15 03:19:11 +00:00
|
|
|
firstName = "(" + Scholar.getString('pane.item.defaultFirstName') + ")";
|
2006-06-07 16:19:56 +00:00
|
|
|
if(!lastName)
|
2006-08-15 03:19:11 +00:00
|
|
|
lastName = "(" + Scholar.getString('pane.item.defaultLastName') + ")";
|
2006-06-07 16:19:56 +00:00
|
|
|
var label = document.createElement("label");
|
2006-06-25 04:35:11 +00:00
|
|
|
label.setAttribute("value",Scholar.getString('creatorTypes.'+Scholar.CreatorTypes.getName(typeID))+":");
|
2006-06-07 16:19:56 +00:00
|
|
|
label.setAttribute("popup","creatorTypeMenu");
|
|
|
|
label.setAttribute("fieldname",'creator-'+_creatorCount+'-typeID');
|
2006-08-28 08:43:18 +00:00
|
|
|
|
2006-06-16 17:21:30 +00:00
|
|
|
label.className = 'clicky';
|
2006-06-07 16:19:56 +00:00
|
|
|
|
2006-08-22 19:52:15 +00:00
|
|
|
// getCreatorFields() needs to be adjusted if this DOM structure changes
|
2006-06-07 16:19:56 +00:00
|
|
|
var row = document.createElement("hbox");
|
|
|
|
|
|
|
|
var firstlast = document.createElement("hbox");
|
|
|
|
firstlast.setAttribute("flex","1");
|
2006-08-28 08:43:18 +00:00
|
|
|
|
|
|
|
var tabindex = _tabIndexMinCreators + (_creatorCount * 2);
|
|
|
|
firstlast.appendChild(
|
|
|
|
createValueElement(
|
|
|
|
lastName + ",",
|
|
|
|
'creator-' + _creatorCount + '-lastName',
|
|
|
|
tabindex
|
|
|
|
)
|
|
|
|
);
|
|
|
|
firstlast.appendChild(
|
|
|
|
createValueElement(
|
|
|
|
firstName,
|
|
|
|
'creator-' + _creatorCount + '-firstName',
|
|
|
|
tabindex + 1
|
|
|
|
)
|
|
|
|
);
|
|
|
|
_tabIndexMaxCreators = Math.max(_tabIndexMaxCreators, tabindex + 1);
|
|
|
|
|
2006-06-07 16:19:56 +00:00
|
|
|
row.appendChild(firstlast);
|
|
|
|
|
2006-06-12 12:43:20 +00:00
|
|
|
var removeButton = document.createElement('label');
|
|
|
|
removeButton.setAttribute("value","-");
|
2006-08-22 19:52:15 +00:00
|
|
|
// If default first row, don't let user remove it
|
2006-08-14 10:02:00 +00:00
|
|
|
if (defaultRow){
|
2006-08-22 19:52:15 +00:00
|
|
|
disableButton(removeButton);
|
2006-08-14 10:02:00 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
removeButton.setAttribute("class","clicky");
|
|
|
|
removeButton.setAttribute("onclick","ScholarItemPane.removeCreator("+_creatorCount+", this.parentNode.parentNode)");
|
|
|
|
}
|
2006-06-07 16:19:56 +00:00
|
|
|
row.appendChild(removeButton);
|
|
|
|
|
2006-06-12 12:43:20 +00:00
|
|
|
var addButton = document.createElement('label');
|
|
|
|
addButton.setAttribute("value","+");
|
2006-08-22 19:52:15 +00:00
|
|
|
// If row isn't saved, don't let user add more
|
2006-08-14 10:02:00 +00:00
|
|
|
if (unsaved)
|
|
|
|
{
|
2006-08-22 19:52:15 +00:00
|
|
|
disableButton(addButton);
|
2006-08-14 10:02:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-22 19:52:15 +00:00
|
|
|
_enablePlusButton(addButton);
|
2006-08-14 10:02:00 +00:00
|
|
|
}
|
2006-06-07 16:19:56 +00:00
|
|
|
row.appendChild(addButton);
|
|
|
|
|
|
|
|
_creatorCount++;
|
|
|
|
|
|
|
|
addDynamicRow(label, row, true);
|
|
|
|
}
|
|
|
|
|
2006-08-22 19:52:15 +00:00
|
|
|
function disableButton(button)
|
|
|
|
{
|
|
|
|
button.setAttribute('disabled', true);
|
|
|
|
button.setAttribute('class', 'unclicky');
|
|
|
|
button.setAttribute('onclick', false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function _enablePlusButton(button)
|
|
|
|
{
|
|
|
|
button.setAttribute('disabled', false);
|
|
|
|
button.setAttribute("class","clicky");
|
|
|
|
button.setAttribute("onclick","ScholarItemPane.disableButton(this); ScholarItemPane.addCreatorRow('','',1,true);");
|
|
|
|
}
|
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
function createValueElement(valueText, fieldName, tabindex)
|
2006-06-06 19:53:27 +00:00
|
|
|
{
|
|
|
|
var valueElement = document.createElement("label");
|
|
|
|
if(fieldName)
|
|
|
|
{
|
|
|
|
valueElement.setAttribute('fieldname',fieldName);
|
2006-08-28 08:43:18 +00:00
|
|
|
valueElement.setAttribute('tabindex', tabindex);
|
2006-06-09 15:52:40 +00:00
|
|
|
valueElement.setAttribute('onclick', 'ScholarItemPane.showEditor(this);');
|
2006-06-16 17:21:30 +00:00
|
|
|
valueElement.className = 'clicky';
|
2006-06-06 19:53:27 +00:00
|
|
|
}
|
2006-06-17 00:57:50 +00:00
|
|
|
|
|
|
|
var firstSpace;
|
|
|
|
if(typeof valueText == 'string')
|
|
|
|
firstSpace = valueText.indexOf(" ");
|
|
|
|
|
2006-06-13 20:45:30 +00:00
|
|
|
if((firstSpace == -1 && valueText.length > 29 ) || firstSpace > 29)
|
|
|
|
{
|
|
|
|
valueElement.setAttribute('crop', 'end');
|
|
|
|
valueElement.setAttribute('value',valueText);
|
|
|
|
}
|
|
|
|
else
|
2006-08-28 08:43:18 +00:00
|
|
|
{
|
|
|
|
// Wrap to multiple lines
|
2006-06-13 20:45:30 +00:00
|
|
|
valueElement.appendChild(document.createTextNode(valueText));
|
2006-08-28 08:43:18 +00:00
|
|
|
}
|
2006-06-06 19:53:27 +00:00
|
|
|
return valueElement;
|
|
|
|
}
|
2006-06-07 16:19:56 +00:00
|
|
|
|
2006-08-14 10:02:00 +00:00
|
|
|
function removeCreator(index, labelToDelete)
|
2006-05-30 19:24:57 +00:00
|
|
|
{
|
2006-08-14 10:02:00 +00:00
|
|
|
// If unsaved row, just remove element
|
|
|
|
if (!_itemBeingEdited.hasCreatorAt(index)){
|
|
|
|
labelToDelete.parentNode.removeChild(labelToDelete);
|
2006-08-22 19:52:15 +00:00
|
|
|
|
|
|
|
// Enable the "+" button on the previous row
|
|
|
|
var elems = _dynamicFields.getElementsByAttribute('value', '+');
|
|
|
|
_enablePlusButton(elems[elems.length-1]);
|
|
|
|
|
2006-08-14 10:02:00 +00:00
|
|
|
_creatorCount--;
|
|
|
|
return;
|
|
|
|
}
|
2006-06-07 16:19:56 +00:00
|
|
|
_itemBeingEdited.removeCreator(index);
|
|
|
|
_itemBeingEdited.save();
|
2006-08-11 15:48:26 +00:00
|
|
|
loadPane(0);
|
2006-05-30 19:24:57 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 19:53:27 +00:00
|
|
|
function showEditor(elem)
|
|
|
|
{
|
2006-08-15 03:19:11 +00:00
|
|
|
//Scholar.debug('Showing editor');
|
2006-08-28 08:43:18 +00:00
|
|
|
|
2006-06-07 16:19:56 +00:00
|
|
|
var fieldName = elem.getAttribute('fieldname');
|
2006-08-28 08:43:18 +00:00
|
|
|
var tabindex = elem.getAttribute('tabindex');
|
2006-06-07 16:19:56 +00:00
|
|
|
var creatorFields = fieldName.split('-');
|
|
|
|
if(creatorFields[0] == 'creator')
|
|
|
|
{
|
|
|
|
var c = _itemBeingEdited.getCreator(creatorFields[1]);
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
var value = c ? c[creatorFields[2]] : '';
|
|
|
|
var itemID = _itemBeingEdited.getID();
|
|
|
|
}
|
|
|
|
else if (fieldName=='tag')
|
|
|
|
{
|
|
|
|
var tagID = elem.parentNode.getAttribute('id').split('-')[1];
|
|
|
|
var value = tagID ? Scholar.Tags.getName(tagID) : '';
|
|
|
|
var itemID = Scholar.getAncestorByTagName(elem, 'tagsbox').item.getID();
|
2006-06-07 16:19:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
var value = _itemBeingEdited.getField(fieldName);
|
|
|
|
var itemID = _itemBeingEdited.getID();
|
2006-06-07 16:19:56 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 19:53:27 +00:00
|
|
|
var t = document.createElement("textbox");
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
t.setAttribute('type', 'autocomplete');
|
|
|
|
t.setAttribute('autocompletesearch', 'zotero');
|
|
|
|
t.setAttribute('autocompletesearchparam', fieldName + (itemID ? '/' + itemID : ''));
|
2006-06-07 16:19:56 +00:00
|
|
|
t.setAttribute('value',value);
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
t.setAttribute('fieldname', fieldName);
|
2006-08-28 08:43:18 +00:00
|
|
|
t.setAttribute('tabindex', tabindex);
|
2006-06-07 16:19:56 +00:00
|
|
|
t.setAttribute('flex','1');
|
2006-06-06 19:53:27 +00:00
|
|
|
|
|
|
|
var box = elem.parentNode;
|
2006-06-07 16:19:56 +00:00
|
|
|
box.replaceChild(t,elem);
|
|
|
|
|
2006-06-06 19:53:27 +00:00
|
|
|
t.select();
|
2006-08-28 08:43:18 +00:00
|
|
|
|
2006-06-09 15:52:40 +00:00
|
|
|
t.setAttribute('onblur',"ScholarItemPane.hideEditor(this, true);");
|
2006-08-28 08:43:18 +00:00
|
|
|
t.setAttribute('onkeypress',"return ScholarItemPane.handleKeyPress(event)");
|
|
|
|
|
|
|
|
_tabDirection = false;
|
|
|
|
_lastTabIndex = tabindex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleKeyPress(event){
|
|
|
|
switch (event.keyCode)
|
|
|
|
{
|
|
|
|
case event.DOM_VK_RETURN:
|
|
|
|
document.commandDispatcher.focusedElement.blur();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case event.DOM_VK_ESCAPE:
|
|
|
|
ScholarItemPane.hideEditor(document.commandDispatcher.focusedElement, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case event.DOM_VK_TAB:
|
|
|
|
_tabDirection = event.shiftKey ? -1 : 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2006-06-06 19:53:27 +00:00
|
|
|
}
|
|
|
|
|
2006-06-07 18:20:45 +00:00
|
|
|
function hideEditor(t, saveChanges)
|
2006-06-06 19:53:27 +00:00
|
|
|
{
|
2006-08-15 03:19:11 +00:00
|
|
|
//Scholar.debug('Hiding editor');
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
var textbox = Scholar.getAncestorByTagName(t, 'textbox');
|
|
|
|
if (!textbox){
|
|
|
|
Scholar.debug('Textbox not found in hideEditor');
|
|
|
|
return;
|
|
|
|
}
|
2006-06-06 19:53:27 +00:00
|
|
|
var fieldName = textbox.getAttribute('fieldname');
|
2006-08-28 08:43:18 +00:00
|
|
|
var tabindex = textbox.getAttribute('tabindex');
|
2006-06-06 19:53:27 +00:00
|
|
|
var value = t.value;
|
|
|
|
|
2006-06-07 16:19:56 +00:00
|
|
|
var elem;
|
|
|
|
var creatorFields = fieldName.split('-');
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
|
|
|
|
// Creator fields
|
2006-06-07 16:19:56 +00:00
|
|
|
if(creatorFields[0] == 'creator')
|
|
|
|
{
|
2006-08-15 03:19:11 +00:00
|
|
|
if (saveChanges){
|
|
|
|
var otherFields =
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
getCreatorFields(textbox.parentNode.parentNode.parentNode);
|
2006-08-15 03:19:11 +00:00
|
|
|
modifyCreator(creatorFields[1], creatorFields[2], value, otherFields);
|
|
|
|
}
|
2006-06-07 16:19:56 +00:00
|
|
|
|
2006-08-14 10:02:00 +00:00
|
|
|
var val = _itemBeingEdited.getCreator(creatorFields[1])[creatorFields[2]];
|
2006-08-15 03:19:11 +00:00
|
|
|
|
|
|
|
if (!val){
|
|
|
|
// Reset to '(first)' or '(last)'
|
|
|
|
if (creatorFields[2]=='lastName'){
|
|
|
|
val = "(" + Scholar.getString('pane.item.defaultLastName') + ")";
|
|
|
|
}
|
|
|
|
else if (creatorFields[2]=='firstName'){
|
|
|
|
val = "(" + Scholar.getString('pane.item.defaultFirstName') + ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add trailing comma
|
2006-08-14 10:02:00 +00:00
|
|
|
if (creatorFields[2]=='lastName'){
|
|
|
|
val += ',';
|
|
|
|
}
|
2006-08-15 03:19:11 +00:00
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
elem = createValueElement(val, fieldName, tabindex);
|
2006-06-07 16:19:56 +00:00
|
|
|
}
|
Closes #259, auto-complete of tags
Addresses #260, Add auto-complete to search window
- New XPCOM autocomplete component for Zotero data -- can be used by setting the autocompletesearch attribute of a textbox to 'zotero' and passing a search scope with the autocompletesearchparam attribute. Additional parameters can be passed by appending them to the autocompletesearchparam value with a '/', e.g. 'tag/2732' (to exclude tags that show up in item 2732)
- Tag entry now uses more or less the same interface as metadata -- no more popup window -- note that tab isn't working properly yet, and there's no way to quickly enter multiple tags (though it's now considerably quicker than it was before)
- Autocomplete for tags, excluding any tags already set for the current item
- Standalone note windows now register with the Notifier (since tags needed item modification notifications to work properly), which will help with #282, "Notes opened in separate windows need item notification"
- Tags are now retrieved in alphabetical order
- Scholar.Item.replaceTag(oldTagID, newTag), with a single notify
- Scholar.getAncestorByTagName(elem, tagName) -- walk up the DOM tree from an element until an element with the specified tag name is found (also checks with 'xul:' prefix, for use in XBL), or false if not found -- probably shouldn't be used too widely, since it's doing string comparisons, but better than specifying, say, nine '.parentNode' properties, and makes for more resilient code
A few notes:
- Autocomplete in Minefield seems to self-destruct after using it in the same field a few times, taking down saving of the field with it -- this may or may not be my fault, but it makes Zotero more or less unusable in 3.0 at the moment. Sorry. (I use 3.0 myself for development, so I'll work on it.)
- This would have been much, much easier if having an autocomplete textbox (which uses an XBL-generated popup for the suggestions) within a popup (as it is in the independent note edit panes) didn't introduce all sorts of crazy bugs that had to be defeated with annoying hackery -- one side effect of this is that at the moment you can't close the tags popup with the Escape key
- Independent note windows now need to pull in itemPane.js to function properly, which is a bit messy and not ideal, but less messy and more ideal than duplicating all the dual-state editor and tabindex logic would be
- Hitting tab in a tag field not only doesn't work but also breaks things until the next window refresh.
- There are undoubtedly other bugs.
2006-09-07 08:07:48 +00:00
|
|
|
|
|
|
|
// Tags
|
|
|
|
else if (fieldName=='tag')
|
|
|
|
{
|
|
|
|
var tagsbox = Scholar.getAncestorByTagName(textbox, 'tagsbox');
|
|
|
|
if (!tagsbox)
|
|
|
|
{
|
|
|
|
Scholar.debug('Tagsbox not found', 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var row = textbox.parentNode;
|
|
|
|
var rows = row.parentNode;
|
|
|
|
|
|
|
|
// Tag id encoded as 'tag-1234'
|
|
|
|
var id = row.getAttribute('id').split('-')[1];
|
|
|
|
|
|
|
|
if (saveChanges)
|
|
|
|
{
|
|
|
|
if (id)
|
|
|
|
{
|
|
|
|
if (value)
|
|
|
|
{
|
|
|
|
tagsbox.replace(id, value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tagsbox.remove(id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var id = tagsbox.add(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id)
|
|
|
|
{
|
|
|
|
elem = createValueElement(value, 'tag', tabindex);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Just remove the row
|
|
|
|
var row = rows.removeChild(row);
|
|
|
|
tagsbox.fixPopup();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fields
|
2006-06-07 16:19:56 +00:00
|
|
|
else
|
|
|
|
{
|
2006-06-07 18:20:45 +00:00
|
|
|
if(saveChanges)
|
2006-06-09 15:52:40 +00:00
|
|
|
modifyField(fieldName,value);
|
2006-06-06 19:53:27 +00:00
|
|
|
|
2006-08-28 08:43:18 +00:00
|
|
|
elem = createValueElement(_itemBeingEdited.getField(fieldName), fieldName, tabindex);
|
2006-06-07 16:19:56 +00:00
|
|
|
}
|
2006-06-06 19:53:27 +00:00
|
|
|
|
|
|
|
var box = textbox.parentNode;
|
2006-06-07 16:19:56 +00:00
|
|
|
box.replaceChild(elem,textbox);
|
2006-08-28 08:43:18 +00:00
|
|
|
|
|
|
|
if (_tabDirection)
|
|
|
|
{
|
|
|
|
_focusNextField(_lastTabIndex, _tabDirection==-1);
|
|
|
|
}
|
2006-05-30 19:24:57 +00:00
|
|
|
}
|
2006-06-09 15:52:40 +00:00
|
|
|
|
|
|
|
function modifyField(field, value)
|
|
|
|
{
|
|
|
|
_itemBeingEdited.setField(field,value);
|
|
|
|
_itemBeingEdited.save();
|
|
|
|
}
|
|
|
|
|
2006-08-14 10:02:00 +00:00
|
|
|
function getCreatorFields(row){
|
2006-08-15 03:19:11 +00:00
|
|
|
var type = row.getElementsByTagName('label')[0].getAttribute('value');
|
2006-08-14 10:02:00 +00:00
|
|
|
var label1 = row.getElementsByTagName('hbox')[0].firstChild.firstChild;
|
|
|
|
var label2 = label1.nextSibling;
|
|
|
|
|
|
|
|
return {
|
|
|
|
lastName: label1.firstChild ? label1.firstChild.nodeValue
|
|
|
|
// Strip trailing comma
|
|
|
|
.substr(0, label1.firstChild.nodeValue.length-1): label1.value,
|
|
|
|
firstName: label2.firstChild ? label2.firstChild.nodeValue
|
|
|
|
: label2.value,
|
2006-08-15 03:19:11 +00:00
|
|
|
typeID: Scholar.CreatorTypes.getID(type.substr(0, type.length-1).toLowerCase()),
|
2006-08-14 10:02:00 +00:00
|
|
|
isInstitution: null // placeholder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function modifyCreator(index, field, value, otherFields)
|
2006-06-09 15:52:40 +00:00
|
|
|
{
|
2006-08-14 10:02:00 +00:00
|
|
|
if (otherFields){
|
|
|
|
var firstName = otherFields.firstName;
|
|
|
|
var lastName = otherFields.lastName;
|
2006-08-15 03:19:11 +00:00
|
|
|
var typeID = otherFields.typeID;
|
2006-08-14 10:02:00 +00:00
|
|
|
// var isInstitution = otherFields.isInstitution;
|
2006-08-15 03:19:11 +00:00
|
|
|
|
|
|
|
// Ignore '(first)' and '(last)'
|
|
|
|
if (firstName == "(" + Scholar.getString('pane.item.defaultFirstName') + ")"){
|
|
|
|
firstName = '';
|
|
|
|
}
|
|
|
|
if (lastName == "(" + Scholar.getString('pane.item.defaultLastName') + ")"){
|
|
|
|
lastName = '';
|
|
|
|
}
|
2006-08-14 10:02:00 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
var creator = _itemBeingEdited.getCreator(index);
|
|
|
|
var firstName = creator['firstName'];
|
|
|
|
var lastName = creator['lastName'];
|
|
|
|
var typeID = creator['creatorTypeID'];
|
2006-08-15 03:19:11 +00:00
|
|
|
// var isInstitution = creator['isInstitution'];
|
2006-08-14 10:02:00 +00:00
|
|
|
}
|
2006-06-09 15:52:40 +00:00
|
|
|
|
2006-08-15 03:19:11 +00:00
|
|
|
if (!_itemBeingEdited.hasCreatorAt(index) && !firstName && !lastName){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (field){
|
|
|
|
case 'firstName':
|
|
|
|
firstName = value;
|
|
|
|
break;
|
|
|
|
case 'lastName':
|
|
|
|
lastName = value;
|
|
|
|
break;
|
|
|
|
case 'typeID':
|
|
|
|
typeID = value;
|
|
|
|
break;
|
|
|
|
}
|
2006-06-09 15:52:40 +00:00
|
|
|
|
|
|
|
_itemBeingEdited.setCreator(index, firstName, lastName, typeID);
|
|
|
|
_itemBeingEdited.save();
|
|
|
|
}
|
2006-06-15 22:35:48 +00:00
|
|
|
|
2006-06-26 13:54:05 +00:00
|
|
|
function removeNote(id)
|
2006-06-15 22:35:48 +00:00
|
|
|
{
|
2006-06-27 20:37:02 +00:00
|
|
|
var note = Scholar.Items.get(id);
|
|
|
|
if(note)
|
|
|
|
if(confirm(Scholar.getString('pane.item.notes.delete.confirm')))
|
|
|
|
note.erase();
|
2006-06-15 22:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function addNote()
|
|
|
|
{
|
2006-06-27 22:47:17 +00:00
|
|
|
ScholarPane.openNoteWindow(_itemBeingEdited.getID());
|
2006-06-15 22:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function _noteToTitle(text)
|
|
|
|
{
|
2006-06-16 14:39:18 +00:00
|
|
|
var MAX_LENGTH = 100;
|
|
|
|
|
|
|
|
var t = text.substring(0, MAX_LENGTH);
|
2006-06-16 07:44:55 +00:00
|
|
|
var ln = t.indexOf("\n");
|
2006-06-16 14:39:18 +00:00
|
|
|
if (ln>-1 && ln<MAX_LENGTH)
|
2006-06-16 07:44:55 +00:00
|
|
|
{
|
|
|
|
t = t.substring(0, ln);
|
|
|
|
}
|
2006-06-15 22:35:48 +00:00
|
|
|
|
|
|
|
if(t == "")
|
|
|
|
{
|
2006-06-21 23:22:37 +00:00
|
|
|
return Scholar.getString('pane.item.notes.untitled');
|
2006-06-15 22:35:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function _updateNoteCount()
|
|
|
|
{
|
2006-06-26 12:58:22 +00:00
|
|
|
var c = _notesList.childNodes.length;
|
2006-06-15 22:35:48 +00:00
|
|
|
|
2006-06-21 23:22:37 +00:00
|
|
|
_notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
|
2006-06-15 22:35:48 +00:00
|
|
|
}
|
2006-07-27 18:08:09 +00:00
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
function _updateAttachmentCount()
|
2006-07-27 18:08:09 +00:00
|
|
|
{
|
2006-08-12 00:18:20 +00:00
|
|
|
var c = _attachmentsList.childNodes.length;
|
2006-07-27 18:08:09 +00:00
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
_attachmentsLabel.value = Scholar.getString('pane.item.attachments.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
|
2006-07-27 18:08:09 +00:00
|
|
|
}
|
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
function removeAttachment(id)
|
2006-07-27 18:08:09 +00:00
|
|
|
{
|
2006-08-12 00:18:20 +00:00
|
|
|
var attachment = Scholar.Items.get(id);
|
|
|
|
if(attachment)
|
|
|
|
if(confirm(Scholar.getString('pane.item.attachments.delete.confirm')))
|
|
|
|
attachment.erase();
|
2006-07-27 18:08:09 +00:00
|
|
|
}
|
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
function addAttachmentFromDialog(link)
|
2006-07-27 18:08:09 +00:00
|
|
|
{
|
2006-08-12 00:18:20 +00:00
|
|
|
ScholarPane.addAttachmentFromDialog(link, _itemBeingEdited.getID());
|
2006-07-27 18:08:09 +00:00
|
|
|
}
|
|
|
|
|
2006-08-12 00:18:20 +00:00
|
|
|
function addAttachmentFromPage(link)
|
2006-07-27 18:08:09 +00:00
|
|
|
{
|
2006-08-12 00:18:20 +00:00
|
|
|
ScholarPane.addAttachmentFromPage(link, _itemBeingEdited.getID());
|
2006-07-27 18:08:09 +00:00
|
|
|
}
|
2006-08-28 08:43:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Advance the field focus forward or backward
|
|
|
|
*
|
|
|
|
* Note: We're basically replicating the built-in tabindex functionality,
|
|
|
|
* which doesn't work well with the weird label/textbox stuff we're doing.
|
|
|
|
* (The textbox being tabbed away from is deleted before the blur()
|
|
|
|
* completes, so it doesn't know where it's supposed to go next.)
|
|
|
|
*
|
|
|
|
* Use of the 'tabindex' attribute is arbitrary.
|
|
|
|
*/
|
|
|
|
function _focusNextField(tabindex, back){
|
|
|
|
tabindex = parseInt(tabindex);
|
|
|
|
if (back)
|
|
|
|
{
|
|
|
|
switch (tabindex)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
//Scholar.debug('At beginning');
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case _tabIndexMinCreators:
|
|
|
|
var nextIndex = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _tabIndexMinFields:
|
|
|
|
var nextIndex = _tabIndexMaxCreators;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
var nextIndex = tabindex - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (tabindex)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
var nextIndex = _tabIndexMinCreators;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _tabIndexMaxCreators:
|
|
|
|
var nextIndex = _tabIndexMinFields;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _tabIndexMaxFields:
|
|
|
|
//Scholar.debug('At end');
|
|
|
|
return false;
|
|
|
|
|
|
|
|
default:
|
|
|
|
var nextIndex = tabindex + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Scholar.debug('Looking for tabindex ' + nextIndex);
|
|
|
|
var next = _dynamicFields.getElementsByAttribute('tabindex', nextIndex);
|
|
|
|
|
|
|
|
if (!next[0])
|
|
|
|
{
|
|
|
|
//Scholar.debug("Next field not found");
|
|
|
|
return _focusNextField(nextIndex, back);
|
|
|
|
}
|
|
|
|
|
|
|
|
next[0].click();
|
|
|
|
return true;
|
|
|
|
}
|
2006-05-30 19:24:57 +00:00
|
|
|
}
|
|
|
|
|
2006-06-09 15:52:40 +00:00
|
|
|
addEventListener("load", function(e) { ScholarItemPane.onLoad(e); }, false);
|