Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/mkws
authorWolfram Schneider <wosch@indexdata.dk>
Wed, 5 Nov 2014 16:47:46 +0000 (16:47 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Wed, 5 Nov 2014 16:47:46 +0000 (16:47 +0000)
45 files changed:
Makefile
doc/mkws-manual.markdown
examples/htdocs/custom.css
examples/htdocs/heikki-motd.html
examples/htdocs/heikki.html
examples/htdocs/intro.html
examples/htdocs/jasmine-local-popup.html
examples/htdocs/jasmine-popup.html
examples/htdocs/jasmine-pp2.html
examples/htdocs/language.html
examples/htdocs/local-auto.html
examples/htdocs/lowlevel.html
examples/htdocs/mike.html
examples/htdocs/mike2.html
examples/htdocs/popup-dev.html
examples/htdocs/prettysimple.css [new file with mode: 0644]
examples/htdocs/prettysimple.html [new file with mode: 0644]
examples/htdocs/topic.css
examples/htdocs/topic.html
examples/htdocs/wolfram.html
src/Makefile
src/mkws-core.js
src/mkws-team.js
src/mkws-widget-facets.js [new file with mode: 0644]
src/mkws-widget-main.js
src/mkws-widget-termlists.js [deleted file]
src/templates/facets.handlebars [new file with mode: 0644]
src/templates/lang.handlebars
src/templates/results.handlebars
src/templates/search.handlebars
src/templates/summary.handlebars
src/templates/termlists.handlebars [deleted file]
test/Makefile
test/bin/bomb.pl
test/spec-dev/async.spec.js [new file with mode: 0644]
test/spec/async.spec.js [deleted file]
test/spec/mkws-pazpar2.js
test/widgets/Makefile
test/widgets/url.demos
test/widgets/url.koha
tools/apache2/mkws-live
tools/apache2/mkws-mike-mac
tools/apache2/sp-mkws-live
tools/apache2/sp-mkws-mike-mac [new file with mode: 0644]
tools/htdocs/mkws.css

index cb4d8f6..a105790 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -29,5 +29,5 @@ help:
        @echo "make [ all | setup | clean | distclean ]"
        @echo "     [ check | check-js | phantomjs ]"
        @echo ""
-       @echo "If 'make check' timeout is too short, extend with: make check PHANTOMJS_TIMEOUT=40"
+       @echo "If 'make check' timeout is too short, extend with: make check PHANTOMJS_TIMEOUT=120"
 
index 46f507c..13f51b4 100644 (file)
@@ -213,7 +213,7 @@ the English), initially sorts search results by title rather than
 relevance (though as always this can be changed in the UI) and makes
 the search box a bit wider than the default.
 
-The full set of supported configuration items is described in the
+The full set of supported configuration settings is described in the
 reference guide below.
 
 Per-widget configuration
@@ -221,7 +221,7 @@ Per-widget configuration
 
 In addition to the global configuration provided by the `mkws_config`
 object, individual widgets' behaviour can be configured by providing
-configuration items as attributed on their HTML elements. For example,
+configuration settings as attributes on their HTML elements. For example,
 a `records` widget might be restricted to displaying no more than
 three records by setting the `numrecs` parameter as follows:
 
@@ -238,11 +238,11 @@ attributes prefixed with `data-mkws-`, so:
 
 For first form is more convenient; the second is more correct.
 
-Because some configuration items take structured values rather than
+Because some configuration settings take structured values rather than
 simple strings, they cannot be directly provided by inline
 attributes. To allow for this, the special attribute
 `data-mkws-config`, if provided, is parsed as JSON and its key-value
-pairs set as configuration items for the widget in question. For
+pairs used as configuration settings for the widget in question. For
 example, the value of `lang_options` is an array of strings specifying
 which of the supported UI languages should be made available. The
 following invocation will limit this list to only English and Danish
@@ -267,7 +267,7 @@ etc., customised layouts may wish to treat each of these components
 separately. In this case, `mkws-results` can be omitted, and the
 following lower-level widgets provided instead:
 
-* `mkws-termlists` -- provides the facets
+* `mkws-facets` -- provides the facets
 
 * `mkws-ranking` -- provides the options for how records are sorted and
    how many are included on each page of results.
@@ -561,7 +561,7 @@ its own User Access record.
 When credential-based authentication is in use (username and
 password), it's necessary to pass these credentials into the Service
 Proxy when establishing the session. This is done 
-by setting the `sp_auth_credentials` configuration item to a string
+by providing the `sp_auth_credentials` configuration setting as a string
 containing the username and password separated by a slash:
 
        mkws_config = { sp_auth_credentials: "mike/swordfish" };
@@ -590,9 +590,10 @@ yourname.com`:
 Step 1: add a rewriting authentication alias to the configuration:
 
        RewriteEngine on
-       RewriteRule /spauth/ http://sp-mkws.indexdata.com/service-proxy/?command=auth&action=check,login&username=U&password=PW [P]
+       RewriteRule /spauth/ http://sp-mkws.indexdata.com/service-proxy/\
+               ?command=auth&action=check,login&username=U&password=PW [P]
 
-Step 2: set the MKWS configuration item `service_proxy_auth` to
+Step 2: set the MKWS configuration setting `service_proxy_auth` to
 `http://yourname.com/spauth/`.
 
 Step 3: protect access to the local path `http://yourname.com/spauth/`
@@ -659,156 +660,370 @@ Name              Description
                   widget be subclassed to store the generated widget
                   definitions in more useful places.
 
-`button`          x
+`button`          The search button. Usually generated a `search`
+                  widget.
 
-`categories`      x
+`categories`      Obtains from the Service Proxy a list of the target
+                  categories associated with the library in use, and
+                  displays them in a drop-down list. When a category
+                  is selected, searches are limited to the targets
+                  that are part of that category.
 
-`config`          x
+`config`          This widget has no functionality of its own, but its
+                  configuration is copied up into its team, allowing
+                  it to affect other widgets in the team. This is the
+                  only way to set configuration settings at the team
+                  level.
 
 `console-builder` Like the `builder` widget, but emits the generated
                   HTML on the JavaScript console. This exists to
                   provide an example of how to subclass the `builder`
                   widget.
 
-`cover-art`       x
-
-`details`         x
-
-`done`            x
+`cover-art`       Displays cover art for a book by searching in
+                  Amazon. Often used with an `autosearch` attribute to
+                  indicate what book to display. For example,
+                  `<div class="mkws-cover-art" autosearch="isbn=1291177124"></div>`
+                  displays cover art for _All Yesterdays: Unique and
+                  Speculative Views of Dinosaurs and Other Prehistoric
+                  Animals_.
+                  For this widget to work, a library that includes the
+                  AmazonBooks target must be used. For example, the
+                  "DEMO AmazonBooks for MKWS" account, which can be
+                  selected with `sp_auth_credentials="mkws-amazon/mkws"`.
+
+`details`         This widget is generated by the toolkit itself to
+                  hold the full details of records that are initially
+                  listed in summary form.
+
+`done`            Initially empty, this widget is set to display
+                  "Search complete: found _n_ records" when all
+                  targets have completed their work, either returning
+                  a hit-count or an error. The message displayed can
+                  be changed by overriding the `done` template using
+                  `<script class="mkws-template-done" type="text/x-handlebars-template">`.
+
+`facet`           A facet that displays the frequency with which a set
+                  of terms occur within a specific field. The specific
+                  field whose contents are analysed must be specified
+                  by the widget's `facet` configuration setting, which
+                  may conveniently be done by means of the
+                  `data-mkws-facet` attribute on the HTML
+                  element. The supported facets are "subject",
+                  "author" and "xtargets" -- the latter a special case
+                  which treats the target providing a record as a
+                  facet. Most often, `facet` widgets are generated
+                  by a `facets` widget, which knows which facets are
+                  required, but they can also be placed individually.
+
+`facets`          An area that contains a "Facets" heading and several
+                  `facet` widgets. The set of facet widgets generated
+                  is specified by the `facets` configuration setting,
+                  which may be set globally or at the level of the
+                  widget or the team. The value of this configuration
+                  setting is an array of zero or more strings, each
+                  naming a facet.
+
+`google-image`    A specialisation of the `images` widget which
+                  defaults to the `Google_Images` target.
+
+`images`          A specialisation of the `records` widget which
+                  defaults to the `images` template. Unlike the default
+                  summary template, this displays an image from the
+                  URL specified by the `md-thumburl` field of each
+                  record.
+
+`lang`            Provides a selection between the supported set of
+                  languages (which defaults to English, German and
+                  Danish, but can be configured by the `lang`
+                  configuration setting, whose value is an array of
+                  two-letter language codes).
+
+`log`             Initially empty, this widget accumulates a log of
+                  messages generated by the widget set, similar to
+                  those emitted on the JavaScript console.
+
+`lolcat`          A specialisation of the `google-image` widget which
+                  defaults to the search-term "kitteh" and
+                  auto-executes.
+
+`motd-container`  An empty container which the `motd` widget, if any,
+                  is moved into for initial display. Usually generated
+                  as part of the `results` widget.
+
+`motd`            May be provided, containing content to appear in the
+                  area where records will later appear. It is moved
+                  into this area (the `motd-container` widget) and
+                  initially displayed; then hidden when the first
+                  search is run. It can be used to provide a "message
+                  of the day".
+
+`navi`            Shows a list of the facets that have been selected,
+                  and allows them to be deselected.
+
+`pager`           Shows a list of the available pages of results, and
+                  allows the user to navigate to a selected page.
+
+`per-page`        Provides a dropdown allowing the user to choose how
+                  many records should appear on each page. The
+                  available set of page-sizes can be specified as the
+                  `perpage_options` configuration setting, whose value is
+                  an array of integers. The initial selected value can
+                  be specified by the `perpage_default` configuration setting.
+
+`progress`        Shows a progress bar which indicates how many of the
+                  targets have responded to the search.
+
+`query`           The input area for a query. Usually generated a `search`
+                  widget.
 
