From: Michael J. Rubinsky Date: Thu, 20 Aug 2009 23:13:36 +0000 (-0400) Subject: Some ideas on feeling out a UI for administration...some of this will likely change X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b5382cbf825a3e75d48c01bb20423f18f3d6581e;p=horde.git Some ideas on feeling out a UI for administration...some of this will likely change --- diff --git a/kronolith/attendees.php b/kronolith/attendees.php index 9c28a9e9d..d48314b5f 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -263,6 +263,10 @@ $vfb_html = $attendee_view->render($date); $cac = Horde_Ajax_Imple::factory(array('kronolith', 'ContactAutoCompleter'), array('triggerId' => 'newAttendees')); $cac->attach(); +// TODO - actually implement this part +$rac = Horde_Ajax_Imple::factory(array('kronolith', 'ContactAutoCompleter'), array('triggerId' => 'newResources')); +$rac->attach(); + $title = _("Edit attendees"); require KRONOLITH_TEMPLATES . '/common-header.inc'; $notification->notify(array('listeners' => 'status')); diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index 6a86da808..26754337a 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -765,9 +765,9 @@ class Kronolith_Driver_Sql extends Kronolith_Driver */ public function saveResource($resource) { - if (!empty($resource->uid)) { + if (!empty($resource->id)) { $query = 'UPDATE kronolith_resources SET resource_name = ?, resource_calendar = ?, resource_category = ? WHERE resource_id = ?'; - $values = array($resource->name, $resource->calendar_id, $resource->category, $resource->uid); + $values = array($resource->name, $resource->calendar, $resource->category, $resource->id); $result = $this->_write_db->query($query, $values); if (!($result instanceof PEAR_Error)) { throw new Horde_Exception($result->getMessage()); @@ -776,7 +776,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $query = 'INSERT INTO kronolith_resources (resource_id, resource_name, resource_calendar, resource_category)'; $cols_values = ' VALUES (?, ?, ?, ?)'; $id = $this->_db->nextId('kronolity_resources'); - $values = array($id, $resource->name, $resource->calendar_id, $resource->category); + $values = array($id, $resource->name, $resource->calendar, $resource->category); $result = $this->_write_db->query($query . $cols_values, $values); if (!($result instanceof PEAR_Error)) { return true; diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index a27350151..ea204b806 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -740,6 +740,8 @@ class Kronolith if (!in_array($calendarId, $GLOBALS['display_external_calendars'])) { $GLOBALS['display_external_calendars'][] = $calendarId; } + } elseif (strncmp($calendarId, 'resource_', 9) === 0) { + $resource_cal = $calendarId; } else { if (!in_array($calendarId, $GLOBALS['display_calendars'])) { $GLOBALS['display_calendars'][] = $calendarId; @@ -788,6 +790,10 @@ class Kronolith } } +// if (!empty($resource_cal)) { +// $GLOBALS['display_calendars'][] = $resource_cal; +// } + /* Make sure all the remote calendars still exist. */ $_temp = $GLOBALS['display_remote_calendars']; $GLOBALS['display_remote_calendars'] = array(); diff --git a/kronolith/lib/Resource.php b/kronolith/lib/Resource.php index d67d09538..5257f7771 100644 --- a/kronolith/lib/Resource.php +++ b/kronolith/lib/Resource.php @@ -50,8 +50,8 @@ class Kronolith_Resource static public function addResource($resource) { // Create a new calendar id. - $calendar = hash('md5', microtime()); - $resource->calendar_id = $calendar; + $calendar = 'resource_' . hash('md5', microtime()); + $resource->calendar = $calendar; if (empty(self::$_driver)) { self::$_driver = Kronolith::getDriver('Sql'); @@ -80,12 +80,9 @@ class Kronolith_Resource static public function isResourceCalendar($calendar) { - if (empty(self::$_driver)) { - self::$_driver = Kronolith::getDriver('Sql'); + if (strncmp($calendar, 'resource_', 9) === 0) { + return true; } - $resource = self::$_driver->getResourceIdByCalendar($calendar); - - return $resource > 0; } } \ No newline at end of file diff --git a/kronolith/resources.php b/kronolith/resources.php index a8cc38a52..e8b45bd82 100644 --- a/kronolith/resources.php +++ b/kronolith/resources.php @@ -9,20 +9,20 @@ $title = _("Edit resources"); require KRONOLITH_TEMPLATES . '/common-header.inc'; /* Test creating a new resource */ -$new = array('name' => _("N329SP"), - 'category' => 'test'); - +//$new = array('name' => _("Big Meeting Room"), +// 'category' => 'conference rooms'); +// //$resource = new Kronolith_Resource_Single($new); //$results = Kronolith_Resource::addResource($resource); //var_dump($results); /* Test adding resource to event */ -//$resource = Kronolith_Resource::getResource(6); -//$driver = Kronolith::getDriver('Sql'); -//$event = $driver->getByUID('20090730102515.90466g7f034lxucc@localhost'); -//$event->addResource($resource, Kronolith::RESPONSE_NONE); -//$event->save(); -// +$resource = Kronolith_Resource::getResource(9); +$driver = Kronolith::getDriver('Sql'); +$event = $driver->getByUID('20090820100656.66097kphc3ecwf8k@localhost'); +$event->addResource($resource, Kronolith::RESPONSE_NONE); +$event->save(); + //var_dump($resource->getFreeBusy(null, null, true)); /* Test listing resources */ diff --git a/kronolith/templates/attendees/attendees.inc b/kronolith/templates/attendees/attendees.inc index 203ab20bc..3a615bdb6 100644 --- a/kronolith/templates/attendees/attendees.inc +++ b/kronolith/templates/attendees/attendees.inc @@ -81,7 +81,7 @@ function switchDateView(view, date)   - + @@ -91,7 +91,7 @@ function switchDateView(view, date) getImageDir('horde')) . ' ' . Horde::img('edit.png', '', null, $registry->getImageDir('horde')) . ' ' ?> - + + @@ -110,6 +111,7 @@ function switchDateView(view, date)
+ + + + + + +hasMethod('contacts/search')): ?> + + + + +
  @@ -122,6 +124,21 @@ function switchDateView(view, date)  
  + /> + +
+