1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

admin UI - 'ip' type added (decode to human readable format on read/edit, encode before DB save)

This commit is contained in:
secretr 2009-11-09 12:23:45 +00:00
parent 026c834c76
commit 6b77edb970
3 changed files with 26 additions and 8 deletions

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $
| $Revision: 1.15 $
| $Date: 2009-11-08 12:08:23 $
| $Author: e107coders $
| $Revision: 1.16 $
| $Date: 2009-11-09 12:23:45 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
require_once("../class2.php");
@ -88,7 +88,7 @@ class comments_admin_ui extends e_admin_ui
'user_name' => array('title'=> "System user", 'type' => 'text', 'width' => 'auto', 'table' => 'user', 'noedit' => true), // User name
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_ip' => array('title'=> "IP", 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
'comment_ip' => array('title'=> "IP", 'type' => 'ip', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ), // No real vetting
'comment_lock' => array('title'=> "Lock", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'),
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')

View File

@ -2257,6 +2257,13 @@ class e_admin_ui extends e_admin_controller_ui
$data[$key] = e107::getDateConvert()->toTime($data[$key], 'input');
}
break;
case 'ip': // TODO - ask Steve if this check is required
if(strpos($data[$key], '.') !== FALSE)
{
$data[$key] = e107::getInstance()->ipEncode($data[$key]);
}
var_dump($data[$key]);
//more to come
}
}
@ -3169,7 +3176,8 @@ class e_admin_ui_dummy extends e_form
* 5. date convert needs string-to-datestamp auto parsing, strptime() is the solution but needs support for
* Windows and PHP < 5.1.0 - build custom strptime() function (php_compatibility_handler.php) on this -
* http://sauron.lionel.free.fr/?page=php_lib_strptime (bad license so no copy/paste is allowed!)
* 6. $fields[parms] mess - fix it, separate list/edit mode parms somehow
* 6. [DONE - read/writeParms introduced ] $fields[parms] mess - fix it, separate list/edit mode parms somehow
* 7. clean up/document all object vars (e_admin_ui, e_admin_dispatcher)
* 8. clean up/document all parameters (get/setParm()) in controller and model classes
* 9. [DONE] 'ip' field type - convert to human readable format while showing/editing record
*/

View File

@ -9,9 +9,9 @@
* Form Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.73 $
* $Date: 2009-11-09 10:52:18 $
* $Author: e107coders $
* $Revision: 1.74 $
* $Date: 2009-11-09 12:23:44 $
* $Author: secretr $
*
*/
@ -1032,6 +1032,12 @@ class e_form
// else same
break;
case 'ip':
$e107 = e107::getInstance();
$value = $e107->ipDecode($value);
// else same
break;
case 'dropdown':
case 'text':
if(vartrue($parms['truncate']))
@ -1172,6 +1178,10 @@ class e_form
return vartrue($parms['pre']).$this->text($key, $value, $maxlength, $parms).vartrue($parms['post']);
break;
case 'ip':
return $this->text($key, e107::getInstance()->ipDecode($value), 32, $parms);
break;
case 'url':
case 'text':
$maxlength = vartrue($parms['maxlength'], 255);