Author: eschwert
Date: Wed Mar 14 14:58:43 2012
New Revision: 1300577

URL: http://svn.apache.org/viewvc?rev=1300577&view=rev
Log:
OPENMEETINGS-82 Confluence Macro for adding room links to pages.

Added:
    
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/OpenMeetingsMacro.java
      - copied, changed from r1298811, 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ExampleMacro.java
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/myBrowserField.js
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/tutorial-macro.vm
Removed:
    
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ExampleMacro.java
Modified:
    incubator/openmeetings/branches/confluence-plugin/LICENSE.TXT
    incubator/openmeetings/branches/confluence-plugin/pom.xml
    
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java
    
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm
    
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm
    
incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java
    
incubator/openmeetings/branches/confluence-plugin/target/openmeetingsconfluence-1.0-SNAPSHOT.jar

Modified: incubator/openmeetings/branches/confluence-plugin/LICENSE.TXT
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/LICENSE.TXT?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/LICENSE.TXT (original)
+++ incubator/openmeetings/branches/confluence-plugin/LICENSE.TXT Wed Mar 14 
14:58:43 2012
@@ -1,6 +1,11 @@
-To avoid future confusion, we recommend that you include a license with your 
plugin.
-This file is simply a reminder.
+       Licensed 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
 
-For a template license you can have a look at: 
http://www.opensource.org/licenses/
+       http://www.apache.org/licenses/LICENSE-2.0
 
-Atlassian releases most of its modules under a BSD license: 
http://www.opensource.org/licenses/bsd-license.php
+   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.
\ No newline at end of file

Modified: incubator/openmeetings/branches/confluence-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/pom.xml?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/pom.xml (original)
+++ incubator/openmeetings/branches/confluence-plugin/pom.xml Wed Mar 14 
14:58:43 2012
@@ -10,8 +10,8 @@
     <version>1.0-SNAPSHOT</version>
 
     <organization>
-        <name>Example Company</name>
-        <url>http://www.example.com/</url>
+        <name>Eugen Schwert</name>
+        <url>http://www.e-schwert.de</url>
     </organization>
 
     <name>openmeetingsconfluence</name>

Copied: 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/OpenMeetingsMacro.java
 (from r1298811, 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ExampleMacro.java)
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/OpenMeetingsMacro.java?p2=incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/OpenMeetingsMacro.java&p1=incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ExampleMacro.java&r1=1298811&r2=1300577&rev=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ExampleMacro.java
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/OpenMeetingsMacro.java
 Wed Mar 14 14:58:43 2012
@@ -1,38 +1,64 @@
+/*
+ * 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.
+ */
 package com.openmeetings.confluence.plugins;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.Map;
 import java.util.List;
 import java.util.Iterator;
 
 import com.atlassian.renderer.RenderContext;
 import com.atlassian.renderer.v2.macro.BaseMacro;
+import com.atlassian.renderer.v2.macro.Macro;
 import com.atlassian.renderer.v2.macro.MacroException;
 import com.atlassian.renderer.v2.RenderMode;
 import com.atlassian.confluence.pages.PageManager;
 import com.atlassian.confluence.pages.Page;
+import com.atlassian.confluence.setup.settings.SettingsManager;
 import com.atlassian.confluence.spaces.SpaceManager;
 import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
 import com.atlassian.user.User;
+import com.openmeetings.confluence.plugins.ao.omrooms.Room;
+import com.openmeetings.confluence.plugins.ao.omrooms.RoomService;
 import com.opensymphony.util.TextUtils;
+import com.atlassian.confluence.renderer.PageContext;
 
 /**
  * This very simple macro shows you the very basic use-case of displaying 
*something* on the Confluence page where it is used.
  * Use this example macro to toy around, and then quickly move on to the next 
example - this macro doesn't
  * really show you all the fun stuff you can do with Confluence.
  */
