[kune-commits] r1102 - in trunk/src: main/java/org/ourproject/kune/app/public/css main/java/org/ourproject/kune/platf/client/dto main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/platf/client/ui/rte/insertimg main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8 main/java/org/ourproject/kune/platf/server main/java/org/ourproject/kune/platf/server/domain main/java/org/ourproject/kune/platf/server/manager main/java/org/ourproject/kune/platf/server/manager/impl main/java/org/ourproject/kune/platf/server/rest main/java/org/ourproject/kune/platf/server/rpc main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg main/java/org/ourproject/kune/workspace/client/editor/insertlocallink main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia main/java/org/ourproject/kune/workspace/client/licensefoot main/java/org/ourproject/kune/workspace/client/search main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions main/resources/db test/java/org/ourproject/kune/platf/client/ui/rte/insertmedia

vjrj vjrj at ourproject.org
Tue Apr 28 14:53:14 CEST 2009


Author: vjrj
Date: 2009-04-28 14:53:10 +0200 (Tue, 28 Apr 2009)
New Revision: 1102

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/ExtMediaDescripDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/ExtMediaDescrip.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/ExtMediaDescripManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherConstants.java
   trunk/src/main/resources/db/update-0014-extmedia.sql
Removed:
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptor.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherContants.java
Modified:
   trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
   trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java
   trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rest/GroupJSONService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rest/I18nTranslationJSONService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rest/UserJSONService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocallink/InsertLinkLocalPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java
   trunk/src/main/resources/db/liquibase_changelog.xml
   trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptorTest.java
Log:
Incomplete - task Insert Media dialog 


Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2009-04-28 12:53:10 UTC (rev 1102)
@@ -41,4 +41,4 @@
     padding: 1px 0px 1px 1px;
     text-decoration:none;
 }
