Reformat sample configuration
[mkws-moved-to-github.git] / tools / htdocs / README.markdown
1 % The MasterKey Widget Set
2 % Mike Taylor; Wolfram Schneider
3 % 10 July 2013
4
5
6 Introduction
7 ------------
8
9 This is the MasterKey Widget Set. The initial version was based on the
10 "jsdemo" application distributed with pazpar2, but it is now far
11 removed from those beginnnings.
12
13 As much of the searching functionality as possible is hosted on
14         <http://mkws.indexdata.com/>
15 so that very simple websites such as
16         <http://example.indexdata.com/>
17 can have MasterKey searching with minimal effort.
18
19 The following files are hosted on `mkws.indexdata.com`:
20
21 * `mkws.js`
22 * `/pazpar2/js/pz2.js`
23 * `mkws-complete.js` -- a single file consisting of `mkws.js`,
24   jQuery (which it uses), Handlebars (ditto) and `pz2.js`
25 * `mkws.css`
26
27
28 Configuring a client
29 --------------------
30
31 The application's HTML must contains the following elements as well as
32 whatever makes up the application itself:
33
34 Prerequisites:
35
36 ~~~
37         <link rel="stylesheet" href="http://mkws.indexdata.com/mkws.css" />
38         <script type="text/javascript" src="http://mkws.indexdata.com/mkws-complete.js"></script>
39 ~~~
40
41 Then the following special `<div>`s can be added (with no content), and
42 will be filled in by MKWS:
43
44 * `<div id="mkwsSwitch"></div>` -- switch between record and target views
45 * `<div id="mkwsLang"></div>  ` -- switch between English, Danish and German
46 * `<div id="mkwsSearch"></div>` -- search box and button
47 * `<div id="mkwsResults"></div>` -- result list, including pager/sorting
48 * `<div id="mkwsTargets"></div>` -- target list, including status
49 * `<div id="mkwsStat"></div>` -- summary statistics
50
51 You can configure and control the client by creating an `mkws_config`
52 object _before_ loading the widget-set.  Here is an example of all
53 possible options:
54
55 ~~~
56     <script type="text/javascript">
57       var mkws_config = {
58         use_service_proxy: true,    /* true, flase: use service proxy instead pazpar2 */
59         show_lang: true,            /* true, false: show/hide language menu */
60         show_sort: true,            /* true, false: show/hide sort menu */
61         show_perpage: true,         /* true, false: show/hide perpage menu */
62         lang_options: ["en", "de", "da"],
63                                     /* display languages links for given languages, [] for all */
64         facets: ["sources", "subjects", "authors"],
65                                     /* display facets, in this order, [] for none */
66         sort_default: "relevance",  /* "relevance", "title:1", "date:0", "date:1" */
67         query_width: 50,            /* 5..50 */
68         perpage_default: 20,        /* 10, 20, 30, 50 */
69         lang: "en",                 /* "en", "de", "da" */
70         debug_level: 0,             /* debug level for development: 0..2 */
71
72         responsive_design_wodth: 600,    /* page reflows for devices < 600 pixels wide */
73         pazpar2_url: "/service-proxy/",            /* URL */
74         service_proxy_auth: "/service-proxy-auth", /* URL */
75         // TODO: language_*, perpage_options, sort_options
76       };
77     </script>
78 ~~~
79
80 jQuery plugin
81 ------------------
82
83 The jQuery plugin version can be used by a single line of JavaScript code:
84
85 ~~~
86         <script>jQuery.pazpar2();</script>
87 ~~~
88
89 put the code in your page at the position where the metasearch should occur.
90
91 Here is an example of all possible options
92
93 ~~~
94         jQuery.pazpar2({
95             "layout": "popup",               /* "table" [default], "div", "popup" */
96             "id_button": "input#mkwsButton", /* submit button id in search field */
97             "id_popup": "#mkwsPopup",        /* internal id of popup window */
98             "width": 880,                    /* popup width, should be at least 800 */ 
99             "height": 760                    /* popup height, should be at least 600 */
100         });
101 ~~~
102
103
104 Supported Browsers
105 ------------------
106
107 Any modern HTML5 browser will work fine. JavaScript must be enabled.
108
109 * IE8 or later
110 * Firefox 17 or later
111 * Google Chrome 27 or later
112 * Safari 6 or later
113 * Opera  12 or later
114 * iOS 6.x (iPhone, iPad)
115 * Android 4.x
116
117 Not supported: IE6, IE7
118
119
120 New Features since jsdemo
121 --------------------------
122
123 - Supports basic pazpar2 and service-proxy requests
124 - Simplified HTML
125 - The search page is fully configurable by a JSON object
126
127
128 Checklist before doing a release
129 ---------------------------------
130 - open the site, e.g. http://mkws-dev.indexdata.com/index-mike.html
131 - open the debug/error console in your browser (alt-cmd-J, shift-cmd-J)
132 - check the language links ("de", "da", "en")
133 - run a search with few, but not to few results, e.g.: freebsd
134 - check "Targets" | "Records" links
135 - check "Next" and "Prev" links
136 - click on the first hit and display details, click on an "URL" to jump to
137   the local catalog or full text
138 - limit search to a "Source"
139 - limit search to an "Author"
140 - sort results by "Title" and "newest"
141 - what else?
142
143
144
145 What next?
146 ----------
147
148 Main areas of work:
149
150 * Make MKWS robust to missing widgets
151 * Clean up the code
152
153 - - -
154
155 Copyright 2013 IndexData ApS. <http://www.indexdata.com>