+++ /dev/null
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>MKWS demo: Reference Universe widget</title>
- <link rel="stylesheet" type="text/css" href="mkws-widget-credo.css" />
- <script type="text/javascript">
- var mkws_config = { service_proxy_auth: "//mkws.indexdata.com/service-proxy-testauth" };
- </script>
- <script type="text/javascript" src="//code.jquery.com/jquery-1.10.0.min.js"></script>
- <script type="text/javascript" src="//x.mkws.indexdata.com/jquery.json-2.4.js"></script>
- <script type="text/javascript" src="//x.mkws.indexdata.com/handlebars-v1.1.2.js"></script>
- <script type="text/javascript" src="//x.mkws.indexdata.com/pazpar2/js/pz2.js"></script>
- <script type="text/javascript" src="src/mkws-handlebars.js"></script>
- <script type="text/javascript" src="src/mkws-core.js"></script>
- <script type="text/javascript" src="src/mkws-team.js"></script>
- <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-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>
- <script type="text/javascript" src="src/mkws-widget-record.js"></script>
- <script type="text/javascript" src="src/mkws-widget-reference.js"></script>
- <script type="text/javascript" src="src/mkws-widget-builder.js"></script>
- <script type="text/javascript" xsrc="mkws-widget-credo.js"></script>
- <script type="text/javascript" src="mkws-widget-credo-1efb82332d8d1a9293ad60f7517668cfcce480b0.js"></script>
- </head>
- <body>
- <div class='mkwsCredo' autosearch='!param!q'>result will appear here</div>
- </body>
-</html>
+++ /dev/null
-mkws.registerWidgetType('Credo', function() {
- var that = this;
- var s = []
- s.push('<table>');
-
- // Main panel: encylopaedia and images on the left, topics on the right
- s.push('<tr class="front">');
-
- s.push('<td class="main">');
- s.push(section('encyclopaedia', 'Topic Page: ### title',
- this.subwidget('Reference')));
- s.push(section('image', 'Images',
- this.subwidget('Images', { /* ### config */ })));
- s.push('</td>');
-
- s.push('<td class="side">');
- s.push(section('mindmap', 'Create a Mind Map for ### title',
- '### Is there a way to make a mind-map?'));
- s.push(section('topics', 'Related Topics',
- this.subwidget('Facet', { facet: 'subject' })));
- s.push('</td>');
-
- s.push('</tr>');
-
- s.push(sectionRow('entries', 'Credo Entries',
- this.subwidget('Records', { /* ### config */ })));
- s.push(sectionRow('articles', 'Articles',
- this.subwidget('Records', { /* ### config */ })));
- s.push(sectionRow('books', 'Books',
- this.subwidget('Records', { /* ### config */ })));
- s.push(sectionRow('news', 'News',
- this.subwidget('Records', { /* ### config */ })));
- s.push(sectionRow('resources', 'Suggested Resources',
- this.subwidget('Records', { /* ### config */ })));
-
- s.push('</table>');
-
- this.node.html(s.join(''));
-
-
- function section(xclass, title, content) {
- var s = [];
- s.push('<div class="' + xclass + ' section">');
- s.push('<div class="title">' + title + '</div>');
- s.push('<div class="content">' + content + '</div>');
- s.push('</div>');
- return s.join('');
- }
-
- function sectionRow(xclass, title, content) {
- var s = [];
- s.push('<tr>');
- s.push('<td colspan="2">');
- s.push(section(xclass, title, content));
- s.push('</td>');
- s.push('</tr>');
- return s.join('');
- }
-});
text-decoration: none;
}
+.mkwsCredo hr.divider {
+ margin: 20px 1%;
+ border-top: 3px dotted #c0c0c0;
+ color: #fff;
+ background-color: #fff;
+ height: 0;
+ width: 98%;
+}
+
+// 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) {
+ return mkws.getParameterByName('q', obj[0]);
+});
+
+
// ### This works inefficiently by having multiple teams all run the
// same search against different sets of targets. A much better
// approach would be run a single search, with all these panels
this.team.registerTemplate('CredoImage', '\
<div>\
- <a href="{{md-electronic-url}}" target="_blank">\
+ <a href="{{mkws-googleurl md-electronic-url}}" target="_blank">\
{{#mkws-first md-thumburl}}\
<img src="{{this}}" alt="{{../md-title}}"/>\
{{/mkws-first}}\
s.push('<td class="side">');
s.push(section('mindmap', 'Create a Mind Map for ### title',
- '### Is there a way to make a mind-map?'));
+ this.subwidget('Mindmap', { _team: 'main', facet: 'subject' })));
s.push(section('topics', 'Related Topics',
- this.subwidget('Facet', { facet: 'subject' })));
+ this.subwidget('Facet', { _team: 'main', facet: 'subject' })));
s.push('</td>');
s.push('</tr>');
+ s.push('<tr><td colspan="2"><hr class="divider"/></td></tr>');
+
s.push(sectionRow('entries', 'Credo Entries',
- 1 || this.subwidget('Records', { /* ### config */ })));
+ this.subwidget('Records', { _team: 'main' })));
s.push(sectionRow('articles', 'Articles',
1 || this.subwidget('Records', { /* ### config */ })));
s.push(sectionRow('books', 'Books',
return s.join('');
}
});
+
+
+mkws.registerWidgetType('Mindmap', function() {
+ this.node.html("### We do not yet have a Mindmap widget");
+});
--- /dev/null
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>MKWS demo: Compound reference widget</title>
+ <link rel="stylesheet" type="text/css" href="mkws-widget-ref.css" />
+ <script type="text/javascript">
+ var mkws_config = { service_proxy_auth: "//mkws.indexdata.com/service-proxy-credoauth" };
+ </script>
+ <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
+ <script type="text/javascript" src="mkws-widget-credo.js"></script>
+ </head>
+ <body>
+ <div class='mkwsCredo' autosearch='!param!q'></div>
+ </body>
+</html>
// This function is taken from a StackOverflow answer
// http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript/901144#901144
-mkws.getParameterByName = function(name) {
+mkws.getParameterByName = function(name, url) {
+ if (!url) url = location.search;
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
- results = regex.exec(location.search);
+ results = regex.exec(url);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}