mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
got select entry custom fields honor required flag and select entry widget show required input with inputRequired css class
This commit is contained in:
parent
3cf986a5df
commit
3f35a9c3f3
@ -594,14 +594,12 @@ class boetemplate extends soetemplate
|
||||
*/
|
||||
static function set_array(&$arr,$idx,$val)
|
||||
{
|
||||
if (!is_array($arr))
|
||||
{
|
||||
throw new egw_exception_assertion_failed(__METHOD__."(\$arr,'$idx','$val') \$arr is no array!");
|
||||
}
|
||||
$idxs = explode('[',str_replace(']','',$idx));
|
||||
$pos = &$arr;
|
||||
foreach($idxs as $idx)
|
||||
{
|
||||
if (!is_array($pos) && !is_null($pos)) return; // gives fatal error under PHP5.3
|
||||
|
||||
$pos = &$pos[$idx];
|
||||
}
|
||||
$pos = $val;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* All widgets here have 2+ comma-separated options ($cell[size]):
|
||||
* - sub-type to display only the cf's without subtype or with a matching one
|
||||
* - use-private to display only (non-)private cf's (0=regular ones, 1=private ones, default both)
|
||||
* - field-name to display only the named custom field(s). Use ! before to display all but given field(s).
|
||||
* - field-name to display only the named custom field(s). Use ! before to display all but given field(s).
|
||||
* Additional fields can be added with a comma between them
|
||||
*
|
||||
* Private cf's the user has no right to see (neither him nor his memberships are mentioned) are never displayed.
|
||||
@ -94,7 +94,20 @@ class customfields_widget
|
||||
$this->advanced_search = $GLOBALS['egw_info']['etemplate']['advanced_search'];
|
||||
}
|
||||
|
||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
/**
|
||||
* pre-processing of the extension
|
||||
*
|
||||
* This function is called before the extension gets rendered
|
||||
*
|
||||
* @param string $form_name form-name of the control
|
||||
* @param mixed &$value value / existing content, can be modified
|
||||
* @param array &$cell array with the widget, can be modified for ui-independent widgets
|
||||
* @param array &$readonlys names of widgets as key, to be made readonly
|
||||
* @param mixed &$extension_data data the extension can store persisten between pre- and post-process
|
||||
* @param etemplate &$tmpl reference to the template we belong too
|
||||
* @return boolean true if extra label is allowed, false otherwise
|
||||
*/
|
||||
function pre_process($form_name,&$value,&$cell,&$readonlys,&$extension_data,etemplate $tmpl)
|
||||
{
|
||||
list($app) = explode('.',$tmpl->name);
|
||||
if ($this->appname == 'etemplate' || !$this->customfields || // if we are in the etemplate editor or the app has no cf's, load the cf's from the app the tpl belongs too
|
||||
@ -126,7 +139,7 @@ class customfields_widget
|
||||
}
|
||||
|
||||
// Remove filtered fields
|
||||
if($field_filter && (!$negate_field_filter && !in_array($key, $field_filter) ||
|
||||
if($field_filter && (!$negate_field_filter && !in_array($key, $field_filter) ||
|
||||
$negate_field_filter && in_array($key, $field_filter)))
|
||||
{
|
||||
unset($fields[$key]);
|
||||
@ -139,6 +152,7 @@ class customfields_widget
|
||||
$fields = array($name => $fields[$name]);
|
||||
$value = array($this->prefix.$name => $value);
|
||||
$singlefield = true;
|
||||
$form_name = substr($form_name,0,-strlen("[$this->prefix$name]"));
|
||||
}
|
||||
switch($type = $cell['type'])
|
||||
{
|
||||
@ -422,6 +436,8 @@ class customfields_widget
|
||||
$input =& etemplate::empty_cell('link-entry',$this->prefix.$lname,array(
|
||||
'size' => $field['type'] == 'link-entry' ? '' : $field['type'],
|
||||
));
|
||||
// register post-processing of link widget to get eg. needed/required validation
|
||||
etemplate::$request->set_to_process(etemplate::form_name($form_name,$this->prefix.$lname), 'ext-link');
|
||||
}
|
||||
$cell['data'][0]['c'.$n++] = $row_class.',top';
|
||||
|
||||
@ -429,7 +445,7 @@ class customfields_widget
|
||||
{
|
||||
if ($readonly) $input['readonly'] = true;
|
||||
|
||||
if ($cell['needed']) $input['needed'] = $cell['needed'];
|
||||
$input['needed'] = $cell['needed'] || $field['needed'];
|
||||
|
||||
if (!empty($field['help']) && $row_class != 'th')
|
||||
{
|
||||
|
@ -419,6 +419,7 @@ class link_widget
|
||||
(count($options) == 1 ? lang($app) : lang('Search')),
|
||||
'extra' => $cell['onchange'] ? ','.self::AJAX_NEED_ONCHANGE : null, // store flang for ajax_search, to display extra_line required by onchange
|
||||
);
|
||||
if ($cell['needed']) $value['class'] = 'inputRequired';
|
||||
|
||||
if ($options) // limit the app-selectbox to the given apps
|
||||
{
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application etemplate
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2010-05-11 14:15
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage setup
|
||||
* @version $Id$
|
||||
*/
|
||||
* EGroupware - eTemplates for Application etemplate
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2011-05-18 11:39
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage setup
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
$templ_version=1;
|
||||
|
||||
@ -125,7 +125,7 @@ $templ_data[] = array('name' => 'etemplate.link_widget.attach','template' => '',
|
||||
|
||||
$templ_data[] = array('name' => 'etemplate.link_widget.create','template' => '','lang' => '','group' => '0','version' => '0.9.15.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:6:"row_on";s:2:"c2";s:7:"row_off";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:3:"app";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:2:"id";s:4:"help";s:28:"Select an entry to link with";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Link";s:4:"name";s:6:"create";s:4:"help";s:29:"click here to create the Link";}s:1:"D";a:4:{s:4:"type";s:6:"button";s:5:"label";s:10:"New search";s:4:"name";s:3:"new";s:4:"help";s:36:"start a new search, cancel this link";}}i:2;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Comment";}s:1:"B";a:5:{s:4:"type";s:4:"text";s:4:"size";s:5:"50,50";s:4:"span";s:3:"all";s:4:"name";s:6:"remark";s:4:"help";s:28:"optional note about the Link";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:4;}}','size' => '','style' => '','modified' => '1035043515',);
|
||||
|
||||
$templ_data[] = array('name' => 'etemplate.link_widget.entry','template' => '','lang' => '','group' => '0','version' => '1.7.002','data' => 'a:1:{i:0;a:7:{s:4:"type";s:3:"box";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"2";i:1;a:8:{s:4:"type";s:3:"box";s:4:"size";s:6:"4,,0,0";i:1;a:4:{s:4:"name";s:3:"app";s:4:"help";s:28:"Select application to search";s:4:"type";s:9:"link-apps";s:8:"onchange";s:177:"xajax_doXMLHTTP(\'etemplate.link_widget.ajax_get_types\',document.getElementById(form::name(\'app\')).value,form::name(\'link_type\'),this.form.etemplate_exec_id.value); return false;";}i:2;a:5:{s:4:"type";s:3:"box";s:4:"name";s:8:"type_box";s:4:"size";s:1:"1";i:1;a:3:{s:4:"type";s:6:"select";s:4:"name";s:9:"link_type";s:4:"help";s:51:"Search only selected record type in the application";}s:4:"span";s:10:",type_hide";}s:4:"span";s:11:",box_inline";s:4:"name";s:11:"search_line";i:3;a:4:{s:4:"type";s:4:"text";s:4:"name";s:5:"query";s:4:"blur";s:5:"@blur";s:4:"size";s:6:"@extra";}i:4;a:5:{s:4:"type";s:6:"button";s:4:"name";s:6:"search";s:5:"label";s:1:">";s:4:"help";s:30:"Click here to start the search";s:7:"onclick";s:345:"xajax_doXMLHTTP(\'etemplate.link_widget.ajax_search\',document.getElementById(form::name(\'app\')).value,document.getElementById(form::name(\'link_type\')).value,document.getElementById(form::name(\'query\')).value,form::name(\'id\'),form::name(\'search_line\'),form::name(\'select_line\'),form::name(\'query\'),this.form.etemplate_exec_id.value); return false;";}}i:2;a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"span";s:22:",link_select link_hide";i:1;a:4:{s:4:"type";s:6:"select";s:4:"name";s:2:"id";s:8:"onchange";s:254:"if (this.value == \'\') { document.getElementById(form::name(\'search_line\')).style.display=\'inline\'; document.getElementById(form::name(\'select_line\')).style.display=\'none\';} else if (this.options[0].value == \' \' || this.value == 0) { this.form.submit(); }";s:7:"no_lang";s:1:"1";}s:4:"name";s:11:"select_line";}}}','size' => '','style' => '.link_hide { display: none; }
|
||||
$templ_data[] = array('name' => 'etemplate.link_widget.entry','template' => '','lang' => '','group' => '0','version' => '1.7.002','data' => 'a:1:{i:0;a:8:{s:4:"type";s:3:"box";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"2";i:1;a:8:{s:4:"type";s:3:"box";s:4:"size";s:6:"4,,0,0";i:1;a:4:{s:4:"name";s:3:"app";s:4:"help";s:28:"Select application to search";s:4:"type";s:9:"link-apps";s:8:"onchange";s:177:"xajax_doXMLHTTP(\'etemplate.link_widget.ajax_get_types\',document.getElementById(form::name(\'app\')).value,form::name(\'link_type\'),this.form.etemplate_exec_id.value); return false;";}i:2;a:5:{s:4:"type";s:3:"box";s:4:"name";s:8:"type_box";s:4:"size";s:1:"1";i:1;a:3:{s:4:"type";s:6:"select";s:4:"name";s:9:"link_type";s:4:"help";s:51:"Search only selected record type in the application";}s:4:"span";s:10:",type_hide";}s:4:"span";s:11:",box_inline";s:4:"name";s:11:"search_line";i:3;a:4:{s:4:"type";s:4:"text";s:4:"name";s:5:"query";s:4:"blur";s:5:"@blur";s:4:"size";s:6:"@extra";}i:4;a:5:{s:4:"type";s:6:"button";s:4:"name";s:6:"search";s:5:"label";s:1:">";s:4:"help";s:30:"Click here to start the search";s:7:"onclick";s:345:"xajax_doXMLHTTP(\'etemplate.link_widget.ajax_search\',document.getElementById(form::name(\'app\')).value,document.getElementById(form::name(\'link_type\')).value,document.getElementById(form::name(\'query\')).value,form::name(\'id\'),form::name(\'search_line\'),form::name(\'select_line\'),form::name(\'query\'),this.form.etemplate_exec_id.value); return false;";}}i:2;a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"span";s:22:",link_select link_hide";i:1;a:4:{s:4:"type";s:6:"select";s:4:"name";s:2:"id";s:8:"onchange";s:254:"if (this.value == \'\') { document.getElementById(form::name(\'search_line\')).style.display=\'inline\'; document.getElementById(form::name(\'select_line\')).style.display=\'none\';} else if (this.options[0].value == \' \' || this.value == 0) { this.form.submit(); }";s:7:"no_lang";s:1:"1";}s:4:"name";s:11:"select_line";}s:4:"span";s:7:",@class";}}','size' => '','style' => '.link_hide { display: none; }
|
||||
.type_hide { display: none;}
|
||||
.type_show { display: inline;}','modified' => '1258396333',);
|
||||
|
||||
|
@ -1,22 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="etemplate.link_widget.entry" template="" lang="" group="0" version="1.3.001">
|
||||
<box rows="1" cols="1">
|
||||
<box options="0,0" class="box_inline" id="search_line">
|
||||
<link-apps id="app" statustext="Select application to search"/>
|
||||
<textbox id="query" blur="Search"/>
|
||||
<button id="search" label=">" statustext="Click here to start the search" onclick="xajax_doXMLHTTP('etemplate.link_widget.ajax_search',document.getElementById(form::name('app')).value,document.getElementById(form::name('query')).value,form::name('id'),form::name('search_line'),form::name('select_line'),form::name('query')); return false;"/>
|
||||
<template id="etemplate.link_widget.entry" template="" lang="" group="0" version="1.7.002">
|
||||
<box cols="1" rows="1" class="@class">
|
||||
<box id="search_line" options="0,0" class="box_inline">
|
||||
<link-apps statustext="Select application to search" id="app" onchange="xajax_doXMLHTTP('etemplate.link_widget.ajax_get_types',document.getElementById(form::name('app')).value,form::name('link_type'),this.form.etemplate_exec_id.value); return false;"/>
|
||||
<box id="type_box" class="type_hide">
|
||||
<menulist>
|
||||
<menupopup statustext="Search only selected record type in the application" id="link_type"/>
|
||||
</menulist>
|
||||
</box>
|
||||
<textbox blur="@blur" id="query" size="@extra"/>
|
||||
<button statustext="Click here to start the search" label=">" id="search" onclick="xajax_doXMLHTTP('etemplate.link_widget.ajax_search',document.getElementById(form::name('app')).value,document.getElementById(form::name('link_type')).value,document.getElementById(form::name('query')).value,form::name('id'),form::name('search_line'),form::name('select_line'),form::name('query'),this.form.etemplate_exec_id.value); return false;"/>
|
||||
</box>
|
||||
<box class="link_select link_hide" id="select_line">
|
||||
<box id="select_line" class="link_select link_hide">
|
||||
<menulist>
|
||||
<menupopup id="id" onchange="if (!this.value) { document.getElementById(form::name('search_line')).style.display='inline'; document.getElementById(form::name('select_line')).style.display='none';}" no_lang="1"/>
|
||||
<menupopup id="id" no_lang="1" onchange="if (this.value == '') { document.getElementById(form::name('search_line')).style.display='inline'; document.getElementById(form::name('select_line')).style.display='none';} else if (this.options[0].value == ' ' || this.value == 0) { this.form.submit(); }"/>
|
||||
</menulist>
|
||||
</box>
|
||||
</box>
|
||||
<styles>
|
||||
.link_hide { display: none; }
|
||||
|
||||
.link_hide { display: none; }
|
||||
.type_hide { display: none;}
|
||||
.type_show { display: inline;}
|
||||
</styles>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user