Skip to content

Commit

Permalink
Item14486: use flexbox in people search interface
Browse files Browse the repository at this point in the history
also:
* use flexbox for people search interface
* fixed creating urls to ImagePlugin rest interface to generate thumbnail previews
* various jQuery fixes
  • Loading branch information
MichaelDaum committed Sep 18, 2017
1 parent 3c36951 commit 112b54e
Show file tree
Hide file tree
Showing 24 changed files with 100 additions and 71 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -26,3 +26,4 @@ pub/System/SolrPlugin/ajax-solr/Rakefile
genpdf_*
/webservice-solr
pub/System/SolrPlugin/ajax-solr.evolvingweb
locale/**/*.mo
3 changes: 2 additions & 1 deletion data/System/NatSkinSolrSearchViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%META:TOPICPARENT{name="SolrSearchViewTemplate"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"SolrSearchView"}%
Expand All @@ -7,6 +7,7 @@
%{<verbatim class="tml">}%
%TMPL:DEF{"sidebar"}%%TMPL:P{"solr::sidebar"}%%TMPL:END%
%TMPL:DEF{"searchbox"}%%TMPL:END%
%TMPL:DEF{"paneltoggle"}%%TMPL:END%
%TMPL:DEF{"topicactions"}%%TMPL:END%
%TMPL:DEF{"revinfo"}%%TMPL:END%
%TMPL:DEF{"form"}%%TMPL:END%
Expand Down
2 changes: 1 addition & 1 deletion data/System/NatSkinWebChangesViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"WebChangesView"}%
%{</verbatim>}%
Expand Down
2 changes: 1 addition & 1 deletion data/System/PatternSkinSolrSearchViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%META:TOPICPARENT{name="SolrSearchBase"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"SolrSearchBase"}%
Expand Down
2 changes: 1 addition & 1 deletion data/System/PatternSkinWebChangesViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"WebChangesView"}%
%{</verbatim>}%
Expand Down
2 changes: 1 addition & 1 deletion data/System/SiteChangesViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"WebChangesView"}%
%{</verbatim>}%
Expand Down
5 changes: 4 additions & 1 deletion data/System/SolrPlugin.txt
Expand Up @@ -874,7 +874,10 @@ specific search applications. The destination fields are then analysed using the

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 18 Sep 2017: | replacing =text_substring= with =text_prefix= and =text_suffix= to improve substring matching |
| 18 Sep 2017: | replacing =text_substring= with =text_prefix= and =text_suffix= to improve substring matching; \
truncate document values larger than 32k to prevent solr from crashing; \
use flexbox for people search interface; \
fixed creating urls to <nop>ImagePlugin rest interface to generate thumbnail previews |
| 23 Jan 2017: | converted WebServices::Solr to Moo; \
fixed documentation for iwatch realtime indexing; \
documentation of SOLRSCRIPTURL macro; \
Expand Down
2 changes: 1 addition & 1 deletion data/System/SolrSearch.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1505725909" format="1.1" version="1"}%
%META:TOPICPARENT{name="WebHome"}%