-`facet`           x
+`ranking`         The result-ranking area, consisting of a `sort`
+                  widget and a `per-page` widget. These may instead
+                  be specified separately if preferred.
+
+`record`          A detailed display of a single record, usually
+                  appearing when the user clicks on a summary
+                  record. This is generated by the `records` widget.
+
+`records`         The area in which summary records appear. (Clicking
+                  on a summary record make it pop up as a detailed
+                  record.)
+
+`reference`       A short summary about a subject specified by the
+                  `autosearch` configuration setting. This is created by
+                  drawing a picture and a paragraph of text from
+                  Wikipedia. To work correctly, this widget must be
+                  used in a library that provides the
+                  `wikimedia_wikipedia_single_result` target.
+
+`results`         A large compound widget used to provide the most
+                  important results-oriented widgets in a pre-packaged
+                  framework: `facets`, `ranking`, `pager`, `navi` and
+                  `records`.
+
+`search-form`     The search form, containing the query area and the
+                  button. Usually generated a `search` widget.
+
+`search`          The search box, consisting of a form containing a
+                  query area and a button.
+
+`sort`            Provides a dropdown allowing the user to choose how
+                  the displayed records should be sorted. The
+                  available set of sort criteria can be specified as the
+                  `sort_options` configuration setting, whose value is
+                  an array of two-element arrays. The first item of
+                  each sub-array is a pazpar2 sort-expression such as
+                  `data:0` and the second is a human-readable label
+                  such as `newest`. The initial selected
+                  value can be specified by the `sort_default` configuration
+                  setting.
+
+`stat`            A summary line stating how many targets remain
+                  active, how many records have been found, and how
+                  many of them have been retrieved for display. For
+                  most purposes, the `progress` widget may be
+                  preferable.
+
+`summary`         A short record, included in the list shown when a
+                  search is run. When clicked, this generally pops up
+                  a detailed `record` widget. This widget is generated
+                  by the toolkit in response to search results.
+
+`switch`          A pair of buttons allowing the user to switch
+                  between viewing the search results (the usual case)
+                  or the target list.
+
+`targets`         A list of all targets in the present library,
+                  showing their ID, the number of records they have
+                  found for the current search, any diagnostics they
+                  have returned, the number of records that have been
+                  returned for display, and the connection state.
+----
 
-`google-image`    x
 
-`images`          x
+Configuration settings
+----------------------
 
-`lang`            x
+Configuration settings may be provided at the level of a indiviual widget, or a team, or globally. Per-widget configuration is
+described above; per-team settings can be placed in a `config` widget belonging to the relevant team, and will be applied to that
+team as a whole; and global settings are provided in the global variable `mkws_config`. This structure is a key-value lookup
+table, and may specify the values of many settings.
 
-`log`             x
+Some settings apply only to specific widgets; others to the behaviour of the tookit as a whole. When a widget does not itself have
+a value specified for a particular configuration setting, its team is consulted; and if that also does not have a value, the global
+settings are consulted. Only if this, too, is unspecified, is the default value used.
 
-`lolcat`          x
+The supported configuration settings are described in the table below. For those settings that apply only to particular widgets,
+the relevant widgets are listed. All entries are optional, but if specified must be given values of the specified type. Long
+default values are in footnotes to keep the table reasonably narrow.
 
-`motd-container`  x
+----
+Element                   Widget    Type    Default   Description
+--------                  ------    -----   --------- ------------
+auth_hostname             _global_
 
-`motd`            x
+autosearch                facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-`navi`            x
+facet                     facet
 
-`pager`           x
+facet_caption_*           facet
 
-`per-page`        x
+facet_max_*               facet
 
-`progress`        x
+facets                    _team_    array   *Note 1*  Ordered list of names of facets to display. Supported facet names are
+                                                      `xtargets`, `subject` and `author`.
 
-`query`           x
+lang                      _team_    string  en        Code of the default language to display the UI in. Supported language codes
+                                                      are `en` = English, `de` = German, `da` = Danish, and whatever additional
+                                                      languages are configured using `language_*` entries (see below).
 
-`ranking`         x
+lang_options              lang      array   []        A list of the languages to offer as options. If empty (the default), then all
+                                                      configured languages are listed.
 
-`record`          x
+language_*                _global_  hash              Support for any number of languages can be added by providing entries whose
+                                                      name is `language_` followed by the code of the language. See the separate
+                                                      section below for details.
 
-`records`         x
+limit                     facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-`reference`       x
+log_level                 _global_  int     1         Level of debugging output to emit. 0 = none, 1 = messages, 2 = messages with
+                                                      datestamps, 3 = messages with datestamps and stack-traces.
 
-`results`         x
+maxrecs                   facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-`search-form`     x
+paragraphs                reference
 
-`search`          x
+pazpar2_url               _global_  string  *Note 2*  The URL used to access the metasearch middleware. This service must be
+                                                      configured to provide search results, facets, etc. It may be either
+                                                      unmediated or Pazpar2 the MasterKey Service Proxy, which mediates access to
+                                                      an underlying Pazpar2 instance. In the latter case, `service_proxy_auth` must
+                                                      be provided.
 
-`sort`            x
+perpage                   facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-`stat`            x
+perpage_default           _team_    string  20        The initial value for the number of records to show on each page.
 
-`switch`          x
+perpage_options           ranking   array   *Note 3*  A list of candidate page sizes. Users can choose between these to determine
+                                                      how many records are displayed on each page of results.
 
-`targets`         x
+pp2_hostname              _global_
 
-`termlists`       x
-----
+pp2_path                  _global_
 
+query_width               _search_  int     50        The width of the query box, in characters.
 
-Configuration object
---------------------
+responsive_design_width   _global_  int               If defined, then the facets display moves between two locations as the
+                                                      screen-width varies, as described above. The specified number is the
+                                                      threshhold width, in pixels, at which the facets move between their two
+                                                      locations.
 
-The configuration object `mkws_config` may be created before including
-the MKWS JavaScript code to modify default behaviour. This structure
-is a key-value lookup table, whose entries are described in the table
-below. All entries are optional, but if specified must be given values
-of the specified type. If ommitted, each setting takes the indicated
-default value; long default values are in footnotes to keep the table
-reasonably narrow.
+scan_all_nodes            _global_
 
-----
-Element                   Type    Default   Description
---------                  -----   --------- ------------
-log_level                 int     1         Level of debugging output to emit. 0 = none, 1 = messages, 2 = messages with
-                                            datestamps, 3 = messages with datestamps and stack-traces.
+sentences                 reference
 
-facets                    array   *Note 1*  Ordered list of names of facets to display. Supported facet names are
-                                            `xtargets`, `subject` and `author`.
+service_proxy_auth        _global_  url     *Note 4*  A URL which, when `use_service_proxy` is true, is fetched once at the
+                                                      beginning of each session to authenticate the user and establish a session
+                                                      that encompasses a defined set of targets to search in.
 
-lang                      string  en        Code of the default language to display the UI in. Supported language codes are `en` =
-                                            English, `de` = German, `da` = Danish, and whatever additional languages are configured
-                                            using `language_*` entries (see below).
+service_proxy_auth_domain _global_  domain            Can be set to the domain for which `service_proxy_auth` proxies
+                                                      authentication, so that cookies are rewritten to appear to be from this
+                                                      domain. In general, this is not necessary, as this setting defaults to the
+                                                      domain of `pazpar2_url`.
 
-lang_options              array   []        A list of the languages to offer as options. If empty (the default), then all
-                                            configured languages are listed.
+show_lang                lang       bool    true      Indicates whether or not to display the language menu.
 
-language_*                hash              Support for any number of languages can be added by providing entries whose name is
-                                            `language_` followed by the code of the language. See the separate section below for
-                                            details.
+show_perpage             ranking    bool    true      Indicates whether or not to display the perpage menu.
 
-pazpar2_url               string  *Note 2*  The URL used to access the metasearch middleware. This service must be configured to
-                                            provide search results, facets, etc. It may be either unmediated or Pazpar2 the
-                                            MasterKey Service Proxy, which mediates access to an underlying Pazpar2 instance. In
-                                            the latter case, `service_proxy_auth` must be provided.
+show_sort                ranking    bool    true      Indicates whether or not to display the sort menu.
 
-perpage_default           string  20        The initial value for the number of records to show on each page.
+show_switch              switch     bool    true      Indicates whether or not to display the switch menu, for switching between
+                                                      showing retrieved records and target information.
 
-perpage_options           array   *Note 3*  A list of candidate page sizes. Users can choose between these to determine how many
-                                            records are displayed on each page of results.
+sort                      facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-query_width               int     50        The width of the query box, in characters.
+sort_default              _team_    string  relevance The label of the default sort criterion to use. Must be one of those in the
+                                                      `sort` array.
 
-responsive_design_width   int               If defined, then the facets display moves between two locations as the screen-width
-                                            varies, as described above. The specified number is the threshhold width, in pixels,
-                                            at which the facets move between their two locations.
+sort_options              ranking   array   *Note 6*  List of supported sort criteria. Each element of the list is itself a
+                                                      two-element list: the first element of each sublist is a pazpar2
+                                                      sort-expression such as `data:0` and the second is a human-readable label
+                                                      such as `newest`.
 
-service_proxy_auth        url     *Note 4*  A URL which, when `use_service_proxy` is true, is fetched once at the beginning of each
-                                            session to authenticate the user and establish a session that encompasses a defined set
-                                            of targets to search in.
+sp_auth_credentials       _global_
 
-service_proxy_auth_domain domain            Can be set to the domain for which `service_proxy_auth` proxies authentication, so
-                                            that cookies are rewritten to appear to be from this domain. In general, this is not
-                                            necessary, as this setting defaults to the domain of `pazpar2_url`.
+sp_auth_path              _global_
 
