[annotator-dev] Fwd: Help n00b with Annotate plugin
Andrea Fiore
andrea.giulio.fiore at googlemail.com
Thu Aug 4 13:47:47 UTC 2011
> Begin forwarded message:
>
>> From: mwcarper13<reply+m-10271441-324af6283ea6e5ad5b7986076c72d69086072a4c at reply.github.com>
>> Subject: Help n00b with Annotate plugin
>> Date: 20 July 2011 02:57:21 GMT+01:00
>> To: nick at whiteink.com
>>
>> Hi Nick. First, I'd like to thank you for all the work you've done for AnnotateIt.org. It goes without saying that I would be 100% lost without your fork and the Wiki. I really appreciate it.
>>
>> I'm thankful for what you've done because I hardly know any programming, but I'm trying to implement something similar to Open Shakespeare for a project idea I'm working on. You can find the work in progress here: http://www.michael-carper.com/theaeneid.html. I've been able to get to that point through the Annotator fork plus looking at the Open Shakepeare and Demo page source code.
>>
>> My problem is, every annotation is logged as my AnnotateIt.org account Id, no matter where I do the annotation. Moreover, it doesn't show who that account Id is.
Hi Micheal,
I will try to answer to your queries point by point..
To start with, I have noticed that you are including in your page both
the full annotator and the plugin files. I would recommend removing the
script pointing at the plugins, as they are already included in
annotator-full.min.js, and they are generating a number of javascript
errors (I guess because of a version mismatch between the two ).
Also remember that the most up to date version of the Annotator is
https://github.com/okfn/annotator
please refer to this repository for updates and bug reports.
>> My question is, how do I adjust the Auth, Permissions and Store plugin settings in jQuery so that:
>> 1. The annotations display the IP address (or Annotateit.org username) of whomever did the editing.
You can detect the visitor's IP string server-side, and then dynamically
assign it to set the user id (this is how this is done in OpenShakespear).
If you have access to PHP on your server, the variable
$_SERVER["REMOTE_ADDR"] returns the client's IP address.
Not sure about displaying the visitor's user name on Annotateit.org's.
@Aron: is this actually possible in the current version of the Annotator?
>> 2. The reading, editing, and deleting permission are open to adjustment by everyone.
This is easy, see code snippet below
>> 3. The annotations are stored on my AnnotateIt account and are displayed publicly.
Yep, this seems to be implied in your permission settings..
>> var annotator = $('#content').annotator().data('annotator');
>> annotator.addPlugin('Permissions', {
>> user: 'mwcarper13',
>> permissions: {
>> 'read': [],
>> 'update': ['mwcarper13'],
>> 'delete': ['mwcarper13'],
>> 'admin': ['mwcarper13']
>> }
>> });
In your current setting you are granting read permission to all users,
while reserving for your self the other ones. In other to grant all
privileges to everybody, try:
annotator.addPlugin('Permissions', {
user: 'mwcarper13',
permissions: {
'read': [],
'update': [],
'delete': [],
'admin': []
}
});
I haven't had the chance to try this out, but I guess that you can avoid
adding the 'Permissions' plugin as this are the default settings.
Hope this helps,
Andrea
PS:
For another example of Annotator initialisation code, see the snippet here:
http://wp-annotator.andreafiore.me/2011/08/04/lorem-ipsum/
More information about the annotator-dev
mailing list