Remove outdated information.
[mkws-moved-to-github.git] / tools / htdocs / README.markdown
1 % An embryonic MasterKey Widget Set
2 % Mike Taylor; Wolfram Schneider
3 % 10 July 2013
4
5
6 This directory contains an embryonic MasterKey Widget Set. The initial
7 version was based on the "jsdemo" application distributed with
8 pazpar2, but it is now far removed from those beginnnings.
9
10
11 How this works
12 --------------
13
14 As much of the searching functionality as possible is hosted on
15         <http://mkws.indexdata.com/>
16 so that very simple websites such as
17         <http://example.indexdata.com/>
18 can have MasterKey searching with minimal effort.
19
20 The following files are hosted on `mkws.indexdata.com`:
21
22 * `mkwsStyle.css`
23 * `mkws.js`
24 * `/libjs-pz2/pz2api.1.js`
25 * `mkws-complete.js` -- a single file consisting of `mkws.js`,
26   jQuery (which it uses) and `pz2api.1.js`
27
28
29 Configuring a client
30 --------------------
31
32 The application's HTML must contains the following elements as well as
33 whatever makes up the application itself:
34
35 Prerequisites:
36
37 ~~~
38         <link rel="stylesheet" href="http://mkws.indexdata.com/mkwsStyle.css" />
39         <script type="text/javascript" src="http://mkws.indexdata.com/mkws-complete.js"></script>
40 ~~~
41
42 Then the following special `<div>`s can be added (with no content), and
43 will be filled in by MKWS:
44
45 * `<div id="mkwsSwitch"></div>` -- switch between record and target views
46 * `<div id="mkwsLang"></div>  ` -- switch between English, Danish and German
47 * `<div id="mkwsSearch"></div>` -- search box and button
48 * `<div id="mkwsResults"></div>` -- result list, including pager/sorting
49 * `<div id="mkwsTargets"></div>` -- target list, including status
50 * `<div id="mkwsStat"></div>` -- summary statistics
51
52 At present, MKWS may not work correctly if some of these are
53 missing. One of the TODOs is to fix it so that it doesn't try to use
54 whatever is not there, and just uses what is.
55
56 You can configure and control the client by creating an `mkws_config`
57 object _before_ loading the widget-set.  Here is an example of all
58 possible options:
59
60 ~~~
61         <script type="text/javascript">
62             var mkws_config = {
63                 use_service_proxy: true,    /* true, flase: use service proxy instead pazpar2 */
64                 switch_menu: true,          /* true, false: show/hide Records|Targets menu */
65                 lang_menu: true,            /* true, false: show/hide language menu */
66                 sort_menu: true,            /* true, false: show/hide sort menu */
67                 perpage_menu: true,         /* true, false: show/hide perpage menu */
68                 lang_display: ["en", "de", "da"], /* display languages links for given
69                                                      languages, [] for all */
70                 facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
71                 sort_default: "relevance",  /* "relevance", "title:1", "date:0", "date:1" */
72                 query_width: 50,            /* 5..50 */
73                 perpage_default: 20,        /* 10, 20, 30, 50 */
74                 lang: "en",                 /* "en", "de", "da" */
75                 debug: 0,                   /* debug level for development: 0..2 */
76
77                 responsive_design: false    /* true, false: resize for smaller mobile devices */
78                 pazpar2_url: "/pazpar2/search.pz2",        /* URL */
79                 service_proxy_url: "/service-proxy/",      /* URL */
80                 service_proxy_auth: "/service-proxy-auth", /* URL */
81             };
82         </script>
83 ~~~
84
85 jQuery plugin
86 ------------------
87
88 The jQuery plugin version can be used by a single line of JavaScript code:
89
90 ~~~
91         <script>jQuery.pazpar2();</script>
92 ~~~
93
94 put the code in your page at the position where the metasearch should occur.
95
96 Here is an example of all possible options
97
98 ~~~
99         jQuery.pazpar2({
100             "layout": "popup",               /* "table" [default], "div", "popup" */
101             "id_button": "input#mkwsButton", /* submit button id in search field */
102             "id_popup": "#mkwsPopup",        /* internal id of popup window */
103             "width": 880,                    /* popup width, should be at least 800 */ 
104             "height": 760                    /* popup height, should be at least 600 */
105         });
106 ~~~
107
108
109 Supported Browsers
110 ------------------
111
112 Any modern HTML5 browser will work fine. JavaScript must be enabled.
113
114 * IE8 or later
115 * Firefox 17 or later
116 * Google Chrome 27 or later
117 * Safari 6 or later
118 * Opera  12 or later
119 * iOS 6.x (iPhone, iPad)
120 * Android 4.x
121
122 Not supported: IE6, IE7
123
124
125 New Features since jsdemo
126 --------------------------
127
128 - Multilinguality: English (default), Danish, German
129 - Depends on the new pazpar2 JS library libjs-pz2/pz2api.1.js
130   which will make the development of pazpar2 plugins faster and
131   easier to share code between projects
132 - Supports basic pazpar2 and service-proxy requests
133 - Simplified HTML
134 - The search page is fully configurable by a JSON object
135
136
137 What next?
138 ----------
139
140 Main areas of work:
141
142 * Make MKWS robust to missing widgets
143 * Clean up the code
144
145 - - -
146 \(c) 2013 by IndexData ApS, <http://www.indexdata.com>
147