Author: ggrekhov
Date: Mon May 28 10:29:17 2012
New Revision: 1343195
URL: http://svn.apache.org/viewvc?rev=1343195&view=rev
Log:
Add organizations rooms
Modified:
incubator/openmeetings/trunk/plugins/teambox/css/index.css
incubator/openmeetings/trunk/plugins/teambox/index.php
incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php
incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamBoxRestService.php
Modified: incubator/openmeetings/trunk/plugins/teambox/css/index.css
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/teambox/css/index.css?rev=1343195&r1=1343194&r2=1343195&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/teambox/css/index.css (original)
+++ incubator/openmeetings/trunk/plugins/teambox/css/index.css Mon May 28
10:29:17 2012
@@ -1,6 +1,20 @@
-.button-primary {
+.button-primary, .button-danger {
width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
+
+table {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+td {
+ text-align: center;
+ vertical-align: middle;
+ padding-left: 5px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ border-bottom: 1px solid grey;
+}
Modified: incubator/openmeetings/trunk/plugins/teambox/index.php
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/teambox/index.php?rev=1343195&r1=1343194&r2=1343195&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/teambox/index.php (original)
+++ incubator/openmeetings/trunk/plugins/teambox/index.php Mon May 28 10:29:17
2012
@@ -31,15 +31,14 @@ $token = getTeamBoxAccessToken();
$tbService = new TeamBoxRestService($token);
$account = $tbService->getAccountInfo();
$projects = $tbService->getUserProjects();
+$organizations = $tbService->getUserOrganizations();
$omService = new OpenMeetingsRestService();
$logged = $omService->loginAdmin();
if (!$logged) {
print 'OpenMeetings internal error. Ask your system administrator.';
exit(0);
-}
-
-$invitationsMap = $omService->getInvitationsMap($projects, $account);
+}
?>
@@ -54,13 +53,36 @@ $invitationsMap = $omService->getInvitat
<div style="text-align: center;">
<?php
-if (0 == count($invitationsMap)) {
- echo '<p>You do not participate in any project, so you can not enter any
project conference room</p>';
+if (0 == count($organizations)) {
+ echo '<p>You do not participate in any organization and project, so you
can not enter any conference room</p>';
} else {
- echo '<p>Please, choose the project which conference room you want to
enter:</p>';
- foreach ($invitationsMap as $project => $url) {
- echo '<p><a class="button button-primary"
href="'.$url.'"><span>'.$project.'</span></a></p>';
+ echo '<p>Please, choose the project or the organization which conference
room you want to enter:</p>';
+
+ echo '<table class="table-with-borders">';
+ echo '<tr>';
+ echo '<td>Organizations:</td>';
+ echo '<td>Projects:</td>';
+ echo '</tr>';
+
+ foreach ($organizations as $organization) {
+ $url = $omService->getInvitationForOrganization($organization,
$account);
+
+ echo '<tr>';
+ echo '<td>';
+ echo '<a class="button button-danger"
href="'.$url.'"><span>'.$organization->name.'</span></a>';
+ echo '</td>';
+
+ echo '<td>';
+ foreach ($projects as $project) {
+ if ($project->organization_id === $organization->id) {
+ $url = $omService->getInvitationForProject($organization,
$project, $account);
+ echo '<p><a class="button button-primary"
href="'.$url.'"><span>'.$project->name.'</span></a></p>';
+ }
+ }
+ echo '</td>';
+ echo '</tr>';
}
+ echo '</table>';
}
?>
Modified:
incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php?rev=1343195&r1=1343194&r2=1343195&view=diff
==============================================================================
---
incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php
(original)
+++
incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php
Mon May 28 10:29:17 2012
@@ -108,6 +108,54 @@ class OpenMeetingsRestService extends Re
return $ret;
}
+ public function getInvitationForProject($organization, $project, $account)
{
+ $projectId = $organization->id."_".$project->id;
+ $projectName = $organization->name."_".$project->name;
+
+ $url = $this->getInvitationUrl($projectId, $projectName, $account);
+ return $url;
+ }
+
+ public function getInvitationForOrganization($organization, $account) {
+ $url = $this->getInvitationUrl($organization->id, $organization->name,
$account);
+ return $url;
+ }
+
+ public function getInvitationUrl($id, $name, $account) {
+ $link = mysql_connect('localhost', $this->mysqlLogin,
$this->mysqlPassword);
+ if (!$link) {
+ die("Can't create a connection to the teambox databse");
+ }
+ $query = 'select roomId from '.$this->mysqlDatabse.'.ProjectRooms
where projectId = '.$id;
+ $result = mysql_query($query);
+
+ $createRoom = true;
+ if ($row = mysql_fetch_assoc($result)) {
+ $roomId = $row['roomId'];
+ $createRoom = false;
+ }
+ mysql_free_result($result);
+
+ if ($createRoom) {
+ $roomId = $this->createRoom($name);
+ if ($roomId < 0) {
+ die("Can't create a room: ".$name);
+ }
+ $query = 'insert into '.$this->mysqlDatabse.'.ProjectRooms
values('.$id.', '.$roomId.')';
+ mysql_query($query);
+ }
+
+ $hash = $this->getRoomHash($roomId, $account);
+ if ($hash < 0) {
+ die("Can't create a secure hash: ".$name);
+ }
+
+ $url = $this->omHashUrl.$hash;
+
+ mysql_close($link);
+ return $url;
+ }
+
public function createRoom($name) {
$request = $this->restApiUrl."RoomService/addRoomWithModeration?"
."SID=".$this->sessionId
Modified:
incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamBoxRestService.php
URL:
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamBoxRestService.php?rev=1343195&r1=1343194&r2=1343195&view=diff
==============================================================================
---
incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamBoxRestService.php
(original)
+++
incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamBoxRestService.php
Mon May 28 10:29:17 2012
@@ -63,6 +63,15 @@ class TeamBoxRestService extends RestSer
return $data;
}
+ public function getUserOrganizations() {
+ $url = $this->restApiUrl . 'organizations';
+ $parameters = 'access_token=' . $this->accessToken;
+ $response = $this->call($url, $parameters, 'GET');
+ $data = $this->getJsonMultiData($response);
+
+ return $data;
+ }
+
private function getJsonSingleData($response) {
if (!($content = strstr($response, '{'))) {
$content = null;