Really nice module - after I’d applied the amended code on Pg 2 of this thread, it worked straight out of the box. A few things I’ve come across:
1.
I’m having a bit of trouble with a TIMESTAMP field - because the DATE format in the module defaults to YYYY-MM-DD, it loses the time part - e.g.
is rewritten as
when that record is edited. I’m not entirely sure how the module is detecting the date format. Would it be an easy fix to make it recognise times as well as dates?
2. I’m finding if I use a select element for displaying with a query, it is using the returned columns in the opposite order from what is stated in the comments - e.g. instead of the example in record.edit.inc.php
select@SELECT value,caption,option_group from `cities` SORT option_group ASC
I need to order the columns as:
select@SELECT option_group,caption,value from `cities` SORT option_group ASC
3. I’ve added in a new type of display item - readonly. This is useful where you might want to display a value, but not allow the user to edit it. In record.edit.inc.php, above the line
I added:
case "readonly":
$tableRows .= "<input{$class} type=\"hidden\" name=\"fld_$fld\" value =\"".$row[$fld]."\" />".$row[$fld];
break;
4. I made the filter dropdown a little friendlier by using the set headings (instead of fieldname):
In records.list.records.inc.php, change:
if($props['use']) $select_fields[] = $fldname;
to
if($props['use']) $select_fields[$fldname] = $props['heading']? $props['heading']:$fldname;
and
<td><?php echo printSelectField( implode(',',$select_fields),$_REQUEST['dbe_fld'],'fldname' ); ?></td>
to
<td><?php echo printSelectField( $select_fields,$_REQUEST['dbe_fld'],'fldname' ); ?></td>
It would be nice if there was an option to only show those listed, but this doesn’t look straightforward.
5. I’ve made an advanced setting to choose whether to show the "add" button or not - this may be useful if you don’t want the user to be able to create new records. I changed:
<td><a class="searchtoolbarbtn" href="<?php echo $dbeHomeUrl; ?>&ra=insert"><img src="media/style/<?php echo $manager_theme; ?>images/icons/add.png" align="absmiddle" /> New Record</a></td>
to
<td><?php if (isset($dbConfig['settings']['hide_add']) && $dbConfig['settings']['hide_add']) { echo ' '; } else { ?> <a class="searchtoolbarbtn" href="<?php echo $dbeHomeUrl; ?>&ra=insert"><img src="media/style/<?php echo $manager_theme; ?>images/icons/add.png" align="absmiddle" /> New Record</a> <?php } ?></td>
And then adding the advanced setting:
hide_add --> true
6. I’ve swapped the contents of the H1 on every page for a configuration variable, to allow you to easily update the name of the module to make it more user friendly.
This requires the following adding to the configuration string:
&mod_name=Module name;string;dbEdit
7. Removed an excess <html> tag from header.inc.php
8. Added installation instructions (and the updated configuration string) to the readme.txt file
I’ve attached a version of the module with these changes made if anyone is interested / would like to continue development further. This was based on cipa’s version from yesterday, with the suggested amended file from pg2 of this thread.
Edit: Updated the zip file to fix a bug where my change 4 above did not work when applying custom SQL through an advanced setting.