-show_lang                 bool    true      Indicates whether or not to display the language menu.
+sp_auth_query             _global_
 
-show_perpage              bool    true      Indicates whether or not to display the perpage menu.
+target                    facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-show_sort                 bool    true      Indicates whether or not to display the sort menu.
+targetfilter              facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-show_switch               bool    true      Indicates whether or not to display the switch menu, for switching between showing
-                                            retrieved records and target information.
+targets                   facet,
+                          facets,
+                          record,
+                          records,
+                          results
 
-sort_default              string  relevance The label of the default sort criterion to use. Must be one of those in the `sort`
-                                            array.
+template                  details,
+                          done,
+                          facet,
+                          facets,
+                          images,
+                          lang,
+                          navi,
+                          pager,
+                          progress,
+                          ranking,
+                          record,
+                          records,
+                          reference,
+                          results,
+                          search,
+                          stat,
+                          switch,
+                          targets
 
-sort_options              array   *Note 6*  List of supported sort criteria. Each element of the list is itself a two-element list:
-                                            the first element of each sublist is a pazpar2 sort-expression such as `data:0` and
-                                            the second is a human-readable label such as `newest`.
+text                      builder
 
-use_service_proxy         bool    true      If true, then a Service Proxy is used to deliver searching services rather than raw
-                                            Pazpar2.
+use_service_proxy         _global_  bool    true      If true, then a Service Proxy is used to deliver searching services rather
+                                                      than raw Pazpar2.
 ----
 
-Perhaps we should get rid of the `show_lang`, `show_perpage`,
-`show_sort` and `show_switch` configuration items, and simply display the relevant menus
+(Perhaps we should get rid of the `show_lang`, `show_perpage`,
+`show_sort` and `show_switch` configuration settings, as we display the relevant menus
 only when their containers are provided -- e.g. an `mkws-lang` element
 for the language menu. But for now we retain these, as an easier route
-to lightly customise the display than my changing providing a full HTML
-structure.
+to lightly customise the display than by providing a full HTML
+structure.)
 
 ### Notes
 
@@ -851,7 +1066,7 @@ The following strings occurring in the UI can be translated:
 `Search`,
 `Sort by`,
 `Targets`,
-`Termlists`,
+`Facets`,
 `and show`,
 `found`,
 `of`,
@@ -890,7 +1105,7 @@ from that toolkit. The relevant lines are:
              href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
 
        <div class="mkws-search"></div>
-       <div class="mkws-popup" popup_width="1024" popup_height="650" popup_modal="0" popup_autoOpen="0" popup_button="input.mkwsButton">
+       <div class="mkws-popup" popup_width="1024" popup_height="650" popup_autoOpen="0">
          <div class="mkws-switch"></div>
          <div class="mkws-lang"></div>
          <div class="mkws-results"></div>
@@ -926,7 +1141,7 @@ In order to override the default CSS styles provided by the MasterKey Widget
 Set, it's necessary to understand that structure of the HTML elements that are
 generated within the widgets. This knowledge make it possible, for example,
 to style each `<div>` with class `term` but only when it occurs inside an
-element with class `mkws-termlists`, so as to avoid inadvertently styling other
+element with class `mkws-facets`, so as to avoid inadvertently styling other
 elements using the same class in the non-MKWS parts of the page.
 
 The HTML structure is as follows. As in CSS, #ID indicates a unique identifier