%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Set" value="SolrSearchView"}%
18 changes: 9 additions & 9 deletions data/System/SolrSearchBaseTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%META:TOPICPARENT{name="SolrPlugin"}%
%{<verbatim class="tml">}%
%{ ###########################################################################
Expand Down Expand Up @@ -285,7 +285,7 @@
<td width='12px'>
<input type='{{:~widget.inputType}}' name='{{:~widget.field}}' title='{{:~getFacetKey(facet)}}' value='{{:~getFacetValue(facet)}}' id='{{:~widget.field}}_{{:#index}}' autocomplete='off' class='solrFacetValue' {{:~checked(facet)}} />
</td>
<td><label for='{{:~widget.field}}_{{:#index}}' style='display:block'>{{:~getFacetKey(facet)}} ({{:count}})</label></td>
<td><label for='{{:~widget.field}}_{{:#index}}' style='display:block'>{{:~getFacetKey(facet)}} <span class='foswikiGrayText'>({{:count}})</span></label></td>
</tr>
</table>
</li>
Expand Down Expand Up @@ -342,7 +342,6 @@
</script>%TMPL:END%
%{</verbatim>}%


%{<verbatim class="tml">}%
%TMPL:DEF{"solr::templates::resultsperpage"}%<script id="solrResultsPerPageTemplate" type="text/x-jsrender">
<table class="foswikiNullTable" width="100%">
Expand Down Expand Up @@ -442,7 +441,7 @@
<input type='text' autocomplete='off' class='foswikiInputField jqFocus solrSearchField' size='50' style='margin-right:8px;' />
</td>
<td>
%BUTTON{"%MAKETEXT{"Search"}%" type="submit" title="%MAKETEXT{"submit the query"}%" icon="find" class="solrSubmitButton"}%
%BUTTON{"%MAKETEXT{"Search"}%" type="submit" icon="find" class="solrSubmitButton"}%
</td>
</tr>
</table>
Expand Down Expand Up @@ -517,13 +516,13 @@
%TMPL:P{"solr::facet"
id="language"
title="%MAKETEXT{"Language"}%"
hidefilter="on"
hidefilter="true"
}%
%TMPL:P{"solr::facet"
id="author"
exclude="UnknownUser|AdminUser|RegistrationAgent|AdminGroup|WikiGuest|FoswikiContributor|ProjectContributor|TestUser"
title="%MAKETEXT{"Author"}%"
hidefilter="on"
hidefilter="true"
}%
<!-- -->%TMPL:END%
%{</verbatim>}%
Expand All @@ -546,6 +545,7 @@
* hidesingle - boolean
* hidenullvalues - boolean
* hidefilter - boolean
* initialstate - boolean: open (default)/ close
* limit - max number of facet values to return
}%
%TMPL:DEF{"solr::facet"}%<div data-field='%id%' %IF{
Expand Down Expand Up @@ -587,9 +587,9 @@
then="data-facet-sort-reverse='%reverse%'"
}%>
<h2 class='clearfix'>
<span class='jqTwisty' data-initial-state='open' data-target='#solrFacetField_%id%'>%title%</span>
<span class='jqTwisty' data-initial-state='%IF{"not '%initialstate%'=~'^([%]initialstate%)?$'" then="%initialstate%" else="open"}%' data-target='#solrFacetField_%id%'>%title%</span>
%IF{
"'%hidefilter%'!='on'"
"'%hidefilter%'!='on' and '%hidefilter%'!='true'"
then="<div class='jqTwisty solrFacetFieldTwisty foswikiRight' data-initial-state='close'>%JQICON{"fa-binoculars"}%</div>
<div class='solrFacetFieldFilter foswikiRight'><input type='text' size='20' class='foswikiInputField' placeholder='%MAKETEXT{"Filter"}%' /></div>"
}%</h2>
Expand Down Expand Up @@ -699,7 +699,7 @@
%{ ###########################################################################
solr::hits - display all search hits
}%
%TMPL:DEF{"solr::hits"}%<div class="solrSearchHits jqPhotoSwipe clearfix" data-history="false" data-item-selector=".solrImageFrame a" data-block-ui="window"></div>%TMPL:END%
%TMPL:DEF{"solr::hits"}%<div class="solrSearchHits jqPhotoSwipe" data-history="false" data-item-selector=".solrImageFrame a" data-block-ui="window"></div>%TMPL:END%
%{</verbatim>}%

%{<verbatim class="tml">}%
Expand Down
2 changes: 1 addition & 1 deletion data/System/SolrSearchViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%META:TOPICPARENT{name="SolrSearchBase"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"SolrSearchBase"}%
Expand Down
2 changes: 1 addition & 1 deletion data/System/SolrSideBar.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
---+!! %TOPIC%

This is a set of widgets to be used in a sidebar navigation. This is used like this:
Expand Down
5 changes: 2 additions & 3 deletions data/System/SolrWikiUsersViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%META:TOPICPARENT{name="WebHome"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"SolrSearchView"}%
Expand Down Expand Up @@ -58,7 +58,7 @@
<div class='solrSearchHit solrTopicHit foswikiProfileInfo'>
{{include tmpl="#solrHitTemplate_userimage" /}}
<h4><a href='{{:url}}'>{{:title}}</a></h4>
<ul class='foswikiTopicInfo jqShrinkUrls' data-size='15'>
<ul class='foswikiTopicInfo'>
{{if field_Telephone_s}}<li>%JQICON{"fa-phone"}% {{:field_Telephone_s}}</li>{{/if}}
{{if field_Email_s}}<li>%JQICON{"fa-inbox"}% <a href='mailto:{{:field_Email_s}}'>{{:field_Email_s}}</a></li>{{/if}}
{{if field_Location_s}}<li>%JQICON{"fa-tag"}% {{:field_Location_s}}</li>{{/if}}
Expand All @@ -80,7 +80,6 @@