-*/.x-tree-node .k-ctn-status-normal a span{}.x-tree-node .k-ctn-status-deleted a span{text-decoration:line-through;color:gray;}.x-tree-node .k-ctn-status-rejected a span{text-decoration:line-through;/* color: #FF6633; */color:#F30;}.x-tree-node .k-ctn-status-editing a span{font-style:italic;color:gray;}.x-tree-node .k-ctn-status-submitted a span{color:green;}.k-info-links{text-decoration:underline;color:gray;cursor:pointer;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;overflow:hidden;}.k-tsp-tag{float:left;padding:3px;cursor:pointer;color:#00F;}.k-tsp-cloud{line-height:1.5em;text-align:center;}.k-link-icon{background-image:url(img/link.gif)!important;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.k-copyleft-icon{background-image:url(img/copyleft.png)!important;}.k-picture-icon{background-image:url(img/picture.png)!important;}.k-film-icon{background-image:url(img/film.png)!important;}.k-specialchars-icon{background-image:url(img/specialchars.png)!important;}.k-info-icon{background-image:url(img/info.gif)!important;}.k-newgroup-icon{background-image:url(img/kune-icon16.png)!important;}.k-colors-icon{background-image:url(img/colors.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;}/* duplicated in rte.css */.k-rte-comment{border:1px dashed silver;line-height:1.4;padding:1px;background-color:#D7FFD7;}.k-specialchar-grid{border:1px solid #ACA899;}.k-specialchar-grid table{}.k-specialchar-grid div{line-height:22px;}.k-specialchar-grid td{padding:1px;}.k-specialchar-pb{border:1px solid #EBE8D7;cursor:pointer;font-size:108%!important;text-align:center;vertical-align:middle;width:18px;height:18px;}.k-specialchar-pb-up{}.k-specialchar-big{padding:3px;line-height:22px;font-size:153.899994%!important;}.k-specialchar-adv-label{margin-left:-10px;}.k-specialchar-popup,{border:1px px solid silver;z-index:9999!important;background-color:#FFF;}.k-specialchar-pb-down{color:#161616;}.k-specialchar-pb-up-hovering{border:thin solid #ACA899;}.k-specialchar-pb-down-hovering{color:#161616;}.k-preview-panel{border:dashed 1px gray;}.k-rte-changelink{white-space:nowrap;color:navy;cursor:pointer;text-decoration:underline;margin:5px;}.k-rte-changelink-popup{border:1px solid silver;z-index:9999!important;background-color:#ECECEC;}.e-ui-room{height:27px;line-height:22px;}.e-ui-room input{font-size:100%;margin-left:0;margin-top:0;}
\ No newline at end of file
+*/.x-tree-node .k-ctn-status-normal a span{}.x-tree-node .k-ctn-status-deleted a span{text-decoration:line-through;color:gray;}.x-tree-node .k-ctn-status-rejected a span{text-decoration:line-through;/* color: #FF6633; */color:#F30;}.x-tree-node .k-ctn-status-editing a span{font-style:italic;color:gray;}.x-tree-node .k-ctn-status-submitted a span{color:green;}.k-info-links{text-decoration:underline;color:gray;cursor:pointer;}.x-tool-kmenu{background-position:0 -75px;}.x-tool-kmenu-over{background-position:-15px -75px;}.k-border-openbox{border-bottom:1px #D0D0D0 solid;border-right:1px #D0D0D0 solid;border-left:1px #D0D0D0 solid;}/* SiteToastMessages */.k-stm-info-icon{background-image:url(img/info.gif)!important;}.k-stm-imp-icon{background-image:url(img/alert.gif)!important;}.k-stm-verimp-icon{background-image:url(img/important.gif)!important;}.k-stm-error-icon{background-image:url(img/error.gif)!important;}.k-error-tb{background:#FFB380 none repeat scroll 0 50%;color:#250;}.k-infod-head{font-size:108%;margin-bottom:10px;}.gwt-DisclosurePanel{}.gwt-DisclosurePanel-open{}.gwt-DisclosurePanel-closed{}.gwt-DisclosurePanel .header,.gwt-DisclosurePanel .header a,.gwt-DisclosurePanel .header td{text-decoration:none;/* Remove underline from header */color:#000;cursor:pointer;cursor:hand;}.gwt-DisclosurePanel .content{border-left:3px solid #e8eef7;padding:4px 0 4px 8px;margin-left:6px;}.k-basic-thumb{background:#FAFAFA none repeat scroll 0 50%;border:1px solid #EBEBEB;padding:3px;margin:3px;}.k-basic-thumb td{padding:2px 3px;border:none;}.k-text-gray{color:gray;}.k-elp-limg{margin-top:4px;margin-left:5px;cursor:pointer;overflow:hidden;}.k-tsp-tag{float:left;padding:3px;cursor:pointer;color:#00F;}.k-tsp-cloud{line-height:1.5em;text-align:center;}.k-link-icon{background-image:url(img/link.gif)!important;}.k-options-icon{background-image:url(img/emblem-system.gif)!important;}.k-copyleft-icon{background-image:url(img/copyleft.png)!important;}.k-picture-icon{background-image:url(img/picture.png)!important;}.k-film-icon{background-image:url(img/film.png)!important;}.k-specialchars-icon{background-image:url(img/specialchars.png)!important;}.k-info-icon{background-image:url(img/info.gif)!important;}.k-newgroup-icon{background-image:url(img/kune-icon16.png)!important;}.k-colors-icon{background-image:url(img/colors.gif)!important;}.x-toolbar-body table{/* width: 100%; */}.k-preview-msg{background:#FCA;}.k-preview-msg-lab{background:#FCA;padding:0 5px;}.k-eil-edit{border:thin solid #000;}/* duplicated in rte.css */.k-rte-comment{border:1px dashed silver;line-height:1.4;padding:1px;background-color:#D7FFD7;}.k-specialchar-grid{border:1px solid #ACA899;}.k-specialchar-grid table{}.k-specialchar-grid div{line-height:22px;}.k-specialchar-grid td{padding:1px;}.k-specialchar-pb{border:1px solid #EBE8D7;cursor:pointer;font-size:108%!important;text-align:center;vertical-align:middle;width:18px;height:18px;}.k-specialchar-pb-up{}.k-specialchar-big{padding:3px;line-height:22px;font-size:153.899994%!important;}.k-specialchar-adv-label{margin-left:-10px;}.k-specialchar-popup,{border:1px px solid silver;z-index:9999!important;background-color:#FFF;}.k-specialchar-pb-down{color:#161616;}.k-specialchar-pb-up-hovering{border:thin solid #ACA899;}.k-specialchar-pb-down-hovering{color:#161616;}.k-preview-panel{border:dashed 1px gray;padding:5px;}.k-rte-changelink{white-space:nowrap;color:navy;cursor:pointer;text-decoration:underline;margin:5px;}.k-rte-changelink-popup{border:1px solid silver;z-index:9999!important;background-color:#ECECEC;}.e-ui-room{height:27px;line-height:22px;}.e-ui-room input{font-size:100%;margin-left:0;margin-top:0;}
\ No newline at end of file

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2009-04-28 12:53:10 UTC (rev 1102)
@@ -973,6 +973,7 @@
 
 .k-preview-panel {
   border: dashed 1px gray;
+  padding: 5px;
 }
 
 .k-rte-changelink {

Copied: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ExtMediaDescripDTO.java (from rev 1100, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptor.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptor.java	2009-04-24 02:28:18 UTC (rev 1100)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ExtMediaDescripDTO.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,107 @@
+package org.ourproject.kune.platf.client.dto;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class ExtMediaDescripDTO implements IsSerializable {
+
+    public static final String URL = "###URL###";
+    public static final String HEIGHT = "###HEIGHT###";
+    public static final String WIDTH = "###WIDTH###";
+
+    private String name;
+    private String siteurl;
+    private String detectRegex;
+    private String idRegex;
+    private String embedTemplate;
+    private int width;
+
+    private int height;
+
+    public ExtMediaDescripDTO() {
+        this(null, null, null, null, null, 0, 0);
+    }
+
+    public ExtMediaDescripDTO(final String name, final String siteurl, final String detectRegex,
+            final String idRegex, final String embedTemplate, final int defWidth, final int defHeight) {
+        this.name = name;
+        this.siteurl = siteurl;
+        this.detectRegex = detectRegex;
+        this.idRegex = idRegex;
+        this.embedTemplate = embedTemplate;
+        width = defWidth;
+        height = defHeight;
+    }
+
+    public String getDetectRegex() {
+        return detectRegex;
+    }
+
+    public String getEmbed(final String url) {
+        String id = getId(url);
+        String result = embedTemplate.replaceAll(URL, id);
+        result = result.replaceAll(HEIGHT, "" + height);
+        result = result.replaceAll(WIDTH, "" + width);
+        return result;
+    }
+
+    public String getEmbedTemplate() {
+        return embedTemplate;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public String getId(final String url) {
+        String id = url.replaceFirst(idRegex, "$1");
+        return id;
+    }
+
+    public String getIdRegex() {
+        return idRegex;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getSiteurl() {
+        return siteurl;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public boolean is(final String url) {
+        return url.matches(detectRegex);
+    }
+
+    public void setDetectRegex(final String detectRegex) {
+        this.detectRegex = detectRegex;
+    }
+
+    public void setEmbedTemplate(final String embedTemplate) {
+        this.embedTemplate = embedTemplate;
+    }
+
+    public void setHeight(final int height) {
+        this.height = height;
+    }
+
+    public void setIdRegex(final String idRegex) {
+        this.idRegex = idRegex;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public void setSiteurl(final String siteurl) {
+        this.siteurl = siteurl;
+    }
+
+    public void setWidth(final int width) {
+        this.width = width;
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/InitDataDTO.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -20,6 +20,7 @@
 package org.ourproject.kune.platf.client.dto;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import com.google.gwt.user.client.rpc.IsSerializable;
 
@@ -48,14 +49,11 @@
     private int imgIconsize;
     private ArrayList<ToolSimpleDTO> userTools;
     private ArrayList<ToolSimpleDTO> groupTools;
-
     private String flvEmbedObject;
-
     private String oggEmbedObject;
-
     private String mp3EmbedObject;
-
     private String aviEmbedObject;
+    private List<ExtMediaDescripDTO> extMediaDescrips;
 
     public String getAviEmbedObject() {
         return aviEmbedObject;
@@ -89,6 +87,10 @@
         return defaultWsTheme;
     }
 
+    public List<ExtMediaDescripDTO> getExtMediaDescrips() {
+        return extMediaDescrips;
+    }
+
     public String getFlvEmbedObject() {
         return flvEmbedObject;
     }
@@ -201,6 +203,10 @@
         this.defaultWsTheme = defaultWsTheme;
     }
 
+    public void setExtMediaDescrips(final List<ExtMediaDescripDTO> extMediaDescrips) {
+        this.extMediaDescrips = extMediaDescrips;
+    }
+
     public void setFlvEmbedObject(final String flvEmbedObject) {
         this.flvEmbedObject = flvEmbedObject;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -520,7 +520,7 @@
         register(Singleton.class, new Factory<ExternalMediaRegistry>(ExternalMediaRegistry.class) {
             @Override
             public ExternalMediaRegistry create() {
-                return new ExternalMediaRegistry();
+                return new ExternalMediaRegistry($(Session.class).getInitData().getExtMediaDescrips());
             }});
 
         $(ApplicationComponentGroup.class).createAll();

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ContentPosition.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,43 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg;
+
+import org.cobogw.gwt.user.client.CSS;
+import org.ourproject.kune.platf.client.i18n.Resources;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.DOM;
+
+public class ContentPosition {
+
+    public static final String LEFT = "left";
+    public static final String CENTER = "center";
+    public static final String RIGHT = "right";
+
+    public static String[][] positions = { new String[] { LEFT }, new String[] { CENTER }, new String[] { RIGHT } };
+
+    private static Object[][] positionObjs;
+
+    public static Element getElementPosition(final Element element, final boolean wraptext, final String position) {
+        if (!wraptext || position.equals(ContentPosition.CENTER)) {
+            com.google.gwt.user.client.Element divEl = DOM.createDiv();
+            CSS.setProperty(divEl, CSS.A.TEXT_ALIGN, position);
+            divEl.setInnerHTML(element.getString());
+            return divEl;
+        } else {
+            CSS.setProperty(element, CSS.A.FLOAT, position);
+            return element;
+        }
+    }
+
+    public static Object[][] getPositions() {
+        if (positionObjs == null) {
+            String[][] values = positions;
+            positionObjs = new Object[values.length][1];
+            int i = 0;
+            for (String[] position : values) {
+                final Object[] obj = new Object[] { position[0], Resources.i18n.t(position[0]) };
+                positionObjs[i++] = obj;
+            }
+        }
+        return positionObjs;
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -18,13 +18,7 @@
     public static final String SIZE_M = "m";
     public static final String SIZE_L = "l";
     public static final String SIZE_XL = "xl";
-    public static final String POSITION_LEFT = "left";
-    public static final String POSITION_CENTER = "center";
-    public static final String POSITION_RIGHT = "right";
 
-    public static String[][] positions = { new String[] { POSITION_LEFT }, new String[] { POSITION_CENTER },
-            new String[] { POSITION_RIGHT } };
-
     public static String[][] sizes = { new String[] { SIZE_ORIGINAL, "Original image size", "" },
             new String[] { SIZE_FIT, "Fit page width", "100%" },
             new String[] { SIZE_XS, "Thumbnail, up to 160 pixels wide", "160px" },
@@ -111,15 +105,7 @@
         com.google.gwt.user.client.Element img = DOM.createImg();
         DOM.setElementProperty(img, "src", src);
         CSS.setProperty(img, CSS.A.WIDTH, getStyleSize());
-        if (!wraptext || position.equals(POSITION_CENTER)) {
-            com.google.gwt.user.client.Element divEl = DOM.createDiv();
-            CSS.setProperty(divEl, CSS.A.TEXT_ALIGN, position);
-            divEl.setInnerHTML(img.getString());
-            return divEl;
-        } else {
-            CSS.setProperty(img, CSS.A.FLOAT, position);
-            return img;
-        }
+        return ContentPosition.getElementPosition(img, wraptext, position);
     }
 
     private String getStyleSize() {

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/InsertImageDialogPresenter.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -46,6 +46,6 @@
 
     private void initImageInfo() {
         imageInfo = new ImageInfo("", ImageInfo.DEF_WRAP_VALUE, ImageInfo.DEF_CLICK_ORIGINAL_VALUE,
-                ImageInfo.POSITION_LEFT, ImageInfo.SIZE_ORIGINAL);
+                ContentPosition.LEFT, ImageInfo.SIZE_ORIGINAL);
     }
 }

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertElementAbstractPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,117 @@
+package org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg;
+
+import org.ourproject.kune.platf.client.i18n.Resources;
+import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ContentPosition;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
+
+
+import com.gwtext.client.data.Record;
+import com.gwtext.client.data.SimpleStore;
+import com.gwtext.client.data.Store;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.form.Checkbox;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.FieldSet;
+import com.gwtext.client.widgets.form.Label;
+import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
+
+public class InsertElementAbstractPanel extends DefaultForm {
+
+    protected final ComboBox positionCombo;
+    protected final Checkbox wrapText;
+    protected final Label intro;
+    protected final FieldSet advanced;
+
+    public InsertElementAbstractPanel(final String title, final int height) {
+        super(title);
+        super.setAutoWidth(true);
+        super.setHeight(height);
+        super.getFormPanel().setLabelWidth(DEF_FIELD_LABEL_WITH + 20);
+
+        intro = new Label();
+
+        final Store storePositions = new SimpleStore(new String[] { "abbr", "trans" }, ContentPosition.getPositions());
+        storePositions.load();
+
+        positionCombo = createCombo(storePositions, Resources.i18n.t("Position"));
+
+        wrapText = new Checkbox(Resources.i18n.t("Wrap text around"));
+        wrapText.setChecked(ImageInfo.DEF_WRAP_VALUE);
+
+        positionCombo.addListener(new ComboBoxListenerAdapter() {
+            @Override
+            public void onSelect(final ComboBox comboBox, final Record record, final int index) {
+                String pos = record.getAsString("abbr");
+                // presenter.setPosition(pos);
+                setWrapVisible(pos);
+            }
+        });
+
+        advanced = new FieldSet(Resources.i18n.t("More options"));
+        advanced.setCollapsible(true);
+        advanced.setCollapsed(true);
+        advanced.setAutoHeight(true);
+        advanced.setAutoWidth(true);
+        advanced.setAutoScroll(false);
+        advanced.addClass("kune-Margin-Large-t");
+        // advanced.setPaddings(10, 0, 0, 0);
+
+        advanced.add(positionCombo);
+        advanced.add(wrapText);
+        add(intro);
+        add(advanced);
+    }
+
+    public String getPosition() {
+        return positionCombo.getValueAsString();
+    }
+
+    public String getSrc() {
+        return null;
+    }
+
+    public boolean getWrapText() {
+        return wrapText.getValue();
+    }
+
+    @Override
+    public void insert(final int index, final Component component) {
+        super.insert(index, component);
+    }
+
+    public void setIntro(final String text) {
+        intro.setHtml(text);
+    }
+
+    private ComboBox createCombo(final Store storeSizes, final String title) {
+        ComboBox cb = new ComboBox();
+        cb.setEditable(false);
+        cb.setForceSelection(true);
+        cb.setMinChars(1);
+        cb.setFieldLabel(title);
+        cb.setStore(storeSizes);
+        cb.setDisplayField("trans");
+        cb.setValueField("abbr");
+        cb.setMode(ComboBox.LOCAL);
+        cb.setTriggerAction(ComboBox.ALL);
+        cb.setTypeAhead(true);
+        cb.setSelectOnFocus(true);
+        cb.setWidth(DEF_FIELD_WIDTH);
+        cb.setHideTrigger(false);
+        cb.setAllowBlank(false);
+        cb.setValidationEvent(false);
+        cb.setListWidth(DEF_FIELD_WIDTH + 30);
+        cb.setResizable(true);
+        return cb;
+    }
+
+    private void setWrapVisible(final String position) {
+        if (position.equals(ContentPosition.CENTER)) {
+            wrapText.setVisible(false);
+        } else {
+            wrapText.setVisible(true);
+        }
+    }
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/abstractimg/InsertImageAbstractPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -1,7 +1,7 @@
 package org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg;
 
 import org.ourproject.kune.platf.client.i18n.Resources;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ContentPosition;
 import org.ourproject.kune.platf.client.ui.rte.insertimg.ImageInfo;
 import org.ourproject.kune.platf.client.ui.rte.insertimg.InsertImageDialogView;
 
@@ -12,44 +12,26 @@
 import com.gwtext.client.widgets.Panel;
 import com.gwtext.client.widgets.form.Checkbox;
 import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.FieldSet;
-import com.gwtext.client.widgets.form.Label;
 import com.gwtext.client.widgets.form.event.CheckboxListenerAdapter;
 import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
 import com.gwtext.client.widgets.form.event.FormPanelListenerAdapter;
 
-public class InsertImageAbstractPanel extends DefaultForm implements InsertImageAbstractView {
+public class InsertImageAbstractPanel extends InsertElementAbstractPanel implements InsertImageAbstractView {
 
     private Object[][] sizesObjs;
-    private Object[][] positionObjs;
     private final ComboBox sizeCombo;
-    private final ComboBox positionCombo;
-    protected final Checkbox wrapText;
     protected final Checkbox clickOriginal;
-    private final Label intro;
     private final InsertImageAbstractPresenter presenter;
 
     public InsertImageAbstractPanel(final String title, final InsertImageAbstractPresenter presenter) {
-        super(title);
+        super(title, InsertImageDialogView.HEIGHT);
         this.presenter = presenter;
-        super.setAutoWidth(true);
-        super.setHeight(InsertImageDialogView.HEIGHT);
-        super.getFormPanel().setLabelWidth(DEF_FIELD_LABEL_WITH + 20);
 
-        intro = new Label();
-
         final Store storeSizes = new SimpleStore(new String[] { "abbr", "trans", "size" }, getSizes());
         storeSizes.load();
 
-        final Store storePositions = new SimpleStore(new String[] { "abbr", "trans" }, getPositions());
-        storePositions.load();
-
         sizeCombo = createCombo(storeSizes, Resources.i18n.t("Size"));
-        positionCombo = createCombo(storePositions, Resources.i18n.t("Position"));
 
-        wrapText = new Checkbox(Resources.i18n.t("Wrap text around image"));
-        wrapText.setChecked(ImageInfo.DEF_WRAP_VALUE);
-
         clickOriginal = new Checkbox(Resources.i18n.t("Clicking this image links to the original image file"));
         clickOriginal.setChecked(ImageInfo.DEF_CLICK_ORIGINAL_VALUE);
         clickOriginal.setWidth(DEF_FIELD_WIDTH);
@@ -65,9 +47,9 @@
         positionCombo.addListener(new ComboBoxListenerAdapter() {
             @Override
             public void onSelect(final ComboBox comboBox, final Record record, final int index) {
+                super.onSelect(comboBox, record, index);
                 String pos = record.getAsString("abbr");
                 presenter.setPosition(pos);
-                setWrapVisible(pos);
             }
         });
 
@@ -94,27 +76,15 @@
             }
         });
 
-        FieldSet advanced = new FieldSet(Resources.i18n.t("More options"));
-        advanced.setCollapsible(true);
-        advanced.setCollapsed(true);
-        advanced.setAutoHeight(true);
-        advanced.setAutoWidth(true);
-        advanced.setAutoScroll(false);
-        advanced.addClass("kune-Margin-Large-t");
-        // advanced.setPaddings(10, 0, 0, 0);
-
         advanced.add(sizeCombo);
-        advanced.add(positionCombo);
-        advanced.add(wrapText);
         advanced.add(clickOriginal);
-        add(intro);
-        add(advanced);
     }
 
     public boolean getClickOriginal() {
         return clickOriginal.getValue();
     }
 
+    @Override
     public String getPosition() {
         return positionCombo.getValueAsString();
     }
@@ -123,10 +93,12 @@
         return sizeCombo.getValueAsString();
     }
 
+    @Override
     public String getSrc() {
         return null;
     }
 
+    @Override
     public boolean getWrapText() {
         return wrapText.getValue();
     }
@@ -143,6 +115,7 @@
         updateValues(linkImage);
     }
 
+    @Override
     public void setIntro(final String text) {
         intro.setHtml(text);
     }
@@ -178,19 +151,6 @@
         return cb;
     }
 
-    private Object[][] getPositions() {
-        if (positionObjs == null) {
-            String[][] values = ImageInfo.positions;
-            positionObjs = new Object[values.length][1];
-            int i = 0;
-            for (String[] position : values) {
-                final Object[] obj = new Object[] { position[0], Resources.i18n.t(position[0]) };
-                positionObjs[i++] = obj;
-            }
-        }
-        return positionObjs;
-    }
-
     private Object[][] getSizes() {
         if (sizesObjs == null) {
             String[][] values = ImageInfo.sizes;
@@ -205,7 +165,7 @@
     }
 
     private void setWrapVisible(final String position) {
-        if (position.equals(ImageInfo.POSITION_CENTER)) {
+        if (position.equals(ContentPosition.CENTER)) {
             wrapText.setVisible(false);
         } else {
             wrapText.setVisible(true);

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptor.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptor.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -1,68 +0,0 @@
-package org.ourproject.kune.platf.client.ui.rte.insertmedia;
-
-public class ExternalMediaDescriptor {
-
-    public static final String URL = "###URL###";
-    public static final String HEIGHT = "###HEIGHT###";
-    public static final String WIDTH = "###WIDTH###";
-
-    private final String name;
-    private final String siteurl;
-    private final String detectRegex;
-    private final String idRegex;
-    private final String embedTemplate;
-    private int width;
-    private int height;
-
-    public ExternalMediaDescriptor(final String name, final String siteurl, final String detectRegex,
-            final String idRegex, final String embedTemplate, final int defWidth, final int defHeight) {
-        this.name = name;
-        this.siteurl = siteurl;
-        this.detectRegex = detectRegex;
-        this.idRegex = idRegex;
-        this.embedTemplate = embedTemplate;
-        width = defWidth;
-        height = defHeight;
-    }
-
-    public String getEmbed(final String url) {
-        String id = getId(url);
-        String result = embedTemplate.replaceAll(URL, id);
-        result = result.replaceAll(HEIGHT, "" + height);
-        result = result.replaceAll(WIDTH, "" + width);
-        return result;
-    }
-
-    public int getHeight() {
-        return height;
-    }
-
-    public String getId(final String url) {
-        String id = url.replaceFirst(idRegex, "$1");
-        return id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getSiteurl() {
-        return siteurl;
-    }
-
-    public int getWidth() {
-        return width;
-    }
-
-    public boolean is(final String url) {
-        return url.matches(detectRegex);
-    }
-
-    public void setHeight(final int height) {
-        this.height = height;
-    }
-
-    public void setWidth(final int width) {
-        this.width = width;
-    }
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaRegistry.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -2,16 +2,23 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
-public class ExternalMediaRegistry extends ArrayList<ExternalMediaDescriptor> {
+import org.ourproject.kune.platf.client.dto.ExtMediaDescripDTO;
+import org.ourproject.kune.platf.client.ui.TextUtils;
 
+public class ExternalMediaRegistry extends ArrayList<ExtMediaDescripDTO> {
+
     private static final long serialVersionUID = 1L;
 
-    public static final ExternalMediaDescriptor NO_MEDIA = new ExternalMediaDescriptor(null, null, null, null, null, 0,
-            0);
+    public static final ExtMediaDescripDTO NO_MEDIA = new ExtMediaDescripDTO(null, null, null, null, null, 0, 0);
 
-    public ExternalMediaDescriptor get(final String url) {
-        for (ExternalMediaDescriptor media : this) {
+    public ExternalMediaRegistry(final List<ExtMediaDescripDTO> extMediaDescrips) {
+        super(extMediaDescrips);
+    }
+
+    public ExtMediaDescripDTO get(final String url) {
+        for (ExtMediaDescripDTO media : this) {
             if (media.is(url)) {
                 return media;
             }
@@ -22,9 +29,9 @@
 
     public String getNames() {
         String names = "";
-        for (Iterator<ExternalMediaDescriptor> iterator = this.iterator(); iterator.hasNext();) {
-            ExternalMediaDescriptor elem = iterator.next();
-            names += elem.getName();
+        for (Iterator<ExtMediaDescripDTO> iterator = this.iterator(); iterator.hasNext();) {
+            ExtMediaDescripDTO elem = iterator.next();
+            names += TextUtils.generateHtmlLink(elem.getSiteurl(), elem.getName());
             if (iterator.hasNext()) {
                 names += ", ";
             }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/InsertMediaDialogView.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -4,6 +4,6 @@
 
 public interface InsertMediaDialogView extends View {
 
-    int HEIGHT = 150;
+    int HEIGHT = 250;
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -1,27 +1,23 @@
 package org.ourproject.kune.platf.client.ui.rte.insertmedia.abstractmedia;
 
 import org.ourproject.kune.platf.client.i18n.Resources;
-import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.ContentPosition;
+import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertElementAbstractPanel;
 import org.ourproject.kune.platf.client.ui.rte.insertmedia.InsertMediaDialogView;
 
+import com.google.gwt.user.client.ui.HTML;
 import com.gwtext.client.widgets.Component;
 import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.form.Label;
 import com.gwtext.client.widgets.form.TextField;
 import com.gwtext.client.widgets.form.event.FormPanelListenerAdapter;
 
-public class InsertMediaAbstractPanel extends DefaultForm implements InsertMediaAbstractView {
+public class InsertMediaAbstractPanel extends InsertElementAbstractPanel implements InsertMediaAbstractView {
 
     protected TextField hrefField;
-    private final Label intro;
 
     public InsertMediaAbstractPanel(final String title, final InsertMediaAbstractPresenter presenter) {
-        super(title);
-        super.setAutoWidth(true);
-        super.setHeight(InsertMediaDialogView.HEIGHT);
+        super(title, InsertMediaDialogView.HEIGHT);
 
-        intro = new Label();
-
         hrefField = new TextField();
         hrefField.setTabIndex(1);
         hrefField.setLabel(Resources.i18n.t("Link"));
@@ -38,10 +34,11 @@
             }
         });
 
-        add(intro);
-        add(hrefField);
+        insert(1, hrefField);
+        defValues();
     }
 
+    @Override
     public String getSrc() {
         return hrefField.getRawValue();
     }
@@ -51,7 +48,24 @@
         super.insert(index, component);
     }
 
+    @Override
+    public void reset() {
+        defValues();
+        super.reset();
+    }
+
+    @Override
     public void setIntro(final String text) {
         intro.setHtml(text + "<br/>");
     }
+
+    public String setPosition(final String embedElement) {
+        return ContentPosition.getElementPosition(new HTML(embedElement).getElement(), getWrapText(), getPosition()).getString();
+    }
+
+    private void defValues() {
+        wrapText.setVisible(true);
+        wrapText.setChecked(true);
+        positionCombo.setValue(ContentPosition.RIGHT);
+    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractView.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractView.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -10,4 +10,6 @@
 
     void reset();
 
+    String setPosition(String embedElement);
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -10,7 +10,8 @@
             final ExternalMediaRegistry externalMediaRegistry) {
         super(i18n.t("External"), presenter);
         String supportedVideos = externalMediaRegistry.getNames();
-        setIntro(i18n.t("Provide a link to the external video (supported videos: [%s])", supportedVideos) + "<br/>");
+        setIntro(i18n.t("Provide a link to an external video (supported videos: [%s])", supportedVideos) + "<br/>");
+        hrefField.setTitle(i18n.t("Write something like: http://www.youtube.com/watch?v=PxsGyljd6B0"));
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPresenter.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ext/InsertMediaExtPresenter.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -1,7 +1,7 @@
 package org.ourproject.kune.platf.client.ui.rte.insertmedia.ext;
 
+import org.ourproject.kune.platf.client.dto.ExtMediaDescripDTO;
 import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level;
-import org.ourproject.kune.platf.client.ui.rte.insertmedia.ExternalMediaDescriptor;
 import org.ourproject.kune.platf.client.ui.rte.insertmedia.ExternalMediaRegistry;
 import org.ourproject.kune.platf.client.ui.rte.insertmedia.InsertMediaDialog;
 import org.ourproject.kune.platf.client.ui.rte.insertmedia.abstractmedia.InsertMediaAbstractPresenter;
@@ -10,34 +10,12 @@
 
     private InsertMediaExtView view;
     private final ExternalMediaRegistry externalMediaRegistry;
-    private ExternalMediaDescriptor mediaDescriptor;
+    private ExtMediaDescripDTO mediaDescriptor;
 
     public InsertMediaExtPresenter(final InsertMediaDialog insertMediaDialog,
             final ExternalMediaRegistry externalMediaRegistry) {
         super(insertMediaDialog);
         this.externalMediaRegistry = externalMediaRegistry;
-
-        externalMediaRegistry.add(new ExternalMediaDescriptor(
-                "youtube",
-                "http://youtube.com",
-                ".*youtube.*",
-                ".*youtube.com/watch.*[\\?&]v=(.*)",
-                "<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://youtube.com/v/###URL###\" /><param name=\"wmode\" value=\"opaque\" /><embed src=\"http://youtube.com/v/###URL###\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" wmode=\"opaque\"></embed></object>",
-                480, 385));
-        externalMediaRegistry.add(new ExternalMediaDescriptor(
-                "blip.tv",
-                "http://blip.tv",
-                ".*blip\\.tv.*",
-                ".*blip.tv/file/([0-9]+).*",
-                "<embed src=\"http://blip.tv/play/###URL###\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" allowscriptaccess=\"always\" allowfullscreen=\"true\" wmode=\"opaque\" ></embed>",
-                480, 385));
-        externalMediaRegistry.add(new ExternalMediaDescriptor(
-                "google video",
-                "http://video.google.com/",
-                ".*video\\.google.*",
-                ".*video\\.google\\.com/videoplay.*docid=([0-9]+).*",
-                "<embed id=\"VideoPlayback\" src=\"http://video.google.com/googleplayer.swf?docid=###URL###&hl=es&fs=true\" style=\"width:###WIDTH###;height:###HEIGHT###\" allowFullScreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" wmode=\"opaque\" > </embed>",
-                400, 326));
     }
 
     public void init(final InsertMediaExtView view) {
@@ -59,6 +37,6 @@
 
     @Override
     protected String updateMediaInfo() {
-        return mediaDescriptor.getEmbed(view.getSrc());
+        return view.setPosition(mediaDescriptor.getEmbed(view.getSrc()));
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -24,7 +24,7 @@
     private final TextField inputUnicodeField;
     private final TextField previewField;
 
-    public InsertSpecialUTF8CharPanel(I18nTranslationService i18n, final InsertSpecialCharDialog charDialog) {
+    public InsertSpecialUTF8CharPanel(final I18nTranslationService i18n, final InsertSpecialCharDialog charDialog) {
         super(i18n.t("Advanced"));
         setAutoWidth(true);
         setHeight(InsertSpecialCharDialogView.HEIGHT - 10);
@@ -34,9 +34,8 @@
 
         Label label = new Label();
         label.setHtml(i18n.t("If you know a special character's [%s] value, enter it below.",
-                "<a href=\"http://unicode.org/charts/\" target=\"_blank\">Unicode</a>")
+                TextUtils.generateHtmlLink("http://unicode.org/charts/", "Unicode"))
                 + "<br/><br/>");
-        // label.setCls("k-specialchar-adv-label");
 
         inputUnicodeField = new TextField();
         inputUnicodeField.setTabIndex(4);
@@ -57,7 +56,7 @@
         previewField.setStyle("background-color:#FFF;background-image:none;color:#000;");
 
         inputUnicodeField.addKeyPressListener(new EventCallback() {
-            public void execute(EventObject e) {
+            public void execute(final EventObject e) {
                 refreshPreview();
             }
         });
@@ -70,7 +69,7 @@
 
         insert.addListener(new ButtonListenerAdapter() {
             @Override
-            public void onClick(Button button, EventObject e) {
+            public void onClick(final Button button, final EventObject e) {
                 if (form.getFormPanel().getForm().isValid()) {
                     charDialog.onInsert(getCharEntered());
                 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/InitData.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.ourproject.kune.platf.server.domain.ExtMediaDescrip;
 import org.ourproject.kune.platf.server.domain.I18nCountry;
 import org.ourproject.kune.platf.server.domain.I18nLanguage;
 import org.ourproject.kune.platf.server.domain.License;
@@ -53,6 +54,7 @@
     private int imgIconsize;
     private ArrayList<ToolSimple> userTools;
     private ArrayList<ToolSimple> groupTools;
+    private List<ExtMediaDescrip> extMediaDescrips;
 
     private String flvEmbedObject;
 
@@ -94,6 +96,10 @@
         return defaultWsTheme;
     }
 
+    public List<ExtMediaDescrip> getExtMediaDescrips() {
+        return extMediaDescrips;
+    }
+
     public String getFlvEmbedObject() {
         return flvEmbedObject;
     }
@@ -202,6 +208,10 @@
         this.defaultWsTheme = defaultWsTheme;
     }
 
+    public void setExtMediaDescrips(final List<ExtMediaDescrip> extMediaDescrips) {
+        this.extMediaDescrips = extMediaDescrips;
+    }
+
     public void setFlvEmbedObject(final String flvEmbedObject) {
         this.flvEmbedObject = flvEmbedObject;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -52,6 +52,7 @@
 import org.ourproject.kune.platf.server.content.CreationService;
 import org.ourproject.kune.platf.server.content.CreationServiceDefault;
 import org.ourproject.kune.platf.server.i18n.I18nTranslationServiceDefault;
+import org.ourproject.kune.platf.server.manager.ExtMediaDescripManager;
 import org.ourproject.kune.platf.server.manager.FileManager;
 import org.ourproject.kune.platf.server.manager.GroupManager;
 import org.ourproject.kune.platf.server.manager.I18nCountryManager;
@@ -70,6 +71,7 @@
 import org.ourproject.kune.platf.server.manager.file.FileDownloadManager;
 import org.ourproject.kune.platf.server.manager.file.FileManagerDefault;
 import org.ourproject.kune.platf.server.manager.file.FileUploadManager;
+import org.ourproject.kune.platf.server.manager.impl.ExtMediaDescripManagerDefault;
 import org.ourproject.kune.platf.server.manager.impl.GroupManagerDefault;
 import org.ourproject.kune.platf.server.manager.impl.I18nCountryManagerDefault;
 import org.ourproject.kune.platf.server.manager.impl.I18nLanguageManagerDefault;
@@ -140,6 +142,7 @@
         bind(TagUserContentManager.class).to(TagUserContentManagerDefault.class);
         bind(CommentManager.class).to(CommentManagerDefault.class);
         bind(FileManager.class).to(FileManagerDefault.class);
+        bind(ExtMediaDescripManager.class).to(ExtMediaDescripManagerDefault.class);
     }
 
     private void bindRPC() {

Added: trunk/src/main/java/org/ourproject/kune/platf/server/domain/ExtMediaDescrip.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/ExtMediaDescrip.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/ExtMediaDescrip.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,119 @@
+package org.ourproject.kune.platf.server.domain;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.hibernate.validator.Length;
+
+import com.wideplay.warp.persist.dao.Finder;
+
+ at Entity
+ at Table(name = "ext_media_descriptors")
+public class ExtMediaDescrip implements HasId {
+
+    @Id
+    @GeneratedValue
+    private Long id;
+    @Column(nullable = false)
+    private String name;
+    @Column(nullable = false)
+    private String siteurl;
+    @Column(nullable = false)
+    private String detectRegex;
+    @Column(nullable = false)
+    private String idRegex;
+    @Column(nullable = false)
+    @Length(max = 1000)
+    private String embedTemplate;
+    private int width;
+    private int height;
+
+    public ExtMediaDescrip() {
+        this(null, null, null, null, null, 0, 0);
+    }
+
+    public ExtMediaDescrip(final String name, final String siteurl, final String detectRegex, final String idRegex,
+            final String embedTemplate, final int defWidth, final int defHeight) {
+        this.name = name;
+        this.siteurl = siteurl;
+        this.detectRegex = detectRegex;
+        this.idRegex = idRegex;
+        this.embedTemplate = embedTemplate;
+        width = defWidth;
+        height = defHeight;
+    }
+
+    @Finder(query = "from ExtMediaDescrip")
+    public List<ExtMediaDescrip> getAll() {
+        return null;
+    }
+
+    public String getDetectRegex() {
+        return detectRegex;
+    }
+
+    public String getEmbedTemplate() {
+        return embedTemplate;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getIdRegex() {
+        return idRegex;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getSiteurl() {
+        return siteurl;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public void setDetectRegex(final String detectRegex) {
+        this.detectRegex = detectRegex;
+    }
+
+    public void setEmbedTemplate(final String embedTemplate) {
+        this.embedTemplate = embedTemplate;
+    }
+
+    public void setHeight(final int height) {
+        this.height = height;
+    }
+
+    public void setId(final Long id) {
+        this.id = id;
+    }
+
+    public void setIdRegex(final String idRegex) {
+        this.idRegex = idRegex;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public void setSiteurl(final String siteurl) {
+        this.siteurl = siteurl;
+    }
+
+    public void setWidth(final int width) {
+        this.width = width;
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/server/manager/ExtMediaDescripManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/ExtMediaDescripManager.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/ExtMediaDescripManager.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,28 @@
+/*
+ *
+ * Copyright (C) 2007-2009 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.server.manager;
+
+import java.util.List;
+
+import org.ourproject.kune.platf.server.domain.ExtMediaDescrip;
+
+public interface ExtMediaDescripManager extends Manager<ExtMediaDescrip, Long> {
+    List<ExtMediaDescrip> getAll();
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ExtMediaDescripManagerDefault.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,29 @@
+package org.ourproject.kune.platf.server.manager.impl;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.ourproject.kune.platf.server.domain.ExtMediaDescrip;
+import org.ourproject.kune.platf.server.manager.ExtMediaDescripManager;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class ExtMediaDescripManagerDefault extends DefaultManager<ExtMediaDescrip, Long> implements
+        ExtMediaDescripManager {
+
+    private final ExtMediaDescrip extMediaFinder;
+
+    @Inject
+    public ExtMediaDescripManagerDefault(final Provider<EntityManager> provider, final ExtMediaDescrip extMediaFinder) {
+        super(provider, ExtMediaDescrip.class);
+        this.extMediaFinder = extMediaFinder;
+    }
+
+    public List<ExtMediaDescrip> getAll() {
+        return extMediaFinder.getAll();
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/LicenseManagerDefault.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -37,12 +37,14 @@
     private final DatabaseProperties properties;
 
     @Inject
-    public LicenseManagerDefault(final Provider<EntityManager> provider, DatabaseProperties properties) {
+    public LicenseManagerDefault(final Provider<EntityManager> provider, final DatabaseProperties properties,
+            final License licenseFinder) {
         super(provider, License.class);
         this.properties = properties;
+        this.licenseFinder = licenseFinder;
     }
 
-    public License findByShortName(String shortName) {
+    public License findByShortName(final String shortName) {
         return licenseFinder.findByShortName(shortName);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rest/ContentJSONService.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -28,7 +28,7 @@
 import org.ourproject.kune.platf.server.manager.impl.SearchResult;
 import org.ourproject.kune.platf.server.mapper.Mapper;
 import org.ourproject.kune.rack.filters.rest.REST;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 
 import com.google.inject.Inject;
 
@@ -45,12 +45,12 @@
         this.mapper = mapper;
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search) {
         return search(search, null, null);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults) {
         SearchResult<Content> results = contentManager.search(search, firstResult, maxResults);
         SearchResult<Container> resultsContainer = containerManager.search(search, firstResult, maxResults);
@@ -61,16 +61,16 @@
         return resultMapped;
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM,
-            SearcherContants.GROUP_PARAM, SearcherContants.MIMETYPE_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM,
+            SearcherConstants.GROUP_PARAM, SearcherConstants.MIMETYPE_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults,
             final String group, final String mimetype) {
         SearchResult<Content> results = contentManager.searchMime(search, firstResult, maxResults, group, mimetype);
         return map(results);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM,
-            SearcherContants.GROUP_PARAM, SearcherContants.MIMETYPE_PARAM, SearcherContants.MIMETYPE2_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM,
+            SearcherConstants.GROUP_PARAM, SearcherConstants.MIMETYPE_PARAM, SearcherConstants.MIMETYPE2_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults,
             final String group, final String mimetype, final String mimetype2) {
         return map(contentManager.searchMime(search, firstResult, maxResults, group, mimetype, mimetype2));

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rest/GroupJSONService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rest/GroupJSONService.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rest/GroupJSONService.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -26,7 +26,7 @@
 import org.ourproject.kune.platf.server.manager.impl.SearchResult;
 import org.ourproject.kune.platf.server.mapper.Mapper;
 import org.ourproject.kune.rack.filters.rest.REST;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 
 import com.google.inject.Inject;
 
@@ -40,12 +40,12 @@
         this.mapper = mapper;
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search) {
         return search(search, null, null);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults) {
         SearchResult<Group> results = manager.search(search, firstResult, maxResults);
         return mapper.mapSearchResult(results, LinkDTO.class);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rest/I18nTranslationJSONService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rest/I18nTranslationJSONService.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rest/I18nTranslationJSONService.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -28,7 +28,7 @@
 import org.ourproject.kune.platf.server.manager.impl.SearchResult;
 import org.ourproject.kune.platf.server.mapper.Mapper;
 import org.ourproject.kune.rack.filters.rest.REST;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 
 import com.google.inject.Inject;
 
@@ -42,26 +42,26 @@
         this.mapper = mapper;
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM })
     public List<I18nTranslationDTO> search(final String language) {
         List<I18nTranslation> results = manager.getUntranslatedLexicon(language);
         return mapper.mapList(results, I18nTranslationDTO.class);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
     public SearchResultDTO<I18nTranslationDTO> search(final String language, final Integer firstResult,
             final Integer maxResults) {
         SearchResult<I18nTranslation> results = manager.getUntranslatedLexicon(language, firstResult, maxResults);
         return mapper.mapSearchResult(results, I18nTranslationDTO.class);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM })
     public List<I18nTranslationDTO> searchtranslated(final String language) {
         List<I18nTranslation> results = manager.getTranslatedLexicon(language);
         return mapper.mapList(results, I18nTranslationDTO.class);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
     public SearchResultDTO<I18nTranslationDTO> searchtranslated(final String language, final Integer firstResult,
             final Integer maxResults) {
         SearchResult<I18nTranslation> results = manager.getTranslatedLexicon(language, firstResult, maxResults);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rest/UserJSONService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rest/UserJSONService.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rest/UserJSONService.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -26,7 +26,7 @@
 import org.ourproject.kune.platf.server.manager.impl.SearchResult;
 import org.ourproject.kune.platf.server.mapper.Mapper;
 import org.ourproject.kune.rack.filters.rest.REST;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 
 import com.google.inject.Inject;
 
@@ -40,12 +40,12 @@
         this.mapper = mapper;
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search) {
         return search(search, null, null);
     }
 
-    @REST(params = { SearcherContants.QUERY_PARAM, SearcherContants.START_PARAM, SearcherContants.LIMIT_PARAM })
+    @REST(params = { SearcherConstants.QUERY_PARAM, SearcherConstants.START_PARAM, SearcherConstants.LIMIT_PARAM })
     public SearchResultDTO<LinkDTO> search(final String search, final Integer firstResult, final Integer maxResults) {
         SearchResult<User> results = manager.search(search, firstResult, maxResults);
         return mapper.mapSearchResult(results, LinkDTO.class);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -26,6 +26,7 @@
 import org.ourproject.kune.platf.client.rpc.SiteService;
 import org.ourproject.kune.platf.server.InitData;
 import org.ourproject.kune.platf.server.UserSession;
+import org.ourproject.kune.platf.server.manager.ExtMediaDescripManager;
 import org.ourproject.kune.platf.server.manager.I18nCountryManager;
 import org.ourproject.kune.platf.server.manager.I18nLanguageManager;
 import org.ourproject.kune.platf.server.manager.LicenseManager;
@@ -54,6 +55,7 @@
     private final I18nLanguageManager languageManager;
     private final I18nCountryManager countryManager;
     private final ServerToolRegistry serverToolRegistry;
+    private final ExtMediaDescripManager extMediaDescripManager;
 
     // TODO: refactor: too many parameters! refactor to Facade Pattern
     @Inject
@@ -61,7 +63,7 @@
             final UserInfoService userInfoService, final LicenseManager licenseManager, final Mapper mapper,
             final KuneProperties kuneProperties, final ChatProperties chatProperties,
             final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
-            final ServerToolRegistry serverToolRegistry) {
+            final ServerToolRegistry serverToolRegistry, final ExtMediaDescripManager extMediaDescripManager) {
         this.userSessionProvider = userSessionProvider;
         this.userManager = userManager;
         this.userInfoService = userInfoService;
@@ -72,6 +74,7 @@
         this.languageManager = languageManager;
         this.countryManager = countryManager;
         this.serverToolRegistry = serverToolRegistry;
+        this.extMediaDescripManager = extMediaDescripManager;
     }
 
     @Transactional(type = TransactionType.READ_ONLY)
@@ -107,6 +110,7 @@
         data.setMp3EmbedObject(kuneProperties.get(KuneProperties.MP3_EMBEDED_OBJECT));
         data.setOggEmbedObject(kuneProperties.get(KuneProperties.OGG_EMBEDED_OBJECT));
         data.setAviEmbedObject(kuneProperties.get(KuneProperties.AVI_EMBEDED_OBJECT));
+        data.setExtMediaDescrips(extMediaDescripManager.getAll());
         return mapper.map(data, InitDataDTO.class);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalimg/InsertImageLocalPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -8,7 +8,7 @@
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.rte.insertimg.abstractimg.InsertImageAbstractPanel;
 import org.ourproject.kune.workspace.client.search.AbstractLiveSearcherField;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 
 import com.calclab.suco.client.events.Listener;
 import com.gwtext.client.core.UrlParam;
@@ -24,9 +24,9 @@
         super(i18n.t("Local"), presenter);
 
         final AbstractLiveSearcherField cb = new AbstractLiveSearcherField(i18n,
-                SearcherContants.CONTENT_TEMPLATE_TEXT_PREFIX
+                SearcherConstants.CONTENT_TEMPLATE_TEXT_PREFIX
                         + downloadUtils.getLogoImageUrl(new StateToken("{shortName}"))
-                        + SearcherContants.CONTENT_TEMPLATE_TEXT_SUFFIX, SearcherContants.CONTENT_DATA_PROXY_URL,
+                        + SearcherConstants.CONTENT_TEMPLATE_TEXT_SUFFIX, SearcherConstants.CONTENT_DATA_PROXY_URL,
                 new Listener<LinkDTO>() {
                     public void onEvent(final LinkDTO link) {
                         src = session.getSiteUrl() + downloadUtils.getImageUrl(new StateToken(link.getLink()));
@@ -40,8 +40,8 @@
             @Override
             public void onFocus(final Field field) {
                 cb.setStoreBaseParams(new UrlParam[] {
-                        new UrlParam(SearcherContants.GROUP_PARAM, presenter.getCurrentGroupName()),
-                        new UrlParam(SearcherContants.MIMETYPE_PARAM, BasicMimeTypeDTO.IMAGE) });
+                        new UrlParam(SearcherConstants.GROUP_PARAM, presenter.getCurrentGroupName()),
+                        new UrlParam(SearcherConstants.MIMETYPE_PARAM, BasicMimeTypeDTO.IMAGE) });
             }
         });
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocallink/InsertLinkLocalPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocallink/InsertLinkLocalPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocallink/InsertLinkLocalPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -26,7 +26,7 @@
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.rte.insertlink.abstractlink.InsertLinkAbstractPanel;
 import org.ourproject.kune.workspace.client.search.AbstractLiveSearcherField;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
 import com.calclab.suco.client.events.Listener;
@@ -41,9 +41,9 @@
         super(i18n.t("Local link"), presenter);
 
         AbstractLiveSearcherField cb = new AbstractLiveSearcherField(i18n,
-                SearcherContants.CONTENT_TEMPLATE_TEXT_PREFIX
+                SearcherConstants.CONTENT_TEMPLATE_TEXT_PREFIX
                         + downloadUtils.getLogoImageUrl(new StateToken("{shortName}"))
-                        + SearcherContants.CONTENT_TEMPLATE_TEXT_SUFFIX, SearcherContants.CONTENT_DATA_PROXY_URL,
+                        + SearcherConstants.CONTENT_TEMPLATE_TEXT_SUFFIX, SearcherConstants.CONTENT_DATA_PROXY_URL,
                 new Listener<LinkDTO>() {
                     public void onEvent(final LinkDTO link) {
                         href = stateTokenUtils.getPublicUrl(new StateToken(link.getLink()));

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -7,7 +7,7 @@
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.rte.insertmedia.abstractmedia.InsertMediaAbstractPanel;
 import org.ourproject.kune.workspace.client.search.AbstractLiveSearcherField;
-import org.ourproject.kune.workspace.client.search.SearcherContants;
+import org.ourproject.kune.workspace.client.search.SearcherConstants;
 
 import com.calclab.suco.client.events.Listener;
 import com.gwtext.client.core.UrlParam;
@@ -23,9 +23,9 @@
         super(i18n.t("Local"), presenter);
 
         final AbstractLiveSearcherField cb = new AbstractLiveSearcherField(i18n,
-                SearcherContants.CONTENT_TEMPLATE_TEXT_PREFIX
+                SearcherConstants.CONTENT_TEMPLATE_TEXT_PREFIX
                         + downloadUtils.getLogoImageUrl(new StateToken("{shortName}"))
-                        + SearcherContants.CONTENT_TEMPLATE_TEXT_SUFFIX, SearcherContants.CONTENT_DATA_PROXY_URL,
+                        + SearcherConstants.CONTENT_TEMPLATE_TEXT_SUFFIX, SearcherConstants.CONTENT_DATA_PROXY_URL,
                 new Listener<LinkDTO>() {
                     public void onEvent(final LinkDTO link) {
                         src = link.getLink();
@@ -39,9 +39,9 @@
             @Override
             public void onFocus(final Field field) {
                 cb.setStoreBaseParams(new UrlParam[] {
-                        new UrlParam(SearcherContants.GROUP_PARAM, presenter.getCurrentGroupName()),
-                        new UrlParam(SearcherContants.MIMETYPE_PARAM, BasicMimeTypeDTO.AUDIO),
-                        new UrlParam(SearcherContants.MIMETYPE2_PARAM, BasicMimeTypeDTO.VIDEO) });
+                        new UrlParam(SearcherConstants.GROUP_PARAM, presenter.getCurrentGroupName()),
+                        new UrlParam(SearcherConstants.MIMETYPE_PARAM, BasicMimeTypeDTO.AUDIO),
+                        new UrlParam(SearcherConstants.MIMETYPE2_PARAM, BasicMimeTypeDTO.VIDEO) });
             }
         });
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPresenter.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/insertlocalmedia/InsertMediaLocalPresenter.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -31,6 +31,6 @@
     @Override
     protected String updateMediaInfo() {
         // FIXME (avi, mp3, ...)
-        return mediaUtils.get().getFlvEmbed(new StateToken(view.getSrc()));
+        return view.setPosition(mediaUtils.get().getFlvEmbed(new StateToken(view.getSrc())));
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/EntityLicensePanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -21,10 +21,10 @@
 
 import org.ourproject.kune.platf.client.dto.LicenseDTO;
 import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.KuneWindowUtils;
 import org.ourproject.kune.platf.client.ui.SimpleToolbar;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
-import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Image;
 import com.google.gwt.user.client.ui.Label;
@@ -56,7 +56,7 @@
         licenseBar.add(licenseLabel);
 
         final ClickListener clickListener = new ClickListener() {
-            public void onClick(Widget arg0) {
+            public void onClick(final Widget arg0) {
                 presenter.onLicenseClick();
             }
         };
@@ -66,12 +66,12 @@
 
         MouseListenerAdapter mouseListenerAdapter = new MouseListenerAdapter() {
             @Override
-            public void onMouseEnter(Widget sender) {
+            public void onMouseEnter(final Widget sender) {
                 fade(true);
             }
 
             @Override
-            public void onMouseLeave(Widget sender) {
+            public void onMouseLeave(final Widget sender) {
                 // fade(false);
             }
         };
@@ -94,7 +94,7 @@
     }
 
     public void openWindow(final String url) {
-        Window.open(url, "_blank", "");
+        KuneWindowUtils.open(url);
     }
 
     public void showLicense(final String groupName, final LicenseDTO licenseDTO) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/AbstractLiveSearcherField.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -41,9 +41,9 @@
 
         store = new Store(dataProxy, reader);
 
-        store.load(new UrlParam[] { new UrlParam(SearcherContants.QUERY_PARAM, "."),
-                new UrlParam(SearcherContants.START_PARAM, 0),
-                new UrlParam(SearcherContants.LIMIT_PARAM, PAGINATION_SIZE) });
+        store.load(new UrlParam[] { new UrlParam(SearcherConstants.QUERY_PARAM, "."),
+                new UrlParam(SearcherConstants.START_PARAM, 0),
+                new UrlParam(SearcherConstants.LIMIT_PARAM, PAGINATION_SIZE) });
 
         final Template resultTpl = new Template(templateText);
         super.setStore(store);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/EntityLiveSearcherPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -86,9 +86,9 @@
             break;
         }
 
-        String templateText = SearcherContants.CONTENT_TEMPLATE_TEXT_PREFIX
+        String templateText = SearcherConstants.CONTENT_TEMPLATE_TEXT_PREFIX
                 + downloadUtils.getLogoImageUrl(new StateToken("{shortName}"))
-                + SearcherContants.CONTENT_TEMPLATE_TEXT_SUFFIX;
+                + SearcherConstants.CONTENT_TEMPLATE_TEXT_SUFFIX;
 
         liveSearcher = new AbstractLiveSearcherPanel(i18n, templateText, dataProxyUrl, new Listener<LinkDTO>() {
             public void onEvent(final LinkDTO link) {

Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherConstants.java (from rev 1096, trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherContants.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherContants.java	2009-04-21 12:54:21 UTC (rev 1096)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherConstants.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,16 @@
+package org.ourproject.kune.workspace.client.search;
+
+public interface SearcherConstants {
+
+    String START_PARAM = "start";
+    String LIMIT_PARAM = "limit";
+    String QUERY_PARAM = "query";
+    String MIMETYPE_PARAM = "mimetype";
+    String MIMETYPE2_PARAM = "mimetype2";
+    String GROUP_PARAM = "group";
+
+    String CONTENT_DATA_PROXY_URL = "/kune/json/ContentJSONService/search";
+    String CONTENT_TEMPLATE_TEXT_PREFIX = "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img src=\"";
+    String CONTENT_TEMPLATE_TEXT_SUFFIX = "\" style=\"height: 16px; width: 16px;\" />{shortName}:&nbsp;{longName}</span></div>";
+
+}

Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherContants.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherContants.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SearcherContants.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -1,16 +0,0 @@
-package org.ourproject.kune.workspace.client.search;
-
-public interface SearcherContants {
-
-    String START_PARAM = "start";
-    String LIMIT_PARAM = "limit";
-    String QUERY_PARAM = "query";
-    String MIMETYPE_PARAM = "mimetype";
-    String MIMETYPE2_PARAM = "mimetype2";
-    String GROUP_PARAM = "group";
-
-    String CONTENT_DATA_PROXY_URL = "/kune/json/ContentJSONService/search";
-    String CONTENT_TEMPLATE_TEXT_PREFIX = "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img src=\"";
-    String CONTENT_TEMPLATE_TEXT_SUFFIX = "\" style=\"height: 16px; width: 16px;\" />{shortName}:&nbsp;{longName}</span></div>";
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteoptions/SiteOptionsPanel.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -20,12 +20,12 @@
 package org.ourproject.kune.workspace.client.sitebar.siteoptions;
 
 import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.platf.client.ui.KuneWindowUtils;
 import org.ourproject.kune.platf.client.ui.rte.TestRTEDialog;
 import org.ourproject.kune.workspace.client.i18n.I18nTranslator;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
 import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.PushButton;
 import com.google.gwt.user.client.ui.Widget;
@@ -58,14 +58,14 @@
 
         final Item testRTE = new Item(i18n.t("Test new RTE"), new BaseItemListenerAdapter() {
             @Override
-            public void onClick(BaseItem item, EventObject e) {
+            public void onClick(final BaseItem item, final EventObject e) {
                 editor.get().show();
             }
         }, "");
 
         final Item testRTEbasic = new Item(i18n.t("Test new RTE (basic mode)"), new BaseItemListenerAdapter() {
             @Override
-            public void onClick(BaseItem item, EventObject e) {
+            public void onClick(final BaseItem item, final EventObject e) {
                 editor.get().setExtended(false);
                 editor.get().show();
             }
@@ -73,7 +73,7 @@
 
         final Item linkHelpInTrans = new Item(i18n.t("Help with the translation"), new BaseItemListenerAdapter() {
             @Override
-            public void onClick(BaseItem item, EventObject e) {
+            public void onClick(final BaseItem item, final EventObject e) {
                 super.onClick(item, e);
                 translatorProvider.get().doShowTranslator();
             }
@@ -81,9 +81,9 @@
 
         final Item linkKuneBugs = new Item(i18n.t("Report kune bugs"), new BaseItemListenerAdapter() {
             @Override
-            public void onClick(BaseItem item, EventObject e) {
+            public void onClick(final BaseItem item, final EventObject e) {
                 super.onClick(item, e);
-                Window.open("http://ourproject.org/tracker/?group_id=407", "_blank", null);
+                KuneWindowUtils.open("http://ourproject.org/tracker/?group_id=407");
             }
         }, "images/kuneicon16.gif");
         optionsMenu.addItem(testRTE);

Modified: trunk/src/main/resources/db/liquibase_changelog.xml
===================================================================
--- trunk/src/main/resources/db/liquibase_changelog.xml	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/resources/db/liquibase_changelog.xml	2009-04-28 12:53:10 UTC (rev 1102)
@@ -119,4 +119,11 @@
       encoding="utf8" stripComments="1" />
     <rollback>SELECT * FROM globalize_countries;</rollback>
   </changeSet>
+  <changeSet id="18" author="vjrj">
+    <comment>Initial External Media Descriptors</comment>
+    <sqlFile path="src/main/resources/db/update-0014-extmedia.sql"
+      encoding="utf8" stripComments="1" />
+    <rollback>DELETE FROM `ext_media_descriptors` WHERE id BETWEEN 1 AND 6;</rollback>
+  </changeSet>
+
 </databaseChangeLog>

Added: trunk/src/main/resources/db/update-0014-extmedia.sql
===================================================================
--- trunk/src/main/resources/db/update-0014-extmedia.sql	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/main/resources/db/update-0014-extmedia.sql	2009-04-28 12:53:10 UTC (rev 1102)
@@ -0,0 +1,6 @@
+INSERT INTO `ext_media_descriptors` VALUES (1,'.*youtube.*','<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://youtube.com/v/###URL###\" /><param name=\"wmode\" value=\"opaque\" /><embed src=\"http://youtube.com/v/###URL###\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" wmode=\"opaque\"></embed></object>',385,'.*youtube.com/watch.*[\\?&]v=(.*)','youtube','http://youtube.com',480);
+INSERT INTO `ext_media_descriptors` VALUES (2,'.*blip\\.tv.*','<embed src=\"http://blip.tv/play/###URL###\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" allowscriptaccess=\"always\" allowfullscreen=\"true\" wmode=\"opaque\" ></embed>',385,'.*blip.tv/file/([0-9]+).*','blip.tv','http://blip.tv',480);
+INSERT INTO `ext_media_descriptors` VALUES (3,'.*video\\.google.*','<embed id=\"VideoPlayback\" src=\"http://video.google.com/googleplayer.swf?docid=###URL###&hl=es&fs=true\" style=\"width:###WIDTH###;height:###HEIGHT###\" allowFullScreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" wmode=\"opaque\" > </embed>',326,'.*video\\.google\\.com/videoplay.*docid=([0-9]+).*','google video','http://video.google.com/',400);
+INSERT INTO `ext_media_descriptors` VALUES (4,'.*video\\.yahoo.*','<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.30\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"AllowScriptAccess\" VALUE=\"always\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"flashVars\" value=\"id=###URL###&embed=1\" /><embed src=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.30\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" allowFullScreen=\"true\" AllowScriptAccess=\"always\" bgcolor=\"#000000\"  wmode=\"opaque\" flashVars=\"id=###URL###&embed=1\" ></embed></object>',322,'.*video.yahoo.com/watch/(.*)','yahoo video','http://video.yahoo.com/',512);
+INSERT INTO `ext_media_descriptors` VALUES (5,'.*vimeo\\.com/.*','<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"movie\" value=\"http://vimeo.com/moogaloop.swf?clip_id=###URL###&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1\" /><embedsrc=\"http://vimeo.com/moogaloop.swf?clip_id=###URL###&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\"  wmode=\"opaque\" allowscriptaccess=\"always\" width=\"###WIDTH###\" height=\"###HEIGHT###\"></embed></object><br />',342,'.*vimeo\\.com/(.*)','vimeo','http://vimeo.com',400);
+INSERT INTO `ext_media_descriptors` VALUES (6,'.*dailymotion\\.com.*','<object type=\"application/x-shockwave-flash\" data=\"http://www.dailymotion.com/swf/###URL###\" width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/###URL###\" /><param name=\"wmode\" value=\"transparent\" /></object>',339,'.*www\\.dailymotion\\.com.*video/([^_]+).*$','daylymotion','http://www.dailymotion.com/',420);

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptorTest.java	2009-04-24 20:53:42 UTC (rev 1101)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/ExternalMediaDescriptorTest.java	2009-04-28 12:53:10 UTC (rev 1102)
@@ -6,37 +6,61 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.ExtMediaDescripDTO;
 
 public class ExternalMediaDescriptorTest {
 
-    private ExternalMediaDescriptor ytmedia;
-    private ExternalMediaDescriptor btmedia;
-    private ExternalMediaDescriptor gvmedia;
+    private ExtMediaDescripDTO ytmedia;
+    private ExtMediaDescripDTO btmedia;
+    private ExtMediaDescripDTO gvmedia;
+    private ExtMediaDescripDTO yvmedia;
+    private ExtMediaDescripDTO vimedia;
+    private ExtMediaDescripDTO dmmedia;
 
     @Before
     public void before() {
-        ytmedia = new ExternalMediaDescriptor(
+        ytmedia = new ExtMediaDescripDTO(
                 "youtube",
                 "http://youtube.com",
                 ".*youtube.*",
                 ".*youtube.com/watch.*[\\?&]v=(.*)",
                 "<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://youtube.com/v/###URL###\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\"http://youtube.com/v/###URL###\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" wmode=\"transparent\"></embed></object>",
                 480, 385);
-        btmedia = new ExternalMediaDescriptor(
+        btmedia = new ExtMediaDescripDTO(
                 "blip.tv",
                 "http://blip.tv",
                 ".*blip\\.tv.*",
                 ".*blip.tv/file/([0-9]+).*",
                 "<embed src=\"http://blip.tv/play/###URL###\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>",
                 480, 385);
-        gvmedia = new ExternalMediaDescriptor(
+        gvmedia = new ExtMediaDescripDTO(
                 "google video",
                 "http://video.google.com/",
                 ".*video\\.google.*",
                 ".*video\\.google\\.com/videoplay.*docid=([0-9]+).*",
                 "<embed id=\"VideoPlayback\" src=\"http://video.google.com/googleplayer.swf?docid=###URL###&hl=es&fs=true\" style=\"width:###WIDTH###;height:###HEIGHT###\" allowFullScreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\"> </embed>",
                 400, 326);
-
+        yvmedia = new ExtMediaDescripDTO(
+                "yahoo video",
+                "http://video.yahoo.com/",
+                ".*video\\.yahoo.*",
+                ".*video.yahoo.com/watch/(.*)",
+                "<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.30\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"AllowScriptAccess\" VALUE=\"always\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"flashVars\" value=\"id=###URL###&embed=1\" /><embed src=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.30\" type=\"application/x-shockwave-flash\" width=\"###WIDTH###\" height=\"###HEIGHT###\" allowFullScreen=\"true\" AllowScriptAccess=\"always\" bgcolor=\"#000000\" flashVars=\"id=###URL###&embed=1\" ></embed></object>",
+                512, 322);
+        vimedia = new ExtMediaDescripDTO(
+                "vimeo",
+                "http://vimeo.com",
+                ".*vimeo\\.com/.*",
+                ".*vimeo\\.com/(.*)",
+                "<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"movie\" value=\"http://vimeo.com/moogaloop.swf?clip_id=###URL###&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1\" /><embed src=\"http://vimeo.com/moogaloop.swf?clip_id=###URL###&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"###WIDTH###\" height=\"###HEIGHT###\"></embed></object><br />",
+                400, 342);
+        dmmedia = new ExtMediaDescripDTO(
+                "Daylymotion",
+                "http://www.dailymotion.com/",
+                ".*dailymotion\\.com.*",
+                ".*www\\.dailymotion\\.com.*video/([^_]+).*$",
+                "<object type=\"application/x-shockwave-flash\" data=\"http://www.dailymotion.com/swf/###URL###\" width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/###URL###\" /><param name=\"wmode\" value=\"transparent\" /></object>",
+                420, 339);
     }
 
     @Test
@@ -59,14 +83,24 @@
                 gvmedia.getId("http://video.google.com/videoplay?docid=7360794370207355739&ei=VBPxSbXDLob2-Aabu9B-&q=chomsky"));
         assertEquals("7360794370207355739",
                 gvmedia.getId("http://video.google.com/videoplay?docid=7360794370207355739"));
+
+        assertEquals("1626663/5503240", yvmedia.getId("http://video.yahoo.com/watch/1626663/5503240"));
+
+        assertEquals("1650316", vimedia.getId("http://vimeo.com/1650316"));
+
+        assertEquals(
+                "x74yqa",
+                dmmedia.getId("http://www.dailymotion.com/relevance/search/free+software/video/x74yqa_stephen-fry-free-software_tech"));
+
+        // assertEquals("", gvmedia.getId(""));
     }
 
     @Test
     public void testGeEmb() {
         String result = ytmedia.getEmbed("http://www.youtube.com/watch?v=v2aKo6la7J4");
-        assertFalse(result.matches(ExternalMediaDescriptor.HEIGHT));
-        assertFalse(result.matches(ExternalMediaDescriptor.WIDTH));
-        assertFalse(result.matches(ExternalMediaDescriptor.URL));
+        assertFalse(result.matches(ExtMediaDescripDTO.HEIGHT));
+        assertFalse(result.matches(ExtMediaDescripDTO.WIDTH));
+        assertFalse(result.matches(ExtMediaDescripDTO.URL));
         assertTrue(result.matches(".*v2aKo6la7J4.*"));
     }
 




More information about the kune-commits mailing list