-public class ExampleMacro extends BaseMacro
+public class OpenMeetingsMacro extends BaseMacro
 {
 
-    // We just have to define the variables and the setters, then Spring 
injects the correct objects for us to use. Simple and efficient.
-    // You just need to know *what* you want to inject and use.
-
     private final PageManager pageManager;
     private final SpaceManager spaceManager;
+    private final SettingsManager settingsManager;
+    private final RoomService roomService;
 
-    public ExampleMacro(PageManager pageManager, SpaceManager spaceManager)
+    public OpenMeetingsMacro(PageManager pageManager, SpaceManager 
spaceManager, SettingsManager settingsManager, RoomService roomService)
     {
         this.pageManager = pageManager;
         this.spaceManager = spaceManager;
+        this.settingsManager = settingsManager;
+        this.roomService = checkNotNull(roomService);
     }
 
     public boolean isInline()
@@ -52,46 +78,70 @@ public class ExampleMacro extends BaseMa
 
     /**
      * This method returns XHTML to be displayed on the page that uses this 
macro
-     * we just do random stuff here, trying to show how you can access the 
most basic
-     * managers and model objects. No emphasis is put on beauty of code nor on
-     * doing actually useful things :-)
+     * 
      */
     public String execute(Map params, String body, RenderContext renderContext)
             throws MacroException
     {
 
-        // in this most simple example, we build the result in memory, 
appending HTML code to it at will.
-        // this is something you absolutely don't want to do once you start 
writing plugins for real. Refer
-        // to the next example for better ways to render content.
+    
         StringBuffer result = new StringBuffer();
 
-        // get the currently logged in user and display his name
-        User user = AuthenticatedUserThreadLocal.getUser();
-        if (user != null)
+        
+       if (params.containsKey("room_id"))
         {
-            String greeting = "Hello " + 
TextUtils.htmlEncode(user.getFullName()) + "<br><br>";
-            result.append(greeting);
+                        Page page = pageManager.getPage(((PageContext) 
renderContext).getEntity().getId());
+                        String pageCreatorName = "";
+                        List<Room> rooms = null;
+                        
+                        if(page != null){
+                                pageCreatorName =      page.getCreatorName();
+                                rooms =  
roomService.allNotDeletedByUserName(pageCreatorName);
+                                 
+                        }else{
+                                
+                                User user = 
AuthenticatedUserThreadLocal.getUser();
+                                pageCreatorName = user.getName();
+                                rooms =  
roomService.allNotDeletedByUserName(pageCreatorName);
+                        }
+                
+               //List<Room> rooms =  
roomService.allNotDeletedByUserName(pageCreatorName);
+               
+               Integer roomid = 
Integer.valueOf(params.get("room_id").toString());
+               
+               //Room roomInParam = roomService.getRoom(roomid);
+               
+               String roomLink = "";
+               
+               for (Room room : rooms) {
+                       if(room.getRoomId() == (long)roomid){
+                               roomLink =  "<a href=" + 
settingsManager.getGlobalSettings().getBaseUrl()+"/plugins/servlet/openmeetingsrooms?enter=y&roomId="
 + roomid + ">Link to Web-Conference</a>";
+                               result.append(roomLink);
+                       }
+               }
+               
+               if(roomLink == ""){
+                       roomLink =  "<span class='error'>Room not 
avaliable!</span>";             
+                result.append(roomLink);
+               }
+               
+//             if(rooms.contains(roomInParam)){
+//                     String roomLink =  "<a href=" + 
settingsManager.getGlobalSettings().getBaseUrl()+"/plugins/servlet/openmeetingsrooms?enter=y&roomId="
 + roomid + ">Link to Web-Conference</a>";
+//                
+//                result.append(roomLink);
+//             
+//             }else{
+//
+//             String roomLink =  "Room not avaliable!";
+//                
+//                result.append(roomLink);
+//             }
+//             
         }
-
-        //get the pages added in the last 55 days to the DS space ("Demo 
Space"), and display them
-        List list = pageManager.getRecentlyAddedPages(55, "DS");
-        result.append("Some stats for the Demo space: <br> ");
-        for (Iterator i = list.iterator(); i.hasNext();)
-        {
-            Page page = (Page) i.next();
-            int numberOfChildren = page.getChildren().size();
-            String pageWithChildren = "Page " + 
TextUtils.htmlEncode(page.getTitle()) + " has " + numberOfChildren + " children 
<br> ";
-            result.append(pageWithChildren);
-        }
-
-        // and show the number of all spaces in this installation.
-        String spaces = "<br>Altogether, this installation has " + 
spaceManager.getAllSpaces().size() + " spaces. <br>";
-        result.append(spaces);
-
-        // this concludes our little demo. Now you should understand the 
basics of code injection use in Confluence, and how
-        // to get a really simple macro running.
+            
 
         return result.toString();
-    }
+    }    
+    
 
 }
\ No newline at end of file

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java
 Wed Mar 14 14:58:43 2012
@@ -138,7 +138,7 @@ public class AdminServlet extends HttpSe
                omPluginSettings.storeSomeInfo("key", key);             
             
             //response.sendRedirect(request.getContextPath() + 
