Remove outdated link to separate library-configuration document.
[mkws-moved-to-github.git] / doc / mkws-manual.markdown
1 % Embedded metasearching with the MasterKey Widget Set
2 % Mike Taylor
3 % 30 July 2014
4
5 Introduction
6 ------------
7
8 There are lots of practical problems in building resource discovery
9 solutions. One of the biggest, and most ubiquitous is incorporating
10 metasearching functionality into existing web-sites -- for example,
11 content-management systems, library catalogues or intranets. In
12 general, even when access to core metasearching functionality is
13 provided by simple web-services such as
14 [Pazpar2](http://www.indexdata.com/pazpar2), integration work is seen
15 as a major part of most projects.
16
17 Index Data provides several different toolkits for communicating with
18 its metasearching middleware, trading off varying degrees of
19 flexibility against convenience:
20
21 * pz2.js -- a low-level JavaScript library for interrogating the
22   Service Proxy and Pazpar2. It allows the HTML/JavaScript programmer
23   to create JavaScript applications display facets, records, etc. that
24   are fetched from the metasearching middleware.
25
26 * masterkey-ui-core -- a higher-level, complex JavaScript library that
27   uses pz2.js to provide the pieces needed for building a
28   full-featured JavaScript application.
29
30 * MasterKey Demo UI -- an example of a searching application built on
31   top of masterkey-ui-core. Available as a public demo at
32   http://mk2.indexdata.com/
33
34 * MKDru -- a toolkit for embedding MasterKey-like searching into
35   Drupal sites.
36
37 All of these approaches require programming to a greater or lesser
38 extent. Against this backdrop, we introduced MKWS (the MasterKey
39 Widget Set) -- a set of simple, very high-level HTML+CSS+JavaScript
40 components that can be incorporated into any web-site to provide
41 MasterKey searching facilities. By placing `<div>`s with well-known
42 identifiers in any HTML page, the various components of an application
43 can be embedded: search-boxes, results areas, target information, etc.
44
45
46 Simple Example
47 --------------
48
49 The following is a complete MKWS-based searching application:
50
51     <html>
52       <head>
53         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
54         <title>MKWS demo client</title>
55         <script type="text/javascript" src="http://mkws.indexdata.com/mkws-complete.js"></script>
56         <link rel="stylesheet" href="http://mkws.indexdata.com/mkws.css" />
57       </head>
58       <body>
59         <div id="mkwsSearch"></div>
60         <div id="mkwsResults"></div>
61       </body>
62     </html>
63
64 Go ahead, try it! You don't even need a web-server. Just copy and
65 paste this HTML into a file on your computer -- `/tmp/magic.html`,
66 say -- and point your web-browser at it:
67 `file:///tmp/magic.html`. Just like that, you have working
68 metasearching.
69
70
71 How the example works
72 ---------------------
73
74 If you know any HTML, the structure of the file will be familar to
75 you: the `<html>` element at the top level contains a `<head>` and a
76 `<body>`. In addition to whatever else you might want to put on your
77 page, you can add MKWS elements.
78
79 These fall into two categories. First, the prerequisites in the HTML
80 header, which are loaded from the tool site mkws.indexdata.com:
81
82 * `mkws-complete.js`
83   contains all the JavaScript needed by the widget-set.
84
85 * `mkws.css`
86   provides the default CSS styling
87
88 Second, within the HTML body, `<div>` elements with special IDs that
89 begin `mkws` can be provided. These are filled in by the MKWS code,
90 and provide the components of the searching UI. The very simple
91 application above has only two such components: a search box and a
92 results area. But more are supported. The main `<div>`s are:
93
94 * `mkwsSearch` -- provides the search box and button.
95
96 * `mkwsResults` -- provides the results area, including a list of
97    brief records (which open out into full versions when clicked),
98    paging for large results sets, facets for refining a search,
99    sorting facilities, etc.
100
101 * `mkwsLang` -- provides links to switch between one of several
102    different UI languages. By default, English, Danish and German are
103    provided.
104
105 * `mkwsSwitch` -- provides links to switch between a view of the
106    result records and of the targets that provide them. Only
107    meaningful when `mkwsTargets` is also provided.
108
109 * `mkwsTargets` -- the area where per-target information will appear
110    when selected by the link in the `mkwsSwitch` area. Of interest
111    mostly for fault diagnosis rather than for end-users.
112
113 * `mkwsStat` --provides a status line summarising the statistics of
114    the various targets.
115
116 To see all of these working together, just put them all into the HTML
117 `<body>` like so:
118
119         <div id="mkwsSwitch"></div>
120         <div id="mkwsLang"></div>
121         <div id="mkwsSearch"></div>
122         <div id="mkwsResults"></div>
123         <div id="mkwsTargets"></div>
124         <div id="mkwsStat"></div>
125
126 Configuration
127 -------------
128
129 Many aspects of the behaviour of MKWS can be modified by setting
130 parameters into the `mkws_config` object. **This must be done *before*
131 including the MKWS JavaScript** so that when that code is executed it
132 can refer to the configuration values. So the HTML header looks like
133 this:
134
135         <script type="text/javascript">
136           var mkws_config = {
137             lang: "da",
138             sort_default: "title",
139             query_width: 60
140           };
141         </script>
142         <script type="text/javascript" src="http://mkws.indexdata.com/mkws-complete.js"></script>
143
144 This configuration sets the UI language to Danish (rather than the
145 default of English), initially sorts search results by title rather
146 than relevance (though as always this can be changed in the UI) and
147 makes the search box a bit wider than the default.
148
149 The full set of supported configuration items is described in the
150 reference guide below.
151
152
153 Control over HTML and CSS
154 -------------------------
155
156 More sophisticated applications will not simply place the `<div>`s
157 together, but position them carefully within an existing page
158 framework -- such as a Drupal template, an OPAC or a SharePoint page.
159
160 While it's convenient for simple applications to use a monolithic
161 `mkwsResults` area which contains record, facets, sorting options,
162 etc., customised layouts may wish to treat each of these components
163 separately. In this case, `mkwsResults` can be omitted, and the
164 following lower-level components provided instead:
165
166 * `mkwsTermlists` -- provides the facets
167
168 * `mkwsRanking` -- provides the options for how records are sorted and
169    how many are included on each page of results.
170
171 * `mkwsPager` -- provides the links for navigating back and forth
172    through the pages of records.
173
174 * `mkwsNavi` -- when a search result has been narrowed by one or more
175    facets, this area shows the names of those facets, and allows the
176    selected values to be clicked in order to remove them.
177
178 * `mkwsRecords` -- lists the actual result records.
179
180 Customisation of MKWS searching widgets can also be achieved by
181 overriding the styles set in the toolkit's CSS stylesheet. The default
182 styles can be inspected in `mkws.css` and overridden in any
183 styles that appears later in the HTML than that file. At the simplest
184 level, this might just mean changing fonts, sizes and colours, but
185 more fundamental changes are also possible.
186
187 To properly apply styles, it's necessary to understand how the HTML is
188 structured, e.g. which elements are nested within which
189 containers. The structures used by the widget-set are described in the
190 reference guide below.
191
192
193 Refinements
194 -----------
195
196
197 ### Message of the day
198
199 Some applications might like to open with content in the area that
200 will subsequently be filled with result-records -- a message of the
201 day, a welcome message or a help page. This can be done by placing an
202 `mkwsMOTD` division anywhere on the page. It will be moved into the
203 `mkwsResults` area and initially displayed, but will be hidden when a
204 search is made.
205
206
207 ### Customised display using Handlebars templates
208
209 Certain aspects of the widget-set's display can be customised by
210 providing Handlebars templates with well-known classes that begin with
211 the string `mkwsTemplate_`. At present, the supported templates are:
212
213 * `mkwsTemplate_Summary` -- used for each summary record in a list of
214   results.
215
216 * `mkwsTemplate_Record` -- used when displaying a full record.
217
218 For both of these the metadata record is passed in, and its fields can
219 be referenced in the template. As well as the metadata fields
220 (`md-*`), two special fields are provided to the `mkwsTemplate_Summary`
221 template, for creating popup links for full records. These are `_id`,
222 which must be provided as the `id` attribute of a link tag, and
223 `_onclick`, which must be provided as the `onclick` attribute.
224
225 For example, an application can install a simple author+title summary
226 record in place of the usual one providing the following template:
227
228         <script class="mkwsTemplate_Summary" type="text/x-handlebars-template">
229           {{#if md-author}}
230             <span>{{md-author}}</span>
231           {{/if}}
232           <a href="#" id="{{_id}}" onclick="{{_onclick}}">
233             <b>{{md-title}}</b>
234           </a>
235         </script>
236
237 For details of Handlebars template syntax, see
238 [the online documentation](http://handlebarsjs.com/).
239
240
241 ### Responsive design
242
243 Metasearching applications may need to appear differently on
244 small-screened mobile devices, or change their appearance when
245 screen-width changes (as when a small device is rotated). To achieve
246 this, MKWS supports responsive design which will move the termlists to
247 the bottom on narrow screens and to the sidebar on wide screens.
248
249 To turn on this behaviour, set the `responsive_design_width` to the desired
250 threshhold width in pixels. For example:
251
252         <script type="text/javascript">
253             var mkws_config = {
254                 responsive_design_width: 990
255             };
256         </script>
257
258 If individual result-related components are in use in place of the
259 all-in-one mkwsResults, then the redesigned application needs to
260 specify the locations where the termlists should appear in both
261 cases. In this case, wrap the wide-screen `mkwsTermlists` element in a
262 `mkwsTermlists-Container-wide` element; and provide an
263 `mkwsTermlists-Container-narrow` element in the place where the narrow-screen
264 termlists should appear.
265
266
267 ### Popup results with jQuery UI
268
269 The [jQuery UI library](http://en.wikipedia.org/wiki/JQuery_UI)
270 can be used to construct MKWS applications in which the only component
271 generally visible on the page is a search box, and the results appear
272 in a popup. The key part of such an application is this invocation of
273 the MKWS jQuery plugin:
274
275         <div class="mkwsSearch"></div>
276         <div class="mkwsPopup" popup_width="1024" popup_height="650" popup_modal="0" popup_autoOpen="0" popup_button="input.mkwsButton">
277           <div class="mkwsSwitch"></div>
278           <div class="mkwsLang"></div>
279           <div class="mkwsResults"></div>
280           <div class="mkwsTargets"></div>
281           <div class="mkwsStat"></div>
282         </div>
283
284 The necessary scaffolding can be seen in an example application,
285 http://example.indexdata.com/index-popup.html
286
287
288 ### Authentication and target configuration
289
290 By default, MKWS configures itself to use a demonstration account on a
291 service hosted by mkws.indexdata.com. This account (username `demo`,
292 password `demo`) provides access to about a dozen free data
293 sources. Authentication onto this service is via an authentication URL
294 on the same MKWS server, so no explicit configuration is needed.
295
296 In order to search in a customised set of targets, including
297 subscription resources, it's necessary to create an account with
298 Index Data's hosted service proxy, and protect that account with
299 authentication tokens (to prevent unauthorised use of subscription
300 resources). For information on how to do this, see the next section.
301
302
303 MKWS Target Selection
304 ---------------------
305
306 MKWS accesses targets using the Pazpar2 metasearching engine. Although
307 Pazpar2 can be used directly, using a statically configured set of
308 targets, this usage is unusual. More often, Pazpar2 is fronted by the
309 Service Proxy (SP), which manages authentication, sessions, target
310 selection, etc.
311
312 This document assumes the SP is used, and explains how to go about
313 making a set of targets (a "library") available, how to connect your
314 MKWS application to that library, and how to choose which of the
315 available targets to use.
316
317
318 ### Maintaining the library
319
320 The service proxy accesses sets of targets that are known as
321 "libraries". In general, each customer will have their own library,
322 though some standard libraries may be shared between many customers --
323 for example, a library containing all open-access academic journals.
324 A library can also contain other configuration information, including
325 the set of categories by which targets are classified for the library.
326
327 Libraries are maintained using MKAdmin (MasterKey
328 Admin). Specifically, those used by MKWS are generally maintained on
329 the "MKX Admin" installation at
330 <http://mkx-admin.indexdata.com/console/>
331
332 In general, Index Data will create a library for each customer, then
333 give the customer a username/password pair that they can use to enter
334 MKAdmin and administrate that library.
335
336 Once logged in, customers can select which targets to include (from
337 the list of several thousand that MKAdmin knows about), and make
338 customer-specific modifications -- e.g. overriding the titles of the
339 targets.
340
341 Most importantly, customers' administrators can add authentication
342 credentials that the Service Proxy will used on their behalf when
343 accessing subscription resources -- username/password pairs or proxies
344 to use for IP-based authentication. Note that **it is then crucial to
345 secure the library from use by unauthorised clients**, otherwise the
346 customer's paid subscriptions will be exploited.
347
348 Access to libraries is managed by creating one or more "User Access"
349 records in MKAdmin, under the tab of that name. Each of these records
350 provides a combination of credentials and other data that allow an
351 incoming MKWS client to be identified as having legitimate access to
352 the library. The authentication process, described below, works by
353 searching for a matching User Access record.
354
355
356 ### Authenticating your MWKS application onto the library
357
358 Some MKWS applications will be content to use the default library with
359 its selection of targets. Most, though, will want to define their own
360 library providing a different range of available targets. An important
361 case is that of applications that authenticate onto subscription
362 resources by means of backe-end site credentials stored in MKAdmin:
363 precautions must be taken so that such library accounts do not allow
364 unauthorised access.
365
366 Setting up such a library is a process of several stages.
367
368 #### Create the User Access account
369
370 Log in to MKAdmin administrate your library:
371
372 * Go to <http://mkx-admin.indexdata.com/console/>
373 * Enter the adminstrative username/password
374 * Go to the User Access tab
375 * Create an end-user account
376 * Depending on what authentication method it be used, set the
377   User Access account's username and password, or IP-address range, or
378   referring URL, or hostname.
379
380 If your MWKS application runs at a well-known, permanent address --
381 <http://yourname.com/app.html>, say -- you can set the User Access
382 record so that this originating URL is recognised by setting it into
383 the "Referring URL" field.
384
385 If your application accesses the Service Proxy by a unique virtual
386 hostname -- yourname.sp-mkws.indexdata.com, say -- you can tie the use
387 of this hostname to your library by setting the User Access record's
388 "Host Name" field to name of the host where the SP is accessed. **Note
389 that this is not secure, as other applications can use this virtual
390 hostname to gain access to your library.**
391
392 > TODO Authentication by IP address does not yet work correctly -- see
393 > bug MKWS-234 ("Improve SP configuration/proxying for better
394 > authentication").
395
396 Alternatively, your application can authenticate by username and
397 password credentials. This is a useful approach in several situations,
398 including when you need to specify the use of a different library from
399 usual one. To arrange for this, set the username and password as a
400 single string separated by a slash -- e.g. "mike/swordfish" -- into
401 the User Access record's Authentication field.
402
403 You can create multiple User Access records: for example, one that
404 uses Referring URL, and another that uses a username/password pair to
405 be used when running an application from a different URL.
406
407 #### Tell the application to use the library
408
409 In the HTML of the application, tell MKWS to authenticate on to the
410 Service Proxy. When IP-based, referer-based or hostname-based
411 authentication is used, this is very simple:
412
413         <script type="text/javascript">
414           var mkws_config = { service_proxy_auth:
415           "//sp-mkws.indexdata.com/service-proxy/?command=auth&action=perconfig" };
416         </script>
417
418 > TODO This should be the default setting
419
420 And ensure that access to the MWKS application is from the correct
421 Referrer URL or IP-range.
422
423 #### (Optional): access by a different virtual hostname
424
425 When hostname-based authentication is in use, it's necessary to access
426 the Service Proxy as the correctly named virtual host. This can be
427 done by setting the `service_proxy_auth` configuration item to a
428 URL containing that hostname, such as
429 <//yourname.sp-mkws.indexdata.com/service-proxy/?command=auth&action=perconfig>
430
431 > TODO It should be possible to change just the hostname without
432 > needing to repeat the rest of the URL (protocol, path, query)
433
434 > TODO When changing the SP authentication URL, the Pazpar2 URL should
435 > in general change along with it.
436
437 #### (Optional): embed credentials for access to the library
438
439 When credential-based authentication is in use (username and
440 password), it's necessary to pass these credentials into the Service
441 Proxy when establishing the session. This can most simply be done just
442 by setting the `service_proxy_auth` configuration item to a URL such as
443 <//sp-mkws.indexdata.com/service-proxy/?command=auth&action=perconfig&username=mike&password=swordfish>
444
445 > TODO It should be possible to add the username and password to the
446 > configuration without needing to repeat the rest of the URL.
447
448 #### (Optional): conceal credentials from HTML source
449
450 Using a credential-based Service-Proxy authentication URL such as the
451 one above reveals the the credentials to public view -- to anyone who
452 does View Source on the MKWS application. This may be acceptable for
453 some libraries, but is intolerable for those which provide
454 authenticated access to subscription resources.
455
456 In these circumstances, a more elaborate approach is necessary. The
457 idea is to make a URL local to the customer that is used for
458 authentication onto the Service Proxy, hiding the credentials in a
459 local rewrite rule. Then local mechanisms can be used to limit access
460 to that local authentication URL. Here is one way to do it when
461 Apache2 is the application's web-server, which we will call
462 yourname.com:
463
464 - Add a rewriting authentication alias to the configuration:
465
466         RewriteEngine on
467         RewriteRule /spauth/ http://mkws.indexdata.com/service-proxy/?command=auth&action=check,login&username=U&password=PW [P]
468
469 - Set the MKWS configuration item `service_proxy_auth` to
470   <http://yourname.com/spauth/>
471 - Protect access to the local path <http://yourname.com/spauth/>
472   (e.g. using a .htaccess file).
473
474
475 ### Choosing targets from the library
476
477 MKWS applications can choose what subset of the library's targets to
478 use, by means of several alternative settings on individual widgets or
479 in the `mkws_config` structure:
480
481 * `targets` -- contains a Pazpar2 targets string, typically of the form
482   "pz:id=" or "pz:id~" followed by a pipe-separated list of low-level
483   target IDs.
484   At present, these IDs can take one of two forms, depending on the
485   configuration of the Service Proxy being used: they may be based on
486   ZURLs (so a typical value would be something like
487   `pz:id=josiah.brown.edu:210/innopac|lui.indexdata.com:8080/solr4/select?fq=database:4902`)
488   or they may be UDBs (so a typical value would be something like
489   `pz:id=brown|artstor`)
490
491 * `targetfilter` -- contains a CQL query which is used to find relevant
492   targets from the relvant library. For example,
493   `udb==Google_Images`
494   or
495   `categories=news`
496
497 * `target` -- contains a single UDB, that of the sole target to be
498   used. For example,
499   `Google_Images`.
500   This is merely syntactic sugar for "targetfilter" with the query
501   `udb==NAME`
502
503 For example, a `Records` widget can be limited to searching only in
504 targets that have been categorised as news sources by providing an
505 attribute as follows:
506
507         <div class="mkwsRecords" targetfilter='categories=news'/>
508
509
510 Reference Guide
511 ---------------
512
513 ### Configuration object
514
515 The configuration object `mkws_config` may be created before including
516 the MKWS JavaScript code to modify default behaviour. This structure
517 is a key-value lookup table, whose entries are described in the table
518 below. All entries are optional, but if specified must be given values
519 of the specified type. If ommitted, each setting takes the indicated
520 default value; long default values are in footnotes to keep the table
521 reasonably narrow.
522
523 ----
524 Element                   Type    Default   Description
525 --------                  -----   --------- ------------
526 debug_level               int     1         Level of debugging output to emit. 0 = none, 1 = messages, 2 = messages with
527                                             datestamps, 3 = messages with datestamps and stack-traces.
528
529 facets                    array   *Note 1*  Ordered list of names of facets to display. Supported facet names are
530                                             `xtargets`, `subject` and `author`.
531
532 lang                      string  en        Code of the default language to display the UI in. Supported language codes are `en` =
533                                             English, `de` = German, `da` = Danish, and whatever additional languages are configured
534                                             using `language_*` entries (see below).
535
536 lang_options              array   []        A list of the languages to offer as options. If empty (the default), then all
537                                             configured languages are listed.
538
539 language_*                hash              Support for any number of languages can be added by providing entries whose name is
540                                             `language_` followed by the code of the language. See the separate section below for
541                                             details.
542
543 pazpar2_url               string  *Note 2*  The URL used to access the metasearch middleware. This service must be configured to
544                                             provide search results, facets, etc. It may be either unmediated or Pazpar2 the
545                                             MasterKey Service Proxy, which mediates access to an underlying Pazpar2 instance. In
546                                             the latter case, `service_proxy_auth` must be provided.
547
548 perpage_default           string  20        The initial value for the number of records to show on each page.
549
550 perpage_options           array   *Note 3*  A list of candidate page sizes. Users can choose between these to determine how many
551                                             records are displayed on each page of results.
552
553 query_width               int     50        The width of the query box, in characters.
554
555 responsive_design_width   int               If defined, then the facets display moves between two locations as the screen-width
556                                             varies, as described above. The specified number is the threshhold width, in pixels,
557                                             at which the facets move between their two locations.
558
559 service_proxy_auth        url     *Note 4*  A URL which, when `use_service_proxy` is true, is fetched once at the beginning of each
560                                             session to authenticate the user and establish a session that encompasses a defined set
561                                             of targets to search in.
562
563 service_proxy_auth_domain domain            Can be set to the domain for which `service_proxy_auth` proxies authentication, so
564                                             that cookies are rewritten to appear to be from this domain. In general, this is not
565                                             necessary, as this setting defaults to the domain of `pazpar2_url`.
566
567 show_lang                 bool    true      Indicates whether or not to display the language menu.
568
569 show_perpage              bool    true      Indicates whether or not to display the perpage menu.
570
571 show_sort                 bool    true      Indicates whether or not to display the sort menu.
572
573 show_switch               bool    true      Indicates whether or not to display the switch menu, for switching between showing
574                                             retrieved records and target information.
575
576 sort_default              string  relevance The label of the default sort criterion to use. Must be one of those in the `sort`
577                                             array.
578
579 sort_options              array   *Note 6*  List of supported sort criteria. Each element of the list is itself a two-element list:
580                                             the first element of each sublist is a pazpar2 sort-expression such as `data:0` and
581                                             the second is a human-readable label such as `newest`.
582
583 use_service_proxy         bool    true      If true, then a Service Proxy is used to deliver searching services rather than raw
584                                             Pazpar2.
585 ----
586
587 Perhaps we should get rid of the `show_lang`, `show_perpage`,
588 `show_sort` and `show_switch` configuration items, and simply display the relevant menus
589 only when their containers are provided -- e.g. an `mkwsLang` element
590 for the language menu. But for now we retain these, as an easier route
591 to lightly customise the display than my changing providing a full HTML
592 structure.
593
594 #### Notes
595
596 1. ["sources", "subjects", "authors"]
597
598 2. /pazpar2/search.pz2
599
600 3. [10, 20, 30, 50]
601
602 4. http://mkws.indexdata.com/service-proxy-auth
603
604 5. http://mkws.indexdata.com/service-proxy/
605
606 6. [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]]
607
608
609 ### Language specification
610
611 Support for another UI language can be added by providing an entry in
612 the `mkws_config` object whose name is `language_` followed by the
613 name of the language: for example, `language_French` to support
614 French. Then value of this entry must be a key-value lookup table,
615 mapping the English-language strings of the UI into their equivalents
616 in the specified language. For example:
617
618             var mkws_config = {
619               language_French: {
620                 "Authors": "Auteurs",
621                 "Subjects": "Sujets",
622                 // ... and others ...
623               }
624             }
625
626 The following strings occurring in the UI can be translated:
627 `Displaying`,
628 `Next`,
629 `Prev`,
630 `Records`,
631 `Search`,
632 `Sort by`,
633 `Targets`,
634 `Termlists`,
635 `and show`,
636 `found`,
637 `of`,
638 `per page`
639 and
640 `to`.
641
642 In addition, facet names can be translated:
643 `Authors`,
644 `Sources`
645 and
646 `Subjects`.
647
648 Finally, the names of fields in the full-record display can be
649 translated. These include, but may not be limited to:
650 `Author`,
651 `Date`,
652 `Location`,
653 `Subject`
654 and
655 `Title`.
656
657
658
659 ### jQuery UI popup invocation
660
661 The MasterKey Widget Set can be invoked in a popup window on top of the page.
662
663 Note that when using the `popup` layout, facilities from the jQuery UI
664 toolkit are used, so it's necessary to include both CSS and JavaScript
665 from that toolkit. The relevant lines are:
666
667     <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
668     <link rel="stylesheet" type="text/css"
669           href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
670
671     <div class="mkwsSearch"></div>
672     <div class="mkwsPopup" popup_width="1024" popup_height="650" popup_modal="0" popup_autoOpen="0" popup_button="input.mkwsButton">
673       <div class="mkwsSwitch"></div>
674       <div class="mkwsLang"></div>
675       <div class="mkwsResults"></div>
676       <div class="mkwsTargets"></div>
677       <div class="mkwsStat"></div>
678     </div>
679
680 ----
681 Element    Type    Default           Description
682 --------   -----   ---------         ------------
683 popup_width     string     880       Width of the popup window (if used), in
684                                      pixels.
685
686 popup_height    string     760       Height of the popup window (if used), in
687                                      pixels.
688
689 popup_button    string      input.mkwsButton  (Never change this.)
690
691 popup_modal     string      0       Modal confirmation mode. Valid values are 0 or 1
692
693 popup_autoOpen  string      1       Open popup window on load. Valid values are 0 or 1
694
695 ----
696
697
698 ### The structure of the HTML generated by the MKWS widgets
699
700 In order to override the default CSS styles provided by the MasterKey Widget
701 Set, it's necessary to understand that structure of the HTML elements that are
702 generated within the components. This knowledge make it possible, for example,
703 to style each `<div>` with class `term` but only when it occurs inside an
704 element with ID `#mkwsTermlists`, so as to avoid inadvertently styling other
705 elements using the same class in the non-MKWS parts of the page.
706
707 The HTML structure is as follows. As in CSS, #ID indicates a unique identifier
708 and .CLASS indicates an instance of a class.
709
710     #mkwsSwitch
711       a*
712
713     #mkwsLang
714       ( a | span )*
715
716     #mkwsSearch
717       form
718         input#mkwsQuery type=text
719         input#mkwsButton type=submit
720
721     #mkwsBlanket
722       (no contents -- used only for masking)
723
724     #mkwsResults
725       table
726         tbody
727           tr
728             td
729               #mkwsTermlists
730                 div.title
731                 div.facet*
732                   div.termtitle
733                   ( a span br )*
734             td
735               div#mkwsRanking
736                 form#mkwsSelect
737                   select#mkwsSort
738                   select#mkwsPerpage
739               #mkwsPager
740               #mkwsNavi
741               #mkwsRecords
742                 div.record*
743                   span (for sequence number)
744                   a (for title)
745                   span (for other information such as author)
746                   div.details (sometimes)
747                     table
748                       tbody
749                         tr*
750                           th
751                           td
752     #mkwsTargets
753       #mkwsBytarget
754         table
755           thead
756             tr*
757               td*
758           tbody
759             tr*
760               td*
761
762     #mkwsStat
763       span.head
764       span.clients
765       span.records
766
767 - - -
768
769 Copyright (C) 2013-2014 by IndexData ApS, <http://www.indexdata.com>