Skip to content

Commit

Permalink
Add UI and frontend code for adding Horde users as attendees.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Jul 13, 2016
1 parent 7c1b812 commit aee31ab
Show file tree
Hide file tree
Showing 13 changed files with 380 additions and 116 deletions.
13 changes: 13 additions & 0 deletions kronolith/attendees.php
Expand Up @@ -34,9 +34,22 @@
// Add new attendees and/or resources. Multiple attendees can be seperated
// on a single line by whitespace and/or commas. Resources are added one
// at a time (at least for now).
$newUser = trim(Horde_Util::getFormData('newUser'));
$newAttendees = trim(Horde_Util::getFormData('newAttendees'));
$newResource = trim(Horde_Util::getFormData('resourceselect'));

$user = $registry->convertUsername($newUser, true);
if (strlen($user)) {
$auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
if ($auth->hasCapability('list') && !$auth->exists($user)) {
$notification->push(sprintf(_("The user \"%s\" does not exist."), $user), 'horde.error');
} else {
$attendees->add(new Kronolith_Attendee(array(
'user' => $user,
'identities' => $injector->getInstance('Horde_Core_Factory_Identity')
)));
}
}
$newAttendees = Kronolith_Attendee_List::parse($newAttendees, $notification);
$session->set('kronolith', 'attendees', $attendees->add($newAttendees));

Expand Down
20 changes: 15 additions & 5 deletions kronolith/index.php
Expand Up @@ -90,26 +90,36 @@
$taskAlarmParams = substr($taskAlarmParams, 0, - 6) . '</div>';
}

$injector->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
$impleFactory = $injector->getInstance('Horde_Core_Factory_Imple');
$impleFactory->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
'box' => 'kronolithEventACBox',
'id' => 'kronolithEventTags',
'pretty' => true
));

$injector->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
$impleFactory->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
'box' => 'kronolithCalendarinternalACBox',
'id' => 'kronolithCalendarinternalTags',
'pretty' => true,
'triggerContainer' => 'kronolithACCalendarTriggerContainer'
));

$injector->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
$impleFactory->create('Kronolith_Ajax_Imple_TagAutoCompleter', array(
'box' => 'kronolithTaskACBox',
'id' => 'kronolithTaskTags',
'pretty' => true
));

$injector->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_ContactAutoCompleter', array(
$impleFactory->create('Kronolith_Ajax_Imple_UserAutoCompleter', array(
'box' => 'kronolithUsersACBox',
'displayFilter' => 'function(u) { return KronolithCore.parseUser(u).name; }',
'id' => 'kronolithEventUsers',
'onAdd' => 'function(u) { KronolithCore.addUser(u); KronolithCore.checkOrganizerAsAttendee(); }',
'onRemove' => 'KronolithCore.removeUser.bind(KronolithCore)',
'pretty' => true,
));

$impleFactory->create('Kronolith_Ajax_Imple_ContactAutoCompleter', array(
'box' => 'kronolithAttendeesACBox',
'id' => 'kronolithEventAttendees',
'onAdd' => 'function(a) { KronolithCore.addAttendee(a); KronolithCore.checkOrganizerAsAttendee(); }',
Expand All @@ -119,7 +129,7 @@
'beforeUpdate' => 'function(a) { return KronolithCore.normalizeAttendee(a); }'
));

$injector->getInstance('Horde_Core_Factory_Imple')->create('Kronolith_Ajax_Imple_ResourceAutoCompleter', array(
$impleFactory->create('Kronolith_Ajax_Imple_ResourceAutoCompleter', array(
'box' => 'kronolithResourceACBox',
'id' => 'kronolithEventResources',
'onAdd' => 'KronolithCore.addResource.bind(KronolithCore)',
Expand Down

0 comments on commit aee31ab

Please sign in to comment.