Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-map-menu-to-associated-maps #492

Merged
merged 8 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crouton.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Description: A tabbed based display for showing meeting information.
Author: bmlt-enabled
Author URI: https://bmlt.app
Version: 3.19.5
Version: 3.20.0
*/
/* Disallow direct access to the plugin file */
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
Expand Down
24 changes: 12 additions & 12 deletions croutonjs/meetingMap/css/meeting_map.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
div.bmlt_map_container_div
div.bmlt_map_container_div
{
width: 100%;
margin:auto;
Expand All @@ -12,7 +12,7 @@ div.bmlt_search_map_div {
margin:auto;
left:0;
top:0;
height:100%;
height:100%;
z-index: 10;
}
div.bmlt_map_container_div .bmlt_map_throbber_div
Expand Down Expand Up @@ -86,7 +86,7 @@ div.bmlt_map_container_div div.bmlt_search_map_div
.accordion h4 {
padding-top: .25em;
font-size: 16px;
font-weight: bold;
font-weight: bold;
margin-top: 8px;
margin-bottom: 8px;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ div.bmlt_map_container_div div.bmlt_search_map_div
padding-bottom: 2px;
font-size:12px;
border:0;
}
}
input[name='panel']:checked ~ .marker_div_meeting {
height:auto;
overflow: auto !important;
Expand All @@ -178,7 +178,7 @@ input[name='panel']:checked ~ .marker_div_meeting {
display: block; overflow: hidden; cursor: pointer;
border: 2px solid #2d5c88 !important; border-radius: 20px !important;
box-shadow: 0 1px 4px rgba(0,0,0,0.3);

}
.onoffswitch-inner {
display: block !important; width: 200% !important; margin-left: -100% !important;
Expand All @@ -196,13 +196,13 @@ input[name='panel']:checked ~ .marker_div_meeting {
position: absolute; top: 0; bottom: 0;
right: 136px !important;
border: 2px solid #2d5c88 !important; border-radius: 20px;
transition: all 0.3s ease-in 0s;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0 !important;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px !important;
right: 0px !important;
}
.mapSearchText {
background-color: #fff !important;
Expand Down Expand Up @@ -234,7 +234,7 @@ div.bmlt_map_container_div button {
}
/* The Modal (background) */
.modal {
font-size: 14px !important; color: black; font-family: Roboto, Arial, sans-serif !important;
font-size: 14px !important; color: black; font-family: Roboto, Arial, sans-serif !important;
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1000; /* Sit on top */
Expand Down Expand Up @@ -367,12 +367,12 @@ div.bmlt_map_container_div button {
font-size: 14px;
font-weight: bold;
margin-top: 0;
line-height: 1.2;
line-height: 1.2;
}
.modal_times {
font-size: 14px;
font-weight: bold;
color: #DB4865;
color: #DB4865;
}
#table_content .meeting-header{
background-color: #93c3cd !important;
Expand Down Expand Up @@ -510,7 +510,7 @@ background-color: #EEEEEE;
.gm-style .gm-style-iw-c {
padding: 0px;
}
#bmlt-map button.gm-ui-hover-effect {
#bmlt-map button.gm-ui-hover-effect, #byfield_embeddedMapPage .gm-ui-hover-effect {
right: 0px;
z-index: 999;
width: 20px !important;
Expand All @@ -521,6 +521,6 @@ background-color: #EEEEEE;
bottom: 13px;
right: 13px;
}
#bmlt-map .gm-style-iw-chr {
#bmlt-map .gm-style-iw-chr, #byfield_embeddedMapPage .gm-style-iw-chr {
height: 0 !important;
}
38 changes: 27 additions & 11 deletions croutonjs/meetingMap/js/meeting_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ function MeetingMap(inConfig) {
}
if (config.map_search.zoom) {
config.zoom = config.map_search.zoom;
}
}
}
let loc = {latitude: config.lat, longitude: config.lng, zoom: config.zoom};
if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
if (handlebarMapOptions) loc = {latitude: handlebarMapOptions.lat, longitude: handlebarMapOptions.lng};
if (gDelegate.createMap(inDiv, loc)) {
gDelegate.addListener('zoomend', function (ev) {
if (shouldRedrawMarkers() && gAllMeetings) {
Expand All @@ -79,7 +79,10 @@ function MeetingMap(inConfig) {
menuContext.imageDir = config.BMLTPlugin_images;
gDelegate.addControl(createNext24Toggle(), 'topleft');
gDelegate.addControl(createMenuButton(menuContext), 'topright', cb);
};
}else {
otrok7 marked this conversation as resolved.
Show resolved Hide resolved
menuContext = {imageDir: config.BMLTPlugin_images, config: config, dropdownData:false};
gDelegate.addControl(createMenuButton(menuContext), 'topright', cb);
}
}
};
};
Expand Down Expand Up @@ -148,6 +151,7 @@ function MeetingMap(inConfig) {
controlDiv.innerHTML = template(menuContext);
controlDiv.querySelector("#nearbyMeetings").addEventListener('click', function (e) {
retrieveGeolocation().then(position => {
filterVisible(false);
gDelegate.setViewToPosition(position, filterMeetingsAndBounds);
}).catch(error => {
console.error(error.message);
Expand All @@ -157,14 +161,19 @@ function MeetingMap(inConfig) {
});

controlDiv.querySelector("#lookupLocation").addEventListener('click', showGeocodingDialog);
controlDiv.querySelector("#filterMeetings").addEventListener('click', showFilterDialog);
controlDiv.querySelector("#showAsTable").addEventListener('click', showListView);
if (menuContext && menuContext.dropdownData) {
controlDiv.querySelector("#filterMeetings").addEventListener('click', showFilterDialog);
controlDiv.querySelector("#showAsTable").addEventListener('click', showListView);
} else {
controlDiv.querySelector("#filterTable").addEventListener('click', toggleVisible);
}
controlDiv.querySelector("#fullscreenMode").addEventListener('click', toggleFullscreen);
controlDiv.querySelector("#map-menu-button").addEventListener('click', function (e) {
let dropdownContent = document.getElementById("map-menu-dropdown");
if (dropdownContent.style.display == "inline-block")
if (dropdownContent.style.display == "inline-block") {
dropdownContent.style.display = "none";
else
filterVisible(false);
} else
dropdownContent.style.display = "inline-block";
});
[...controlDiv.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>closeModalWindow(e.target)));
Expand Down Expand Up @@ -454,12 +463,12 @@ function MeetingMap(inConfig) {
? filtered.map((m)=>[m])
: mapOverlappingMarkersInCity(filtered);

if (useMarkerCluster()) gDelegate.createClusterLayer();
if (useMarkerCluster()) gDelegate.createClusterLayer();
// Draw the meeting markers.
overlap_map.forEach(function (marker) {
createMapMarker(marker);
});
gDelegate.addClusterLayer();
gDelegate.addClusterLayer();
if (expand) {
const lat_lngs = filtered.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[]);
gDelegate.fitBounds(lat_lngs);
Expand Down Expand Up @@ -564,20 +573,27 @@ function MeetingMap(inConfig) {
(meetings.length > 1),
marker_html, null ,meetings.map((m)=>parseInt(m.id_bigint)));
};
var listOnlyVisible = false;
function filterBounds(bounds) {
return gAllMeetings.filter((meeting) => gDelegate.contains(bounds, meeting.latitude, meeting.longitude));
}
function filterVisible(on=true) {
if (on===listOnlyVisible) return;
let mtgs = on ? filterBounds(gDelegate.getBounds()) : gAllMeetings;
let visible = mtgs.map((m)=>m.id_bigint);
jQuery(".bmlt-data-row").each(function(index,row) {
row.dataset.visible = (visible.includes(row.id.split('-').pop())) ? '1' : '0';
});
jQuery("#byday").removeClass('hide');
jQuery("#filter-dropdown-visibile").val('a-1');
jQuery("#filter-dropdown-visibile").val(on?'a-1':'');
fitDuringFilter = false;
crouton.doFilters();
crouton.simulateFilterDropdown();
fitDuringFilter = true;
jQuery("#filteringByVisibility").html(on?'✔':'');
listOnlyVisible = on;
}
function toggleVisible() {
filterVisible(!listOnlyVisible);
}
function filterBounds(bounds) {
var ret = gAllMeetings.filter((meeting) =>
Expand Down
13 changes: 11 additions & 2 deletions croutonjs/src/js/crouton-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ Crouton.prototype.render = function(doMeetingMap = false) {
{placeholder: self.localization.getWord('common_needs'), pointer: 'Formats', elementId: "filter-dropdown-commonneeds",
uniqueData: (meetings) => getUniqueFormatsOfType(meetings, 'FC3'),
objectPointer: (f) => convertToPunyCode(f.name), optionName: (f)=>f.name});
if (doMeetingMap) self.dropdownData.push(
if (doMeetingMap || self.config.show_map || self.config.map_page) self.dropdownData.push(
{placeholder: '', pointer: 'visible', elementId: "filter-dropdown-visibile",
uniqueData: (meetings) => self.getUsedVisibility(meetings),
objectPointer: (s)=>s.value, optionName: (s)=>s.name});
Expand Down Expand Up @@ -1675,7 +1675,7 @@ crouton_Handlebars.registerHelper('hasBMLT2ics', function() {
return crouton.config['bmlt2ics'].length>0;});
crouton_Handlebars.registerHelper('BMLT2ics', function() {return crouton.config['bmlt2ics'];});
crouton_Handlebars.registerPartial('icsButton',
'<a href="{{BMLT2ics}}?meeting-id={{id_bigint}}" download="{{meeting_name}}.ics" class="bootstrap-bmlt" ><div class="btn btn-primary bmlt-sharebutton"><span class="glyphicon glyphicon-download-alt"></span> {{getWord "bmlt2ics"}}</div></a>');
'<a href="{{BMLT2ics}}?meeting-id={{id_bigint}}" download="{{meeting_name}}.ics" id="share-button" class="btn btn-primary btn-xs" ><span class="glyphicon glyphicon-download-alt"></span> {{getWord "bmlt2ics"}}</a>');
crouton_Handlebars.registerPartial('offerIcsButton',
"{{#if (hasBMLT2ics)}}{{> icsButton}}<br/>{{/if}}");
function convertToPunyCode(str) {
Expand Down Expand Up @@ -1730,6 +1730,15 @@ Crouton.prototype.renderMeetingCount = function() {
self.updateMeetingCount()
});
}
Crouton.prototype.simulateFilterDropdown = function() {
self = this;
jQuery('.bmlt-page:not(#byfield_embeddedMapPage)').each(function () {
self.hidePage(this);
});
self.filteredPage();
if (!self.filtering && !self.config.map_page)
self.showView(self.config['view_by'] === 'byday' ? 'byday' : 'day');
}
Crouton.prototype.getAdjustedDateTime = function(meeting_day, meeting_time, meeting_time_zone) {
var timeZoneAware = this.config['auto_tz_adjust'] === true || this.config['auto_tz_adjust'] === "true";
var meeting_date_time_obj;
Expand Down
34 changes: 34 additions & 0 deletions croutonjs/src/js/crouton-localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ function CroutonLocalization(language) {
'meeting page': "صفحة الاجتماع",
'meeting details': "تفاصيل الاجتماع",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"da-DK": {
"days_of_the_week": ["", "Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"],
Expand Down Expand Up @@ -108,6 +110,8 @@ function CroutonLocalization(language) {
'enter a city or zip code': 'Enter a city or zip code',
'toggle fullscreen mode': 'Toggle fullscreen mode',
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"de-DE":{
"days_of_the_week": ["", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
Expand Down Expand Up @@ -163,6 +167,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Seite",
'meeting details': "Genaueres zum Meeting",
'report update': "Report an Update",
'filter by visibility': "Zeige nur Meetings, die gerade auf dem Karte stehen",
'go': "Los!"
},
"en-AU": {
"days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
Expand Down Expand Up @@ -217,6 +223,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"en-CA": {
"days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
Expand Down Expand Up @@ -272,6 +280,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"en-NZ": {
"days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
Expand Down Expand Up @@ -327,6 +337,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"en-UK": {
"days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
Expand Down Expand Up @@ -382,6 +394,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"en-US": {
"days_of_the_week" : ["", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
Expand Down Expand Up @@ -437,6 +451,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"es-US": {
"days_of_the_week" : ["", "Domingo", " Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
Expand Down Expand Up @@ -492,6 +508,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"fa-IR": {
"days_of_the_week" : ["", 'یَکشَنب', 'دوشَنبه', 'سه‌شنبه', 'چهار شنبه', 'پَنج شَنبه', 'جُمعه', 'شَنبه'],
Expand Down Expand Up @@ -546,6 +564,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"fr-CA": {
"days_of_the_week" : ["", "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"],
Expand Down Expand Up @@ -601,6 +621,8 @@ function CroutonLocalization(language) {
"meeting page": "Page de la réunion",
"meeting details": "Détails de la réunion",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"it-IT": {
"days_of_the_week" : ["", "Domenica", " Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"],
Expand Down Expand Up @@ -656,6 +678,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"nl-NL": {
"days_of_the_week" : ["", "Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"],
Expand Down Expand Up @@ -711,6 +735,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"pl-PL": {
"days_of_the_week" : ["", "Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"],
Expand Down Expand Up @@ -766,6 +792,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"pt-BR": {
"days_of_the_week" : ["", "Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"],
Expand Down Expand Up @@ -821,6 +849,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"ru-RU": {
"days_of_the_week" : ["", "Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"],
Expand Down Expand Up @@ -876,6 +906,8 @@ function CroutonLocalization(language) {
'meeting page': "Страница собрания",
'meeting details': "Подробности собрания",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
},
"sv-SE": {
"days_of_the_week" : ["", "Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"],
Expand Down Expand Up @@ -931,6 +963,8 @@ function CroutonLocalization(language) {
'meeting page': "Meeting Page",
'meeting details': "Meeting Details",
'report update': "Report an Update",
'filter by visibility': "List only these meetings",
'go': "Go!"
}
};
}
Expand Down
Loading
Loading