forked from extern/egroupware
Use calendar-owner widget in edit dialog for participants
This commit is contained in:
parent
58b7f38426
commit
32b4872084
@ -36,6 +36,7 @@ class calendar_owner_etemplate_widget extends etemplate_widget_taglist
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
|
||||
$value =& self::get_array(self::$request->content, $form_name);
|
||||
if(!is_array($value)) $value = array();
|
||||
if (!is_array(self::$request->sel_options[$form_name]))
|
||||
{
|
||||
self::$request->sel_options[$form_name] = array();
|
||||
@ -88,6 +89,30 @@ class calendar_owner_etemplate_widget extends etemplate_widget_taglist
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate input
|
||||
*
|
||||
* @param string $cname current namespace
|
||||
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
|
||||
* @param array $content
|
||||
* @param array &$validated=array() validated content
|
||||
*/
|
||||
public function validate($cname, array $expand, array $content, &$validated=array())
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
|
||||
if (!$this->is_readonly($cname, $form_name))
|
||||
{
|
||||
$value = $value_in =& self::get_array($content, $form_name);
|
||||
if(!is_array($value))
|
||||
{
|
||||
$value = Array($value);
|
||||
}
|
||||
|
||||
$valid =& self::get_array($validated, $form_name, true);
|
||||
$valid = $value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handle ajax searches for owner across all supported resources
|
||||
*
|
||||
|
@ -361,66 +361,58 @@ class calendar_uiforms extends calendar_ui
|
||||
case 'cal_resources':
|
||||
case 'status_date':
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
// email or rfc822 addresse (eg. "Ralf Becker <ralf@domain.com>") in the search field
|
||||
$matches = array();
|
||||
if (($email = $content['participants']['resource']['search']) &&
|
||||
(preg_match('/^(.*<)?([a-z0-9_.-]+@[a-z0-9_.-]{5,})>?$/i',$email,$matches)))
|
||||
{
|
||||
$status = calendar_so::combine_status('U',$content['participants']['quantity'],$content['participants']['role']);
|
||||
// check if email belongs to account or contact --> prefer them over just emails (if we are allowed to invite him)
|
||||
if (($data = $GLOBALS['egw']->accounts->name2id($matches[2],'account_email')) && $this->bo->check_acl_invite($data))
|
||||
case 'participant':
|
||||
foreach($data as $participant)
|
||||
{ // email or rfc822 addresse (eg. "Ralf Becker <ralf@domain.com>")
|
||||
$email = array();
|
||||
if(preg_match('/^(.*<)?([a-z0-9_.-]+@[a-z0-9_.-]{5,})>?$/i',$participant,$email))
|
||||
{
|
||||
$event['participants'][$data] = $event['participant_types']['u'][$data] = $status;
|
||||
}
|
||||
elseif ((list($data) = ExecMethod2('addressbook.addressbook_bo.search',array(
|
||||
'email' => $matches[2],
|
||||
'email_home' => $matches[2],
|
||||
),true,'','','',false,'OR')))
|
||||
{
|
||||
$event['participants']['c'.$data['id']] = $event['participant_types']['c'][$data['id']] = $status;
|
||||
$status = calendar_so::combine_status('U',$content['participants']['quantity'],$content['participants']['role']);
|
||||
if (($data = $GLOBALS['egw']->accounts->name2id($email[2],'account_email')) && $this->bo->check_acl_invite($data))
|
||||
{
|
||||
$event['participants'][$data] = $event['participant_types']['u'][$data] = $status;
|
||||
}
|
||||
elseif ((list($data) = ExecMethod2('addressbook.addressbook_bo.search',array(
|
||||
'email' => $email[2],
|
||||
'email_home' => $email[2],
|
||||
),true,'','','',false,'OR')))
|
||||
{
|
||||
$event['participants']['c'.$data['id']] = $event['participant_types']['c'][$data['id']] = $status;
|
||||
}
|
||||
else
|
||||
{
|
||||
$event['participants']['e'.$participant] = $event['participant_types']['e'][$participant] = $status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$event['participants']['e'.$email] = $event['participant_types']['e'][$email] = $status;
|
||||
}
|
||||
}
|
||||
elseif (!$content['participants']['account'] && !$content['participants']['resource'])
|
||||
{
|
||||
$msg = lang('You need to select an account, contact or resource first!');
|
||||
}
|
||||
break;
|
||||
if(is_numeric($participant))
|
||||
{
|
||||
$uid = 'u'.$participant;
|
||||
$id = $participant;
|
||||
$resource = $this->bo->resources[''];
|
||||
}
|
||||
else
|
||||
{
|
||||
$uid = $participant;
|
||||
$id = substr($participant,1);
|
||||
$resource = $this->bo->resources[$participant[0]];
|
||||
}
|
||||
if(!$this->bo->check_acl_invite($uid))
|
||||
{
|
||||
if(!$msg_permission_denied_added)
|
||||
{
|
||||
$msg .= lang('Permission denied!');
|
||||
$msg_permission_denied_added = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = $resource['type'];
|
||||
$status = isset($this->bo->resources[$type]['new_status']) ?
|
||||
ExecMethod($this->bo->resources[$type]['new_status'],$id) :
|
||||
($uid == $this->bo->user ? 'A' : 'U');
|
||||
|
||||
case 'resource':
|
||||
if (is_array($data)) // if $data['current'] is NOT set --> $app==''
|
||||
{
|
||||
list($app,$id) = explode(':',$data['current']);
|
||||
if(!$app && !$id)
|
||||
{
|
||||
$app = $data['app'];
|
||||
$id = $data['id'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list($app,$id) = explode(':',$data);
|
||||
}
|
||||
foreach($this->bo->resources as $type => $data)
|
||||
{
|
||||
if ($data['app'] == $app) break;
|
||||
}
|
||||
$uid = $this->bo->resources[$type]['app'] == $app ? $type.$id : false;
|
||||
if ($app == 'home-accounts')
|
||||
{
|
||||
$data = $id;
|
||||
}
|
||||
// check if new entry is no account (or contact entry of an account)
|
||||
elseif ($app != 'addressbook' || !($data = $GLOBALS['egw']->accounts->name2id($id,'person_id')) || !$this->bo->check_acl_invite($data))
|
||||
{
|
||||
if ($uid && $id)
|
||||
{
|
||||
$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
|
||||
if ($status)
|
||||
{
|
||||
$res_info = $this->bo->resource_info($uid);
|
||||
@ -432,6 +424,7 @@ class calendar_uiforms extends calendar_ui
|
||||
{
|
||||
$event['participants'][$n] = $content['participants'][$n];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -439,33 +432,13 @@ class calendar_uiforms extends calendar_ui
|
||||
calendar_so::combine_status($status,$content['participants']['quantity'],$content['participants']['role']);
|
||||
}
|
||||
}
|
||||
elseif(!$msg_permission_denied_added)
|
||||
{
|
||||
$msg .= lang('Permission denied!');
|
||||
$msg_permission_denied_added = true;
|
||||
}
|
||||
}
|
||||
// if participant is a contact and no title yet, add its link title as title
|
||||
if ($app == 'addressbook' && empty($event['title']))
|
||||
{
|
||||
$event['title'] = egw_link::title($app, substr($uid, 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
// fall-through for accounts entered as contact
|
||||
case 'account':
|
||||
foreach(is_array($data) ? $data : explode(',',$data) as $uid)
|
||||
break;
|
||||
case 'add':
|
||||
if (!$content['participants']['participant'])
|
||||
{
|
||||
if ($uid && $this->bo->check_acl_invite($uid))
|
||||
{
|
||||
$event['participants'][$uid] = $event['participant_types']['u'][$uid] =
|
||||
calendar_so::combine_status($uid == $this->bo->user ? 'A' : 'U',1,$content['participants']['role']);
|
||||
}
|
||||
elseif($uid && !$msg_permission_denied_added)
|
||||
{
|
||||
$msg .= lang('Permission denied!');
|
||||
$msg_permission_denied_added = true;
|
||||
}
|
||||
$msg = lang('You need to select an account, contact or resource first!');
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -75,8 +75,11 @@ var et2_calendar_owner = et2_taglist_email.extend(
|
||||
// with the group
|
||||
.on('load expand', function() {
|
||||
window.setTimeout(function() {
|
||||
widget.div.find('.ms-res-item-active')
|
||||
.removeClass('ms-res-item-active');
|
||||
if(widget && widget.div)
|
||||
{
|
||||
widget.div.find('.ms-res-item-active')
|
||||
.removeClass('ms-res-item-active');
|
||||
}
|
||||
},1);
|
||||
})
|
||||
|
||||
|
@ -107,20 +107,12 @@
|
||||
<description value="Add new participants or resource" span="all"/>
|
||||
</row>
|
||||
<row class="row optional" disabled="@no_add">
|
||||
<vbox span="2">
|
||||
<menulist>
|
||||
<menupopup type="select-account" statustext="User or group" id="account" multiple="true" no_lang="true" tags="true" account_type="both" empty_label="User or group" class="et2_fullWidth" width="99%"/>
|
||||
</menulist>
|
||||
<link-entry id="resource" options="@cal_resources" query="app.calendar.edit_participant_search"/>
|
||||
</vbox>
|
||||
<vbox span="2">
|
||||
<textbox type="integer" align="center" id="quantity" min="1" size="3"/>
|
||||
<menulist>
|
||||
<menupopup class="selectRole" id="role"/>
|
||||
</menulist>
|
||||
</vbox>
|
||||
<calendar-owner id="participant" allowFreeEntries="true" span="2"/>
|
||||
<textbox type="integer" align="center" id="quantity" min="1" size="3"/>
|
||||
<menulist>
|
||||
<menupopup class="selectRole" id="role"/>
|
||||
</menulist>
|
||||
<button align="center" label="Add" id="add" image="add" background_image="1" novalidate="1"/>
|
||||
<description/>
|
||||
</row>
|
||||
<row class="th gray">
|
||||
<description value="Type"/>
|
||||
|
@ -1747,43 +1747,6 @@ div.calendar {
|
||||
vertical-align: top;
|
||||
padding-top: 3px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody span.ui-icon-search {
|
||||
/*.background_color_10_gray;*/
|
||||
-webkit-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background-size: 16px 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-left: 3px;
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody span.ui-icon-search:hover {
|
||||
/*.background_color_20_gray;*/
|
||||
-webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
|
||||
-moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
|
||||
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
|
||||
border: 1px solid rgba(0, 0, 0, 0.5);
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody span.ui-icon-searchactive {
|
||||
/*.background_color_30_gray;*/
|
||||
border: 1px solid rgba(0, 0, 0, 0.9);
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
background-color: #1aa200;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody input#calendar-edit_quantity {
|
||||
width: 30px;
|
||||
/* position: relative;
|
||||
@ -1791,25 +1754,6 @@ div.calendar {
|
||||
left: 40px;*/
|
||||
margin: 6px 0px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody div#calendar-edit_resource {
|
||||
margin: 5px 0 10px 0;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody div#calendar-edit_resource select {
|
||||
margin-right: 3px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody select#calendar-edit_role {
|
||||
/*width: 30px;*/
|
||||
/* position: relative;
|
||||
top: 6px;
|
||||
left: -168px;*/
|
||||
width: 120px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-participants tbody #calendar-edit_add {
|
||||
position: relative;
|
||||
/*left: -145px;*/
|
||||
top: 31px;
|
||||
}
|
||||
#calendar-edit #calendar-edit_calendar-edit-recurrence tbody {
|
||||
display: table;
|
||||
width: 100%;
|
||||
|
@ -565,20 +565,6 @@ div.calendar { position: relative; }
|
||||
td {vertical-align: top; padding-top: 3px;}
|
||||
|
||||
|
||||
// Suchen Bild
|
||||
|
||||
span.ui-icon-search {
|
||||
.Complete_Button_Icon_normal;
|
||||
background-size: 16px 16px;
|
||||
.dimension_width_height_s;
|
||||
margin-left: 3px;
|
||||
position: relative;
|
||||
top: 4px;
|
||||
|
||||
&:hover {.Complete_Button_Icon_hover;}
|
||||
&active {.Complete_Button_Icon_active;}
|
||||
}
|
||||
|
||||
// Quantity
|
||||
input#calendar-edit_quantity {
|
||||
width: 30px;
|
||||
@ -589,36 +575,6 @@ div.calendar { position: relative; }
|
||||
|
||||
}
|
||||
|
||||
// Ressourcen
|
||||
|
||||
div#calendar-edit_resource {
|
||||
margin: 5px 0 10px 0;
|
||||
|
||||
select {margin-right: 3px;}
|
||||
}
|
||||
|
||||
|
||||
// Rolle
|
||||
|
||||
select#calendar-edit_role {
|
||||
/*width: 30px;*/
|
||||
/* position: relative;
|
||||
top: 6px;
|
||||
left: -168px;*/
|
||||
width: 120px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
// hinzufügen button
|
||||
|
||||
#calendar-edit_add {
|
||||
|
||||
position: relative;
|
||||
/*left: -145px;*/
|
||||
top: 31px;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Table
|
||||
|
Loading…
Reference in New Issue
Block a user