"/plugins/servlet/openmeetingsadmin");
-            response.sendRedirect(request.getContextPath() + 
"/secure/AdminSummary.jspa");
+            response.sendRedirect(request.getContextPath() + 
"/admin/console.action");
        
     }
     

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java
 Wed Mar 14 14:58:43 2012
@@ -38,9 +38,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
+import com.atlassian.confluence.setup.settings.SettingsManager;
 import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
 import com.atlassian.crowd.embedded.api.User;
 import com.atlassian.sal.api.user.UserManager;
+import com.atlassian.spring.container.ContainerManager;
 import com.atlassian.templaterenderer.TemplateRenderer;
 import com.google.common.collect.Maps;
 import 
com.openmeetings.confluence.plugins.ao.adminconfiguration.OmPluginSettings;
@@ -48,6 +50,9 @@ import com.openmeetings.confluence.plugi
 import com.openmeetings.confluence.plugins.ao.omrooms.RoomService;
 import com.openmeetings.confluence.plugins.gateway.OmGateway;
 
+import com.atlassian.confluence.user.UserAccessor;
+import com.atlassian.confluence.user.actions.ProfilePictureInfo;
+
  
 public final class RoomsServlet extends HttpServlet
 {
@@ -56,10 +61,9 @@ public final class RoomsServlet extends 
     private final RoomService roomService;
     private TemplateRenderer templateRenderer;
     private OmGateway omGateway;
-    private UserManager userManager;           
-       //protected final VelocityRequestContextFactory requestContextFactory;
-       private OmPluginSettings omPluginSettings;      
-       ///private final AvatarManager avatarManager;
+    private UserManager userManager; 
+       private OmPluginSettings omPluginSettings;              
+       private SettingsManager settingsManager;
        
        private ArrayList<Exception> errors = new ArrayList<Exception>();;
        
@@ -70,34 +74,28 @@ public final class RoomsServlet extends 
     private static final String EDIT_BROWSER_TEMPLATE = 
"/templates/omrooms/edit.vm";
     private static final String ENTER_BROWSER_TEMPLATE = 
"/templates/omrooms/enter.vm";
  
-    public RoomsServlet(OmPluginSettings omPluginSettings, RoomService 
roomService, TemplateRenderer templateRenderer, OmGateway omGateway, 
UserManager userManager)
+    public RoomsServlet(SettingsManager settingsManager, OmPluginSettings 
omPluginSettings, RoomService roomService, TemplateRenderer templateRenderer, 
OmGateway omGateway, UserManager userManager)
     {
         this.roomService = checkNotNull(roomService);
         this.templateRenderer = templateRenderer;
         this.omGateway = omGateway;
         this.userManager = userManager;
-        this.omPluginSettings = omPluginSettings;     
+        this.omPluginSettings = omPluginSettings; 
+        this.settingsManager = settingsManager;        
         
     }
  
-    public String getCanonicalBaseUrl() {
-               return "";
-          //return 
this.requestContextFactory.getJiraVelocityRequestContext().getCanonicalBaseUrl();
-    }
-
+   
        private User getCurrentUser(HttpServletRequest req) {
-           // To get the current user, we first get the username from the 
session.
-           // Then we pass that over to the jiraUserManager in order to get an
-           // actual User object.              
-           return  (User) 
AuthenticatedUserThreadLocal.getUser();//jiraUserManager.getUserObject(userManager.getRemoteUsername(req));
+               
+           return  (User) AuthenticatedUserThreadLocal.getUser();
        }
        
                
     @Override
     protected void doGet(HttpServletRequest req, HttpServletResponse res) 
throws ServletException, IOException
     {
-       User currentUser = getCurrentUser(req);         
-       //ArrayList<Exception> errors = new ArrayList<Exception>();
+       User currentUser = getCurrentUser(req);
        String roomURL = "";    
         
                //User currentUser2 = 
ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
@@ -155,15 +153,17 @@ public final class RoomsServlet extends 
                                                username = 
currentUser.getName();
                                                becomeModeratorAsInt = 1;
                                                showAudioVideoTestAsInt = 1;
-                               }                                       
-                                        String avatarId = 
"1";//this.avatarManager.getDefaultAvatarId(Avatar.Type.USER).toString();       
                              
-                                        //URI avatarUrl = 
avatarService.getAvatarURL(currentUser, avatarId, Avatar.Size.SMALL);
-                                        //String profilePictureUrl = 
avatarUrl.toString();
-                                        String profilePictureUrl = 
this.getCanonicalBaseUrl() + "/secure/projectavatar?avatarId=" + avatarId + 
"&size=small";
-                                        
+                               }
+                               
+                               UserAccessor userAccessor = (UserAccessor) 
ContainerManager.getInstance().getContainerContext().getComponent("userAccessor");
                           