%{<verbatim class="tml">}%
%TMPL:DEF{"solr::assets"}%%TMPL:PREV%<!-- -->
%JQREQUIRE{"shrinkurls"}%<!-- -->
%ADDTOZONE{"head"
requires="SOLRPLUGIN"
text="<link rel='stylesheet' href='%PUBURLPATH%/%SYSTEMWEB%/SolrPlugin/wikiusers.css' media='all' />"
Expand Down
2 changes: 1 addition & 1 deletion data/System/WebChangesViewTemplate.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1485183295" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1505725909" format="1.1" version="1"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"SolrSearchBase"}%
%{</verbatim>}%
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/SolrPlugin.pm
Expand Up @@ -30,8 +30,8 @@ BEGIN {
}
}

our $VERSION = '5.00';
our $RELEASE = '23 Jan 2017';
our $VERSION = '6.00';
our $RELEASE = '18 Sep 2017';
our $SHORTDESCRIPTION = 'Enterprise Search Engine for Foswiki based on [[http://lucene.apache.org/solr/][Solr]]';
our $NO_PREFS_IN_TOPIC = 1;
our %searcher;
Expand Down
29 changes: 16 additions & 13 deletions pub/System/SolrPlugin/ajax-solr-widgets.uncompressed.js
Expand Up @@ -283,7 +283,7 @@

