posting minutes I worked yesterday with martin on reporting backend
Category: "Activity log"
Worked on the reporting backend:
- With David and Stew's help, got the SQL query building worked out. We were hampered by the fact that we're on mySQL 4.0, so we don't have embedded SELECT available, and bracketing is a little unusual; ended up writing lots of pre-queries which are executed before the main query.
- Got the query working correctly, with the exception of trapping for when no selections are made; that should probably be prevented in JavaScript.
- Got the basic table output built.
- Added a permalink to a URL which will consist only of the report. Only the shell of this is done; the reports.php page can tell when it's a standalone, and it will supply header and footer eventually.
- Wrote the arithmetic stuff for figuring out minutes worked for all retrieved posts.
- Confirmed that the hooked-in CSS file is working (CSS is not written yet).
Modified the following file:
/blogs/skins_adm/evo/_adminUI.class.php
to add a link to a stylesheet which sits in the hcmc_stats folder:
/blogs/inc/CONTROL/hcmc_stats/hcmc_stats.css
posting minutes worked with martin on start of backend for reporting
With Stew:
Created:
/blogs/inc/CONTROL/hcmc_stats/reports.php
Figured out how to hook into the main db functionality by including the relevant libraries in reports.php. Worked out how to extract parameters from the URL using the B2Evo param() function. Began building the SQL string we'll need to pass to the database to get back a list of posts. Found a number of difficulties; posts are not directly in blogs, they're associated with categories (through two different tables), and categories are associated with blogs. Got some way into it; more tomorrow.
I hacked together a style derived from the main (new) HCMC website.
Please try it and comment. I've only tested in Firefox on Linux so far.
Modified the AJAX code from the Moses project to call the back-end PHP script and put the response into the page. (PHP script itself doesn't do anything yet, other than respond...)
Added the HTML code to:
/blogs/inc/CONTROL/hcmc_stats/hcmc_stats.php
Added CSS code to:
/blogs/rsc/css/admin.global.css
JS code which displays and updates the progress bar is part of the AJAX code which will be imported next.
Contrary to the previous post, I decided that the best way to submit a report query to the back-end is to build a URL search string; this will enable us to provide URLs directly to reports. The SQL query should be constructed by the back-end code based on the field values submitted (through GET). This is also consistent with our AJAX code in the Moses and ScanCan projects.
Created a JS file to do this (hcmc_reports.js). This will later include all the AJAX functions. Tested the search string generation, and tweaked the form field names so they make more sense as GET fields.
posting minutes worked on Report form GUI created
Worked with Stew to build the GUI for the stats report generator. Populated all the controls by querying the database through the B2Evo DB object. Seems to be working well.
Next steps:
- Write JavaScript code to build SQL statement based on form field values.
- Import and adapt AJAX code from ScanCan or Moses project and plug it into the hcmc_functions.js library.
- Add a progress bar to the page.
- Hook up the form-generated SQL to the AJAX submission system.
- Write the PHP handler on the back end to generate the report data (XHTML) from the submitted SQL.
- Write the JS code to drop the report XHTML into the page.
Just logging time. Stewart's post and Martin's post provide the details.
The default skin ('custom') was showing overlap in the list of blogs at the top of the page. Experimented with various ways of fixing this, and eventually settled on adjusted padding, margins and line-height, and removed all margins.
Added new quicktags button for waste of time (currently not displaying as anything, but it does add a span with a specific class of "TimeWasted").
Set up the Admin, Academic and Depts. blogs.
Began work on the statistics page:
- Analysed the way other admin pages are constructed as controllers and called through embedding in the admin.php page.
- Created a blank page using the same mechanism -- took a while to get that right.
- Used the model of the Users controller to create an HCMC Stats controller page, and tweaked it until it displayed correctly based on the same permissions as the User admin controller.
Files changed:
blogs/_header.php
blogs/conf/_admin.php
Next steps: figure out how to make db calls through the database object, which is based on ezsql (http://justinvincent.com/docs/ezsql/ez_sql_help.htm), and then start setting up a search form. We'll use AJAX to retrieve and display reports.
Created a system for checking the value of "Minutes worked" when submitting a post. If any category or subcategory with the name "Activity log" is selected, and yet the value of "Minutes worked" is NaN or less than 1, a warning pops up and the submission is prevented.
Created a new file:
blogs/rsc/js/hcmc_functions.js
Edited this file, to add a call to include the above:
blogs/inc/VIEW/_menutop.php
In the process of testing this, I noticed a persistent js error from one of the B2Evo files:
Error: first_form has no properties
Source File: http://tapor.uvic.ca/~hcmc/blogs/rsc/js/form_extensions.js
Line: 251
This should be looked at.
Stewart posting minutes worked in meeting with Martin and Greg as detailed in Martin's post.
Greg and I used this example to discuss more elegant ways of handling this situation:
1) allow person posting to include minutes worked for others in post or provide way for person B to edit post by person A to include minutes spent by person B
2) allow comments made by authenticated users to include minutes worked, so that a post like this one would instead be a comment
Had a long discussion with Stew, Greg and David, and latterly Scott, about how to handle a number of issues in our customization and usage of the blog tool. Outcomes:
- Tracking of CTO and vacation days will be carried out in a separate simple PHP/mySQL database that we build. Building it into the blog is going to be too complicated, while creating a dedicated tool shouldn't be too onerous. This might get going in the New Year.
- All projects worthy of the name will get their own blogs.
- All projects deemed by their owners/administrators to be moribund can be hidden using their property settings; the blog would still be accessible, e.g. via a link from the project home page, but it would not appear in the list of blogs on the blog site. Any project blog could be re-activated by unhiding it. This manual control is deemed preferable to any kind of system we could imagine for detecting moribundity algorithmically.
- All project blogs will have, at some level in their category system, at least one (possibly more) instance of each of the following: "Activity log", "Announcements", and "Tasks". These categories will all be distinct records in the db category table, but can nonetheless be used for filtering records for reports using the category names (hence they must be precisely as shown above).
- Any post which includes "Activity log" as one of its categories should include a value for "Minute worked". I need to find an efficient way of adding a check for that in the posting interface. This will be added as a task.
- Where necessary, an "Academic" category will be added to a project blog to accommodate conference presentations, authoring of papers, etc.
The following blogs will be added to handle more general and non-project work:
- Maint (already added): covers HW and SW maintenance and updating.
- Depts: will cover simple support for departments, website updates and so on.
- Admin: will cover bureaucratic work, general meetings, and so on.
The default view under any skin of a single blog did not provide any simple clear link to add a new post; it was necessary to scroll down the right menu to find an "Admin" entry, and then click on that to make a post. I trawled through the code to figure out how to do this, then added appropriate code (slightly different in different skins) to all of the _main.php skin files (not including the RSS feed skins).
Files changed:
blogs/skins/basic/_main.php
blogs/skins/bluesky/_main.php
blogs/skins/custom/_main.php
blogs/skins/guadeloupe/_main.php
blogs/skins/natural_pink/_main.php
blogs/skins/nifty_corners/_main.php
blogs/skins/originalb2/_main.php
blogs/skins/wpc_aubmach/_main.php
blogs/skins/wpc_default/_main.php
B2Evolution Customization Notes
All customizations are prefaced by comments thus:
MDH_Custom begin... [explanation]
and end with comments thus:
MDH_Custom end... [explanation]
Files changed so far:
blogs/a_noskin.php
blogs/inc/MODEL/items/_item.class.php
blogs/inc/MODEL/items/_itemlist.class.php
blogs/inc/VIEW/items/_browse_posts_exp.inc.php
blogs/inc/VIEW/items/_item.form.php
blogs/skins/_atom/_main.php
blogs/skins/_rdf/_main.php
blogs/skins/_rss/_main.php
blogs/skins/_rss2/_main.php
blogs/skins/basic/_main.php
blogs/skins/bluesky/_main.php
blogs/skins/custom/_main.php
blogs/skins/guadeloupe/_main.php
blogs/skins/natural_pink/_main.php
blogs/skins/nifty_corners/_main.php
blogs/skins/originalb2/_main.php
blogs/skins/wpc_aubmach/_main.php
blogs/skins/wpc_default/_main.php
blogs/plugins/_quicktags.plugin.php
1. Adding new custom tag generators to the toolbar:
The toolbar is created by the _quicktags.plugin.php file in the plugins folder. Each button is created by a call to a script function. NOTE: It seems that the shortcut key assignments don't work as advertised (e.g. Alt + W), but with an additional Shift (Alt + Shift + W).
2. Adding a "Minutes worked" field to the db and to the post interface:
DB:
The evo_posts table contains the fields which store individual posts. An integer field has been added to that table:
post_minutes_worked int(11) UNSIGNED No 0
PHP MODEL:
The blogs/inc/MODEL/items/_item_class.php file contains the item class definition which interfaces with the db.
The blogs/inc/MODEL/items/_itemlist.class.php handles lists of items.
New variables, functions and codeblocks have been added to both of these files modelled on the handling of item_priority, which is also an unsigned int(11) field. The only slight difference is that when priority is displayed, it has to be converted to a string value representing what a particular priority setting means (there are five options); our minutes_worked field is simpler, because we can simply output a number.
PHP VIEW:
The blogs/inc/VIEW/_item.form.php file implements the interface to the item class, and provides the form elements on the page. This has been modified in several places to create the necessary form field and label, and re-populate it when editing an existing post.
The blogs/inc/VIEW/items/_browse_posts_exp.inc.php file implements post browsing. This has again been modified to display the minutes worked value in the post header.
PHP SKINS etc.:
The blogs/a_noskin.php file outputs a simple representation of a list of posts. This has been modified to show the value of minutes worked in post headers.
The blogs/skins/*/_main.php file is the main template for each particular skin. Again, a modification has been added in each case to include minutes worked in post display. Modifications vary considerably; some files are outputting XHTML for the Web, others XML syndication feeds.
- Added a field to the db.
- Modified core item code to save and retrieve info from db.
- Modified several display files to make the values show up where they may be useful.
Remaining tasks:
- Finish the documentation.
-
Make a complete list of files which have been changed.
- Start looking at retrieving this data in useful ways via RSS.
This is a test to see if minutes worked is recorded (expecting everything to blow up).
It seems to work fine!
Right now there's this "Blog All" thing, which doesn't make much sense. There should be a basic HCMC blog that introduces us, links to the website and so on...
Posts which are designated as tasks can have priority, assignees, task status, and deadline. In the Task status drop-down, though, only "none" is available. We need a suitable set of values there.
Update:
We've set up three status levels: outstanding, completed and abandoned.
- Logged into the new B2Evolution blogging system set up by Greg.
- Created a blog for the Transformer project, and made several posts including two tasks.
- Everything seems to be working OK. At the moment, there are no task status values available in the Workflow properties; we need to figure out how to add these.
- 1
- 2