Changeset 233

Show
Ignore:
Timestamp:
04/25/08 12:59:04 (9 months ago)
Author:
Stuart Thiel
Message:

-Fixed #199 and deployed #199 and #181
--Cleaned up some code that didn't catch errors and rollback (and used a commit instead of a rollback)

Files:

Legend:

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

    r231 r233  
    242242   
    243243   addMediaAnnotation: function(event) { 
    244                 var newID = this._addMediaAnnotation("0 - 0 ", this.parentItem.getID(), "", 12); 
     244                var myApplet = content.document.getElementById('MA-applet'); 
     245                var url = myApplet.wrappedJSObject.getcurrenUrl(); 
     246                var newID = this._addMediaAnnotation(url, "0 - 0 ", myApplet.wrappedJSObject.getParentItem(), "", 12); 
    245247                this.item = Zotero.Items.get(newID); 
    246         var myApplet = content.document.getElementById('MA-applet');   
    247                    
    248248 
    249249                var newNote = "<mediannotate><description></description>\n" + 
    250250                  myApplet.wrappedJSObject.getTime() +  
    251                   "<url><![CDATA["+this.current_url+"]]></url>" + 
     251                  "<url><![CDATA["+url+"]]></url>" + 
    252252                  "</mediannotate>";             
    253253                this.item.updateNote(newNote); 
     
    259259  }, 
    260260   
    261   _addMediaAnnotation: function(title, source_id, mime_type, charset_id) { 
    262                  
    263                 var itemID = this._addToDB(this.current_url, title, Zotero.Attachments.LINK_MODE_LINKED_URL, 
     261  _addMediaAnnotation: function(current_url, title, source_id, mime_type, charset_id) { 
     262                 
     263                var itemID = this._addToDB(current_url, title, Zotero.Attachments.LINK_MODE_LINKED_URL, 
    264264                        mime_type, charset_id, source_id); 
    265265                return itemID; 
     
    277277        if(this.isMediaAnnotation) myApplet.wrappedJSObject.loadMovie(this.current_url, this.item.getNote()); 
    278278        else myApplet.wrappedJSObject.loadMovie(this.current_url); 
     279        myApplet.wrappedJSObject.setParentItem(this.parentItem.getID()); 
    279280  },   
    280281   
     
    293294        _addToDB: function (url, title, linkMode, mimeType, charsetID, sourceItemID){ 
    294295                Zotero.DB.beginTransaction(); 
    295                  
     296                try { 
    296297                if (sourceItemID){ 
    297                         var sourceItem = Zotero.Items.get(sourceItemID); 
    298                         if (!sourceItem){ 
    299                                 Zotero.DB.commitTransaction(); 
     298                        var sourceItem = new Zotero.Item(); 
     299                        sourceItem.loadFromID(sourceItemID); 
     300                        if (!sourceItem || sourceItem.isAttachment()){ 
     301                                Zotero.DB.rollbackTransaction(); 
    300302                                throw ("Cannot set attachment source to invalid item " + sourceItemID); 
    301                         } 
    302                         if (sourceItem.isAttachment()){ 
    303                                 Zotero.DB.commitTransaction(); 
    304                                 throw ("Cannot set attachment source to another file (" + sourceItemID + ")"); 
    305303                        } 
    306304                } 
     
    328326                        Zotero.Notifier.trigger('modify', 'item', sourceItemID); 
    329327                } 
    330                  
     328                } catch (e) { 
     329                        alert(e); 
     330                        Zotero.DB.rollbackTransaction(); 
     331                } 
    331332                Zotero.DB.commitTransaction(); 
    332333                 
  • MediAnnotateXPI/trunk/srcExtension/install.rdf

    r230 r233  
    55    <em:id>videannotate@htmlweb.com</em:id> 
    66    <em:name>Vertov</em:name> 
    7     <em:version>0.7.3.3</em:version> 
     7    <em:version>0.7.3.4</em:version> 
    88    <em:creator>Stuart Thiel Concordia University University</em:creator> 
    99    <em:developer>Stuart Thiel</em:developer> 
  • MediAnnotateXPI/trunk/update_mediannotate.rdf

    r230 r233  
    88      <RDF:li> 
    99        <RDF:Description> 
    10           <version>0.7.3.3</version> 
     10          <version>0.7.3.4</version> 
    1111          <targetApplication> 
    1212            <RDF:Description>