Changeset 121

Show
Ignore:
Timestamp:
12/02/07 11:52:51 (1 year ago)
Author:
Stuart Thiel
Message:

-Fixed #99
-Also addressed the annoying flicker between the Media Annotation Panel and it's underlying info Panel. It still happens when going from a non-MA item to an MA item (I'd have to look much deeper for that), but has otherwise been removed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • MediAnnotateXPI/trunk/srcExtension/chrome/MediAnnotate/content/overlay.js

    r120 r121  
    66 
    77    prepareMediAnnotate: function() { 
     8    if(!this.isInMidChange) { 
     9    // Chances are this is a Media Annotation, so let's limit the flicker between items and 
     10    // just show a Media Annotation panel right away (it flickers if you jump between Media 
     11    // Annotations because the selection of the item initiates a load). If we're wrong, we 
     12    // store the old panel and put it back. If jumping between Media Annotations and things 
     13    // that aren't we'll get more flicker, but initial usability showing says people looking 
     14    // at Media Annotations are more likely to click on subsequent Media Annotations, and  
     15    // if they're not looking at Media Annotations, they're more likely to click on non- 
     16    // Media Annotaions. The flicker essentially only happens when clicking from a non- 
     17    // Media Annotation item to a Media Annotation item, and so far we'll just have to live 
     18    // with it. 
     19    var oldPanel = document.getElementById('zotero-item-pane-content').selectedPanel; 
     20    // This being the test of whether the last item shown was a MediaAnnotation Item. 
     21    if(this.isMediaAnnotation)this.showMAPanel(); 
    822    var extensionMatch = /^.*((mpg)|(avi)|(mov))$/i; 
    923        var itemId = ZoteroPane.getSelectedItems(true)[0]; 
    10         this.isSaveable = false; 
    1124        this.item = Zotero.Items.get(itemId); 
    1225 
     
    3346 
    3447        if(this.isMediaAnnotation) { 
     48                this.applyChange(); 
    3549                this.parentItem = Zotero.Items.get(this.item.getSource()); 
    3650                this.current_url = this.parentItem.getField('url'); 
    3751                this.prepareMAEntryView(this.item); 
     52        } else { 
     53                //In the even that we're not a Media Annotation, let's put the old item info panel back.  
     54                document.getElementById('zotero-item-pane-content').selectedPanel = oldPanel; 
    3855        } 
    3956 
     
    5168                 
    5269        } 
    53  
    54         this.isSaveable = true; 
    55          
     70        } 
    5671  },  
    5772   
     
    7287        var xmlDoc = objDOMParser.parseFromString(xmlString, "text/xml"); 
    7388        this.xmlDoc = xmlDoc; 
    74              
     89 
     90        //update the fields 
    7591        document.getElementById('ma-description').value = this.xmlDoc.evaluate("//description", this.xmlDoc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; 
    7692        document.getElementById('ma-start-time').value = this.xmlDoc.evaluate("//start", this.xmlDoc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; 
    7793        document.getElementById('ma-end-time').value = this.xmlDoc.evaluate("//end", this.xmlDoc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent; 
    7894        document.getElementById('ma-itemRef').value = item.getID(); 
    79          
    80         //This is a silly way of doing things.  
    81         //document.getElementById('zotero-item-pane-content').selectedIndex = 4; 
    82         //Below is the correct way (or at least a much better way). 
    83         var MAPanel = document.getElementById('zotero-view-MA'); 
    84         document.getElementById('zotero-item-pane-content').selectedPanel = MAPanel; 
     95                 
     96        this.showMAPanel(); 
    8597         
    8698        //Load tags into the popup scrollbar 
     
    89101  },  
    90102   
     103  showMAPanel: function() { 
     104        document.getElementById('zotero-item-pane-content').selectedPanel = document.getElementById('zotero-view-MA'); 
     105  }, 
     106   
    91107  applyChange: function() { 
    92     if(this.isSaveable) { 
    93     var item = Zotero.Items.get(document.getElementById('ma-itemRef').value); 
    94                 var newNote = "<mediannotate><description>" + document.getElementById('ma-description').value  + "</description>\n" + 
    95                   "<start>" + document.getElementById('ma-start-time').value + "</start>\n" + 
    96                   "<end>" + document.getElementById('ma-end-time').value + "</end></mediannotate>"; 
    97                 item.updateNote(newNote); 
    98                 var title = document.getElementById('ma-start-time').value + " - " + document.getElementById('ma-end-time').value + " " + Zotero.Notes.noteToTitle(document.getElementById('ma-description').value); 
    99                 item.setField(110, title, false); 
    100                 item.save(); 
     108        if(document.getElementById('ma-itemRef').value && !this.isInMidChange) { 
     109                this.isInMidChange = true; 
     110                var item = Zotero.Items.get(document.getElementById('ma-itemRef').value); 
     111                var newNote = "<mediannotate><description>" + document.getElementById('ma-description').value  + "</description>\n" + 
     112                  "<start>" + document.getElementById('ma-start-time').value + "</start>\n" + 
     113                  "<end>" + document.getElementById('ma-end-time').value + "</end></mediannotate>"; 
     114                item.updateNote(newNote); 
     115                //Sometimes were applying a change because we've switched to another item and the change in item takes effect before 
     116                //the onchange takes effect. If that item is a Media Annotation, we'll want to switch back to the MAPanel because 
     117                //updating the note will have reset it to its normal view, annoyingly enough. 
     118                if(this.isMediaAnnotation) this.showMAPanel(); 
     119                var title = document.getElementById('ma-start-time').value + " - " + document.getElementById('ma-end-time').value + " " + Zotero.Notes.noteToTitle(document.getElementById('ma-description').value); 
     120                item.setField(110, title, false); 
     121                item.save(); 
     122                if(this.isMediaAnnotation) this.showMAPanel(); 
     123                this.isInMidChange = false; 
     124                this.hasChangedAnnotation = false; 
    101125        } 
    102126  }, 
  • MediAnnotateXPI/trunk/srcExtension/install.rdf

    r120 r121  
    55    <em:id>videannotate@htmlweb.com</em:id> 
    66    <em:name>MediAnnotate</em:name> 
    7     <em:version>0.6.0.7</em:version> 
     7    <em:version>0.6.2.1</em:version> 
    88    <em:creator>Stuart Thiel Concordia University University</em:creator> 
    99    <em:developer>Stuart Thiel</em:developer> 
  • MediAnnotateXPI/trunk/update_mediannotate.rdf

    r120 r121  
    88      <RDF:li> 
    99        <RDF:Description> 
    10           <version>0.6.0.7</version> 
     10          <version>0.6.2.1</version> 
    1111          <targetApplication> 
    1212            <RDF:Description>