mirror of
https://github.com/e107inc/e107.git
synced 2025-08-21 05:41:58 +02:00
Newspost administration - work in progres (news cats ready);
overall administration area improvements; iconpicker shortcode, iconpicker e_form method; new Ajax#toggleUpdate, Ajax#scUpdate methods; old icons removal
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 2009-01-15 15:42:24 $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 2009-01-16 17:57:56 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
@@ -78,6 +78,24 @@ class e_form
|
||||
return "<input type='text' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
|
||||
}
|
||||
|
||||
function iconpicker($name, $default, $label, $sc_parameters = '', $ajax = true)
|
||||
{
|
||||
$e107 = &e107::getInstance();
|
||||
$id = $this->name2id($name);
|
||||
$sc_parameters .= '&id='.$id;
|
||||
$jsfunc = $ajax ? "e107Ajax.toggleUpdate('{$id}-iconpicker', '{$id}-iconpicker-cn', 'sc:iconpicker=".urlencode($sc_parameters)."', '{$id}-iconpicker-ajax', { overlayElement: '{$id}-iconpicker-button' })" : "e107Helper.toggle('{$id}-iconpicker')";
|
||||
$ret = $this->text($name, $default).$this->admin_button($name.'-iconpicker-button', $label, 'action', '', array('other' => "onclick=\"{$jsfunc}\""));
|
||||
$ret .= "
|
||||
<div id='{$id}-iconpicker' class='e-hideme'>
|
||||
<div class='expand-container' id='{$id}-iconpicker-cn'>
|
||||
".(!$ajax ? $e107->tp->parseTemplate('{ICONPICKER='.$sc_parameters.'}') : '')."
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function file($name, $options = array())
|
||||
{
|
||||
$options = $this->format_options('file', $name, $options);
|
||||
@@ -320,14 +338,14 @@ class e_form
|
||||
* @param string $id_value value for attribute id passed with the option array
|
||||
* @param string $name the name attribute passed to that field
|
||||
* @param unknown_type $value the value attribute passed to that field
|
||||
* @return unknown
|
||||
* @return string formatted id attribute
|
||||
*/
|
||||
function _format_id($id_value, $name, $value = '', $return_attribute = 'id')
|
||||
{
|
||||
if($id_value === false) return '';
|
||||
|
||||
//format data first
|
||||
$name = rtrim(str_replace(array('[]', '[', ']', '_'), array('-', '-', '', '-'), $name), '-');
|
||||
$name = $this->name2id($name);
|
||||
$value = trim(preg_replace('#[^a-z0-9\-]/i#','-', $value), '-');
|
||||
|
||||
if(!$id_value && is_numeric($value)) $id_value = $value;
|
||||
@@ -337,6 +355,11 @@ class e_form
|
||||
else return " {$return_attribute}='{$id_value}'";
|
||||
}
|
||||
|
||||
function name2id($name)
|
||||
{
|
||||
return rtrim(str_replace(array('[]', '[', ']', '_'), array('-', '-', '', '-'), $name), '-');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format options based on the field type,
|
||||
|
Reference in New Issue
Block a user