+                               String picturePath = 
userAccessor.getUserProfilePicture((com.atlassian.user.User)currentUser).getDownloadPath();
+                               String baseURL = 
settingsManager.getGlobalSettings().getBaseUrl(); 
+                               
+                                       String profilePictureUrl = baseURL + 
picturePath;                               
+                                       
                                        Long roomId = 
Long.valueOf(req.getParameter("roomId"));
                                                                                
-                                       String roomHash = 
omGateway.setUserObjectAndGenerateRoomHash(username, firsname, "", 
profilePictureUrl, 
+                                       String roomHash = 
omGateway.setUserObjectAndGenerateRoomHash(username, firsname, "", 
profilePictureUrl.toString(), 
                                                                                
                                                                                
email, userId, externalUserType,        roomId, 
                                                                                
                                                                                
becomeModeratorAsInt,
                                                                                
                                                                                
showAudioVideoTestAsInt);

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties
 Wed Mar 14 14:58:43 2012
@@ -30,7 +30,7 @@ openmeetings.rooms.participent.label=Par
 openmeetings.rooms.ismoderated.label=Is Moderated
 openmeetings.rooms.isaudio.label=Is Audio Only
 
-openmeetings.rooms.roomlist.label=Room List
+openmeetings.rooms.roomlist.label=Rooms List
 openmeetings.rooms.edit.label=Edit
 openmeetings.rooms.delete.label=Delete
 openmeetings.rooms.createnewroom.label=Create New Room
@@ -53,3 +53,8 @@ openmeetings.config.key.label=Key
 
 openmeetings.rooms.enter.titel.label=OpenMeetings Room
 
+com.openmeetings.confluence.plugins.openmeetingsconfluence.openmeetings-room-link.param.room_id.label=OpenMeetings
 Room Id
+com.openmeetings.confluence.plugins.openmeetingsconfluence.openmeetings-room-link.param.room_id.desc=Room
 Id from your OpenMeetings Rooms
+
+
+

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml
 Wed Mar 14 14:58:43 2012
@@ -6,7 +6,7 @@
         <param name="configure.url">/plugins/servlet/openmeetingsadmin</param>
     </plugin-info>
 
-    <macro name="openmeetings-room-link" 
class="com.openmeetings.confluence.plugins.ExampleMacro" 
key="openmeetings-room-link">
+    <macro name="openmeetings-room-link" 
class="com.openmeetings.confluence.plugins.OpenMeetingsMacro" 
key="openmeetings-room-link">
            <!-- TODO: Add macro description -->
            <description>Insert Room Link in page</description>  
            
@@ -15,13 +15,51 @@
             <param name="help-section" value="confluence"/>
         </resource>
         <!-- Specifies which macro browser category this macro should display 
in. -->
-        <category name="confluence-content"/>
+        <category name="communication"/>
         <!-- Defines the parameters this macro may consume. -->
         <parameters>
-            <parameter name="greeting" type="string"/>
+            <parameter name="room_id" type="string"/>
+            <!--
+            <parameter name="roomid" type="enum">
+               <value name="10"/>
+               <value name="100"/>
+            </parameter>
+            <parameter name="title" type="confluence-content">
+               <option key="type" value="attachment"/>
+                <option key="showNameInPlaceholder" value="false" />
+                <option key="showValueInPlaceholder" value="true" />
+            </parameter>
+            -->
         </parameters>   
     </macro>
-   
+    <!--
+    <macro name="openmeetings-room-link2" 
class="com.openmeetings.confluence.plugins.TutorialMacro" 
key="openmeetings-room-link2">
+           
+           <description>Insert Room Link in page</description>  
+           
+          
+        <resource type="velocity" name="enter" 
location="templates/omrooms/enter.vm">
+            <param name="help-section" value="confluence"/>
+        </resource>
+        
+        <category name="confluence-content"/>
+       
+        <parameters>
+            <parameter name="room_id" type="string"/>
+            <parameter name="roomid" type="enum">
+               <value name="10"/>
+               <value name="100"/>
+            </parameter>
+        </parameters>   
+    </macro>
+    -->
+   <!--
+    <web-resource key="macro-browser-smart-fields" name="Macro Browser Smart 
Fields">
+       <resource type="download" name="myBrowserField.js" 
location="myBrowserField.js" />
+       <dependency>confluence.editor.actions:editor-macro-browser</dependency>
+       <context>macro-browser</context>
+       </web-resource>
+   -->
   <web-item key="om_config" section="system.admin/configuration">
     <label>OpenMeetings Setup</label>
     <link linkId="admin_link" 
absolute="false">/plugins/servlet/openmeetingsadmin</link>
@@ -37,20 +75,23 @@
     <link linkId="my_links_link"/>   
   </web-item>
   -->
-  
+  <!--
   <web-item key="website_link_space" name="Rooms Web Site Space" 
section="system.space" weight="100">
     <label>My OpenMeetings Rooms</label>
     <link linkId="rooms_link_space" 
absolute="false">/plugins/servlet/openmeetingsrooms</link>/&gt;
   </web-item>
+  -->
   <web-item key="website_link_browse" name="Rooms Web Site Browse" 
section="system.browse" weight="100">
     <label>My OpenMeetings Rooms</label>
     <link linkId="rooms_link_browse" 
absolute="false">/plugins/servlet/openmeetingsrooms</link>/&gt;
   </web-item>
+  <!--
    <web-item key="website_link_dashboard" name="Rooms Web Site Dashboard" 
section="system.dashboard" weight="47">
     <label>My OpenMeetings Rooms</label>
     <link linkId="rooms_link_dashboard" 
absolute="false">/plugins/servlet/openmeetingsrooms</link>/&gt;
-    <!--<condition 
class="com.atlassian.confluence.plugin.webfragment.conditions.UserLoggedInCondition"/>-->
+    <condition 
class="com.atlassian.confluence.plugin.webfragment.conditions.UserLoggedInCondition"/>
   </web-item>
+  -->
   <web-item key="create_room_link" name="Create Room Web Site" 
section="system.content.add/space" weight="10">
     <label>Create Room</label>
     <link linkId="create_room_link" 
absolute="false">/plugins/servlet/openmeetingsrooms?new=y</link>/&gt;

Added: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/myBrowserField.js
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/myBrowserField.js?rev=1300577&view=auto
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/myBrowserField.js
 (added)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/myBrowserField.js
 Wed Mar 14 14:58:43 2012
@@ -0,0 +1,51 @@
+(function($) {
+    var MacroJsOverrideForFields = function(fileTypes) {
+        this.fileTypes = fileTypes;
+    };
+ 
+    // Overwrites how the parameter-values are visible to the user (in the 
macro browser window)
+    MacroJsOverrideForFields.prototype.beforeParamsSet = function(params, 
inserting) {
+        /* Enter here your code to modifie the parameter-values before they're 
visible.
+            E.g. you have a list of account-numbers, but want to show the 
corresponding names to the user.
+                  Then you can write here something like: 
+                  params["accnr"] = getName(params["accnr"]);
+                  In the Rich Text Editor you will see something like this: 
{mymacro:accnr=7234892} and in the Macro-Browser you will see a list of names.
+            But don't forget to convert it back in the <beforeParamsRetrieved> 
function below.
+        */
+       params["roomid"] = getName(params["roomid"]);
+        return params;
+    };
+ 
+    // Overwrites how the parameter-values are returned back to your macro
+    MacroJsOverrideForFields.prototype.beforeParamsRetrieved = 
function(params) {
+        // Enter here your code to modifie the parameter-values before they're 
returned to the macro.
+        // See <beforeParamsSet> above for more details.
+       params["roomid"] = getName(params["roomid"]);
+        return params;
+    };
+ 
+    // Overwrites the parameter itself. Make sure you overwrite the correct 
parameter -> maybe you have more then one parameter of the same type
+    MacroJsOverrideForFields.prototype.fields = {
+        "enum" : function(param) {
+               /* Here you can modifie and/or populate your enums dynamically. 
This function is called each time the macro browser starts.
+                   E.g.:
+                       if(param.name == "nameOfYourParameter") {
+                           param.enumValues = ["this", "is", "an", "example"];
+                       }
+               */
+               
+               if(param.name == "roomid") {
+                param.enumValues = ["this", "is", "an", "example"];
+            }
+            var result = AJS.MacroBrowser.ParameterFields["enum"](param, null);
+            return result;
+        }
+    };
+ 
+    AJS.MacroBrowser.activateSmartFieldsAttachmentsOnPage = 
function(macroName, fileTypes) {
+       AJS.MacroBrowser.setMacroJsOverride("openmeetings-room-link", new 
MacroJsOverrideForFields("roomid"));
+              // <mymacro> should be the name of your macro and <myparameter> 
the name of your parameter. But for the second one I'm not sure what it should 
really be.
+              // I really don't know, what this function does exactly. But I 
haven't found some usefull documentation about it (to be honest: I've found 
nothing at all)
+    }
+ 
+})(AJS.$);
\ No newline at end of file

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm
 Wed Mar 14 14:58:43 2012
