mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
admin UI tools: add model data fields when parsing callbacks results; imagepreview/imageselector SC minor improvements
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
// $Id: imagepreview.sc,v 1.2 2008-12-17 17:27:07 secretr Exp $
|
// $Id: imagepreview.sc,v 1.3 2009-11-18 09:32:31 secretr Exp $
|
||||||
global $e107;
|
global $e107;
|
||||||
|
|
||||||
list($name, $width, $height) = explode("|",$parm, 3);
|
list($name, $width, $height) = explode("|",$parm, 3);
|
||||||
@@ -11,9 +11,8 @@ if(varset($width))
|
|||||||
}
|
}
|
||||||
if(varset($height))
|
if(varset($height))
|
||||||
{
|
{
|
||||||
$height = " width: {$height};";
|
$height = " height: {$height};";
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = (varset($_POST[$name]) && defsettrue('e_AJAX_REQUEST')) ? $e107->tp->replaceConstants($_POST[$name], 'full') : e_IMAGE_ABS."generic/blank.gif";
|
$path = (varset($_POST[$name]) && defsettrue('e_AJAX_REQUEST')) ? $e107->tp->replaceConstants($_POST[$name], 'full') : e_IMAGE_ABS."generic/blank.gif";
|
||||||
|
return "<a href='{$path}' rel='external' class='e-image-preview'><img src='{$path}' alt=\"\" class='image-selector' style='{$width}{$height}' /></a>";
|
||||||
return "<img src='{$path}' alt=\"\" class='image-selector' style='{$width}{$height}' />";
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
// $Id: imageselector.sc,v 1.9 2009-01-16 17:57:56 secretr Exp $
|
// $Id: imageselector.sc,v 1.10 2009-11-18 09:32:31 secretr Exp $
|
||||||
//FIXME - full rewrite, backward compatible
|
//FIXME - full rewrite, backward compatible
|
||||||
global $sql,$parm,$tp;
|
global $sql,$parm,$tp;
|
||||||
|
|
||||||
if(strstr($parm,"="))
|
if(strstr($parm,"="))
|
||||||
{ // query style parms.
|
{ // query style parms.
|
||||||
parse_str($parm, $tmp);
|
parse_str($parm, $parms);
|
||||||
extract($tmp);
|
extract($parms);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // comma separated parms.
|
{ // comma separated parms.
|
||||||
@@ -17,7 +17,7 @@ $paths = explode("|",$path);
|
|||||||
|
|
||||||
if(trim($default[0])=="{")
|
if(trim($default[0])=="{")
|
||||||
{
|
{
|
||||||
$pvw_default = $tp->replaceConstants($default);
|
$pvw_default = $tp->replaceConstants($default, 'abs');
|
||||||
$path = ""; // remove the default path if a constant is used.
|
$path = ""; // remove the default path if a constant is used.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +92,7 @@ if(!$pvw_default)
|
|||||||
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
|
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$text .= "<div class='imgselector-container' id='{$name}_prev'>";
|
$text .= "<div class='imgselector-container' id='{$name}_prev'>";
|
||||||
if(varset($click_target))
|
if(varset($click_target))
|
||||||
{
|
{
|
||||||
@@ -99,11 +100,14 @@ if(varset($click_target))
|
|||||||
$post = varset($click_postfix);
|
$post = varset($click_postfix);
|
||||||
$text .= "<a href='#' onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name}\").value+\"{$post}\", true);document.getElementById(\"{$name}\").selectedIndex = -1;return false;'>";
|
$text .= "<a href='#' onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name}\").value+\"{$post}\", true);document.getElementById(\"{$name}\").selectedIndex = -1;return false;'>";
|
||||||
}
|
}
|
||||||
$text .= "<img src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />";
|
else
|
||||||
if(varset($click_target))
|
|
||||||
{
|
{
|
||||||
$text .= "</a>";
|
$text .= "<a href='{$pvw_default}' rel='external' class='e-image-preview'>";
|
||||||
}
|
}
|
||||||
|
if(vartrue($height)) $height = "height:{$height}";
|
||||||
|
if(vartrue($width)) $width = "width:{$width}; ";
|
||||||
|
$text .= "<img src='{$pvw_default}' alt='' style='{$width}{$height}' /></a>";
|
||||||
|
|
||||||
$text .= "</div>\n";
|
$text .= "</div>\n";
|
||||||
|
|
||||||
return "\n\n<!-- Start Image Selector [{$scaction}] -->\n\n".$text."\n\n<!-- End Image Selector [{$scaction}] -->\n\n";
|
return "\n\n<!-- Start Image Selector [{$scaction}] -->\n\n".$text."\n\n<!-- End Image Selector [{$scaction}] -->\n\n";
|
@@ -9,9 +9,9 @@
|
|||||||
* Administration UI handlers, admin helper functions
|
* Administration UI handlers, admin helper functions
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/admin_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/admin_handler.php,v $
|
||||||
* $Revision: 1.31 $
|
* $Revision: 1.32 $
|
||||||
* $Date: 2009-11-18 07:16:42 $
|
* $Date: 2009-11-18 09:32:31 $
|
||||||
* $Author: e107coders $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -2112,6 +2112,26 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $field
|
||||||
|
* @param string $key attribute name
|
||||||
|
* @param mixed $value default value if not set, default is null
|
||||||
|
* @return mixed FIXME
|
||||||
|
*/
|
||||||
|
public function setFieldAttr($field, $key = null, $default = null)
|
||||||
|
{
|
||||||
|
if(isset($this->fields[$field]))
|
||||||
|
{
|
||||||
|
if(null !== $key)
|
||||||
|
{
|
||||||
|
return isset($this->fields[$field][$key]) ? $this->fields[$field][$key] : $default;
|
||||||
|
}
|
||||||
|
return $this->fields[$field];
|
||||||
|
}
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get fields stored as user preferences
|
* Get fields stored as user preferences
|
||||||
* @return array
|
* @return array
|
||||||
@@ -2865,6 +2885,14 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
}
|
}
|
||||||
if($data && is_array($data))
|
if($data && is_array($data))
|
||||||
{
|
{
|
||||||
|
// add to model data fields array if required
|
||||||
|
foreach ($data as $f => $val)
|
||||||
|
{
|
||||||
|
if($this->getFieldAttr($f, 'data'))
|
||||||
|
{
|
||||||
|
$model->setDataField($f, $this->getFieldAttr($f, 'data'));
|
||||||
|
}
|
||||||
|
}
|
||||||
$_posted = array_merge($_posted, $data);
|
$_posted = array_merge($_posted, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* e107 Base Model
|
* e107 Base Model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||||
* $Revision: 1.40 $
|
* $Revision: 1.41 $
|
||||||
* $Date: 2009-11-18 01:04:43 $
|
* $Date: 2009-11-18 09:32:31 $
|
||||||
* $Author: e107coders $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -140,6 +140,16 @@ class e_model
|
|||||||
$this->_data_fields = $data_fields;
|
$this->_data_fields = $data_fields;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Predefined data field
|
||||||
|
* @return e_model
|
||||||
|
*/
|
||||||
|
public function setDataField($field, $type)
|
||||||
|
{
|
||||||
|
$this->_data_fields[$field] = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set name of object's field id
|
* Set name of object's field id
|
||||||
|
Reference in New Issue
Block a user