Permalink
Browse files

0.2.14 - add menu item to change a field en masse

  • Loading branch information...
1 parent f780cf3 commit f630bd2f939417d66482328cf34c6f87081afd5f @corajr corajr committed Nov 2, 2012
View
@@ -14,7 +14,7 @@ In order to run Paper Machines, you will need the following (Python and Java are
* Java ([download page](http://java.com/en/download/index.jsp))
## Installation
-Paper Machines should work either in Zotero for Firefox or Zotero Standalone. To install, you must download the <a href="https://github.com/downloads/chrisjr/papermachines/papermachines-0.2.13.xpi">XPI file</a>. If you wish to use the extension in the Standalone version, right-click on the link and save the XPI file in your Downloads folder. Then, in Zotero Standalone, go to the Tools menu -> Add-Ons. Select the gear icon at the right, then "Install Add-On From File." Navigate to your Downloads folder (or wherever you have saved the XPI file) and open it.
+Paper Machines should work either in Zotero for Firefox or Zotero Standalone. To install, you must download the <a href="https://github.com/downloads/chrisjr/papermachines/papermachines-0.2.14.xpi">XPI file</a>. If you wish to use the extension in the Standalone version, right-click on the link and save the XPI file in your Downloads folder. Then, in Zotero Standalone, go to the Tools menu -> Add-Ons. Select the gear icon at the right, then "Install Add-On From File." Navigate to your Downloads folder (or wherever you have saved the XPI file) and open it.
## Usage
To begin, right-click (control-click for Mac) on the collection you wish to analyze and select "Extract Texts for Paper Machines." Once the extraction process is complete, this right-click menu will offer several different processes that may be run on a collection, each with an accompanying visualization. Once these processes have been run, selecting "Export Output of Paper Machines..." will allow you to choose which visualizations to export.
@@ -98,6 +98,8 @@
</menupopup>
<menupopup id="zotero-itemmenu">
<menuseparator hidden="false"/>
+ <menuitem id="change-field" label="&papermachines.itemmenu.change_field;"
+ oncommand="Zotero.PaperMachines.changeField()"/>
<menuitem id="mallet-highlight" label="&papermachines.itemmenu.text_in_topic_view;"
disabled="true"
oncommand="Zotero.PaperMachines.showTextInTopicView()"/>
@@ -874,6 +874,24 @@ Zotero.PaperMachines = {
queue.next();
},
+ bulkChangeField: function (items, field, new_value, force) {
+ for (var i in items) {
+ var item = items[i];
+ if (force || item.getField(field) == '') {
+ item.setField(field, new_value);
+ item.save();
+ }
+ }
+ },
+ changeField: function () {
+ var items = ZoteroPane.getSelectedItems();
+ var params = Zotero.PaperMachines.promptForProcessParams("change_field");
+ if (params) {
+ Zotero.PaperMachines.bulkChangeField(items, params["field"], params["value"], params["force"]);
+ } else {
+ return false;
+ }
+ },
getFilenameForItem: function (item) {
var filename = "";
if (item.isRegularItem()) {
@@ -1317,18 +1335,26 @@ Zotero.PaperMachines = {
{"name": "guessissue", "type": "check", "pref": "extensions.papermachines.import.guessissue"},
{"name": "issueregex", "type": "text", "pref": "extensions.papermachines.import.issueregex"},
{"name": "startingoffset", "type": "text", "pref": "extensions.papermachines.import.startingoffset"},
+ ],
+ "change_field": [{"name": "field", "type": "text", "value": ""},
+ {"name": "value", "type": "text", "value": ""},
+ {"name": "force", "type": "check", "value": false}
]
},
promptForProcessParams: function(process) {
var items = Zotero.PaperMachines.processParamLists[process];
+ var advanced = false;
for (var i in items) {
items[i].label = Zotero.PaperMachines.paramLabels[process][items[i].name];
if ("pref" in items[i]) {
items[i].value = Preferences.get(items[i].pref);
}
+ if ("advanced" in items[i]) {
+ advanced = true;
+ }
}
var intro = Zotero.PaperMachines.processNames[process];
- return Zotero.PaperMachines._promptForProcessParams(intro, items, true);
+ return Zotero.PaperMachines._promptForProcessParams(intro, items, advanced);
},
_promptForProcessParams: function(intro, items, advanced) {
var params = {"dataIn": {"intro": intro, "items": items}, "dataOut": null};
@@ -1,5 +1,7 @@
<!ENTITY papermachines.name "Paper Machines">
+<!ENTITY papermachines.itemmenu.change_field "Change Field for Items">
+
<!ENTITY papermachines.collectionmenu.extract_text "Extract Text for Paper Machines">
<!ENTITY papermachines.collectionmenu.wordcloud "Word Cloud">
@@ -70,6 +72,8 @@
<!ENTITY papermachines.prefs.general.download_snapshots "Download live pages and remote links (can be slow!)">
<!ENTITY papermachines.prefs.general.python_exe "Path to Python executable: ">
+<!ENTITY papermachines.prefs.general.experimental "Experimental Features">
+
<!ENTITY papermachines.prefs.lda.topics "Number of topics: ">
<!ENTITY papermachines.prefs.lda.iterations "Number of iterations: ">
@@ -16,6 +16,7 @@ processNames.dbpedia = DBpedia Annotation
processNames.failed = The process log is displayed below. Refreshing status in 15 seconds.
processNames.nolog = No log file found.
processNames.bulk_import = Periodical PDF Import
+processNames.change_field = Bulk Edit Metadata
prompts.mallet_classify-file = Select classifier to use
prompts.mallet_lda_jstor = Add JSTOR DFR set
prompts.mallet_lda_MI = Must run topic modeling (by time or subcollection) first
@@ -48,4 +49,7 @@ paramLabels.bulk_import.guessdate = Guess date from PDF metadata
paramLabels.bulk_import.dateformat = Date format (get date from directory names)
paramLabels.bulk_import.guessissue = Extract issue from PDF fulltext
paramLabels.bulk_import.issueregex = Issue search pattern
-paramLabels.bulk_import.startingoffset = Starting offset
+paramLabels.bulk_import.startingoffset = Starting offset
+paramLabels.change_field.field = Field to change
+paramLabels.change_field.value = Value
+paramLabels.change_field.force = Overwrite?
@@ -10,6 +10,8 @@ pref("extensions.papermachines.general.extract_livepages", false);
pref("extensions.papermachines.general.extract_standalone", true);
pref("extensions.papermachines.general.download_snapshots", false);
+pref("extensions.papermachines.general.experimental", false);
+
pref("extensions.papermachines.general.python_exe", "");
pref("extensions.papermachines.import.title", "Issue");
View
@@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>papermachines@chrisjr.org</em:id>
<em:name>Paper Machines</em:name>
- <em:version>0.2.13</em:version>
+ <em:version>0.2.14</em:version>
<em:description>A Zotero extension for analysis and visualization in the digital humanities.</em:description>
<em:creator>Chris Johnson-Roberson</em:creator>
<em:homepageURL>http://chrisjr.github.com/papermachines/</em:homepageURL>
@@ -43,7 +43,7 @@
<Description>
<em:id>zotero@chnm.gmu.edu</em:id>
<em:minVersion>3.0b1</em:minVersion>
- <em:maxVersion>3.0.*</em:maxVersion>
+ <em:maxVersion>3.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>

0 comments on commit f630bd2

Please sign in to comment.