You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by gg...@apache.org on 2012/07/13 07:04:26 UTC

svn commit: r1361050 - in /incubator/openmeetings/trunk/plugins/teambox: TeamboxUtils.php index.php rest_lib/OpenMeetingsRestService.php rest_lib/TeamboxUtils.php

Author: ggrekhov
Date: Fri Jul 13 05:04:25 2012
New Revision: 1361050

URL: http://svn.apache.org/viewvc?rev=1361050&view=rev
Log:
Teambox: add internationalization

Added:
    incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamboxUtils.php
Removed:
    incubator/openmeetings/trunk/plugins/teambox/TeamboxUtils.php
Modified:
    incubator/openmeetings/trunk/plugins/teambox/index.php
    incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php

Modified: incubator/openmeetings/trunk/plugins/teambox/index.php
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/teambox/index.php?rev=1361050&r1=1361049&r2=1361050&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/teambox/index.php (original)
+++ incubator/openmeetings/trunk/plugins/teambox/index.php Fri Jul 13 05:04:25 2012
@@ -24,8 +24,8 @@ $CFG = parse_ini_file('config/settings.i
 
 require_once('rest_lib/TeamBoxRestService.php');
 require_once('rest_lib/OpenMeetingsRestService.php');
+require_once('rest_lib/TeamboxUtils.php');
 require_once('oauthLogin.php');
-require_once('TeamboxUtils.php');
 
 $token = getTeamBoxAccessToken();
 

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=1361050&r1=1361049&r2=1361050&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php (original)
+++ incubator/openmeetings/trunk/plugins/teambox/rest_lib/OpenMeetingsRestService.php Fri Jul 13 05:04:25 2012
@@ -20,6 +20,7 @@
 */
 
 require_once('RestService.php');
+require_once('TeamboxUtils.php');
 
 class OpenMeetingsRestService extends RestService {
     
@@ -150,7 +151,8 @@ class OpenMeetingsRestService extends Re
             die("Can't create a secure hash: ".$name);
         }
 
-        $url = $this->omHashUrl.$hash;
+        $langId = getLanguageId($account->locale);
+        $url = $this->omHashUrl.$hash.'&language='.$langId;
     
         mysql_close($link);
         return $url;

Added: incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamboxUtils.php
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamboxUtils.php?rev=1361050&view=auto
==============================================================================
--- incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamboxUtils.php (added)
+++ incubator/openmeetings/trunk/plugins/teambox/rest_lib/TeamboxUtils.php Fri Jul 13 05:04:25 2012
@@ -0,0 +1,83 @@
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function isArchivedProject($project) {
+    if (null == $project->archived) {
+        return false;
+    } else {
+        return $project->archived;
+    }
+}
+
+function getFilteredOrganizationProjects($organization, $projects) {
+    $result = array();
+    foreach ($projects as $project) {
+        if (isArchivedProject($project)) {
+            continue;
+        }
+        if ($project->organization_id === $organization->id) {
+            $idx = strtoupper($project->name . $project->id);
+            $result[$idx] = $project;
+        }
+    }
+
+    ksort($result);
+    return $result;
+}
+
+function getSortedOrganizations($organizations) {
+    $result = array();
+    foreach ($organizations as $org) {
+        $idx = strtoupper($org->name . $org->id);
+        $result[$idx] = $org;
+    }
+
+    ksort($result);
+    return $result;
+}
+
+function getLanguageId($lang) {
+    $languages = array(
+        'ar'     => 14,
+        'bt'     => 1,
+        'ca'     => 29,
+        'de'     => 2,
+        'en'     => 1,
+        'es'     => 8,
+        'fr'     => 4,
+        'it'     => 5,
+        'ko'     => 13,
+        'pl'     => 25,
+        'pt-BR'  => 7,
+        'ru'     => 9,
+        'si'     => 1,
+        'tr'     => 18,
+        'zh'     => 22
+    );
+
+    if (array_key_exists($lang, $languages)) {
+        return $languages[$lang];
+    } else {
+        return 0;
+    }
+}
+
+?>