gist: 24256 Download_button fork
public
Description:
Ubiquity command to search Oracle documentation
Public Clone URL: git://gist.github.com/24256.git
ubiquity-oracle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Ubiquity command to search Oracle documentation
*/
CmdUtils.CreateCommand({
  name: "oracle",
  author: {
    name: "Gary Hodgson",
    homepage: "http://www.garyhodgson.com/",
    email: "contact@garyhodgson.com"
  },
  contributors: ["Don Seiler"],
  license: "MPL",
  icon: "http://www.google.com/s2/favicons?domain=www.oracle.com",
  description: "Executes search of Oracle RDBMS documentation.",
  releaseinfo: {
    1 : "(10 Sep 2008) Initial Release. Based on the Tahiti command by <a href=\"http://www.pythian.com/blogs/1187/ubiquity-and-tahiti-together-at-last\">Don Seiler</a>"
  },
  help: "Specify search terms and version (9iR2, 10gR1, 10gR2, 11gR1). If no version is specified, or specified version is not recognized, all version will be searched. Specifying a version without a revision will default to the latest revision.",
  takes: {"search term": noun_arb_text},
  modifiers: {in: new CmdUtils.NounType( "Version", ["9iR2", "10gR1", "10gR2", "11gR1", "All"])},
  preview: function( pblock, term, mods ) {
    var msg = "Searches Oracle (${loc}) for '${term}'";
    var subs = {term: term.text, loc: mods.in.text||"All"};
    
    pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
  },
  execute: function( term, mods) {
    var VersMap= {
    "9IR2":"/pls/db92/db92.drilldown?word=",
    "10GR1":"/pls/db10g/search?word=",
    "10GR2":"/pls/db102/search?word=",
    "11GR1":"/pls/db111/search?word=",
    "ALL":"/pls/db102/print_hit_summary?search_string=",
    };
    h='http://www.oracle.com';
    vers=(mods.in.text) ? mods.in.text.toUpperCase() : "ALL";
    p=VersMap[vers] || VersMap["ALL"];
    
    cp=h+p+encodeURIComponent(term.text);
    Utils.openUrlInBrowser(cp,null);
  }
});

Owner

garyhodgson

Revisions