===== Browser Staff Client Development Notes ===== Explorations and milestones for the browser staff client development project. ==== 2014-07-18 ==== Author: Bill Erickson === Integrating Existing HTML Interfaces === After expressing my own concerns (annoyances?) about using iframes for HTML UI integration, Dan Wells replied to the list, "I don’t think we should rule out using iframes for catalog integration. Iframes are actually pretty close in many respects to the way the catalog 'integrates' into the current (XUL) staff client." Point taken and ran with... I've integrated patron registration and the catalog into the browser client in a manner similar to the XUL client using iframes. In most cases, it's as simple as passing in "xulG" functions to mimic the ones on offer by the XUL client. In a few cases, we have to edit the original UIs (e.g. avoiding inline hrefs for "oils://" and the like), but thus far that has been the exception. I'm still working through the different behaviors, but I have no reason to think we can't port all of the actions from the XUL client over to the browser. == One Fly in the Ointment == I have run into one snag with this approach related to how WebKit (Chrome/Safari) browsers handle browsing history with iframes in conjunction with HTML5 pushstate. Basically, after navigating forward in the iframe, then clicking the Back button in the browser, instead of going to the previous iframe page as one would expect (and as Firefox does), the browser navigates to the previous pushsate URL, which will always be the URL of the containing page, which effectively does nothing, since that URL doesn't change. If this sounds like gibberish, you can see it in effect on my dev site. Simply perform a record search, then try using the back button to return to the search page: https://bill-dev2.esilibrary.com/eg/staff/cat/catalog/index (admin / demo123) Unlike here, where I'm using an iframe but no pushstate routing. Using the Back button after a search actually returns the user to the previous page. https://bill-dev2.esilibrary.com/~berick/cat.html I have yet to track down a bug entry for this (I did find a mention at https://github.com/jashkenas/backbone/issues/799), though I'm fairly sure this is in fact a browser bug. BTW, I did try wiring up handlers for myIframe.contentWindow.history.back(), etc. but they resulted the same behavior. I'll keep an eye out for any developments on this. ==== 2014-07-02 ==== Author: Bill Erickson === Working Through Circ Interfaces === The past month I've been in the trenches mainly working on [[http://evergreen-ils.org/dokuwiki/doku.php?id=dev:browser_staff:dev_sprints:1|circulation UI's]]. Evergreen is highly configurable, particularly with circulation, which means there's a lot of code to work through. I think I'm over the main hump, though, with checkout/checkin/renewal and their accompanying actions effectively done. There are still a few things to tend do (e.g. permission failure override dialogs), but I'm out of the woods. === Miscellaneous === == Date / Time Pickers == Chrome and [[https://bugzilla.mozilla.org/show_bug.cgi?id=773205|eventually Firefox]] supports the HTML5 , which presents a date picker UI to the user without the need for external javascript. What neither yet supports, though, is the type='datetime' input, which offers both a date and time selector. There are a few places in Evergreen where users need to select a time, like editing due dates. I don't personally see having to enter hh:mm:ss as burdensome until the selectors are implemented (assuming the necessary UI hints), particularly considering how rarely users need to enter time, but I could be missing something. Input welcome. I know people don't like entering yyyy-mm-dd for dates, though, so if Firefox is unable to get date inputs working in time, we may have to use an external solution, like the angular-ui-bootstrap datepicker). I've coded the date input as an Angular directive (), so in theory, the main work of adding an external option should be done directly within the directive and not spread throughout the codebase. (Though, really, there are only a handful of date selectors...) == APIs and Permissions == PCRUD didn't exist for the first few years of the XUL client, so it relies heavily on middle-layer API calls which simply collect data. In the browser client, I'm leaning heavily on PCRUD (either directly or via flattener) for these data collection calls, since it's considerably faster. (Plus PCRUD is C code, so it requires less RAM and CPU). I mention this here because PCRUD uses its own set of permissions for allowing access to data. In any case where I added support to PCRUD for retrieval of a certain type of object (in the IDL), I made sure to match the permission from the API call. However, there will certainly be cases where the permissions don't quite match. In those cases, we may have to add/modify the permission to the relevant PCRUD entry in the IDL. Something to watch out for. == Opening Multiple Tabs == Chrome has a security feature / limitation which limits the number of tabs opened from a single user action to one. You can see how this would be ideal for general web browsing. It creates some barriers for us, though. For example, if you selected 5 patrons in a list and chose the "open these patrons in a new tab" action, only one tab would open with one patron. (Note that no such action exists in the current code for this very reason). We have to approach this from a different angle. For example, providing links in list rows to the same resources allows users to directly ctrl-click the links and open the resources in a new tab. Instead of selecting 5 items then picking an action, click on the desired link within each row directly. However, this creates a requirement that certain list columns must be visible for accessing the action. For example, to access Item Details from a list of checkouts, the barcode (link) column would have to be visible, regardless of whether you wanted to see the barcode in the list. I don't know if that's a reasonable expectation. We can use row-specific context menus, like how the XUL client duplicates the 'actions for selected items' menus as right-click context menus. Making the default row double-click action (configurably) open items in new tabs is another option. E.g. double-clicking each patron in a list of search results opens the patron in a new tab. I believe this is consistent with the XUL client. We'll get there. More to think about... ==== 2014-06-02 ==== Author: Bill Erickson === Billing Interfaces === The primary UI work for the last week and half has been the patron billing interfaces. Most of the functionality is there, though there are a few odds and ends left, like styling rows for items that are still accruing fines, etc. You can see it on my development server: https://bill-dev2.esilibrary.com/eg/staff/circ/patron/7/bills You’ll notice that the summary billing data is laid out differently than the XUL client. I strive to avoid moving things around unless it really seems necessary. This is one case where the interface seems to have accreted information over the years. (E.g. at least three data points are repeated in the page). I personally find this confusing, so instead of mimicking the UI as it is in the XUL client, I’ve presented the information in a more tabular fashion, all in one place. I can accept if I’m the odd man out here, but I find this much easier to visually navigate. None of this is set in stone, of course, and comments are appreciated. === Print Templates === We now have a functional print templates structure in place. The templates are HTML chunks taken practically verbatim from the stock XUL print templates, modified to use Angular syntax and slightly different data structures. Each template lives within its own .tt2 file on the server (e.g. view source on https://bill-dev2.esilibrary.com/eg/staff/share/print_templates/t_bills_current) instead being embedded within the application. Some benefits of this approach are that administrators have the option of applying modification to stock templates (per org, etc.) in the same manner as TPAC templates or other browser staff templates. It also means stock templates are locale aware. At print time, the application first looks for a locally saved version of the template and, if it does not find one, it fetches the stock template from the server via XMLHttpRequest (using Angular’s $http service). Once fetched, it’s inserted into a hidden DOM node and $compile’d using the print scope data provided by the caller. The end product is sent to the printer, either directly from the DOM for browser printing or as an HTML string when printing remotely. === Print Templates Admin UI === We also have a way to modify and save templates locally via the new template editor. E.g. https://bill-dev2.esilibrary.com/eg/staff/admin/workstation/print/templates Like the XUL template editor, users can modify templates and preview the changes. We only have 2 templates for now, but more will follow as needed. To see one in action, go to the [[https://bill-dev2.esilibrary.com/eg/staff/circ/patron/7/bills|Patron Bills Page]] and chose Print Bills in the Grid’s “Actions” drop-down menu. The print template only has access to the slim set of data provided by the caller for template variables and the base Angular template control structures (for looping, etc.), however (currrently) it’s also possible to insert a