@@ -13,7 +13,7 @@
  -->
 <html>
 <head>
-    <title>OpenMeetings Admin &mdash; </title>
+    <title>OpenMeetings Admin</title>
     <meta name="decorator" content="atl.admin">
 </head>
 <body class="page-type-admin">

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm
 Wed Mar 14 14:58:43 2012
@@ -20,7 +20,7 @@
 <div class="content-container">
 
     <div class="content-body">
-        <h1>$i18n.getText("openmeetings.rooms.edit.titel.label"): 
$room.getName()</h1>
+       <!-- <h1>$i18n.getText("openmeetings.rooms.edit.titel.label"): 
$room.getName()</h1>-->
 
         #if ($errors.size()>0)
             <div class="aui-message error shadowed">

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm
 Wed Mar 14 14:58:43 2012
@@ -56,7 +56,7 @@
                 <table class="aui">
                     <thead>
                     <tr>
-                        
##<th>$i18n.getText("openmeetings.rooms.roomid.label")</th>
+                        
<th>$i18n.getText("openmeetings.rooms.roomid.label")</th>
                         
<th>$i18n.getText("openmeetings.rooms.roomname.label")</th>
                         
<th>$i18n.getText("openmeetings.rooms.roomtype.label")</th>
                         
<th>$i18n.getText("openmeetings.rooms.participent.label")</th>
@@ -68,7 +68,7 @@
                     <tbody>
                         #foreach( $room in $rooms )
                         <tr>
