CenterForDigitalHumanities / rerum

Open and free repository for linked open data.
http://rerum.io
10 stars 3 forks source link

Manifest Creation From Images #29

Closed thehabes closed 6 years ago

thehabes commented 7 years ago

Test this module and make sure everything is working.

Offer a non-editable preview. Mention edit is available once the manifest is saved into RERUM.

Offer ability to supply basic Manifest metadata.

Redirect when save is complete.

Check page resizing and reflow

Finalize and approve with team. Make sure skinning, design and functionality are BETA acceptable.

thehabes commented 7 years ago

A fun test image set

http://165.134.241.141/brokenBooks/images/folio/Puckett_IM11146_r.jpg, http://165.134.241.141/brokenBooks/images/folio/Puckett_IM11146_v.jpg, http://165.134.241.141/brokenBooks/images/folio/SLU_VFL_MS_002_fol_f_r.jpg, http://165.134.241.141/brokenBooks/images/folio/SLU_VFL_MS_002_fol_f_v.jpg, http://www.medievalacademy.org/resource/resmgr/Images/LFD/damms_antikvariat_v.jpg, http://www.medievalacademy.org/resource/resmgr/Images/LFD/Ohio_u_v.jpg, http://www.medievalacademy.org/resource/resmgr/Images/LFD/CMA_r.jpg, http://www.medievalacademy.org/resource/resmgr/Images/LFD/CMA_v.jpg, http://ids.lib.harvard.edu/ids/iiif/6517556/full/pct:50/0/native.jpg, http://ids.lib.harvard.edu/ids/iiif/6517555/full/pct:50/0/native.jpg, http://ids.lib.harvard.edu/ids/iiif/6517557/full/pct:50/0/native.jpg

thehabes commented 7 years ago

I have hit a wall and cannot continue forward without diving into the annotation store. Here is why.

http://165.134.241.141/rerum/#/build If I get a manifest object together here and post to http://165.134.241.141/annotationstore/anno/saveNewAnnotation.action, I get a 403. I do not know why. If I post to http://165.134.156.141/annotationstore/anno/saveNewAnnotation.action, I get a 400 with the message "Didn't receive any data" which is thrown by the store when it cannot gather the "content" parameter

http://165.134.156.141/rerum/#/build If I get a manifest object together here and post to http://165.134.241.141/annotationstore/anno/saveNewAnnotation.action, CORS is no longer working so the action is denied by the browser. If I post to http://165.134.156.141/annotationstore/anno/saveNewAnnotation.action, I get a 400 with the message "Didn't receive any data" which is thrown by the store when it cannot gather the "content" parameter.

To get it to work on either server, I will need to dive into the store and figure out why this is happening.

thehabes commented 7 years ago

I made this as a bookmarklet and it works fine....

javascript:(function(){
    var testObj = {"hello": "world"};
    testObj = JSON.stringify(testObj);
    var postURL = "http://165.134.156.141/annotationstore/anno/saveNewAnnotation.action?content="+testObj; 
    var xhr = new XMLHttpRequest(); 
    xhr.open("POST", postURL, true);  
    xhr.send(); 
})();
thehabes commented 7 years ago

In fact, adding the manifest to the URL string like this fixed everything...so we can't include data with the angularjs $http.post() like we expect.

thehabes commented 7 years ago

The working rewrite is below.

this.save = function(obj) {
            var url = obj['@id'] ?
                "http://165.134.156.141/annotationstore/anno/updateAnnotation.action?content=" :
                "http://165.134.156.141/annotationstore/anno/saveNewAnnotation.action?content=";
            var obj_str = JSON.stringify(obj); //Serialize JSON data into a string.
            var parameters = {"content":obj_str};
            url += obj_str;
            return $http.post(url);
        };
thehabes commented 7 years ago

It's because the .actions in the annotation store do not look to the content of the body, they look to the URL. This is handled through our applications through internal servlets, but RERUM will not have these, so we have to write to the URLs directly for our Posts to our annotation store to work.

However, it is working. Call this piece in alpha.

thehabes commented 7 years ago

The algorithm in the background should be tied into #33