dev/getting started
Translations of this page:

This is a short introduction for how to get started in development of Zotero or Zotero extensions. It may contain errors and gaps so please be free to fix them, it's a wiki!

If you do not want to get into coding but help out with localization and/or citation stylesheets, see localization and creating citation styles.

Preconditions

You need at least

Depending on which part of Zotero you are going to work, basic knowledge of XML, SQL, RDF, and the Citation Style Language (CSL) may also be needed.

Furthermore you should be somehow familiar with usage and structure of bibliographic data in general. You probably wont need a master in library and information science, but if you never researched and created a bibliography or if you think that bibliographic data is plain trivial, then you are likely to miss the the real needs of reality and Zotero's users.

Setting up a working environment

First you should set up an extension development environment. (Do not set nglayout.debug.disable_xul_cache to true unless you know what you're doing, as it breaks parts of Zotero.) Above all you should create a development profile so that you do not screw up your default Firefox profile. On Linux you can start a second instance of Firefox from the command line (replace 'dev' with the name of your development profile):

firefox -no-remote -P dev

Within this profile install the Firefox extensions JavaScript Debugger (Venkman), Extension Developer's Extension, Console2, Chrome List, Firebug, and Restart Firefox. The Web developer toolbar is also highly useful if you plan to create HTML.

In Venkman you must disable “Exclude Browser Files” in the Debug menu. With Firebug you cannot inspect the Zotero code but it is very helpful to monitor network requests and other stuff.

Now you can finally install Zotero. You should use the latest development XPI located at http://www.zotero.org/download/dev/zotero-1.0-branch.xpi (see svn_and_trac_access) or checkout with Subversion. Alternatively install a subversion checkout of Zotero described here (quite a lot more convenient than installing an XPI, but slightly riskier).

Getting familiar

You find all installed files with the “Explore Chrome” plugin. To dig into the running JavaScript sourcecode start the JavaScript Debugger and select 'zotero.js'. I have not found out yet how to inspect the rest of the Zotero sources!

Open the JavaScript Development Environment (in the Developer's Extension). Replace the example script with the following script and execute:

var Zotero = Components.classes["@zotero.org/Zotero;1"]
				.getService(Components.interfaces.nsISupports)
				.wrappedJSObject;
print(Zotero.getSystemInfo());
var items = Zotero.Items.getAll(); 
print("Items (" + items.length + "):\n");
for(i=0; i<items.length; i++) {
    var item = items[i];
    var title = item.getDisplayTitle();
    print( i + ": " + title + "\n");
}

The script will print a summary with a list of all items like this:

version => 1.0.0rc6.r1847, platform => Linux i686, 
locale => en-US, appName => Firefox, appVersion => 2.0.0.8
Items (1):
0: Zotero - Quick Start Guide 

More information can be found at interacting_with_zotero_from_within_firefox. You should now be able to write and test small scripts that interact with Zotero.

Plugin development

A Zotero plugin is an firefox extension of its own which can be installed in addition to Zotero. The plugin then interacts with Zotero from within Firefox. The advantage of a plugin is that you can mostly create it as you like without bothering much wich other developers. The disadvantage is that you cannot really modify the basics of Zotero and with each update of Zotero your extension might not work anymore.

An example is provided with the sample plugin. To create a new a plugin, you can simply start with the sampe: download the sources with subversion to a local working directory of your choice. Within Firefox select the Extension Builder of the Extension Developer's Extension and point it to the working directory. Click “Install for Development” and restart Firefox.

The sample plugin will show you an annoying alert whenever an item is added, modified or deleted in Zotero, so you should quickly edit chrome/content/helloworldzotero/hello.js and change this behaviour. Just change line 92 from

alert(str);

to

alert("Sorry for bothing, I just wanted to tell you:\n" + str);

Save the file, restart Firefox and the alert is at least polite. You can now call yourself a firefox extensions hacker :-)

More Information about Firefox extension development can be found in the extension development documentation project.

Zotero development

If you want to make code changes to the current branch of the Zotero, you need to checkout a a Subversion working copy as described at svn and trac access.

svn co https://www.zotero.org/svn/extension/branches/1.0/ zotero

In the Extension builder of the Extension Developer Extensions choose and add the working directory for development. Modification at the source file affect Zotero each type you restart the browser. Do not forget to update regularly via Subversion instead of installing the online XPI!.

Please note the Coding Guidelines. For general information see the developer_information. If you plan extensive changes please have a look at the roadmap first.

 
dev/getting_started.txt · Last modified: 2008/11/06 03:05 (external edit)
 
Driven by DokuWiki