-                            ##<td>$room.getRoomId()</td>
+                            <td>$room.getRoomId()</td>
                             <td>$room.getName()</td>
                             <td>
                                 #if($room.getRoomType() == 1)                  
                   

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm
 Wed Mar 14 14:58:43 2012
@@ -20,7 +20,7 @@
 <div class="content-container">
 
     <div class="content-body">
-        <h1>Create Room</h1>
+       <!-- <h1>Create Room</h1>-->
         <div class="create-issue-panel">
 
             <form method="post" id="h" action="openmeetingsrooms" class="aui">

Added: 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/tutorial-macro.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/tutorial-macro.vm?rev=1300577&view=auto
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/tutorial-macro.vm
 (added)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/main/resources/tutorial-macro.vm
 Wed Mar 14 14:58:43 2012
@@ -0,0 +1,25 @@
+<!--
+   Licensed 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.
+ -->
+#customControlHeader ($action $customField.id $customField.name 
$fieldLayoutItem.required $displayParameters $auiparams)
+<select class="select" name="$customField.id" id="$customField.id">
+    #if (!$fieldLayoutItem || $fieldLayoutItem.required == false)
+        <option value="-1">$i18n.getText("common.words.none")</option>
+    #else
+        <option value="">$i18n.getText("common.words.none")</option>
+    #end
+    #foreach ($option in $rooms)
+        <option #if ($value == $option.getRoomId().toString()) 
selected="selected"#end 
value=$textutils.htmlEncode($option.getRoomId().toString()) 
>$option.getName()</option>
+    #end
+</select>
+#customControlFooter ($action $customField.id 
$fieldLayoutItem.fieldDescription $displayParameters $auiparams)
\ No newline at end of file

Modified: 
incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java
 (original)
+++ 
incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java
 Wed Mar 14 14:58:43 2012
@@ -3,7 +3,7 @@ package com.openmeetings.confluence.plug
 import org.junit.Test;
 
 /**
- * Testing {@link com.openmeetings.confluence.plugins.ExampleMacro}
+ * Testing {@link com.openmeetings.confluence.plugins.OpenMeetingsMacro}
  */
 public class ExampleMacroTest
 {

Modified: 
incubator/openmeetings/branches/confluence-plugin/target/openmeetingsconfluence-1.0-SNAPSHOT.jar
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/target/openmeetingsconfluence-1.0-SNAPSHOT.jar?rev=1300577&r1=1300576&r2=1300577&view=diff
==============================================================================
Binary files - no diff available.


Reply via email to