index 0a99dec..80eb04a 100644 (file)
@@ -1,4 +1,4 @@
-.mkws-termlists {
+.mkws-facets {
     background: white;
 }
 .mkws-facet {
index aa53154..843d3bc 100644 (file)
@@ -19,7 +19,7 @@
     <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
 
     <style type="text/css">
-      .mkws-termlists div.facet {
+      .mkws-facets div.facet {
       float:left;
       width: 30%;
       margin: 0.3em;
index 8a92369..5138bfe 100644 (file)
@@ -21,7 +21,7 @@
     <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
     <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
     <style type="text/css">
-      .mkws-termlists div.facet {
+      .mkws-facets div.facet {
       float:left;
       width: 30%;
       margin: 0.3em;
@@ -56,7 +56,7 @@
       <tr>
         <td>
           <div style="height:300px; overflow: hidden">
-            <div class="mkws-termlists"></div>
+            <div class="mkws-facets"></div>
           </div>
         </td>
       </tr>
index 59ecd50..1bd424f 100644 (file)
@@ -16,7 +16,7 @@
     <script type="text/javascript" src="src/mkws-filter.js"></script>
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
index 6bc7355..689557d 100644 (file)
@@ -18,7 +18,7 @@
     <script type="text/javascript" src="src/mkws-filter.js"></script>
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
index 9c6eb86..b5e79fe 100644 (file)
@@ -18,7 +18,7 @@
     <script type="text/javascript" src="src/mkws-filter.js"></script>
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
index dbe236a..8a8e64b 100644 (file)
@@ -22,7 +22,7 @@
 
     <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
     <style type="text/css">
-      .mkws-termlists div.facet {
+      .mkws-facets div.facet {
       float:left;
       width: 30%;
       margin: 0.3em;
@@ -71,7 +71,7 @@
       <tr>
         <td>
           <div style="height:300px; overflow: hidden">
-            <div class="mkws-termlists"></div>
+            <div class="mkws-facets"></div>
           </div>
         </td>
       </tr>
index d24e017..2cbd8be 100644 (file)
@@ -40,7 +40,7 @@
                        "Subject": "موضوع",
                        "Location": "موقع",
                        // Facet heading and individual facet names
-                       "Termlists": "العضو Ø§Ù„أجل",
+                       "Facets": "العضو Ø§Ù„أجل",
                        "Sources": "مصادر",
                        "Subjects": "المواضيع",
                        "Authors": "الكتاب",
index 27336ef..1c5604d 100644 (file)
@@ -30,7 +30,7 @@
        sort='relevance'
        targets='pz:id~josiah.brown.edu:210/innopac|connect.indexdata.com:9000/mit_opencourseware'
 >News will appear here</div>
-       <div class='mkws-termlists mkws-team-news'/>
+       <div class='mkws-facets mkws-team-news'/>
        </td>
        <td width="30%">
          <h2>Blog</h2>
@@ -39,7 +39,7 @@
        sort='relevance'
        targets='pz:id~josiah.brown.edu:210/innopac|connect.indexdata.com:9000/mit_opencourseware'
 >Blog entries will appear here</div>
-       <div class='mkws-termlists mkws-team-blog'/>
+       <div class='mkws-facets mkws-team-blog'/>
        </td>
       </tr>
     </table>
index ebf4043..74b55d2 100644 (file)
@@ -5,7 +5,7 @@
     <link rel="stylesheet" type="text/css" href="//mkws.indexdata.com/mkws.css" />
     <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
     <style type="text/css">
-      .mkws-termlists div.facet {
+      .mkws-facets div.facet {
       float:left;
       width: 30%;
       margin: 0.3em;
@@ -38,7 +38,7 @@
       <tr>
         <td>
           <div style="height:300px; overflow: hidden">
-            <div class="mkws-termlists"></div>
+            <div class="mkws-facets"></div>
           </div>
         </td>
       </tr>
index ee5e03d..4105b3d 100644 (file)
@@ -18,7 +18,7 @@
     <script type="text/javascript" src="src/mkws-filter.js"></script>
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
@@ -30,7 +30,7 @@
   <body>
     <div class="mkws-auth-name"></div>
     <div class="mkws-switch"></div>
-    <div class="mkws-lang" data-mkws-config='{ "lang_options": [ "en", "da" ] }'></div>
+    <div class="mkws-lang" data-mkws-config='{ "lang_options": [ "en", "de" ] }'></div>
     <div class="mkws-progress"></div>
     <div class="mkws-search"></div>
     <div class="mkws-results"></div>
index 6f1387b..f596dd8 100644 (file)
@@ -18,7 +18,7 @@
     <script type="text/javascript" src="src/mkws-filter.js"></script>
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
index 2ebf5ce..b79c37e 100644 (file)
@@ -26,7 +26,7 @@
     <script type="text/javascript" src="src/mkws-filter.js"></script>
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
diff --git a/examples/htdocs/prettysimple.css b/examples/htdocs/prettysimple.css
new file mode 100644 (file)
index 0000000..2984f7c
--- /dev/null
@@ -0,0 +1,386 @@
+/* General styling */
+html {
+  height: 100%;
+  margin: 0;
+}
+body {
+  display: flex;
+  align-content: space-between;
+  align-items: center;
+  flex-wrap: wrap;
+  height: 100%;
+  width: 100%;
+  max-width: 1100px;
+  margin: auto;
+  font-family: "Open Sans", sans-serif;
+}
+a {
+ text-decoration: none;
+ color: black;
+}
+
+/* Top level layout */
+.header {
+  width: 100%;
+  display: flex;
+  margin: .5em;
+  margin-bottom: 1em;
+}
+.mkws-switch {
+  margin-left: auto;
+}
+.main {
+  width: 100%;
+  display: flex;
+  align-items: flex-start;
+  margin: 1em;
+  margin-bottom: auto;
+}
+.forms {
+  width: 100%;
+  margin: 1em;
+}
+.mkws-facets {
+  margin-right: 66px;
+  flex: 1;
+}
+.results {
+  flex: 3;
+}
+
+/* Search form */
+/* heavily inspired by: */
+/* https://github.com/philipwalton/solved-by-flexbox/blob/master/_sass/components/_input-add-on.scss */
+.mkws-search {
+  margin-left: auto;
+  margin-bottom: 0;
+}
+.mkws-search-form {
+  display: flex;
+  margin-left: auto;
+  max-width: 30em;
+}
+.mkws-search-form .mkws-query {
+  flex: 1;
+  border-right: 0 !important;
+  border-radius: 2px 0 0 2px;
+  font-size: 1.1em;
+}
+.mkws-search-form .mkws-button {
+  border-radius: 0 2px 2px 0;
+  background-color: hsla(31, 15%, 50%, 0.1);
+  font: inherit;
+  font-weight: normal;
+}
+.mkws-search-form .mkws-query, .mkws-search-form .mkws-button {
+  border: 1px solid hsla(31, 15%, 50%, 0.25);
+  padding: 0.5em 0.75em;
+  margin: 0;
+}
+.mkws-ranking {
+  font-family: "Open Sans Light", sans-serif;
+  border-top: none;
+  border-bottom-left-radius: 5em 100%;
+  margin-top: 0;
+  margin-left: auto;
+  font-size: .9em;
+  text-align: right;
+  max-width: 25em;
+}
+.mkws-ranking select {
+ font-size: 1.0em;
+ font-family: "Open Sans", sans-serif;
+ border: none;
+ background: none;
+}
+
+/* Misc. elements */
+.mkws-lang {
+  color: gray;
+  font-family: "Open Sans Light", sans-serif;
+}
+.mkws-lang > span {
+  color: black;
+  font-family: "Open Sans", sans-serif;
+}
+.mkws-switch {
+  color: gray;
+  font-family: "Open Sans Light", sans-serif;
+}
+.mkws-switch > a {
+  color: black;
+}
+.mkws-pager {
+  width: 100%;
+}
+.mkws-current-page {
+  background: gray;
+  border-radius: 3em;
+  padding: 0 .5em;
+  color: white;
+}
+.mkws-navi {
+  margin-top: 10px;
+  width: 100%;
+  
+}
+.mkws-removable:after {
+  content: " X";
+  color: DarkRed; 
+}
+.mkws-removable:hover {
+  text-decoration: line-through;
+}
+.mkws-records {
+  width: 100%;
+}
+
+
+/* Facets */
+.mkws-facet {
+  padding-bottom: 1em;
+}
+.mkws-facet-title {
+  border-left: 5px solid #7d8187;
+  padding: .5em 10px;
+  text-transform: uppercase;
+}
+.mkws-facet:nth-child(1)>.mkws-facet-title {
+  border-color: #2980b9;
+}
+.mkws-facet:nth-child(2)>.mkws-facet-title {
+  border-color: #68a863;
+}
+.mkws-facet:nth-child(3)>.mkws-facet-title {
+  border-color: #b45b47;
+}
+
+.mkws-facet:last-child {
+  padding-bottom: initial;
+}
+.mkws-term {
+  display: flex;
+  padding-left: 15px;
+  font-size: .9em;
+}
+.mkws-term a {
+  flex: 1;
+  overflow: hidden; 
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.mkws-term span {
+  flex: 0 0 min-content;
+  float: right;
+  margin-left: .7em;
+}
+.mkws-stat {
+  font-family: "Open Sans Light", sans-serif;
+  text-align: right;
+  font-size: .9em;
+}
+
+
+/* Result containers */
+.mkws-summary {
+  padding: 40px 20px;
+  min-height: 120px;
+  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
+}
+.mkws-summary:last-child {
+  border: none;
+}
+.mkws-field-data {
+  min-height: 120px;
+  display: flex;
+  flex-direction: column;
+  flex-wrap: wrap;
+  align-items: flex-start;
+  align-content: flex-start;
+  justify-content: space-around;
+}
+
+/* Result fields */
+.mkws-field-data > * {
+  flex 1;
+}
+.mkws-field-date {
+  order: 1;
+  font-size: 14px;
+  color: rgba(0, 0, 0, 0.3);
+}
+.mkws-field-title {
+  order: 2;
+  font-family: "Open Sans Light", sans-serif;
+  font-size: 24px;
+  line-height: 1.2;
+  letter-spacing: -0.02em;
+  margin-bottom: 4px;
+}
+.mkws-field-title-remainder {
+  order: 3;
+  font-family: "Open Sans Light", sans-serif;
+  font-size: 12px;
+  margin-top: -4px;
+  margin-bottom: 4px;
+  overflow: hidden; 
+  text-overflow: ellipsis;
+}
+.mkws-field-description {
+  order: 4;
+  font-family: "Open Sans Light", sans-serif;
+  font-size: 18px;
+  line-height: 1.2;
+  max-height: 44px;
+  overflow: hidden;
+}
+.mkws-field-author {
+  order: 5;
+  font-weight: bold;
+  font-size: 12px;
+  letter-spacing: 0.1em;
+  text-transform: uppercase;
+}
+.mkws-field-thumb {
+  float: left;
+  margin-right: 25px;
+}
+.mkws-field-thumb > img {
+  width: 140px;
+  height: 120px;
+  object-fit: contain;
+}
+.mkws-details {
+  margin-top: 25px;
+}
+.mkws-prev, .mkws-next {
+  text-transform: uppercase;
+  font-size: .75em;
+} 
+
+
+/* Responsive */
+@media screen and (max-width: 1020px) {
+  .mkws-facets {
+    margin-right: 30px;
+  }
+}
+@media screen and (max-width: 900px) {
+  .mkws-pager {
+    margin: 0;
+  }
+  .mkws-pager > div {
+    margin-top: 10px;
+  }
+  .main {
+    flex-wrap: wrap;
+  }
+  .mkws-facets {
+    order: 99;
+    width: 100%;
+    margin-top: 40px;
+    margin-right: 0;
+    flex: none;
+  }
+  .results {
+    width: 100%;
+    order 1;
+    flex: none;
+  }
+  .mkws-ranking {
+    width: 100%;
+  }
+  .mkws-search {
+    width: 100%;
+  }
+  .mkws-summary {
+    min-height: 60px;
+    padding: 20px 10px;
+  }
+  .mkws-field-data {
+    min-height: 60px;
+  }
+  .mkws-field-date {
+    font-size: 12px;
+  }
+  .mkws-field-title {
+    font-size: 18px;
+  }
+  .mkws-field-description {
+    font-size: 14px;
+    max-height: 34px;
+  }
+  .mkws-field-author {
+    font-size: 11px;
+  }
+  .mkws-field-thumb {
+    order: -1;
+    margin-right: 10px;
+  }
+  .mkws-field-thumb > img {
+    width: 70px;
+    height: 60px;
+    object-fit: contain;
+  }
+  .mkws-pager > div {
+    float: none !important;
+  }
+}
+
+/* Font (from mozilla.org) */
+@font-face{
+  font-family:'Open Sans Light';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Light-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Light-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Light-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Light-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Light-webfont.svg#OpenSansLight) format('svg');
+  font-weight:400;
+  font-style:normal
+}
+
+@font-face{
+  font-family:'Open Sans Light';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.svg#OpenSansRegular) format('svg');
+  font-weight:700;
+  font-style:normal
+}
+
+@font-face{
+  font-family:'Open Sans Light';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-LightItalic-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-LightItalic-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-LightItalic-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-LightItalic-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-LightItalic-webfont.svg#OpenSansRegular) format('svg');
+  font-weight:400;
+  font-style:italic
+}
+
+@font-face{
+  font-family:'Open Sans';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Regular-webfont.svg#OpenSansRegular) format('svg');
+  font-weight:400;
+  font-style:normal
+}
+
+@font-face{
+  font-family:'Open Sans';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Semibold-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Semibold-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Semibold-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Semibold-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold) format('svg');
+  font-weight:700;
+  font-style:normal
+}
+
+@font-face{
+  font-family:'Open Sans';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Italic-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Italic-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Italic-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Italic-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-Italic-webfont.svg#OpenSansItalic) format('svg');
+  font-weight:400;
+  font-style:italic
+}
+
+@font-face{
+  font-family:'Open Sans Extra Bold';
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-ExtraBold-webfont.eot);
+  src:url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-ExtraBold-webfont.eot?#iefix) format('embedded-opentype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-ExtraBold-webfont.woff) format('woff'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-ExtraBold-webfont.ttf) format('truetype'),url(//mozorg.cdn.mozilla.net/media/fonts/OpenSans-ExtraBold-webfont.svg#OpenSansSemibold) format('svg');
+  font-weight:700;
+  font-style:normal
+}
+
diff --git a/examples/htdocs/prettysimple.html b/examples/htdocs/prettysimple.html
new file mode 100644 (file)
index 0000000..3891f6d
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>MKWS demo</title>
+    <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
+    <link rel="stylesheet" href="prettysimple.css" />
+  </head>
+  <body>
+    <div class="header">
+      <div class="mkws-lang"></div>
+      <div class="mkws-switch"></div>
+    </div>
+    <div class="forms">
+      <div class="mkws-search"></div>
+      <div class="mkws-ranking"></div>
+    </div>
+    <div class="main">
+      <div class="mkws-facets"></div>
+      <div class="results">
+        <div class="mkws-pager"></div>
+        <div class="mkws-navi"></div>
+        <div class="mkws-records"></div>
+        <div class="mkws-targets"></div>
+        <div class="mkws-stat"></div>
+      </div>
+    </div>
+  </body>
+</html>
+
+
index 47da435..9e0e181 100644 (file)
@@ -50,8 +50,15 @@ b, strong {
   }
 
 .mkws-summary {
-  padding: .5em 0;
+  margin: .5em 0;
   line-height: 1.35;
+  min-height: 60px;
+}
+.articles .mkws-summary, .alltargets .mkws-summary {
+  min-height: 0;
+}
+.articles .mkws-field-thumb, .alltargets .mkws-field-thumb {
+  display: none;
 }
 .mkws-summary:last-child {
   padding-bottom: 0;
@@ -80,7 +87,7 @@ b, strong {
 }
   .mkws-google-image img {
     max-width: 100%;
-    max-height: 200px;
+    max-height: 180px;
     padding: 1em 0 .5em;
   }
 .list-group-item {
@@ -90,6 +97,25 @@ b, strong {
   box-shadow: none;
   -webkit-box-shadow: none;
 }
+
+/* Fields */
+.mkws-field-thumb {
+  height: 60px;
+  width: 80px;
+  overflow: hidden;
+  margin-right: 1em;
+  float: left;
+}
+.mkws-field-thumb > img {
+  height: 60px;
+  max-width: 80px;
+} 
+.mkws-field-description {
+  overflow: hidden; 
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
 @media screen and (min-width:700px) {
   .multicol {
     column-count: 2;
@@ -100,3 +126,13 @@ b, strong {
     -webkit-column-gap: 20px;
   }
 }
+@media screen and (min-width:900px) {
+  .multicol {
+    column-count: 3;
+    column-gap: 20px;
+    -moz-column-count: 3;
+    -moz-column-gap: 20px;
+    -webkit-column-count: 3;
+    -webkit-column-gap: 20px;
+  }
+}
index 642941b..0c727e1 100644 (file)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
-<html lang="en">
-<head>
+<html lang="en"><head>
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  <title>MKWS demo: Compound reference widget, Bootstrap edition</title>
+  <title>MKWS demo</title>
+
+  <!-- Include Bootstrap. It needs jQuery. -->
   <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
   <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
   <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
   <!-- <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.1.1/amelia/bootstrap.min.css" rel="stylesheet"> -->
   <!-- <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.1.1/united/bootstrap.min.css" rel="stylesheet"> -->
   <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
+
+  <!-- Before including MKWS we can define a configuration object. -->
   <script type="text/javascript">
     var mkws_config = { sp_auth_credentials: "credo/emu" };
   </script>
+
+  <!-- mkws-complete.js includes jQuery and Handlebars. It will co-exist with
+       another copy of jQuery as we have here but you can also use mkws.js
+       if you have included both separately -->
   <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
-  <!-- <script type="text/javascript" src="//mkws.local/mkws&#45;complete.js"></script> -->
   <link rel="stylesheet" type="text/css" href="topic.css">
+
+  <!-- Handlebars templates can make calls to Javascript functions you
+       define this way. -->
   <script>
-    // The Google Images database returns links like:
-    //      http://images.google.com/url?q=http://eofdreams.com/fish.html&sa=U&ei=RAB-U9XNDo2Dqga1o4L4Bw&ved=0CC4Q9QEwAA&usg=AFQjCNFhRtn6GMevHbpITZ6kfx6rsHV2ow
-    // This Handlebars helper avoids a pointless redirect by transforming
-    // this to the URL of the underling page, in this case
-    //      http://eofdreams.com/fish.html
-    Handlebars.registerHelper('mkws-googleurl', function(obj) {
-      if (!obj) {
-        return "obj undefined";
-      } else if (!obj[0]) {
-        return "obj[0] undefined, JSON=" + $.toJSON(obj);
-      } else {
-        return mkws.getParameterByName('q', obj[0]);
-      }
-    });
     Handlebars.registerHelper('mkws-topicurl', function(topic) {
+      /* Creates a link back to this page with the topic as a parameter */
       return window.location.pathname + "?q=" + encodeURIComponent(topic);
     });
   </script>
+
+  <!-- Here we create replacement templates that incorporate bootstrap. 
+       The prefix "mkws-template-" makes them available to MKWS -->
   <script class="mkws-template-topic-image" type="text/x-handlebars-template">
     {{#each hits}}
       <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
-       <a href="{{mkws-googleurl md-electronic-url}}" target="_blank">
+       <a href="{{md-electronic-url}}" target="_blank">
         {{#mkws-first md-thumburl}}
           <img src="{{this}}" alt="{{../md-title}}"/>
         {{/mkws-first}}
     {{/each}}
   </script>
 </head>
+
 <body>
-  <div class='page-header container' autosearch='!param!q'>
+  <div class='page-header container'>
     <div class="row">
-      <!-- reference entry -->
-      <div class="jumbotron panel col-md-8">
+      <!-- mkws-reference - A widget that fetches a Wikipedia entry -->
+      <div class="jumbotron panel col-md-8 col-sm-7">
+        <!-- Note the "autosearch" attribute. It indicates where to get
+             the search term from, in this case a URL parameter.  A URL
+             path component or Javascript variable are also possible. --> 
         <div class="panel-body mkws-reference mkws-team-ref" autosearch="!param!q"
              data-mkws-config='{"paragraphs":1}'></div>
       </div>
-      <!-- related topics -->
-      <div class="col-md-offset-1 col-md-3"><div class="panel panel-default">
+      <!-- Related topics -->
+      <div class="col-md-offset-1 col-md-3 col-sm-5"><div class="panel panel-default">
         <div class="panel-heading title">
           <h3 class="panel-title">Related Topics</h3>
         </div>
+        <!-- This mkws-facet widget is particularly illustrative: 
+             * the data-mkws-facet attribute specifies a particular facet
+             * data-mkws-config allows configuration override; in this case
+               we employ one of the templates we defined above.
+             * having the class mkws-team-main groups this widget with others
+               on the same team. The mkws-records widget at the bottom of
+               the page shares the same team and is thus working from the same
+               result set. -->
         <ul class="panel-body list-group mkws-facet mkws-team-main"
             autosearch="!param!q"
             data-mkws-facet="subject"
@@ -85,6 +96,7 @@
         <div class="panel-heading title">
           <h3 class="panel-title">Images</h3>
         </div>
+        <!-- The "target" config key narrows the search to a list of targets -->
         <div class="panel-body mkws-google-image" autosearch="!param!q"
              data-mkws-config='{ "maxrecs": 4, "template": "topic-image", "target": "google_images_js" }'></div>
       </div></div>
 
     <!-- sources -->
     <div class="row">
-        <div class="col-md-4 col-sm-6"><div class="panel panel-default">
+        <div class="news col-md-4 col-sm-6"><div class="panel panel-default">
           <div class="panel-heading title">
             <h3 class="panel-title">News</h3>
           </div>
+          <!-- The "targetfilter" narrows the search to targets matching some criteria -->
           <div class="panel-body mkws-records mkws-team-news" autosearch="!param!q"
                data-mkws-config='{"targetfilter":"categories=news",
                                   "perpage":7}'></div>
         </div></div>
-        <div class="col-md-4 col-sm-6"><div class="panel panel-default">
+        <div class="articles col-md-4 col-sm-6"><div class="panel panel-default">
           <div class="panel-heading title">
             <h3 class="panel-title">Articles</h3>
           </div>
                data-mkws-config='{"targetfilter":"categories=articles",
                                   "perpage":7}'></div>
         </div></div>
-        <div class="col-md-4 col-sm-6"><div class="panel panel-default">
+        <div class="books col-md-4 col-sm-6"><div class="panel panel-default">
           <div class="panel-heading title">
             <h3 class="panel-title">Books</h3>
           </div>
         </div></div>
     </div>
     <div class="row">
-        <div class="col-md-12"><div class="panel panel-default">
+        <div class="alltargets col-md-12"><div class="panel panel-default">
           <div class="panel-heading title">
             <h3 class="panel-title">Results from all targets</h3>
           </div>
index 268c414..0ae251b 100644 (file)
@@ -29,7 +29,7 @@
 
     <script type="text/javascript" src="src/mkws-widget.js"></script>
     <script type="text/javascript" src="src/mkws-widget-main.js"></script>
-    <script type="text/javascript" src="src/mkws-widget-termlists.js"></script>
+    <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
     <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
     <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
     <script type="text/javascript" src="src/mkws-widget-log.js"></script>
index bd05b9b..51f399e 100644 (file)
@@ -22,7 +22,7 @@ COMPONENTS = mkws-handlebars.js \
        mkws-filter.js \
        mkws-widget.js \
        mkws-widget-main.js \
-       mkws-widget-termlists.js \
+       mkws-widget-facets.js \
        mkws-widget-authname.js \
        mkws-widget-categories.js \
        mkws-widget-log.js \
index 6bb98b3..6b71bc1 100644 (file)
@@ -28,7 +28,7 @@ window.mkws = {
       "Subjects": "Schlagw&ouml;rter",
       "Sources": "Daten und Quellen",
       "source": "datenquelle",
-      "Termlists": "Termlisten",
+      "Facets": "Termlisten",
       "Next": "Weiter",
       "Prev": "Zur&uuml;ck",
       "Search": "Suche",
@@ -57,7 +57,7 @@ window.mkws = {
       "Subjects": "Emner",
       "Sources": "Kilder",
       "source": "kilder",
-      "Termlists": "Termlists",
+      "Facets": "Termlists",
       "Next": "N&aelig;ste",
       "Prev": "Forrige",
       "Search": "S&oslash;g",
@@ -298,7 +298,8 @@ mkws.log("Using window.name '" + window.name + "'");
     'MOTDContainer': 'motd-container',
     'Perpage': 'per-page',
     'SearchForm': 'search-form',
-    'ReferenceUniverse': 'reference-universe'
+    'ReferenceUniverse': 'reference-universe',
+    'Termlists': 'facets'
   };
   // Annoyingly, there is no built-in way to invert a hash
   var _new2old = {};
index 7ec9c2f..43f2fbf 100644 (file)
@@ -122,7 +122,7 @@ mkws.makeTeam = function($, teamName) {
 
   function onTerm(data) {
     log("term");
-    queue("termlists").publish(data);
+    queue("facets").publish(data);
   }
 
   function onShow(data, teamName) {
@@ -172,7 +172,7 @@ mkws.makeTeam = function($, teamName) {
       params.onstat = onStat;
       log("setting stat callback");
     }
-    if (m_queues.termlists && config.facets.length) {
+    if (m_queues.facets && config.facets.length) {
       params.onterm = onTerm;
       log("setting term callback");
     }
diff --git a/src/mkws-widget-facets.js b/src/mkws-widget-facets.js
new file mode 100644 (file)
index 0000000..478bf0a
--- /dev/null
@@ -0,0 +1,81 @@
+mkws.registerWidgetType('facets', function() {
+  // Initially hide the facets; display when we get results
+  var that = this;
+  var team = this.team;
+  team.queue("facets").subscribe(function(data) {
+    that.node.addClass("active");
+  });
+
+  var template = team.loadTemplate(this.config.template || "facets");
+  this.node.html(template({
+    team: team.name(),
+    facets: this.config.facets
+  }));
+  this.autosearch();
+});
+
+
+mkws.registerWidgetType('facet', function() {
+  var facetConfig = {
+    xtargets: [ "Sources",  16, false ],
+    subject:  [ "Subjects", 10, true ],
+    author:   [ "Authors",  10, true ]
+  }
+  var that = this;
+  var team = this.team;
+  var name = that.config.facet;
+  var ref = facetConfig[name] || [ "Unknown", 10, true ];
+  var caption = this.config['facet_caption_' + name] || ref[0];
+  var max     = parseInt(this.config['facet_max_' + name] || ref[1]);
+  var pzIndex = ref[2] ? name : null;
+
+  that.toString = function() {
+    return '[Widget ' + team.name() + ':' + that.type + '(' + name + ')]';
+  };
+
+  team.queue("facets").subscribe(function(data) {
+    data = data[name];
+    var terms = [];
+    var teamName = team.name();
+    for (var i = 0; i < data.length && i < max; i++) {
+      var linkdata = "";
+      var action = "";
+      if (!pzIndex) {
+        // Special case: target selection
+        linkdata += ('target_id='+data[i].id+' ');
+        if (!team.targetFiltered(data[i].id)) {
+          action = 'mkws.limitTarget(\'' + teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
+        }
+      } else {
+        action = 'mkws.limitQuery(\'' + teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
+      }
+      linkdata += 'onclick="' + action + ';return false;"';
+      terms.push({
+        term: data[i].name,
+        field: data[i].id,
+        count: data[i].freq,
+        linkdata: linkdata
+      }); 
+    }
+    // configured template > facet specific template > default facet template
+    var template;
+    if (that.config.template) {
+      template = team.loadTemplate(that.config.template);
+    } else {
+      template = team.loadTemplate("facet-" + name);
+      if (template) {
+        that.log("Using facet-" + name + " template.")
+      } else {
+        that.log("No " + name + " specific template, using default.")
+        template = team.loadTemplate("facet");
+      }
+    }
+    that.node.html(template({
+      name: name,
+      caption: caption,
+      query: that.config.query,
+      terms: terms
+    }));
+  });
+  this.autosearch();
+});
index 8a51a4d..c161686 100644 (file)
@@ -56,7 +56,7 @@ mkws.registerWidgetType('pager', function() {
     output.found = data.total;
 
     //client indexes pages from 1 but pz2 from 0
-    var onsides = 6;
+    var onsides = 5;
     var pages = Math.ceil(that.team.totalRecordCount() / that.team.perpage());
     var currentPage = that.team.currentPage();
 
@@ -106,7 +106,6 @@ mkws.registerWidgetType('details', function() {
       that.node.html(template(data));
     }
   });
-  that.autosearch();
 });
 
 mkws.registerWidgetType('records', function() {
diff --git a/src/mkws-widget-termlists.js b/src/mkws-widget-termlists.js
deleted file mode 100644 (file)
index e3dc55e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-mkws.registerWidgetType('termlists', function() {
-  // Initially hide the termlists; display when we get results
-  var that = this;
-  var team = this.team;
-  team.queue("termlists").subscribe(function(data) {
-    that.node.addClass("active");
-  });
-
-  var template = team.loadTemplate(this.config.template || "termlists");
-  this.node.html(template({
-    team: team.name(),
-    facets: this.config.facets
-  }));
-  this.autosearch();
-});
-
-
-mkws.registerWidgetType('facet', function() {
-  var facetConfig = {
-    xtargets: [ "Sources",  16, false ],
-    subject:  [ "Subjects", 10, true ],
-    author:   [ "Authors",  10, true ]
-  }
-  var that = this;
-  var team = this.team;
-  var name = that.config.facet;
-  var ref = facetConfig[name] || [ "Unknown", 10, true ];
-  var caption = this.config['facet_caption_' + name] || ref[0];
-  var max     = parseInt(this.config['facet_max_' + name] || ref[1]);
-  var pzIndex = ref[2] ? name : null;
-
-  that.toString = function() {
-    return '[Widget ' + team.name() + ':' + that.type + '(' + name + ')]';
-  };
-
-  team.queue("termlists").subscribe(function(data) {
-    data = data[name];
-    var terms = [];
-    var teamName = team.name();
-    for (var i = 0; i < data.length && i < max; i++) {
-      var linkdata = "";
-      var action = "";
-      if (!pzIndex) {
-        // Special case: target selection
-        linkdata += ('target_id='+data[i].id+' ');
-        if (!team.targetFiltered(data[i].id)) {
-          action = 'mkws.limitTarget(\'' + teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
-        }
-      } else {
-        action = 'mkws.limitQuery(\'' + teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
-      }
-      linkdata += 'onclick="' + action + ';return false;"';
-      terms.push({
-        term: data[i].name,
-        field: data[i].id,
-        count: data[i].freq,
-        linkdata: linkdata
-      }); 
-    }
-    // configured template > facet specific template > default facet template
-    var template;
-    if (that.config.template) {
-      template = team.loadTemplate(that.config.template);
-    } else {
-      template = team.loadTemplate("facet-" + name);
-      if (template) {
-        that.log("Using facet-" + name + " template.")
-      } else {
-        that.log("No " + name + " specific template, using default.")
-        template = team.loadTemplate("facet");
-      }
-    }
-    that.node.html(template({
-      name: name,
-      caption: caption,
-      query: that.config.query,
-      terms: terms
-    }));
-  });
-  this.autosearch();
-});
diff --git a/src/templates/facets.handlebars b/src/templates/facets.handlebars
new file mode 100644 (file)
index 0000000..3ca13a6
--- /dev/null
@@ -0,0 +1,9 @@
+{{!
+Facets, a container of all configured facets.
+
+team - the current team
+facets - array of facet names
+}}
+{{#each facets}}
+  <div class="mkws-facet mkwsFacet mkws-team-{{../team}}" data-mkws-facet="{{this}}"></div>
+{{/each}}
index 26ee6da..bd6bf3e 100644 (file)
@@ -12,7 +12,7 @@ languages
   {{~else~}}
     <a href="{{{url}}}">{{code}}</a>
   {{~/if~}}
-  {{#unless last}}
+  {{#unless @last}}
     |
   {{/unless}}
 {{/each}}
index fcda1bc..fc87e4c 100644 (file)
@@ -5,8 +5,8 @@ team - team for this widget
 }}
 <table width="100%" border="0" cellpadding="6" cellspacing="0">
   <tr>
-    <td class="mkws-termlists-container-wide mkws-team-{{team}}" width="250" valign="top">
-      <div class="mkws-termlists mkwsTermlists mkws-team-{{team}}"></div>
+    <td class="mkws-facets-container-wide mkws-team-{{team}}" width="250" valign="top">
+      <div class="mkws-facets mkwsTermlists mkws-team-{{team}}"></div>
     </td>
     <td class="mkws-motd-container mkwsMOTDContainer mkws-team-{{team}}" valign="top">
       <div class="mkws-ranking mkwsRanking mkws-team-{{team}}"></div>
@@ -17,7 +17,7 @@ team - team for this widget
   </tr>
   <tr>
     <td colspan="2">
-      <div class="mkws-termlists-container-narrow mkws-team-{{team}}"></div>
+      <div class="mkws-facets-container-narrow mkws-team-{{team}}"></div>
     </td>
   </tr>
 </table>
index 82cbd15..446ba16 100644 (file)
@@ -2,10 +2,9 @@
 Search form
 
 team - MKWS team
-queryWidth - configured width for search box
 }}
 <form name="mkws-search-form" class="mkws-search-form mkws-team-{{team}}" action="">
-  <input class="mkws-query mkws-query mkwsQuery mkws-team-{{team}}" type="text" size="{{queryWidth}}">
+  <input class="mkws-query mkws-query mkwsQuery mkws-team-{{team}}" type="text">
   <input class="mkws-button mkws-button mkwsButton mkws-team-{{team}}" type="submit" value="{{{mkws-translate "Search"}}}">
 </form>
 
index aa2ed10..85b371d 100644 (file)
@@ -10,15 +10,34 @@ detailClick - a click event handler for details
 renderedDetails - active record details rendered from the details template
 md-* - metadata fields passed through from backend
 }}
-<a href="#" id="{{detailLinkId}}" onclick="{{detailClick}}">
-  <b>{{md-title}}</b>
-</a>
-{{#if md-title-remainder}}
-  <span>{{md-title-remainder}}</span>
-{{/if}}
-{{#if md-title-responsibility}}
-  <span><i>{{md-title-responsibility}}</i></span>
+{{#if md-thumburl}}
+  <a class="mkws-field-thumb" href="#" onclick="{{detailClick}}">
+    <img src="{{md-thumburl.[0]}}"/>
+  </a>
 {{/if}}
+<div class="mkws-field-data">
+  <span class="mkws-field-title">
+  <a href="#" id="{{detailLinkId}}" onclick="{{detailClick}}">
+    {{md-title}}
+  </a>
+  </span>
+  {{#if md-title-remainder}}
+    <span class="mkws-field-title-remainder">{{md-title-remainder}}</span>
+  {{/if}}
+  {{#if md-author}}
+    <span class="mkws-field-author">{{md-author}}</span>
+  {{else}}
+    {{#if md-title-responsibility}}
+      <span class="mkws-field-author">{{md-title-responsibility}}</span>
+    {{/if}}
+  {{/if}}
+  {{#if md-description}}
+    <div class="mkws-field-description">{{md-description}}</div>
+  {{/if}}
+  {{#if md-date}}
+    <span class="mkws-field-date">{{md-date}}</span>
+  {{/if}}
+</div>
 {{#if renderedDetails}}
   {{{renderedDetails}}}
 {{/if}}
diff --git a/src/templates/termlists.handlebars b/src/templates/termlists.handlebars
deleted file mode 100644 (file)
index 66caa83..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{{!
-Termlists, a container of all configured facets.
-
-team - the current team
-facets - array of facet names
-}}
-
-<div class="mkws-termlists-title mkwsTermlistsTitle">Termlists</div>
-{{#each facets}}
-  <div class="mkws-facet mkwsFacet mkws-team-{{../team}}" data-mkws-facet="{{this}}"></div>
-{{/each}}
index 1b986b4..e3fa61a 100644 (file)
@@ -105,7 +105,7 @@ node_modules node-modules:
 
 apache-start:
        bin/apache-template-update
-       ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev-${APACHE_PORT}.conf
+       umask 002; ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev-${APACHE_PORT}.conf
 
 APACHE_PID_FILE=${TMP_DIR}/mkws-jasmine-${APACHE_PORT}.pid
 apache-stop:
@@ -128,7 +128,7 @@ help:
        @echo "Examples: "
        @echo ""
        @echo "make phantomjs PHANTOMJS_PATH=${PHANTOMJS_PATH}"
-       @echo "DEBUG=0 APACHE_PORT=5050 make -s phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_PATH=${PHANTOMJS_PATH}"
+       @echo "DEBUG=0 APACHE_PORT=5050 make -s phantomjs PHANTOMJS_TIMEOUT=16 PHANTOMJS_PATH=${PHANTOMJS_PATH}"
        @echo "DEBUG=2 make phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_URL=${PHANTOMJS_URL}"
        @echo ""
        @echo "make APACHE_PORT=5050 apache-start"
index 0f434d0..94f5c8d 100755 (executable)
@@ -42,26 +42,34 @@ die usage if !@system;
 # be ignored
 eval {
     require BSD::Resource;
-    BSD::Resource::setrlimit("RLIMIT_CPU", $timeout, 2*$timeout) or die "Cannot set CPU limit: $!\n";
+    BSD::Resource::setrlimit( "RLIMIT_CPU", $timeout, 2 * $timeout )
+      or die "Cannot set CPU limit: $!\n";
 };
 if ($@) {
-    warn "WARNING: things would go more nicely with the BSD::Resource package\n";
+    warn
+      "WARNING: things would go more nicely with the BSD::Resource package\n";
 }
 
-
 #
-# use fork/exec instead system()
+# configure signal handlers
 #
-$pid = fork();
-die "fork() failed: $!" unless defined $pid;
+$SIG{ALRM} = sub {
+    my $pgid = getpgrp();
 
-# child
-if ($pid) {
-    alarm($timeout);
-    exec(@system) or die "exec @system: $!\n";
-}
+    warn "Alarm handler got called after $timeout seconds\n";
+    warn "Kill now the process group...\n\n";
+
+    # kill process group
+    kill "INT", -$pgid;
+};
 
-# parent
-else { }
+# don't kill ourself
+$SIG{INT} = "IGNORE";
+
+alarm($timeout);
+
+system(@system) == 0
+  or die "system('@system') failed: ?='$?', !='$!', ^E='$^E', ?='$?'";
 
 1;
+
diff --git a/test/spec-dev/async.spec.js b/test/spec-dev/async.spec.js
new file mode 100644 (file)
index 0000000..6de372d
--- /dev/null
@@ -0,0 +1,85 @@
+/* Copyright (c) 2013 Index Data ApS. http://indexdata.com
+ *
+ * async check
+ *
+ */
+describe("Asynchronous check", function () {
+    it("contains spec with an expectation", function () {
+        expect(true).toBe(true);
+    });
+
+    // Asynchronous part
+    it("simple check", function () {
+        var max_time = 1;
+        var timer = 0;
+
+        function found(time, none) {
+            setTimeout(function () {
+                timer = time;
+            }, time * 1000);
+            expect(time >= 0).toBeTruthy();
+        }
+
+        runs(function () {
+            // check hit counter after N seconds
+            found(0, true);
+            found(0.2);
+            found(0.4);
+            found(0.5);
+            found(0.7);
+            found(max_time);
+        });
+
+        waitsFor(function () {
+            // console.log("waits for ... " + timer);
+            return timer == max_time ? true : false;
+        }, "The Value should be N seconds", max_time * 1000);
+
+        runs(function () {
+            expect(timer).toEqual(max_time);
+        });
+    });
+
+
+    it("double async check", function () {
+        var max_time = 0.5;
+        var timer = 0;
+
+        function found(time, none) {
+            setTimeout(function () {
+                timer = time;
+            }, time * 1000);
+            expect(time >= 0).toBeTruthy();
+        }
+
+        runs(function () {
+            found(0);
+            found(0.2);
+            found(max_time - 0.1);
+        });
+
+        waitsFor(function () {
+            return timer == max_time - 0.1 ? true : false;
+        }, "The Value should be N seconds", max_time * 1000);
+
+        runs(function () {
+            expect(timer <= max_time).toBeTruthy();
+        });
+
+        timer = 0;
+        runs(function () {
+            found(0.1);
+            found(max_time);
+        });
+
+        waitsFor(function () {
+            // console.log("waits for ... " + timer);
+            return timer == max_time ? true : false;
+        }, "The Value should be N seconds", max_time * 1000);
+
+        runs(function () {
+            expect(timer <= max_time).toBeTruthy();
+        });
+    });
+
+});
diff --git a/test/spec/async.spec.js b/test/spec/async.spec.js
deleted file mode 100644 (file)
index 6de372d..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (c) 2013 Index Data ApS. http://indexdata.com
- *
- * async check
- *
- */
-describe("Asynchronous check", function () {
-    it("contains spec with an expectation", function () {
-        expect(true).toBe(true);
-    });
-
-    // Asynchronous part
-    it("simple check", function () {
-        var max_time = 1;
-        var timer = 0;
-
-        function found(time, none) {
-            setTimeout(function () {
-                timer = time;
-            }, time * 1000);
-            expect(time >= 0).toBeTruthy();
-        }
-
-        runs(function () {
-            // check hit counter after N seconds
-            found(0, true);
-            found(0.2);
-            found(0.4);
-            found(0.5);
-            found(0.7);
-            found(max_time);
-        });
-
-        waitsFor(function () {
-            // console.log("waits for ... " + timer);
-            return timer == max_time ? true : false;
-        }, "The Value should be N seconds", max_time * 1000);
-
-        runs(function () {
-            expect(timer).toEqual(max_time);
-        });
-    });
-
-
-    it("double async check", function () {
-        var max_time = 0.5;
-        var timer = 0;
-
-        function found(time, none) {
-            setTimeout(function () {
-                timer = time;
-            }, time * 1000);
-            expect(time >= 0).toBeTruthy();
-        }
-
-        runs(function () {
-            found(0);
-            found(0.2);
-            found(max_time - 0.1);
-        });
-
-        waitsFor(function () {
-            return timer == max_time - 0.1 ? true : false;
-        }, "The Value should be N seconds", max_time * 1000);
-
-        runs(function () {
-            expect(timer <= max_time).toBeTruthy();
-        });
-
-        timer = 0;
-        runs(function () {
-            found(0.1);
-            found(max_time);
-        });
-
-        waitsFor(function () {
-            // console.log("waits for ... " + timer);
-            return timer == max_time ? true : false;
-        }, "The Value should be N seconds", max_time * 1000);
-
-        runs(function () {
-            expect(timer <= max_time).toBeTruthy();
-        });
-    });
-
-});
index 91543c2..eca9da5 100644 (file)
@@ -227,13 +227,13 @@ describe("Check pazpar2 hit counter", function () {
     });
 });
 
-describe("Check Termlist", function () {
+describe("Check Facets", function () {
     var $ = mkws.$;
 
-    it("found Termlist", function () {
-        var termlist = $("div.mkws-termlists");
-        debug("Termlist success: " + termlist.length);
-        expect(termlist.length).toBe(1);
+    it("found Facets", function () {
+        var facets = $("div.mkws-facets");
+        debug("Facet success: " + facets.length);
+        expect(facets.length).toBe(1);
 
         waitsFor(function () {
             return $("div.mkws-facet[data-mkws-facet='xtargets']").length == 1 ? true : false;
@@ -242,7 +242,7 @@ describe("Check Termlist", function () {
         // everything displayed?
         runs(function () {
             var sources = $("div.mkws-facet[data-mkws-facet='xtargets']");
-            debug("Termlist sources success: " + sources.length);
+            debug("Facet sources success: " + sources.length);
             expect(sources.length).toBe(1);
 
             var subjects = $("div.mkws-facet[data-mkws-facet='subject']");
@@ -670,11 +670,13 @@ describe("Check SortBy options", function () {
         var waitcount = 0;
         var sort_value = 'title:1';
         var per_page_number = 20;
+
+       // keep current title list
         var title_list_old = title_list("xxx ");
 
         function title_list(prefix) {
             var list = [];
-            var terms = $("div.mkws-records > div.mkws-summary > a");
+            var terms = $("div.mkws-records > div.mkws-summary > div.mkws-field-data span.mkws-field-title");
             for (var i = 0; i < terms.length; i++) {
                 var term = $(terms[i]).text().trim();
                 list.push(term);
@@ -707,7 +709,7 @@ describe("Check SortBy options", function () {
             $("div.mkws-records").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
             debug("unbind by sort");
 
-            var records = $("div.mkws-records > div.mkws-summary > a");
+            var records = $("div.mkws-records > div.mkws-summary");
             debug("Sort by got now " + records.length + " records");
             expect(records.length).toBe(per_page_number);
         });
@@ -740,7 +742,7 @@ describe("Check async widget discovery", function () {
       var numInput = $("div.mkws-search input").length;
       debug("Input elements present: " + numInput);
       expect(numInput).toBe(4);
-      var numRec = $("div.mkws-records > div.mkws-summary > a").length;
+      var numRec = $("div.mkws-records > div.mkws-summary").length;
       debug("Records should still be present. There are: " + numRec);
       expect(numRec).toBeGreaterThan(0);
     });
index 18a303c..f1d13f2 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com
 
 PHANTOMJS_TIMEOUT=30
-PHANTOMJS=     ../node_modules/phantomjs/bin/phantomjs
+PHANTOMJS=     perl ../bin/bomb.pl --timeout=${PHANTOMJS_TIMEOUT} ../node_modules/phantomjs/bin/phantomjs
 IMAGES=                ./images
 SCREENSHOT_WIDTH_HEIGHT=       1000 1200
 PERL_SCRIPTS=  ../bin/bomb.pl
@@ -18,6 +18,7 @@ all: help
 
 clean:
        rm -f index-*.html
+       rm -f iframe-*.html
        rm -f ${IMAGES}/*.png
 
 distclean: clean
@@ -27,10 +28,11 @@ test: check
 
 screenshot:
        file=${PREFIX}.$$(echo "${PHANTOMJS_URL}" | perl -npe 's,(\W),-,g; s/-$$//;'); \
-         ${PHANTOMJS} ${PROG} ${PHANTOMJS_URL} ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \
+         ${PHANTOMJS} ${PROG} "${PHANTOMJS_URL}" ${IMAGES}/tmp.$$file.png ${SCREENSHOT_WIDTH_HEIGHT} ${TIMEOUT}; \
          mv -f  ${IMAGES}/tmp.$$file.png  ${IMAGES}/$$file.png
 
-screenshots: clean estimate-time
+screenshots: clean estimate-time iframe
+       set -e; \
        for t in ${TESTS}; do \
            for i in $$(cat url.$$t); do \
                ${MAKE} PHANTOMJS_URL="$$i" TIMEOUT=4 PREFIX=$$t screenshot; \
@@ -45,10 +47,14 @@ estimate-time:
 index:
        ( cd ${IMAGES}; ls -tr ${PREFIX}.*.png | perl -ne 'chomp; print qq{<h2>$$_</h2><img src="'${IMAGES}/'$$_"/><br/><br/><p/>\n}' ) > index-${PREFIX}.html
 
+iframe: index-iframe-demo
+index-iframe-demo:
+       ( cat url.demos | perl -ne 'chomp; print qq{<h2>$$_</h2><iframe width="900px" height="600px" src="$$_"></iframe>\n}' ) > iframe-demos.html
+
 help:
        @echo "make [ all | clean | distclean ]"
        @echo "     [ screenshots ]"
-       @echo "     [ screenshot | index ]"
+       @echo "     [ screenshot | index | iframe ]"
        @echo ""
        @echo "Examples: "
        @echo ""
index 8fd213d..6ef9d58 100644 (file)
@@ -8,3 +8,5 @@ http://example.indexdata.com/popup.html
 http://example.indexdata.com/auto.html
 http://example.indexdata.com/localauth.html
 http://www.indexdata.com/news/2014/06/using-smart-widgets-integrate-information-access
+http://example.indexdata.com/topic.html?q=sushi
+http://example.indexdata.com/prettysimple.html
index 2ff6029..4000742 100644 (file)
@@ -2,6 +2,4 @@ http://cph.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
 http://demo.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
 http://demo.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi3
 http://boston.koha.indexdata.com/cgi-bin/koha/opac-search.pl?q=sushi
-http://example.indexdata.com/topic.html?q=sushi
-http://example.indexdata.com/simple.html
-
+http://cph.koha.indexdata.com/cgi-bin/koha/opac-mkws.pl?q=sushi&t=connect.indexdata.com:9000/flickr_api
index 74c384f..989e2ef 100644 (file)
@@ -3,13 +3,15 @@
 
 <VirtualHost *:80>
     ServerName mkws.indexdata.com
+    ServerAlias mkws01.indexdata.com
+    ServerAlias mkws02.indexdata.com
 
     ErrorLog /var/log/apache2/mkws-error.log
     CustomLog /var/log/apache2/mkws-access.log combined
 
     DocumentRoot /home/indexdata/mkws/tools/htdocs
     Alias /libjs-pz2/ /home/indexdata/libjs-pz2/
-    Alias /pazpar2/ /home/indexdata/pazpar2/
+    Alias /pazpar2/ /usr/share/pazpar2/
 
     RewriteEngine on
     RewriteLogLevel 1
index d756148..7db0c62 100644 (file)
@@ -3,16 +3,16 @@
 
 <VirtualHost *:80>
     ServerName x.mkws.indexdata.com
-    ErrorLog /opt/local/apache2/logs/mkws-error.log
-    CustomLog /opt/local/apache2/logs/mkws-access.log combined
+    ErrorLog /var/log/apache2/mkws-error.log
+    CustomLog /var/log/apache2/mkws-access.log combined
 
-    DocumentRoot /usr/local/src/git/mkws/tools/htdocs
-    Alias /libjs-pz2/ /usr/local/src/git/libjs-pz2/
-    Alias /pazpar2/ /usr/local/src/git/pazpar2/
+    DocumentRoot /Users/mike/git/work/mkws/tools/htdocs
+    Alias /libjs-pz2/ /Users/mike/git/work/libjs-pz2/
+    Alias /pazpar2/ /Users/mike/git/work/pazpar2/
 
     RewriteEngine on
     RewriteLogLevel 1
-    RewriteLog /opt/local/apache2/logs/spclient-rewrite.log 
+    RewriteLog /var/log/apache2/spclient-rewrite.log 
     RewriteRule /service-proxy-auth(/)?(;jsessionid=.+)? /service-proxy/$2?command=auth&action=login&username=guest&password=guest [P] # [NE,P]
 
     # For MKC Service Proxy
         Allow from all
     </Directory>
 </VirtualHost>
-
-<VirtualHost *:80>
-    ServerName x.example.indexdata.com
-    ErrorLog /opt/local/apache2/logs/example-error.log
-    CustomLog /opt/local/apache2/logs/example-access.log combined
-
-    DocumentRoot /usr/local/src/git/mkws/examples/htdocs
-    Alias /tools/htdocs/ /usr/local/src/git/mkws/tools/htdocs/
-    Alias /src/ /usr/local/src/git/mkws/src/
-    Alias /jasmine/ /usr/local/src/git/mkws/examples/jasmine/
-    Alias /test/ /usr/local/src/git/mkws/test/
-
-    # Needed on Mac, which locks Apache down hard by default.
-    <Directory />
-        Allow from all
-    </Directory>
-</VirtualHost>
index f335d96..3ad151b 100644 (file)
@@ -7,6 +7,8 @@
 #
 <VirtualHost *:80>
     ServerName sp-mkws.indexdata.com
+    ServerAlias sp-mkws01.indexdata.com
+    ServerAlias sp-mkws02.indexdata.com
 
     ErrorLog /var/log/apache2/sp-mkws-error.log
     CustomLog /var/log/apache2/sp-mkws-access.log combined
diff --git a/tools/apache2/sp-mkws-mike-mac b/tools/apache2/sp-mkws-mike-mac
new file mode 100644 (file)
index 0000000..e942550
--- /dev/null
@@ -0,0 +1,25 @@
+<VirtualHost *:80>
+    ServerName x.sp-mkws.indexdata.com
+
+    ErrorLog /var/log/apache2/sp-mkws-error.log
+    CustomLog /var/log/apache2/sp-mkws-access.log combined
+
+    DocumentRoot /Users/mike/git/work/mkws/tools/sp-htdocs
+
+    Header set Access-Control-Allow-Credentials true
+
+    ProxyPreserveHost On
+    # We could use any of the following:
+    ProxyPass        /service-proxy/ http://x.sp-mkws.indexdata.com:8585/service-proxy/
+    ProxyPassReverse /service-proxy/ http://x.sp-mkws.indexdata.com:8585/service-proxy/
+
+    <Directory />
+        Allow from all
+    </Directory>
+
+#    PerlOptions +Parent
+#    PerlSwitches -I/home/indexdata/mkws/tools/mod_perl
+#    <Location /service-proxy>
+#        PerlOutputFilterHandler MyApache2::SetACAO
+#    </Location>
+</VirtualHost>
index 86636a6..e36e87f 100644 (file)
@@ -1,7 +1,7 @@
 .mkwsLang, .mkws-lang,
 .mkwsSwitch, .mkws-switch,
 .mkwsSearch, .mkws-search,
-.mkwsTermlists, .mkws-termlists,
+.mkwsTermlists, .mkws-facets,
 .mkwsFacet, .mkws-facet,
 .mkwsRanking, .mkws-ranking,
 .mkwsPager, .mkws-pager,
     background: #f0f8ff;
 }
 
-.mkwsTermlistsTitle, .mkws-termlists-title {
+.mkwsTermlistsTitle, .mkws-facets-title {
     font-size: large;
     font-weight: bold;
     text-transform: uppercase;
 }
 
-.mkwsTermlists, .mkws-termlists {
+.mkwsTermlists, .mkws-facets {
     background: #d0e0ff;
     padding: 0.7em;
     font-size: small;
     -webkit-border-top-right-radius: 10px;
 }
 
-.mkwsTermlists.active, .mkws-termlists.active {
+.mkwsTermlists.active, .mkws-facets.active {
     display: block;
 }
 
   display: inline-table /* only for Firefox! */
 }
 
+.mkws-field-description, .mkws-field-date, .mkws-field-thumb {
+  display: none;
+}
+
+