Remove commented-out alternative authentication.
[mkws-moved-to-github.git] / examples / htdocs / topic.html
1 <!DOCTYPE html>
2 <html lang="en"><head>
3   <meta charset="utf-8">
4   <meta http-equiv="X-UA-Compatible" content="IE=edge">
5   <meta name="viewport" content="width=device-width, initial-scale=1">
6   <title>MKWS demo</title>
7
8   <!-- Include Bootstrap. It needs jQuery. -->
9   <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
10   <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
11   <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
12   <!-- http://www.bootstrapcdn.com/#bootswatch_tab has some themes that look mediumly okay -->
13   <!-- <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.1.1/cyborg/bootstrap.min.css" rel="stylesheet"> -->
14   <!-- <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.1.1/amelia/bootstrap.min.css" rel="stylesheet"> -->
15   <!-- <link href="//maxcdn.bootstrapcdn.com/bootswatch/3.1.1/united/bootstrap.min.css" rel="stylesheet"> -->
16   <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
17
18   <!-- Before including MKWS we can define a configuration object. -->
19   <script type="text/javascript">
20     var mkws_config = { sp_auth_credentials: "credo/emu" };
21   </script>
22
23   <!-- mkws-complete.js includes jQuery and Handlebars. It will co-exist with
24        another copy of jQuery as we have here but you can also use mkws.js
25        if you have included both separately -->
26   <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
27   <link rel="stylesheet" type="text/css" href="topic.css">
28
29   <!-- Handlebars templates can make calls to Javascript functions you
30        define this way. -->
31   <script>
32     Handlebars.registerHelper('mkws-topicurl', function(topic) {
33       /* Creates a link back to this page with the topic as a parameter */
34       return window.location.pathname + "?q=" + encodeURIComponent(topic);
35     });
36   </script>
37
38   <!-- Here we create replacement templates that incorporate bootstrap. 
39        The prefix "mkws-template-" makes them available to MKWS -->
40   <script class="mkws-template-topic-image" type="text/x-handlebars-template">
41     {{#each hits}}
42       <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
43        <a href="{{md-electronic-url}}" target="_blank">
44         {{#mkws-first md-thumburl}}
45           <img src="{{this}}" alt="{{../md-title}}"/>
46         {{/mkws-first}}
47         <br/>
48        </a>
49        <p>{{{md-title}}}</p>
50       </div>
51     {{/each}}
52   </script>
53   <script class="mkws-template-topic-facet" type="text/x-handlebars-template">
54     {{#each terms}}
55       <li class="list-group-item mkws-term">
56         <span class="badge">{{count}}</span>
57         <a href="{{mkws-topicurl term}}">{{term}}</a>
58       </li>
59     {{/each}}
60   </script>
61 </head>
62
63 <body>
64   <div class='page-header container'>
65     <div class="row">
66       <!-- mkws-reference - A widget that fetches a Wikipedia entry -->
67       <div class="jumbotron panel col-md-8 col-sm-7">
68         <!-- Note the "autosearch" attribute. It indicates where to get
69              the search term from, in this case a URL parameter.  A URL
70              path component or Javascript variable are also possible. --> 
71         <div class="panel-body mkws-reference mkws-team-ref" autosearch="!param!q"
72              data-mkws-config='{"paragraphs":1}'></div>
73       </div>
74       <!-- Related topics -->
75       <div class="col-md-offset-1 col-md-3 col-sm-5"><div class="panel panel-default">
76         <div class="panel-heading title">
77           <h3 class="panel-title">Related Topics</h3>
78         </div>
79         <!-- This mkws-facet widget is particularly illustrative: 
80              * the data-mkws-facet attribute specifies a particular facet
81              * data-mkws-config allows configuration override; in this case
82                we employ one of the templates we defined above.
83              * having the class mkws-team-main groups this widget with others
84                on the same team. The mkws-records widget at the bottom of
85                the page shares the same team and is thus working from the same
86                result set. -->
87         <ul class="panel-body list-group mkws-facet mkws-team-main"
88             autosearch="!param!q"
89             data-mkws-facet="subject"
90             data-mkws-config='{ "template": "topic-facet" }'></ul>
91       </div></div>
92     </div>
93     <!-- images -->
94     <div class="row">
95       <div class="col-md-12"><div class="panel panel-default">
96         <div class="panel-heading title">
97           <h3 class="panel-title">Images</h3>
98         </div>
99         <!-- The "target" config key narrows the search to a list of targets -->
100         <div class="panel-body mkws-google-image" autosearch="!param!q"
101              data-mkws-config='{ "maxrecs": 4, "template": "topic-image", "target": "google_images_js" }'></div>
102       </div></div>
103     </div>
104
105     <!-- sources -->
106     <div class="row">
107         <div class="news col-md-4 col-sm-6"><div class="panel panel-default">
108           <div class="panel-heading title">
109             <h3 class="panel-title">News</h3>
110           </div>
111           <!-- The "targetfilter" narrows the search to targets matching some criteria -->
112           <div class="panel-body mkws-records mkws-team-news" autosearch="!param!q"
113                data-mkws-config='{"targetfilter":"categories=news",
114                                   "perpage":7}'></div>
115         </div></div>
116         <div class="articles col-md-4 col-sm-6"><div class="panel panel-default">
117           <div class="panel-heading title">
118             <h3 class="panel-title">Articles</h3>
119           </div>
120           <div class="panel-body mkws-records mkws-team-articles" autosearch="!param!q"
121                data-mkws-config='{"targetfilter":"categories=articles",
122                                   "perpage":7}'></div>
123         </div></div>
124         <div class="books col-md-4 col-sm-6"><div class="panel panel-default">
125           <div class="panel-heading title">
126             <h3 class="panel-title">Books</h3>
127           </div>
128           <div class="panel-body mkws-records mkws-team-books" autosearch="!param!q"
129                data-mkws-config='{"targetfilter":"categories=books",
130                                   "perpage":7}'></div>
131         </div></div>
132     </div>
133     <div class="row">
134         <div class="alltargets col-md-12"><div class="panel panel-default">
135           <div class="panel-heading title">
136             <h3 class="panel-title">Results from all targets</h3>
137           </div>
138           <div class="panel-body multicol mkws-records mkws-team-main"></div>
139         </div></div>
140     </div>
141   </div>
142 </body>
143 </html>