diff options
Diffstat (limited to 'templates/web')
-rwxr-xr-x | templates/web/default/reports/ward.html | 2 | ||||
-rw-r--r-- | templates/web/fixmybarangay/auth/sign_out.html | 8 | ||||
-rw-r--r-- | templates/web/fixmybarangay/footer.html | 57 | ||||
-rw-r--r-- | templates/web/fixmybarangay/report/_message_manager.html | 119 |
4 files changed, 164 insertions, 22 deletions
diff --git a/templates/web/default/reports/ward.html b/templates/web/default/reports/ward.html index 8b65ffb28..4b2ea29a5 100755 --- a/templates/web/default/reports/ward.html +++ b/templates/web/default/reports/ward.html @@ -1 +1 @@ -[% INCLUDE reports/council.html %] +[% INCLUDE reports/body.html %] diff --git a/templates/web/fixmybarangay/auth/sign_out.html b/templates/web/fixmybarangay/auth/sign_out.html new file mode 100644 index 000000000..11888089a --- /dev/null +++ b/templates/web/fixmybarangay/auth/sign_out.html @@ -0,0 +1,8 @@ +[% INCLUDE 'header.html', title = loc('Sign out'), bodyclass = 'fullwidthpage' %] + +<h1>[% loc('You have been signed out') %]</h1> + +<p>Please feel free to <a href="[% c.uri_for('/auth') %]">sign in again</a>, or +go back to the <a href="/">FixMyBarangay front page</a>.</p> + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmybarangay/footer.html b/templates/web/fixmybarangay/footer.html index 737b151ac..966abacd8 100644 --- a/templates/web/fixmybarangay/footer.html +++ b/templates/web/fixmybarangay/footer.html @@ -28,7 +28,7 @@ </div> [% IF global.want_fmb_hidden_dialogs %] - <!-- fancybox hidden dialogues for message-manager reply/hide --> + <!-- fancybox hidden dialogues for message-manager reply/hide/help --> <div style="display:none"> <div id="reply-form-container"> <form action="#" id="reply-form" onsubmit="event.returnValue = false; return false;" method="post" accept-charset="utf-8"> @@ -74,6 +74,61 @@ </form> </div> </div> + <div style="display:none"> + <div id="mm-help" style="font-size:90%;"> + <h2> Accessing Message Manager from FixMyBarangay (FMB)</h2> + <h3> + Logging into Message Manager + </h3> + <p> + You'll need a username and password (ask your manager if you haven't already got one). Your Message Manager password + might not be the same as your FMB password. + </p> + <p> + When you've logged in, you'll see the currently available messages (and any replies that have been sent to them). + You <em>only</em> see messages that are waiting to be used to make reports, and which are tagged with the keywords + your login allows you to see (these may mean you only see messages for your own barangay). + If you want to see any other messages, you'll need to have a manager or admin account on Message Manager: click on the + <a href="[% c.config.MESSAGE_MANAGER_URL %]">admin</a> link to get there. + </p> + <h3> + Creating a new report from a message + </h3> + <p> + If you want to use a message to create a problem report, you'll need to select it first. Click on the radio button. When the message + is selected, it will go bright green. Now when you click on the map, the report will be used to create the report. + </p> + <p> + To stop two people replying to a message at the same time, if anyone else has just started working on it, you'll see a message + warning you, and you won't be able to select the radio button. Normally, if nobody works with a message, such a lock is released + after about 3 minutes. + </p> + <h3> + Replying to a message + </h3> + <p> + You can send an SMS back to the original sender: just hover over the message and click <span class="demo_reply_btn">reply</span>. It will usually + take a few minutes for the message to arrive. + </p> + <h3> + Getting message info + </h3> + <p> + Hover over a message and click on its <span class="demo_info_btn">i</span> button to see when it was sent. + You can also see the sender, although not their + actual number (instead the number is scrambled, but will be the <em>same scrambled number</em> on other messages they've sent). + </p> + <h3> + Hiding a message + </h3> + <p> + If a message can't be used to create a report, you can hide it by hovering over it and clicking its <span class="demo_hide_btn">X</span> button. If you're not + going to create a problem report with this message, you might like to reply first, to tell the person who sent the message why not. + When you click the X, give a reason why you're hiding it so other staff (managers in Message Manager) can see why the message was hidden. + </p> + </div> + </div> + [% END %] <!-- [% INCLUDE 'debug_footer.html' %] --> diff --git a/templates/web/fixmybarangay/report/_message_manager.html b/templates/web/fixmybarangay/report/_message_manager.html index 04ffb0f42..10f627a2e 100644 --- a/templates/web/fixmybarangay/report/_message_manager.html +++ b/templates/web/fixmybarangay/report/_message_manager.html @@ -1,18 +1,35 @@ [% IF c.user && c.user.from_council %] +[% IF problem.external_source_id && problem.external_source == c.config.MESSAGE_MANAGER_URL %] + <p class="mm-submitted-by-sms"> + [%# OK to link to Message Manager here because (currently) we're only showing this to staff users %] + <a href="[%= problem.external_source %]messages/view/[%= problem.external_source_id %]" + title="view in Message Manager admin"><img + src="/cobrands/fixmybarangay/images/mobile-22x40.png" alt="SMS"></a> + This report was submitted via SMS. + </p> +[% END %] + [% IF problem.id %] - <input type="button" class="green-btn" value="Show Messages" id="show_messages"> + <div id="mm-container-for-report-btns"> + <input type="button" class="green-btn" value="Show Messages" id="show_messages"> + </div> [% END %] <ul id="message_manager" class="issue-list-a tab" style="display: none"> + <li id="mm-admin-buttons"> + [% IF problem.id %] + <a style="float:left" id="mm-link-to-toggle-archive" href="#" title="show the message(s) associated with this report">show message for <b>this</b> report</a> + [% END %] + <a id="mm-link-to-refresh" href="#" title="update list of messages">refresh</a> + <a id="mm-link-to-admin" href="[% c.config.MESSAGE_MANAGER_URL %]" title="jump to Message Manager admin">admin</a> + <a id="mm-link-to-help" href="#mm-help" title="show help information">help</a> + </li> <li id="message-control"> - <div id="mm-admin-buttons"> - <a id="mm-link-to-admin" href="[% c.config.MESSAGE_MANAGER_URL %]">[admin]</a> - <a id="mm-link-to-refresh" href="#">[refresh]</a> - </div> <div id="mm-username-container">username: <span id="mm-received-username"></span></div> <div id="mm-status-message-container"> - <div id="mm-status-message"></div> + <img id="mm-spinner" src="/cobrands/fixmybarangay/images/fmb-spinner-16x16.gif" alt=""/> + <p id="mm-status-message"></p> </div> <div id="mm-login-container"> <div> @@ -44,26 +61,33 @@ $(document).ready(function() { var timeout_id = 0; var can_refresh = true; // disable refresh var refresh_period = 60000 * 3; // refresh messages every three minutes + var has_archive_message = false; function sanitise_id(css_id) { return css_id.replace(/\D/g, ""); } + // call this to push the auto-refresh timeout off so it's only triggered + // if there's no activity for a while + function reset_timeout() { + if (refresh_period && can_refresh) { + if (timeout_id) { + clearTimeout(timeout_id); + } + timeout_id = setTimeout(mm_refresh_messages, refresh_period); + } + } + var mm_refresh_messages = function() { $('#mm-link-to-refresh').fadeOut(); $('#available-submit').click(); } var mm_populate_list = function(data) { - $('#mm-status-message-container').text("Accessed Message Manager as " + data['username']); + $('#mm-status-message-container').find('p').text("Accessed Message Manager as " + data['username']); $('input[name=mm_text]').prop('checked', false); // uncheck all $('#mm-link-to-refresh').delay(2000).fadeIn(); - if (refresh_period && can_refresh) { - if (timeout_id) { - clearTimeout(timeout_id); - } - timeout_id = setTimeout(mm_refresh_messages, refresh_period); - } + reset_timeout(); } var mm_selected_message = function(data) { @@ -83,12 +107,14 @@ $(document).ready(function() { } var dummy_reply_cleanup = function(data) { + reset_timeout(); $('#reply_text').val(''); dummy_busy = false; mm_refresh_messages(); } var dummy_hide_cleanup = function(data) { + reset_timeout(); $('#reason_text').val(''); dummy_busy = false; } @@ -105,9 +131,11 @@ $(document).ready(function() { $('#available-submit').click(function(e){ e.preventDefault(); + reset_timeout(); message_manager.get_available_messages({ callback: mm_populate_list, suggest_username: fms_username, + fms_id: problem_id, anim_duration: 500 }); }); @@ -120,6 +148,7 @@ $(document).ready(function() { }); $('#mm-message-list').on('click', '.mm-info', function(e){ + reset_timeout(); message_manager.show_info(sanitise_id($(this).parent().attr('id'))); }); @@ -146,6 +175,7 @@ $(document).ready(function() { $('#hide-submit').click(function(e) { e.preventDefault(); + reset_timeout(); // TODO: pending fancybox callbacks working, force dummy_busy here // this is possibly overly cautious anyway dummy_busy = false; @@ -163,13 +193,15 @@ $(document).ready(function() { // only show on problem display page if (problem_id) { $('<input type="button" value="Copy to update"/>').attr({ - 'id': 'add_support', - 'name': 'add_support', - 'class': 'green-btn' - }).appendTo($('#message_manager')); + 'id': 'copy_to_update', + 'name': 'copy_to_update', + 'class': 'green-btn', + 'title': "add the selected message's text as an update to this report" + }).appendTo($('#mm-container-for-report-btns')); } - $('#add_support').click(function(e){ + $('#copy_to_update').click(function(e){ + reset_timeout(); e.preventDefault(); $('#mm-message-list input:checked').each( function(index) { var id = $(this).attr('id'); @@ -183,8 +215,15 @@ $(document).ready(function() { }); $('#show_messages').on('click', function(e) { - $('#message_manager').toggle(); - $('#show_messages').val( $('#show_messages').val() == 'Show Messages' ? 'Hide Messages' : 'Show Messages' ); + $('#message_manager').slideToggle(1000); + if ($('#show_messages').val() == 'Show Messages') { + $('#show_messages').val('Hide Messages'); + $('#copy_to_update').stop(true,true).fadeIn(); + } else { + $('#show_messages').val('Show Messages'); + $('#copy_to_update').stop(true,true).fadeOut(); + } + }); $('#mm-link-to-refresh').on('click', function(e) { @@ -192,6 +231,46 @@ $(document).ready(function() { mm_refresh_messages(); }); + // suppress fading control while archive messages are displayed, for now + $('#mm-link-to-toggle-archive').on('click', function(e) { + e.preventDefault(); + $('#mm-link-to-toggle-archive').fadeOut(); + if ($('.mm-current', $mm_message_list).is(':visible')) { + $('#copy_to_update').stop(true,true).fadeOut(); + $('#mm-link-to-refresh').stop(true,true).fadeOut(); + $('.mm-empty', $mm_message_list).stop(true,true).fadeOut(); + $('.mm-current', $mm_message_list).stop(true,true).slideUp(1000, function(){ + if($('.mm-archive', $mm_message_list).find('li').length == 0) { + message_manager.say_status("No messages found for this report,"); + } else { + message_manager.say_status("Messages for this report:"); + }; + $('.mm-archive', $mm_message_list).stop(true,true).slideDown(1000, function(){ + $('#mm-link-to-toggle-archive').html('show all available messages') + .attr('title', 'show all available messages (for adding updates)'); + $('#mm-link-to-toggle-archive').fadeIn(); + can_refresh = false; + }) + }); + } else { + $('.mm-archive', $mm_message_list).stop(true,true).slideUp(1000, function(){ + message_manager.say_status("Available messages:"); + $('.mm-current', $mm_message_list).stop(true,true).slideDown(1000, function(){ + $('#mm-link-to-toggle-archive').html("show message for <b>this</b> report") + .attr('title', 'show the original message(s) for this report'); + $('#copy_to_update').stop(true,true).fadeIn(); + $('#mm-link-to-toggle-archive').stop(true,true).fadeIn(); + $('#mm-link-to-refresh').stop(true,true).fadeIn(); + $('.mm-empty', $mm_message_list).stop(true,true).fadeIn(); + can_refresh = true; + reset_timeout(); + }) + }); + } + }); + + $("a#mm-link-to-help").fancybox(); + message_manager.populate_boilerplate_strings('hide-reason'); message_manager.populate_boilerplate_strings('reply'); }); |