Changeset 2780


Ignore:
Timestamp:
04/05/13 14:30:13 (11 years ago)
Author:
olof
Message:

added logging for development.
inserted function calls for insert, update

Location:
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/annotations.wired.marker.js

    r2769 r2780  
    1 var annotationService = (function() {
     1var annotationProxy = (function() {
    22    return {
    3         getAnnotations: function(url, callback) {
     3        getAnnotations: function(url) {
     4           this.log('getAnnotations for: '+url);
     5           annotationFramework.getAnnotations({url:url}, function(){});
    46           
    57        },
    68        putAnnotation: function(annotation) {
    7            
     9            var a = om_object2annotation(annotation);
     10            this.log('putAnnotation : '+a);
     11        },
     12        updateAnnotation: function(annotation) {
     13            this.log('updateAnnotation : '+JSON.stringify(annotation));
     14        },
     15        log: function(message){
     16            //log this to the local proxy
     17            $.ajax({
     18                type: "POST",
     19                url: 'http://localhost/annotations/annotator-service/test/proxy.php',
     20                data: {log:'true',message:message}
     21            });
    822        }
    923    }
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/conversion.utils.js

    r2716 r2780  
    3636
    3737function om_object2annotation(om_object){
    38     var annotation = {};
     38    var note = om_object.oid_property.match(/<NOTE>(.+?)<\/NOTE>/)[1];
     39    var d = new Date(om_object.oid_date);
    3940   
     41    var annotation = '<?xml version="1.0"?>\n\
     42                      <annotation xmlns="http://dasish.eu/ns/addit" timeStamp="'+d.toISOString()+'">\n\
     43                        <body type="Note">'+note+'</body>\n\
     44                      </annotation>';
    4045    return annotation;
    41 }
    42 
    43 function annotation2xml(annotation){
    44    
    4546}
    4647
     
    5657}
    5758
     59function createXpointer(url, bgn_dom, end_dom){
     60   
     61}
    5862
    59 
    60 
     63if (!Date.prototype.toISOString) {
     64    Date.prototype.toISOString = function() {
     65        function pad(n) { return n < 10 ? '0' + n : n }
     66        return this.getUTCFullYear() + '-'
     67            + pad(this.getUTCMonth() + 1) + '-'
     68            + pad(this.getUTCDate()) + 'T'
     69            + pad(this.getUTCHours()) + ':'
     70            + pad(this.getUTCMinutes()) + ':'
     71            + pad(this.getUTCSeconds()) + 'Z';
     72    };
     73}
    6174
    6275/*
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/test/proxy.php

    r2716 r2780  
    88    }
    99  }
     10 
     11  if($_REQUEST['log']){
     12      file_put_contents('log.txt', date("c")."\t".$_REQUEST['message']."\n",  FILE_APPEND);
     13  }
    1014
    1115  $response = file_get_contents($_GET['url'].'?'.$params);
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/markingcollection.js

    r2769 r2780  
    327327                },
    328328                onLocationChange : function(webProgress, aRequest, aURI){
    329                         //alert('get all from this url: '+webProgress.DOMWindow.document.URL);
     329                        annotationProxy.getAnnotations(webProgress.DOMWindow.document.URL);//Get alla remote annotations
    330330                        if(webProgress.isLoadingDocument) return;
    331331                        bitsMarkingCollection.marking(webProgress.DOMWindow.document);
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/objectmng.js

    r2769 r2780  
    36263626                                                var aSql2 = "insert into om_object ("+ columns.join(",") +") values ("+ values.join(",") +")";
    36273627                                                //alert("INSERT "+aObject.note);
     3628                                               
     3629                                                annotationProxy.putAnnotation(aObject);
    36283630                                                sqlArr.push(aSql1);
    36293631                                                sqlArr.push(aSql2);
     
    49284930                                        var aSql = 'update om_object set '+ values.join(",") +' where oid="'+ aObject.oid +'"';
    49294931                                        //alert("UPDATE oid: "+aObject.oid);
     4932                                        annotationProxy.updateAnnotation(aObject);
    49304933                                        rtn = this.cmdB(aMode,aSql,para);
    49314934                                }
  • DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/overlay.xul

    r2769 r2780  
    4848    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/lib/jquery.xml2json.js"/>
    4949    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotation-service.js"/>
     50    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/annotations.wired.marker.js"/>
     51    <script type="application/x-javascript" src="chrome://markingcollection/content/annotator-service/conversion.utils.js"/>
    5052    <!-- end -->   
    5153    <script type="application/x-javascript">
Note: See TracChangeset for help on using the changeset viewer.