diff --git a/chrome/chromeFiles/content/scholar/fileInterface.js b/chrome/chromeFiles/content/scholar/fileInterface.js index 5cbfecde1..f52d7739e 100644 --- a/chrome/chromeFiles/content/scholar/fileInterface.js +++ b/chrome/chromeFiles/content/scholar/fileInterface.js @@ -80,7 +80,6 @@ Scholar_File_Interface = new function() { // get translators again, bc now we can check against the file translators = translation.getTranslators(); if(translators.length) { - // TODO: display a list of available translators translation.setTranslator(translators[0]); // show progress indicator translation.setHandler("itemDone", _importItemDone); diff --git a/chrome/chromeFiles/content/scholar/xpcom/cite.js b/chrome/chromeFiles/content/scholar/xpcom/cite.js index 5aa23b5e1..cc06c2de0 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/cite.js +++ b/chrome/chromeFiles/content/scholar/xpcom/cite.js @@ -8,13 +8,23 @@ Scholar.Cite = new function() { this.getStyles = getStyles; function getStyles() { - // TODO: return key/values from database - return {1:"American Psychological Association"}; + // get styles + var sql = "SELECT cslID, title FROM csl ORDER BY title"; + var styles = Scholar.DB.query(sql); + + // convert to associative array + var stylesObject = new Object(); + for each(var style in styles) { + stylesObject[style.cslID] = style.title; + } + + return stylesObject; } - function getBibliography(style, items) { - // TODO: retrieve style from the database - style = ' American Psychological Association APA 5 Bruce DÕArcus bdarcus@sourceforge.net 2005-05-18 2006-07-09 Citation Styles Handbook: APA psychology Style for the American Psychological Association. <editor prefix=", "/> <publisher/> <access prefix=" "/> </reftype> <reftype name="chapter"> <author alternate="editor"/> <year prefix=" (" suffix=")."/> <title prefix=" "/> <group class="container"> <text idref="in"/> <editor/> <title type="container" font-style="italic" prefix=" " suffix="."/> <title type="series" prefix=" " suffix="."/> <publisher/> </group> <access prefix=" "/> <pages prefix=", "/> </reftype> <reftype name="article"> <author alternate="container-title"/> <year prefix=" (" suffix=")."/> <title prefix=" "/> <group class="container"> <editor/> <title type="container" font-style="italic" prefix=" " suffix="."/> </group> <access prefix=" "/> <volume prefix=" "/> <issue prefix="(" suffix=")"/> <pages prefix=", "/> </reftype> <reftype name="legalcase"> <title/> <year prefix=" (" suffix=")"/> <access prefix=", "/> </reftype> </item-layout> </bibliography></citationstyle>'; + function getBibliography(cslID, items) { + // get style + var sql = "SELECT csl FROM csl WHERE cslID = ?"; + var style = Scholar.DB.valueQuery(sql, [cslID]); // get item arrays var itemArrays = new Array(); diff --git a/chrome/chromeFiles/content/scholar/xpcom/schema.js b/chrome/chromeFiles/content/scholar/xpcom/schema.js index 9a1f6a4bb..e220c3704 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/schema.js +++ b/chrome/chromeFiles/content/scholar/xpcom/schema.js @@ -391,7 +391,7 @@ Scholar.Schema = new function(){ // // Change this value to match the schema version // - var toVersion = 31; + var toVersion = 32; if (toVersion != _getSchemaSQLVersion()){ throw('Schema version does not match version in _migrateSchema()'); @@ -415,7 +415,7 @@ Scholar.Schema = new function(){ } } - if (i==31){ + if (i==32){ _initializeSchema(); } } diff --git a/schema.sql b/schema.sql index 7ea13ed69..c27b0ef44 100644 --- a/schema.sql +++ b/schema.sql @@ -1,4 +1,4 @@ --- 31 +-- 32 DROP TABLE IF EXISTS version; CREATE TABLE version ( @@ -232,6 +232,14 @@ FOREIGN KEY (transactionID) REFERENCES transactions(transactionID) ); + DROP TABLE IF EXISTS csl; + CREATE TABLE csl ( + cslID TEXT PRIMARY KEY, + updated DATETIME, + title TEXT, + csl TEXT + ); + INSERT INTO itemTypes VALUES (1,'note'); INSERT INTO itemTypes VALUES (2,'book'); diff --git a/scrapers.sql b/scrapers.sql index de6971721..6407511c3 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -3916,7 +3916,6 @@ MARC_Record.prototype._associateDBField = function(item, fieldNo, part, fieldNam value = execMe(value, arg1, arg2); } - // TODO: handle creators better if(fieldName == "creator") { item.creators.push(value); } else { @@ -4073,4 +4072,103 @@ function doImport(url) { // the URL is actually here for other translators holdOver += text; } } -}'); \ No newline at end of file +}'); + +REPLACE INTO "csl" VALUES('id-not-yet-given', '2006-08-03 00:33:00', 'American Psychological Association', +'<citationstyle xmlns="http://purl.org/net/xbiblio/csl" xml:lang="en"> + <info> + <title>American Psychological Association + APA + 5 + + Bruce DÕArcus + bdarcus@sourceforge.net + + 2005-05-18 + 2006-07-09 + Citation Styles Handbook: APA + psychology + Style for the American Psychological + Association. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <editor prefix=", "/> + <publisher/> + <access prefix=" "/> + </reftype> + <reftype name="chapter"> + <author alternate="editor"/> + <year prefix=" (" suffix=")."/> + <title prefix=" "/> + <group class="container"> + <text idref="in"/> + <editor/> + <title type="container" font-style="italic" prefix=" " suffix="."/> + <title type="series" prefix=" " suffix="."/> + <publisher/> + </group> + <access prefix=" "/> + <pages prefix=", "/> + </reftype> + <reftype name="article"> + <author alternate="container-title"/> + <year prefix=" (" suffix=")."/> + <title prefix=" "/> + <group class="container"> + <editor/> + <title type="container" font-style="italic" prefix=" " suffix="."/> + </group> + <access prefix=" "/> + <volume prefix=" "/> + <issue prefix="(" suffix=")"/> + <pages prefix=", "/> + </reftype> + <reftype name="legalcase"> + <title/> + <year prefix=" (" suffix=")"/> + <access prefix=", "/> + </reftype> + </item-layout> + </bibliography> +</citationstyle>'); \ No newline at end of file