Revision: 1376
http://mrbs.svn.sourceforge.net/mrbs/?rev=1376&view=rev
Author: cimorrison
Date: 2010-07-23 17:39:15 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Extended view_entry so that it can cope with the remaining types of custom
fields.
Modified Paths:
--------------
mrbs/branches/custom_entry_fields/web/lang.en
mrbs/branches/custom_entry_fields/web/view_entry.php
Modified: mrbs/branches/custom_entry_fields/web/lang.en
===================================================================
--- mrbs/branches/custom_entry_fields/web/lang.en 2010-07-23 15:17:49 UTC
(rev 1375)
+++ mrbs/branches/custom_entry_fields/web/lang.en 2010-07-23 17:39:15 UTC
(rev 1376)
@@ -121,6 +121,8 @@
$vocab["last_request"] = "Last request sent at"; // Used for the
title tooltip on More Info button
$vocab["by"] = "by"; // Used for the
title tooltip on More Info button
$vocab["sent_at"] = "Sent at ";
+$vocab["yes"] = "Yes";
+$vocab["no"] = "No";
// Used in edit_entry_handler.php
$vocab["error"] = "Error";
Modified: mrbs/branches/custom_entry_fields/web/view_entry.php
===================================================================
--- mrbs/branches/custom_entry_fields/web/view_entry.php 2010-07-23
15:17:49 UTC (rev 1375)
+++ mrbs/branches/custom_entry_fields/web/view_entry.php 2010-07-23
17:39:15 UTC (rev 1376)
@@ -481,28 +481,30 @@
{
$fields = sql_field_info($tbl_entry);
$field_natures = array();
+ $field_lengths = array();
foreach ($fields as $field)
{
$field_natures[$field['name']] = $field['nature'];
+ $field_lengths[$field['name']] = $field['length'];
}
foreach ($custom_fields as $key => $value)
{
- $desc = get_vocab("entry.$key");
- if (!isset($desc))
+ echo "<tr>\n";
+ echo "<td>" . get_loc_field_name($tbl_entry, $key) . ":</td>\n";
+ // Output a yes/no if it's a boolean or integer <= 2 bytes (which we will
+ // assume are intended to be booleans)
+ if (($field_natures[$key] == 'boolean') ||
+ (($field_natures[$key] == 'integer') && isset($field_lengths[$key])
&& ($field_lengths[$key] <= 2)) )
{
- $desc = htmlspecialchars($key);
+ $shown_value = empty($value) ? get_vocab("no") : get_vocab("yes");
}
- $shown_value = htmlspecialchars($value);
- if ($field_natures[$key] == 'integer')
+ // Otherwise output a string
+ else
{
- $shown_value = ($value == 0) ? get_vocab("YES") : get_vocab("NO");
+ $shown_value = (isset($value)) ? htmlspecialchars($value): " ";
}
- print "
- <tr>
- <td>$desc:</td>
- <td>$shown_value</td>
- </tr>
-";
+ echo "<td>$shown_value</td>\n";
+ echo "</tr>\n";
}
}
?>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits