closes #22, button in note pane for new note

closes #26, notes list in notes pane
closes #79, add icons for new object types
fixes #71, Metadata pane should be refreshed on a notify() event for the selected item
This commit is contained in:
David Norton 2006-06-26 12:58:22 +00:00
parent a33b119dff
commit fb9e803ab5
17 changed files with 83 additions and 41 deletions

View file

@ -3,8 +3,7 @@ ScholarItemPane = new function()
var _dynamicFields;
var _creatorTypeMenu;
var _beforeRow;
var _notesMenu;
var _notesField;
var _notesList;
var _notesLabel;
var _creatorCount;
@ -30,9 +29,8 @@ ScholarItemPane = new function()
_dynamicFields = document.getElementById('editpane-dynamic-fields');
_itemTypeMenu = document.getElementById('editpane-type-menu');
_creatorTypeMenu = document.getElementById('creatorTypeMenu');
_notesMenu = document.getElementById('scholar-notes-menu');
_notesField = document.getElementById('scholar-notes-field');
_notesLabel = document.getElementById('scholar-notes-label');
_notesList = document.getElementById('editpane-dynamic-notes');
_notesLabel = document.getElementById('editpane-notes-label');
var creatorTypes = Scholar.CreatorTypes.getTypes();
for(var i = 0; i < creatorTypes.length; i++)
@ -56,10 +54,7 @@ ScholarItemPane = new function()
* Loads an item
*/
function viewItem(thisItem)
{
if(_itemBeingEdited && thisItem.getID() == _itemBeingEdited.getID())
return;
{
if(document.commandDispatcher.focusedElement)
document.commandDispatcher.focusedElement.blur();
@ -112,19 +107,25 @@ ScholarItemPane = new function()
}
//NOTES:
_notesMenu.removeAllItems();
while(_notesList.hasChildNodes())
_notesList.removeChild(_notesList.firstChild);
var notes = _itemBeingEdited.getNotes();
if(notes.length)
{
for(var i = 0; i < notes.length; i++)
_notesMenu.appendItem(_noteToTitle(_itemBeingEdited.getNote(notes[i])),notes[i]);
else
addNote();
{
var row = document.createElement('row');
var button = document.createElement('label');
button.setAttribute('value',_noteToTitle(_itemBeingEdited.getNote(notes[i])));
button.setAttribute('onclick',"window.open('chrome://scholar/content/note.xul?item="+_itemBeingEdited.getID()+"&note="+notes[i]+"','','chrome,resizable,centerscreen');");
button.setAttribute('class','clicky')
row.appendChild(button);
_notesList.appendChild(row);
}
}
_updateNoteCount();
_notesMenu.selectedIndex = 0;
onNoteSelected();
}
function changeTypeTo(id)
@ -347,12 +348,7 @@ ScholarItemPane = new function()
function addNote()
{
modifySelectedNote();
_notesMenu.appendItem(Scholar.getString('pane.item.notes.untitled'),null);
_notesMenu.selectedIndex = _notesMenu.firstChild.childNodes.length-1;
onNoteSelected();
_updateNoteCount();
window.open("chrome://scholar/content/note.xul?item="+_itemBeingEdited.getID(),'','chrome,resizable,centerscreen');
}
function onNoteSelected()
@ -390,7 +386,7 @@ ScholarItemPane = new function()
function _updateNoteCount()
{
var c = _notesMenu.firstChild.childNodes.length;
var c = _notesList.childNodes.length;
_notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
}

View file

@ -31,18 +31,14 @@
</grid>
</vbox>
<vbox>
<hbox align="center">
<label id="scholar-notes-label"/>
<menulist flex="1" id="scholar-notes-menu" oncommand="ScholarItemPane.onNoteSelected();">
<menupopup/>
</menulist>
<label value="&scholar.minus;" class="clicky" onclick="ScholarItemPane.removeSelectedNote();"/>
<label value="&scholar.plus;" class="clicky" onclick="ScholarItemPane.addNote();"/>
</hbox>
<textbox id="scholar-notes-field"
type="timed" timeout="1000" oncommand="ScholarItemPane.modifySelectedNote();"
multiline="true" flex="1"
onblur="ScholarItemPane.modifySelectedNote();"/>
<button label="New Note" oncommand="ScholarItemPane.addNote();"/>
<label id="editpane-notes-label"/>
<grid flex="1">
<columns>
<column flex="1"/>
</columns>
<rows id="editpane-dynamic-notes" flex="1"/>
</grid>
</vbox>
<vbox align="center" pack="center">
<label value="Coming soon"/>

View file

@ -0,0 +1,33 @@
var item;
var noteID;
var note;
var _notesField;
function onLoad()
{
_notesField = document.getElementById('notes-box');
var params = new Array();
var b = document.location.href.substr(document.location.href.indexOf('?')+1).split('&');
for(var i = 0; i < b.length; i++)
{
var mid = b[i].indexOf('=');
params[b[i].substr(0,mid)] = b[i].substr(mid+1);
}
item = Scholar.Items.get(params['item']);
noteID = params['note'];
document.getElementById('info-label').setAttribute('value',item.getField('title'));
if(noteID)
_notesField.setAttribute('value',item.getNote(noteID));
}
function save()
{
if(noteID)
item.updateNote(noteID,_notesField.value);
else
noteID = item.addNote(_notesField.value);
}
addEventListener("load", function(e) { onLoad(e); }, false);

View file

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?>
<window
id="scholar-note-window"
title="Edit Note"
orient="vertical"
width="400"
height="250"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="include.js"/>
<script src="note.js"/>
<label id="info-label"/>
<textbox id="notes-box" flex="1" multiline="true" type="timed" timeout="1000" oncommand="save();"/>
</window>

View file

@ -120,11 +120,6 @@ vbox #scholar-pane
background: #666666;
}
textbox[multiline="true"][type="timed"]
{
-moz-binding: url('chrome://scholar/content/customControls.xml#timed-textarea');
}
#scholar-splitter
{
border-top: none;

View file

@ -0,0 +1,4 @@
textbox[multiline="true"][type="timed"]
{
-moz-binding: url('chrome://scholar/content/customControls.xml#timed-textarea');
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B