A new config setting in BlueBox2.0 allows for bespoke handling of 'page not found' errors.
This is not to be confused with traditional server-side 404 errors, and only applies to /?page_name allocations withing the BB2.0 database templates engine.
In this case, if you wanted to create a new BB2.0 'page' in the template engine, this would be assigned a page_name.page title in the database templates module. To access your page you would use '/?page_name' and this would then call the page commands contained therein.
Up till recently, if page_name.page did not exist, the fail-over response in BB2 was to attempt to load /?class=page_name and if that failed it would revert to /? (the home page).
So, this new setting, found in the config file (admin->config) is called $system_default_no_page_found, and it take a setting as a string with the class_name:method_name to run in the event that /?some_url is not verified using the above 2 standard methods.
For example, you could set it to run 'bb_come_class:some_method' and it would be invoked as such.
This new approach is very handy in 'url friendly' sites where you want the user to be interpreted based on it's contents. So a user like '/?Run Report One' would then be able to be parsed and run a specific report, or '/?plumbers_in_london' could be parsed to show filtered results.
Sunday, February 24, 2013
Saturday, January 28, 2012
New Deduplication Tool in BlueBox2.0
BlueBox2.0 Database Module now includes a new data deduplication tool to assist in scrubbing out annoying duplicate entries.
The new tool can be found in the Database Tools list in Admin->Database and works a follows:
The new tool can be found in the Database Tools list in Admin->Database and works a follows:
- Select the class/module that requires cleansing (ie bb_users)
- Then select the fields that together or separately identify the duplicates (ie company_name and street_zipcode will find all users where the company_name and the street_zipcode are the same).
- You can also filter the results for a certain range, select how many to show and opt for 'and' or 'or' selectivity.
- When the duplicate entries in the database are displayed to you they are clustered in 'groups' and you can then select the entry in each group to keep, and thereby specify which entries to have deleted from the database. Entries that are an exact match are shown in in red to highlight severe duplications.
- Finally the system will process your requests and delete the duplicated entries, but most helpfully, it will also run through every table in the database and substitute the newly deleted entries with the correct entry you have chosen to keep, so that all your related data is automatically cleansed in the process.
Saturday, January 21, 2012
Reading and Writing Data from an Excel File into BlueBox2.0
Today I will be explaining a very simple technique for reading and writing data in Excel files (xls) for use with the BlueBox2.0 platform, but this concept is generically valuable to any PHP/MySQL developer.
The Scenario:
This technique will be specifically useful for anyone who uses offline spreadsheets (xls/Excel) and wants to use these to show data from their BlueBox2.0 system in real time, and even more excitingly, wants to be able to enter/change data into their spreadsheet and have it automatically populate their BlueBox2.0 system in real time.
The Overview:
In essence what I am describing here is a simple web-query that is uploaded into a cell in your spreadsheet with a pre-defined query built into it. This query is set up to request a result from your BlueBox2.0 system. In the case of a read-only requirement, the result will be shown in the cell. In the case where you want data sent to the BlueBox2.0 system the query sends the value of another cell as part of the query, which is then processed on the server and the result is sent back to show in the cell.
For this to be most useful, I am building an example which sends data to the server, but in essence the only difference is that in the URL below you would simply leave out the bit in square-brackets.
The Ingredients:
To get this technique to work you will need the following:
Once you have the above 2 files set up, you can then open a new or existing excel spreadsheet and go to Data->Existing Connections->Browse for More. Select the .iqy file from your desktop.
You will then be asked to select the target cell for the response, and after that you will be challenged for the cell position where the script must load the value for ["my value"]. Once you have specified these 2 cells it will store the info and your cell will be automated to read/write to and from your BlueBox2.0 system.
Making it automatic:
When you are in the final stages of specify which cell to load the data from (above) you will see some checkboxes. make sure to select the 'Refresh automatically when cell value changes' option.
The Scenario:
This technique will be specifically useful for anyone who uses offline spreadsheets (xls/Excel) and wants to use these to show data from their BlueBox2.0 system in real time, and even more excitingly, wants to be able to enter/change data into their spreadsheet and have it automatically populate their BlueBox2.0 system in real time.
The Overview:
In essence what I am describing here is a simple web-query that is uploaded into a cell in your spreadsheet with a pre-defined query built into it. This query is set up to request a result from your BlueBox2.0 system. In the case of a read-only requirement, the result will be shown in the cell. In the case where you want data sent to the BlueBox2.0 system the query sends the value of another cell as part of the query, which is then processed on the server and the result is sent back to show in the cell.
For this to be most useful, I am building an example which sends data to the server, but in essence the only difference is that in the URL below you would simply leave out the bit in square-brackets.
The Ingredients:
To get this technique to work you will need the following:
- A notepad/text file on your desktop in the following format, with 3 lines, saved with the extension of .iqy
WEB
1
http://www.yourdomain.com/?&class=bb_some_class&method=some_method&global_noincludes=rawtext&global_value=["my value"]
Notes: Even though there seems to be 4 lines in my example, make sure that your notepad file is not breaking the 3rd line, as it should be one continuous line. Also: I have specifically used the new global_noincludes=rawtext option above as opposed to the usual global[noincludes]=rawtext because the URL in an iqy file cannot include square-brackets other than those specifying dynamic variables. For the same reason the value is passed as global_value and not global[value] etc. - A BlueBox2.0 PHP class/method file set up in your system to receive the message, which would look something like this
class bb_some_class extends baseclass{
var $bbsetting_module_name="Some Class Name";
var $bbsetting_skip_permissions=array("all");
function some_method($conf=NULL){
global $global,$global_value;
resp("I got $global_value from Excel!");
}
}
Notes: make sure you declare your bespoke global variables for this method (ie global_value etc) as these are not passing through the normal global[] name space. I also set bbsetting_skip_permissions to 'all' so that Excel can access this function easily, but this is a security concern. In a live version of this script you should add a client-side key and check the key in PHP before processing any data.
Once you have the above 2 files set up, you can then open a new or existing excel spreadsheet and go to Data->Existing Connections->Browse for More. Select the .iqy file from your desktop.
You will then be asked to select the target cell for the response, and after that you will be challenged for the cell position where the script must load the value for ["my value"]. Once you have specified these 2 cells it will store the info and your cell will be automated to read/write to and from your BlueBox2.0 system.
Making it automatic:
When you are in the final stages of specify which cell to load the data from (above) you will see some checkboxes. make sure to select the 'Refresh automatically when cell value changes' option.
Friday, January 13, 2012
Draggable and Resizable Objects in BlueBox2.0
This week I want to share a new LGPL library we have used in a few BlueBox2.0 projects, by Angus Turnbull, TwinHelix Designs, http://www.twinhelix.com.
The use of this new function is to allow certain elements in your pages to be draggable and resizeable.
The small javascript library/function is called dragresize() and we have formalised it into BlueBox2.0 as follows:
To load it in your page, simply call the function inline with one of your print/resp statements as follows:
The important bits here are:
This example prints a floating box to the screen which, when clicked renders eight handles which allow you to resize the box, revealing less or more of the background image.
Currently our implementation of dragresize is for resizing only, and will only allow you to specify one set of parameters for the page. However, you can set an unlimited number of elements as class=drsElement, which will make them all resizeable.
The use of this new function is to allow certain elements in your pages to be draggable and resizeable.
The small javascript library/function is called dragresize() and we have formalised it into BlueBox2.0 as follows:
To load it in your page, simply call the function inline with one of your print/resp statements as follows:
resp("
" . dragresize("drag_me",0,0,0,0,2000,2000) . "
<div class=drsElement style=\"position:absolute;top:200;left:200;background:silver;width:400;height:400;\">
<div style=\"overflow:auto;width:100%;height:100%;\">
<img src=http://www.blueboxonline.com/portal/img/2011/banners/jpegs/Specific-Product-Focused.jpg>
</div>
</div>
");
The important bits here are:
- dragresize("drag_me",0,0,0,0,2000,2000) where the 'drag_me' is a future-placeholder for scalability when this function will work for specified objects on the page, currently no used, but required. The numbers following that are max-width, max-height, left-threshold, top-threshold, right-threshold, and bottom-threshold.
- and, all elements which you want resizable must be set with class=drsElement (for now, until we get the function to isolate to certain objects.)
- and finally, the elements which are resizable must be set with style-position of absolute or relative.
Currently our implementation of dragresize is for resizing only, and will only allow you to specify one set of parameters for the page. However, you can set an unlimited number of elements as class=drsElement, which will make them all resizeable.
Saturday, January 7, 2012
BlueBox2.0 Surveys
Tucked away in the Publishing->WebTools menu is our original BlueBox Surveys module. This has recently been upgraded as follows:
- Link a surveys to any data in the BlueBox2.0 System:
Using a new feature in the survey header data, you can specify whether to link it to another class/module in BB2.0. This allows you to capture surveys or data segments against other data elements in the system, ie: you could capture a customer satisfaction survey against certain sales orders or even against each customer file in the system. - Create a survey and publish the direct-link using new encrypted survey id
Surveys are now referred to via their long-id (a 32 character encrypted ID). This means that you can publish direct links to various surveys on your website or in emails and have members of the public submit data directly into the system securely. - Control survey look and feel via CSS
A new CSS template which determines that look of each element of the survey can be accessed by editing survey_css.template in the database templates module. - Survey dashboard
The survey dashboard allows you quick access to survey results as well as direct links to each survey. You can also add/edit survey data via this dashboard. - Survey reporting
You can report on survey data in detailed or summary view off the new survey dashboard.
Wednesday, November 9, 2011
More Bespoke Plugins for BB2.0 : Controlling Fields
For PHP developers there are many ways in which you can control and manipulate the outcomes of system processes within BlueBox2.0. One of these is via our plugins architecture.
The newest feature in this regard is the ability to intercept and control fields and the way they display in forms as well as other outputs (ie views and viewlists).
Interception can take place at 3 levels for form-fields and for displaying variable values.
The newest feature in this regard is the ability to intercept and control fields and the way they display in forms as well as other outputs (ie views and viewlists).
Interception can take place at 3 levels for form-fields and for displaying variable values.
- Level 1: Global level - whenever the variable is 'called' it will look to your new method to render it to the engine.
- Level 2: Class/variable level - whenever the variable is called from forms within a specified class it will look to your new method to render it to the engine.
- Level 3: Field level - specified using a naming syntax within the variable name, your method will only be called when your specific custom named variable is called.
- For Form Fields:
- Within the BB2 Forms Engine we have a function which renders form-fields to the GUI engine. At it's simplest form it can be called with a BB2.0 Tag like this:
<!--:formfield:variable_name:--> - These new plugins essentially hi-jack the process that is invoked by this tag and allow you to determine what form-field element/s get rendered to the GUI when this variable is called
- To change the form-field globally for a variable name (ie cashbookISbb_finance_cashbooksID) you can use the class->method call within bb_plugins.php. To do this you will need a bb_plugins.php file in your custom_modules folder and then you will need to name/format your function as follows:
function formfield_cashbookISbb_finance_cashbooksID($conf=NULL){
//the value of $conf is an array with useful data in it
//most notably $conf[default] which is the current value, if any, for this variable
//for the full array simply resp_r($conf) at this point...
return("
<input
id=global[fields][cashbookISbb_finance_cashbooksID]
name=global[fields][cashbookISbb_finance_cashbooksID]
value='$conf[default]'
>");
}
In the above example you can see that you need to return a string with a form element in it, but this can be any combination of html, javascript, etc instructions. Basically, wherever this variable is called through the forms engine, this will be sent back to the form as the 'field'. - For a specific class/variable combination by using a bbsetting, namely bbsetting_field_display_formfield_plugins. This can be set within a PHP file as follows:
var $bbsetting_field_display_formfield_plugins=array("field_name"=>"method_to_call");
or it can be set using the Admin>Module Settings functionality by entering the field=>method pairs separated by commas ie:
field_name=method_name,
field_name2=method_name2,
You can set multiple field=>method values within this array. The 'method' can then sit within the bb_plugins class or the parent class where the bbsetting has been set, either place will work. The method can be styled exactly as per the function example above. So, just to drive the point home, in this instance, if the bbsetting was set in the bb_finance_cashbook_entries class, then only when forms within that class are rendering the cashbookISbb_finance_cashbooksID will this form-field override take effect. - On an ad-hoc basis within the variable/field name itself, by using the variable naming syntax as follows : variable_nameISPLUGIN_method_name. This behaves exactly as per the second example above, whereby it looks for the method within the bb_plugins class or, if it can detect a current related class to the variable, within the current class. The method can be styled exactly as per the function example above.
- Within the BB2 Forms Engine we have a function which renders form-fields to the GUI engine. At it's simplest form it can be called with a BB2.0 Tag like this:
- For Field Value Display:
- Within the BB2 GUI engine we have a function called item_display_value. This takes an input in the form of an array which specifies the variable name to display and any possible value/s for it. The function then determines how to render the variable/value to the GUI engine.
- These new plugin options essentially hi-jack this process and override the renderer with your bespoke method.
- To change the form-field globally for a variable name (ie cashbookISbb_finance_cashbooksID)
you can use the class->method call within bb_plugins.php. To do this
you will need a bb_plugins.php file in your custom_modules folder and
then you will need to name/format your function as follows:
function item_display_value_cashbookISbb_finance_cashbooksID($conf=NULL){
//the value of $conf is an array with useful data in it
//most notably $conf[1] which is the current value, if any, for this variable
//for the full array simply resp_r($conf) at this point...
return($conf[1]);
}
In the above example you can see that you need to return a string with the value as you want it represented in it, but this can be any combination of html, javascript, etcas required. Basically, wherever this variable is called through the GUI engine, this will be sent back as the value/output.
- For a specific class/variable combination by using a bbsetting,
namely bbsetting_field_display_plugins. This can be set
within a PHP file as follows:
var $bbsetting_field_display_plugins=array("field_name"=>"method_to_call");
or it can be set using the Admin>Module Settings functionality by entering the field=>method pairs separated by commas ie:
field_name=method_name,
field_name2=method_name2,
You can set multiple field=>method values within this array. The 'method' can then sit within the bb_plugins class or the parent class where the bbsetting has been set, either place will work. The method can be styled exactly as per the function example above. So, just to drive the point home, in this instance, if the bbsetting was set in the bb_finance_cashbook_entries class, then only when forms within that class are rendering the cashbookISbb_finance_cashbooksID will this form-field override take effect.
- On an ad-hoc basis within the variable name itself, by using the variable naming syntax of variable_nameISPLUGIN_method_name. This behaves exactly as per the second example above, whereby it looks for the method within the bb_plugins class or, if it can detect a current related class to the variable, within the current class. The method can be styled exactly as per the function example above.
Sunday, November 6, 2011
Better Visibility of Inventory Overallocation in BlueBox2.0
BlueBox2.0 has wonderful
inventory visibility and control features. These include a detailed
inventory report which shows inventory in real time, specifying it's
location, allocation status etc.
A new addition to this report is the visibility of whether an item allocated to a document in the system is over-allocated or not. The appearance of a red ! will indicate that the system thinks the item is over-allocated and you are then able to click through to the parent document for further info.
Following on from this, our 'Release Stock' function has also had an upgrade in that it now allows filtering for only those items which are over-allocated, and will indicate in a normal listing of items to release, which it thinks are over-allocated.
Both new features will assist Inventory Controllers as they go about their day-to-day tasks, making finding and releasing over-allocated stock as simple a a few clicks of the mouse.
A new addition to this report is the visibility of whether an item allocated to a document in the system is over-allocated or not. The appearance of a red ! will indicate that the system thinks the item is over-allocated and you are then able to click through to the parent document for further info.
Following on from this, our 'Release Stock' function has also had an upgrade in that it now allows filtering for only those items which are over-allocated, and will indicate in a normal listing of items to release, which it thinks are over-allocated.
Both new features will assist Inventory Controllers as they go about their day-to-day tasks, making finding and releasing over-allocated stock as simple a a few clicks of the mouse.
Subscribe to:
Posts (Atom)