if (self.filterField && self.filterField.is(":visible")) {
var val = self.filterField.val();
if (val) {
if (typeof(val) !== 'undefined') {
self.container.find(".jqSerialPager").data("filter", val);
}
}
Expand All @@ -310,13 +310,13 @@

self.$target.find(".solrFacetFieldTwisty").on("afterClose.twisty", function() {
var val = self.filterField.val();
if (val) {
if (typeof(val) !== 'undefined') {
self.container.find(".jqSerialPager").trigger("refresh");
}
self.filterField.blur();
}).on("afterOpen.twisty", function() {
var val = self.filterField.val();
if (val) {
if (typeof(val) !== 'undefined') {
self.container.find(".jqSerialPager").trigger("refresh", val);
}
self.filterField.focus();
Expand All @@ -332,7 +332,7 @@
clearTimeout(timer);
timer = undefined;
}
timer =setTimeout(function() {
timer = window.setTimeout(function() {
pager.trigger("refresh", val);
timer = undefined;
}, 250);
Expand Down Expand Up @@ -402,15 +402,15 @@

if (self.isSelected(self.options.value)) {
if (self.options.inverse) {
self.checkbox.removeAttr("checked");
self.checkbox.prop("checked", false);
} else {
self.checkbox.attr("checked", "checked");
self.checkbox.prop("checked", true);
}
} else {
if (self.options.inverse) {
self.checkbox.attr("checked", "checked");
self.checkbox.prop("checked", true);
} else {
self.checkbox.removeAttr("checked");
self.checkbox.prop("checked", false);
}
}
},
Expand Down Expand Up @@ -624,7 +624,7 @@
if (numFound > 0) {
self.$target
.find(".solrRows").show()
.find("option[value='"+rows+"']").attr("selected", "selected")
.find("option[value='"+rows+"']").prop("selected", true)
.end().find("select").change(function() {
var rows = $(this).val();
self.manager.store.get('rows').val(rows);
Expand Down Expand Up @@ -729,7 +729,7 @@
return encodeURIComponent(text);
},
getTemplateName: function() {
var type = this.data.type,
var type = this.data.type.replace(/%\d+/g, ""), // clean up errors in data
topicType = this.data.field_TopicType_lst || [],
templateName;

Expand Down Expand Up @@ -835,6 +835,9 @@

return moment(dateString).format(dateFormat || self.options.dateFormat);
//return moment(dateString).calendar();
},
contains: function(arr, val) {
return $.inArray(val, arr) >= 0;
}
}
));
Expand All @@ -861,7 +864,7 @@
$(self.options.displayAs).change(function() {
self.update();
});
$(self.options.displayAs).filter("[value='"+self.options.defaultDisplay+"']").attr("checked", "checked");
$(self.options.displayAs).filter("[value='"+self.options.defaultDisplay+"']").prop("checked", true);
self._isFirst = true;

self.update();
Expand Down Expand Up @@ -1104,8 +1107,8 @@
val = currentSort.val();
}
val = val || self.defaults.defaultSort;
self.$target.find("option").removeAttr("selected");
self.$target.find("[value='"+val+"']").attr('selected', 'selected');
self.$target.find("option").prop("selected", false);
self.$target.find("[value='"+val+"']").prop('selected', true);
},

init: function() {
Expand Down
7 changes: 5 additions & 2 deletions pub/System/SolrPlugin/jquery.autosuggest.uncompressed.js
Expand Up @@ -75,7 +75,10 @@
var self = this,
elem = self.menu.element;

self.options.thumbnailBase = foswiki.getPreference("SCRIPTURL") + "/rest/ImagePlugin/resize?size=48&crop=on";
self.options.thumbnailBase = foswiki.getScriptUrl("rest", "ImagePlugin", "resize", {
"size": 48,
"crop": "on"
});

elem.addClass("ui-autosuggest").removeClass("ui-autocomplete");
if (self.options.menuClass) {
Expand All @@ -90,7 +93,7 @@
var self = this;

self.cache = {};
self.options.source = self.options.source || foswiki.getPreference("SCRIPTURL") + '/rest/SolrPlugin/autosuggest';
self.options.source = self.options.source || foswiki.getScriptUrl("rest", "SolrPlugin", "autosuggest");

self.source = function(request, response) {
var term = request.term.replace(/(^\s+)|(\s+$)/g, ""),
Expand Down
Expand Up @@ -109,7 +109,7 @@

if (self.filterField && self.filterField.is(":visible")) {
var val = self.filterField.val();
if (val) {
if (typeof(val) !== 'undefined') {
self.container.find(".jqSerialPager").data("filter", val);
}
}
Expand All @@ -136,13 +136,13 @@

self.$target.find(".solrFacetFieldTwisty").on("afterClose.twisty", function() {
var val = self.filterField.val();
if (val) {
if (typeof(val) !== 'undefined') {
self.container.find(".jqSerialPager").trigger("refresh");
}
self.filterField.blur();
}).on("afterOpen.twisty", function() {
var val = self.filterField.val();
if (val) {
if (typeof(val) !== 'undefined') {
self.container.find(".jqSerialPager").trigger("refresh", val);
}
self.filterField.focus();
Expand All @@ -158,7 +158,7 @@
clearTimeout(timer);
timer = undefined;
}
timer =setTimeout(function() {
timer = window.setTimeout(function() {
pager.trigger("refresh", val);
timer = undefined;
}, 250);
Expand Down
7 changes: 5 additions & 2 deletions pub/System/SolrPlugin/widgets/ResultWidget.uncompressed.js
Expand Up @@ -75,7 +75,7 @@
return encodeURIComponent(text);
},
getTemplateName: function() {
var type = this.data.type,
var type = this.data.type.replace(/%\d+/g, ""), // clean up errors in data
topicType = this.data.field_TopicType_lst || [],
templateName;

Expand Down Expand Up @@ -181,6 +181,9 @@

return moment(dateString).format(dateFormat || self.options.dateFormat);
//return moment(dateString).calendar();
},
contains: function(arr, val) {
return $.inArray(val, arr) >= 0;
}
}
));
Expand All @@ -207,7 +210,7 @@
$(self.options.displayAs).change(function() {
self.update();
});
$(self.options.displayAs).filter("[value='"+self.options.defaultDisplay+"']").attr("checked", "checked");
$(self.options.displayAs).filter("[value='"+self.options.defaultDisplay+"']").prop("checked", true);
self._isFirst = true;

self.update();
Expand Down
Expand Up @@ -32,7 +32,7 @@
if (numFound > 0) {
self.$target
.find(".solrRows").show()
.find("option[value='"+rows+"']").attr("selected", "selected")
.find("option[value='"+rows+"']").prop("selected", true)
.end().find("select").change(function() {
var rows = $(this).val();
self.manager.store.get('rows').val(rows);
Expand Down
4 changes: 2 additions & 2 deletions pub/System/SolrPlugin/widgets/SortWidget.uncompressed.js
Expand Up @@ -22,8 +22,8 @@
val = currentSort.val();
}
val = val || self.defaults.defaultSort;
self.$target.find("option").removeAttr("selected");
self.$target.find("[value='"+val+"']").attr('selected', 'selected');
self.$target.find("option").prop("selected", false);
self.$target.find("[value='"+val+"']").prop('selected', true);
},

init: function() {
Expand Down

0 comments on commit 112b54e

Please sign in to comment.