You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2007/12/05 02:04:50 UTC

svn commit: r601179 - in /portals/jetspeed-2/trunk/applications/j2-admin/src: java/org/apache/jetspeed/portlets/selector/resources/ webapp/WEB-INF/view/selectors/

Author: taylor
Date: Tue Dec  4 17:04:47 2007
New Revision: 601179

URL: http://svn.apache.org/viewvc?rev=601179&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-821
localization of Category Portlet Selector
contribution from Jeseung Choi

Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector.properties
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_en.properties
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_ko.properties
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-edit-selector.vm
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-portlet-selector.vm

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector.properties?rev=601179&r1=601178&r2=601179&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector.properties (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector.properties Tue Dec  4 17:04:47 2007
@@ -3,18 +3,40 @@
 # this work for additional information regarding copyright ownership.
 # The ASF licenses this file to You under the Apache License, Version 2.0
 # (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-select=Select
-category=Category
-
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+category.name=Category Name
+select=Select
+add=Add
+categories=Categories
+search=Search
+refresh=Refresh
+next=Next
+last=Last
+previous=Previous
+first=First
+search.portlet=Search portlet
+goback=GoBack
+count=Count
+save=Save
+edit.category=Edit Category
+edit.grid=Edit Display Grid
+add.category=Add Category
+remove.category=Remove Category
+rows=Rows
+columns=Columns
+cancel=Cancel
+keywords=Keywords
+ok=OK
+

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_en.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_en.properties?rev=601179&r1=601178&r2=601179&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_en.properties (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_en.properties Tue Dec  4 17:04:47 2007
@@ -3,18 +3,39 @@
 # this work for additional information regarding copyright ownership.
 # The ASF licenses this file to You under the Apache License, Version 2.0
 # (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-select=Select
-category=Category
-
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+category.name=Category Name
+select=Select
+add=Add
+categories=Categories
+search=Search
+refresh=Refresh
+next=Next
+last=Last
+previous=Previous
+first=First
+search.portlet=Search portlet
+goback=GoBack
+count=Count
+save=Save
+edit.category=Edit Category
+edit.grid=Edit Display Grid
+add.category=Add Category
+remove.category=Remove Category
+rows=Rows
+columns=Columns
+cancel=Cancel
+keywords=Keywords
+ok=OK

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_ko.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_ko.properties?rev=601179&r1=601178&r2=601179&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_ko.properties (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/resources/PortletSelector_ko.properties Tue Dec  4 17:04:47 2007
@@ -1,20 +1,40 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-select=\uc120\ud0dd
-category=\uce74\ud14c\uace0\ub9ac
-
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+category.name=\uce74\ud14c\uace0\ub9ac \uc774\ub984
+select=\uc120\ud0dd
+add=\ucd94\uac00
+categories=\uce74\ud14c\uace0\ub9ac
+search=\uac80\uc0c9
+refresh=\uc0c8\ub85c\uace0\uce68
+next=\ub2e4\uc74c
+last=\ub9c8\uc9c0\ub9c9
+previous=\uc774\uc804
+first=\ucc98\uc74c
+search.portlet=\ud3ec\ud2c0\ub9bf \uac80\uc0c9
+goback=\ub4a4\ub85c
+count=\uac2f\uc218
+save=\uc800\uc7a5
+edit.category=\uce74\ud14c\uace0\ub9ac \uc124\uc815
+edit.grid=\ud654\uba74 \ubc30\uc5f4 \uc124\uc815
+add.category=\uce74\ud14c\uace0\ub9ac \ucd94\uac00
+remove.category=\uce74\ud14c\uace0\ub9ac \uc0ad\uc81c
+rows=\ud589 \uac2f\uc218
+columns=\uc5f4 \uac2f\uc218
+cancel=\ucde8\uc18c
+keywords=\ud0a4\uc6cc\ub4dc
+ok=\ud655\uc778

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-edit-selector.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-edit-selector.vm?rev=601179&r1=601178&r2=601179&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-edit-selector.vm (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-edit-selector.vm Tue Dec  4 17:04:47 2007
@@ -1,296 +1,297 @@
-#*
+#*
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*#
-<div dojoType="dialog" id="AddCategoryDialog" bgColor="grey" bgOpacity="0.5" toggle="fade" toggleDuration="250">
-  <form onsubmit="return false;">
-  <input type="hidden" id='theNewCategory'>
-    <div id="AddCategoryPane" dojoType="ContentPane" label="Add Category" class="constraints">
-      <div style="height:21px; padding: 2px"><b>Category Name:&nbsp;</b><span id="categoryName"></span></div>
-      <div class="categoryTableDiv">
-      <table>
-      <tr>
-        <td>Category Name:</td>
-        <td><input id='jsCatName' type="text"></td>
-      </tr>
-      </table>
-      </div>
-      <div dojoType="LayoutContainer"
-                     widgetId="constraintsEditorBottom"
-                     minHeight="20"
-                     layoutAlign="bottom"
-                     style="padding: 4px; width: 100%; height: 30px">
-            <div dojoType="LayoutContainer"
-                 widgetId="constraintsEditorBottomLeft"
-                 minHeight="20"
-                 layoutAlign="left"
-                 style="padding: 4px; width: 18%; height: 30px">
-            </div>
-            <div dojoType="LayoutContainer"
-                 widgetId="constraintsEditorBottomRight"
-                 minHeight="20"
-                 layoutAlign="right"
-                 style="padding: 4px; border-right: thin inset grey; width: 78%; height: 30px">
-                <div class="buttonbox">
-                    <button dojoType="Button" onClick="dojo.widget.byId( 'AddCategoryDialog' ).hide();" >Cancel</button>
-                    <button dojoType="Button" onClick="addCategory();">OK</button>
-                </div>
-            </div>
-      </div>
-    </div>
-  </form>
-</div>
-#set ($cancelLink = $renderResponse.createRenderURL())
-$cancelLink.setPortletMode($MODE_VIEW)
-<!-- Search Form -->
-<form id='jsEditSelectorForm' onSubmit='return false;' method="post" style="height:250px; padding: 2px; margin:10px">
-<table>
-<tr>
-<td nowrap class="portlet-section-alternate" align="right">Categories:&nbsp;</td>
-<td nowrap>
-<select id='jsSelectCat' size='10' onChange='javascript:handleSelect();'>
-</select>
-<td nowrap class="portlet-section-alternate" align="right">Keywords:&nbsp;</td>
-<td nowrap>
-<input type="text" name="keywords" id="keywords" size="60" value="" class="portlet-form-field-label"/>    
-</tr>
-<tr>
-<td nowrap>
-<input type="submit" value="Add Category" onClick='javascript:handleAdd();'/>
-</td>
-<td nowrap>
-<input type="submit" value="Remove Category" onClick='javascript:handleRemove();'/>
-</td>
-</tr>
-<tr>
-<td nowrap class="portlet-section-alternate" align="right">Rows:&nbsp;</td>
-<td nowrap>         
-<input type="text" name="Rows" id="Rows" size="6" value="$!Rows" class="portlet-form-field-label"/>    
-</td>
-<td nowrap class="portlet-section-alternate" align="right">Columns:&nbsp;</td>
-<td nowrap>
-<input type="text" name="Columns" id="Columns" size="6" value="$!Columns" class="portlet-form-field-label"/>    
-</td>
-</tr>
-<tr>
-<td nowrap>
-<input type="submit" value="Save" onClick='javascript:handleSave();'/>
-<input type="submit" value="Cancel" onClick='javascript:handleCancel();'/>
-<input type="hidden" name='jsModifiedCats' id='jsModifiedCats' value=""/>
-<input type="hidden" name='jsModifiedKeys' id='jsModifiedKeys' value=""/>
-<input type="hidden" name='jsAddedCats' id='jsAddedCats' value=""/>
-<input type="hidden" name='jsAddedKeys' id='jsAddedKeys' value=""/>
-<input type="hidden" name='jsRemovedCats' id='jsRemovedCats' value=""/>
-<input type="hidden" name='jsCats' id='jsCats' value=""/>
-<input type="hidden" name='jspage' id='jspage' value="$jspage"/>
-</td>
-</tr>
-</table>
-</form>
-
-<script language="JavaScript" type="text/javascript">
-function JsCategory(name, keywords)
-{
-   this.name = name;
-   this.keywords = keywords;
-   this.state = "clean";
-}
-function saveOffKeywords()
-{
-   var keywords = document.getElementById('keywords');
-   if (window.jsLastIndex > -1)
-   {
-      if (jsCategories[window.jsLastIndex].keywords != keywords.value)
-      {
-        jsCategories[window.jsLastIndex].keywords = keywords.value; 
-        if (jsCategories[window.jsLastIndex].state != "new")
-        {
-           jsCategories[window.jsLastIndex].state = "modified";
-        }
-      }
-   }
-}
-function handleSelect()
-{
-   var catList = document.getElementById('jsSelectCat');
-   saveOffKeywords();
-   var keywords = document.getElementById('keywords');   
-   keywords.value = jsCategories[catList.selectedIndex].keywords;
-   window.jsLastIndex = catList.selectedIndex;
-}
-function handleAdd()
-{ 
-   dojo.widget.byId("AddCategoryDialog").show();   
-}
-function addCategory()
-{
-    saveOffKeywords();
-    var newIndex = jsCategories.length;
-    var catName = document.getElementById('jsCatName').value;    
-    catName = trim(catName);
-    if (catName.length > 0)
-    {    
-        // check for dups
-        for (i = 0; i < jsCategories.length; i++)
-        {
-           if (catName.toLowerCase() == jsCategories[i].name.toLowerCase())
-           {
-              dojo.widget.byId("AddCategoryDialog").hide();   
-              return;
-           }
-        }
-        jsCategories[newIndex] = new JsCategory(catName, "");
-        jsCategories[newIndex].state = "new";
-        var catList = document.getElementById('jsSelectCat');
-        var opt = new Option(catName, catName);
-        catList.add(opt, null); 
-    }
-    dojo.widget.byId("AddCategoryDialog").hide();   
-}
-function handleRemove()
-{
-    var catList = document.getElementById('jsSelectCat');
-    if (catList.selectedIndex != -1)
-    {
-        window.jsLastIndex = -1;
-        var keywords = document.getElementById('keywords');   
-        keywords.value = "";
-        jsRemoves[jsRemoves.length] = jsCategories[catList.selectedIndex].name;
-        // shift up
-        var temp = new Array();
-        var j = 0;
-        for (i = 0; i < jsCategories.length; i++)
-        {
-            if (i != catList.selectedIndex)
-            {
-                temp[j] = jsCategories[i];
-                j = j + 1;
-            }
-        }
-        delete jsCategories;
-        jsCategories = temp;
-        catList.remove(catList.selectedIndex);
-    }
-    
-}
-function handleSave()
-{
-   saveOffKeywords();
-   processDeletes(window.jsRemoves, 'jsRemovedCats');
-   var modifiedCats = document.getElementById("jsModifiedCats");  
-   var modifiedKeys = document.getElementById("jsModifiedKeys");  
-   var addedCats = document.getElementById("jsAddedCats");  
-   var addedKeys = document.getElementById("jsAddedKeys");  
-   var cats = document.getElementById("jsCats");
-   if (window.jsCategories.length == 0)
-   {
-       modifiedCats.value = "";
-       modifiedKeys.value = "";
-       addedCats.value = "";
-       addedKeys.value = "";
-       cats.value = "";      
-   }
-   else
-   {
-       var newCount = 0;
-       var modCount = 0;
-       for (i = 0; i < window.jsCategories.length; i++)
-       {
-          if (i == 0)
-          {
-              cats.value = window.jsCategories[i].name;
-          }
-          else
-          {
-              cats.value = cats.value + "," + window.jsCategories[i].name;
-          }
-          if (window.jsCategories[i].state == "new")
-          {
-             if (newCount == 0)
-             {
-                addedCats.value = window.jsCategories[i].name;
-                addedKeys.value = window.jsCategories[i].keywords;
-             }
-             else
-             {
-                addedCats.value = addedCats.value + "," + window.jsCategories[i].name;
-                addedKeys.value = addedKeys.value + "|" + window.jsCategories[i].keywords;
-             }
-             newCount = newCount + 1;
-          }
-          else if (window.jsCategories[i].state == "modified")
-          {
-             if (modCount == 0)
-             {
-                modifiedCats.value = window.jsCategories[i].name;
-                modifiedKeys.value = window.jsCategories[i].keywords;
-             }
-             else
-             {
-                modifiedCats.value = modifiedCats.value + "," + window.jsCategories[i].name;
-                modifiedKeys.value = modifiedKeys.value + "|" + window.jsCategories[i].keywords;
-             }
-             modCount = modCount + 1;
-          }
-       }
-
-   }
-   var editForm = document.getElementById('jsEditSelectorForm');
-   editForm.action = "$renderResponse.createActionURL()";
-   editForm.submit();
-}
-function handleCancel()
-{
-   var editForm = document.getElementById('jsEditSelectorForm');
-   editForm.action = "$cancelLink";
-   editForm.submit();
-}
-
-function processDeletes(arr, fieldName)
-{
-   var inputField = document.getElementById(fieldName);  
-   if (arr.length == 0)
-   {
-       inputField.value = "";
-       return;
-   }
-   var temp = arr[0]; 
-   for (i = 1; i < arr.length; i++)
-   {
-      temp = temp + "," + arr[i];               
-   }
-   inputField.value = temp;
-}
-function trim(str)
-{
-   return str.replace(/(^\s*|\s*$)/g, "");
-}
-function initializeEditPortletSelector()
-{
-    #foreach ( $cat in $categories)
-    #set ($icount = $velocityCount - 1)   
-    jsCategories[$icount] = new JsCategory("$cat.Name", "$!cat.Keywords");
-    #end
-    var catList = document.getElementById('jsSelectCat');
-    for (i = 0; i < jsCategories.length; i++)
-    {
-       catList.options[i] = new Option(jsCategories[i].name,jsCategories[i].name);
-    }
-}
-window.jsCategories = new Array();
-window.jsRemoves = new Array();
-window.jsLastIndex = -1;
-dojo.addOnLoad( window.initializeEditPortletSelector );
-</script>
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+#set ($messages = $portletConfig.getResourceBundle($renderRequest.Locale))
+<div dojoType="dialog" id="AddCategoryDialog" bgColor="grey" bgOpacity="0.5" toggle="fade" toggleDuration="250">
+  <form onsubmit="return false;">
+  <input type="hidden" id='theNewCategory'>
+    <div id="AddCategoryPane" dojoType="ContentPane" label="Add Category" class="constraints">
+      <div style="height:21px; padding: 2px"><b>$messages.getString("category.name"):&nbsp;</b><span id="categoryName"></span></div>
+      <div class="categoryTableDiv">
+      <table>
+      <tr>
+        <td>$messages.getString("category.name"):</td>
+        <td><input id='jsCatName' type="text"></td>
+      </tr>
+      </table>
+      </div>
+      <div dojoType="LayoutContainer"
+                     widgetId="constraintsEditorBottom"
+                     minHeight="20"
+                     layoutAlign="bottom"
+                     style="padding: 4px; width: 100%; height: 30px">
+            <div dojoType="LayoutContainer"
+                 widgetId="constraintsEditorBottomLeft"
+                 minHeight="20"
+                 layoutAlign="left"
+                 style="padding: 4px; width: 18%; height: 30px">
+            </div>
+            <div dojoType="LayoutContainer"
+                 widgetId="constraintsEditorBottomRight"
+                 minHeight="20"
+                 layoutAlign="right"
+                 style="padding: 4px; border-right: thin inset grey; width: 78%; height: 30px">
+                <div class="buttonbox">
+                    <button dojoType="Button" onClick="dojo.widget.byId( 'AddCategoryDialog' ).hide();" >$messages.getString("cancel")</button>
+                    <button dojoType="Button" onClick="addCategory();">$messages.getString("ok")</button>
+                </div>
+            </div>
+      </div>
+    </div>
+  </form>
+</div>
+#set ($cancelLink = $renderResponse.createRenderURL())
+$cancelLink.setPortletMode($MODE_VIEW)
+<!-- Search Form -->
+<form id='jsEditSelectorForm' onSubmit='return false;' method="post" style="height:250px; padding: 2px; margin:10px">
+<table>
+<tr>
+<td nowrap class="portlet-section-alternate" align="right">$messages.getString("categories"):&nbsp;</td>
+<td nowrap>
+<select id='jsSelectCat' size='10' onChange='javascript:handleSelect();'>
+</select>
+<td nowrap class="portlet-section-alternate" align="right">$messages.getString("keywords"):&nbsp;</td>
+<td nowrap>
+<input type="text" name="keywords" id="keywords" size="60" value="" class="portlet-form-field-label"/>    
+</tr>
+<tr>
+<td nowrap>
+<input type="submit" value='$messages.getString("add.category")' onClick='javascript:handleAdd();'/>
+</td>
+<td nowrap>
+<input type="submit" value='$messages.getString("remove.category")' onClick='javascript:handleRemove();'/>
+</td>
+</tr>
+<tr>
+<td nowrap class="portlet-section-alternate" align="right">$messages.getString("rows"):&nbsp;</td>
+<td nowrap>         
+<input type="text" name="Rows" id="Rows" size="6" value="$!Rows" class="portlet-form-field-label"/>    
+</td>
+<td nowrap class="portlet-section-alternate" align="right">$messages.getString("columns"):&nbsp;</td>
+<td nowrap>
+<input type="text" name="Columns" id="Columns" size="6" value="$!Columns" class="portlet-form-field-label"/>    
+</td>
+</tr>
+<tr>
+<td nowrap>
+<input type="submit" value='$messages.getString("save")' onClick='javascript:handleSave();'/>
+<input type="submit" value='$messages.getString("cancel")' onClick='javascript:handleCancel();'/>
+<input type="hidden" name='jsModifiedCats' id='jsModifiedCats' value=""/>
+<input type="hidden" name='jsModifiedKeys' id='jsModifiedKeys' value=""/>
+<input type="hidden" name='jsAddedCats' id='jsAddedCats' value=""/>
+<input type="hidden" name='jsAddedKeys' id='jsAddedKeys' value=""/>
+<input type="hidden" name='jsRemovedCats' id='jsRemovedCats' value=""/>
+<input type="hidden" name='jsCats' id='jsCats' value=""/>
+<input type="hidden" name='jspage' id='jspage' value="$jspage"/>
+</td>
+</tr>
+</table>
+</form>
+
+<script language="JavaScript" type="text/javascript">
+function JsCategory(name, keywords)
+{
+   this.name = name;
+   this.keywords = keywords;
+   this.state = "clean";
+}
+function saveOffKeywords()
+{
+   var keywords = document.getElementById('keywords');
+   if (window.jsLastIndex > -1)
+   {
+      if (jsCategories[window.jsLastIndex].keywords != keywords.value)
+      {
+        jsCategories[window.jsLastIndex].keywords = keywords.value; 
+        if (jsCategories[window.jsLastIndex].state != "new")
+        {
+           jsCategories[window.jsLastIndex].state = "modified";
+        }
+      }
+   }
+}
+function handleSelect()
+{
+   var catList = document.getElementById('jsSelectCat');
+   saveOffKeywords();
+   var keywords = document.getElementById('keywords');   
+   keywords.value = jsCategories[catList.selectedIndex].keywords;
+   window.jsLastIndex = catList.selectedIndex;
+}
+function handleAdd()
+{ 
+   dojo.widget.byId("AddCategoryDialog").show();   
+}
+function addCategory()
+{
+    saveOffKeywords();
+    var newIndex = jsCategories.length;
+    var catName = document.getElementById('jsCatName').value;    
+    catName = trim(catName);
+    if (catName.length > 0)
+    {    
+        // check for dups
+        for (i = 0; i < jsCategories.length; i++)
+        {
+           if (catName.toLowerCase() == jsCategories[i].name.toLowerCase())
+           {
+              dojo.widget.byId("AddCategoryDialog").hide();   
+              return;
+           }
+        }
+        jsCategories[newIndex] = new JsCategory(catName, "");
+        jsCategories[newIndex].state = "new";
+        var catList = document.getElementById('jsSelectCat');
+        var opt = new Option(catName, catName);
+        catList.add(opt, null); 
+    }
+    dojo.widget.byId("AddCategoryDialog").hide();   
+}
+function handleRemove()
+{
+    var catList = document.getElementById('jsSelectCat');
+    if (catList.selectedIndex != -1)
+    {
+        window.jsLastIndex = -1;
+        var keywords = document.getElementById('keywords');   
+        keywords.value = "";
+        jsRemoves[jsRemoves.length] = jsCategories[catList.selectedIndex].name;
+        // shift up
+        var temp = new Array();
+        var j = 0;
+        for (i = 0; i < jsCategories.length; i++)
+        {
+            if (i != catList.selectedIndex)
+            {
+                temp[j] = jsCategories[i];
+                j = j + 1;
+            }
+        }
+        delete jsCategories;
+        jsCategories = temp;
+        catList.remove(catList.selectedIndex);
+    }
+    
+}
+function handleSave()
+{
+   saveOffKeywords();
+   processDeletes(window.jsRemoves, 'jsRemovedCats');
+   var modifiedCats = document.getElementById("jsModifiedCats");  
+   var modifiedKeys = document.getElementById("jsModifiedKeys");  
+   var addedCats = document.getElementById("jsAddedCats");  
+   var addedKeys = document.getElementById("jsAddedKeys");  
+   var cats = document.getElementById("jsCats");
+   if (window.jsCategories.length == 0)
+   {
+       modifiedCats.value = "";
+       modifiedKeys.value = "";
+       addedCats.value = "";
+       addedKeys.value = "";
+       cats.value = "";      
+   }
+   else
+   {
+       var newCount = 0;
+       var modCount = 0;
+       for (i = 0; i < window.jsCategories.length; i++)
+       {
+          if (i == 0)
+          {
+              cats.value = window.jsCategories[i].name;
+          }
+          else
+          {
+              cats.value = cats.value + "," + window.jsCategories[i].name;
+          }
+          if (window.jsCategories[i].state == "new")
+          {
+             if (newCount == 0)
+             {
+                addedCats.value = window.jsCategories[i].name;
+                addedKeys.value = window.jsCategories[i].keywords;
+             }
+             else
+             {
+                addedCats.value = addedCats.value + "," + window.jsCategories[i].name;
+                addedKeys.value = addedKeys.value + "|" + window.jsCategories[i].keywords;
+             }
+             newCount = newCount + 1;
+          }
+          else if (window.jsCategories[i].state == "modified")
+          {
+             if (modCount == 0)
+             {
+                modifiedCats.value = window.jsCategories[i].name;
+                modifiedKeys.value = window.jsCategories[i].keywords;
+             }
+             else
+             {
+                modifiedCats.value = modifiedCats.value + "," + window.jsCategories[i].name;
+                modifiedKeys.value = modifiedKeys.value + "|" + window.jsCategories[i].keywords;
+             }
+             modCount = modCount + 1;
+          }
+       }
+
+   }
+   var editForm = document.getElementById('jsEditSelectorForm');
+   editForm.action = "$renderResponse.createActionURL()";
+   editForm.submit();
+}
+function handleCancel()
+{
+   var editForm = document.getElementById('jsEditSelectorForm');
+   editForm.action = "$cancelLink";
+   editForm.submit();
+}
+
+function processDeletes(arr, fieldName)
+{
+   var inputField = document.getElementById(fieldName);  
+   if (arr.length == 0)
+   {
+       inputField.value = "";
+       return;
+   }
+   var temp = arr[0]; 
+   for (i = 1; i < arr.length; i++)
+   {
+      temp = temp + "," + arr[i];               
+   }
+   inputField.value = temp;
+}
+function trim(str)
+{
+   return str.replace(/(^\s*|\s*$)/g, "");
+}
+function initializeEditPortletSelector()
+{
+    #foreach ( $cat in $categories)
+    #set ($icount = $velocityCount - 1)   
+    jsCategories[$icount] = new JsCategory("$cat.Name", "$!cat.Keywords");
+    #end
+    var catList = document.getElementById('jsSelectCat');
+    for (i = 0; i < jsCategories.length; i++)
+    {
+       catList.options[i] = new Option(jsCategories[i].name,jsCategories[i].name);
+    }
+}
+window.jsCategories = new Array();
+window.jsRemoves = new Array();
+window.jsLastIndex = -1;
+dojo.addOnLoad( window.initializeEditPortletSelector );
+</script>

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-portlet-selector.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-portlet-selector.vm?rev=601179&r1=601178&r2=601179&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-portlet-selector.vm (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/selectors/category-portlet-selector.vm Tue Dec  4 17:04:47 2007
@@ -17,17 +17,17 @@
 #set ($refreshLink = $renderResponse.createActionURL())
 $refreshLink.setParameter("reset","true")
 #set ($renderLink = $renderResponse.createActionURL())
-
+#set ($messages = $portletConfig.getResourceBundle($renderRequest.Locale))
 #set ($portalContextPath=$renderRequest.getAttribute("org.apache.jetspeed.request.RequestContext").request.contextPath)
 <!-- Search Form -->
 <form id='jsSelectorForm' onSubmit='return false;' style="height:21px; padding: 2px; margin:10px">
 <table>
 <tr>
-<td nowrap class="portlet-section-alternate" align="right">Search for portlets:&nbsp;</td>
+<td nowrap class="portlet-section-alternate" align="right">$messages.getString("search.portlet"):&nbsp;</td>
 <td nowrap class="portlet-section-alternate">
 <input type="text" name="filter" id="searchString" size="40" value="$!searchString" class="portlet-form-field-label">    
-<input type="submit" value="Search" onClick='javascript:performSearch();'>
-<input type="submit" value="Refresh" onClick="javascript:performRefresh()">
+<input type="submit" value="$messages.getString("search")" onClick='javascript:performSearch();'>
+<input type="submit" value="$messages.getString("refresh")" onClick="javascript:performRefresh()">
 <input type="hidden" value="$category" id="category" name="category">
 <input type="hidden" value="$pageNumber" id="pageNumber" name="pageNumber">
 <input type="hidden" value="$jspage" id="pagePath" name="pagePath">
@@ -80,14 +80,14 @@
 function addPortletToPage(theNewPortlet,pID)
 {                                                      
    //dojo.widget.byId("AddPortletDialog").hide();   
-   var portletDef = new jetspeed.om.PortletDef( theNewPortlet );   
+   var portletDef = new jetspeed.selector.PortletDef( theNewPortlet );   
    var pagePath = jetspeed.url.removeAllQueryParameters( jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + getReturnPagePath() );
-   jetspeed.addNewPortletDefinition( portletDef, null, pagePath, getAddToLayoutId() );
+   jetspeed.selector.addNewPortletDefinition( portletDef, pagePath, getAddToLayoutId() );
    selectorPortlets[pID].count = parseInt(selectorPortlets[pID].count) + 1;
    var cell = document.getElementById(theNewPortlet);
    if (cell != null)
    {
-      cell.innerHTML = "Count: " + selectorPortlets[pID].count; // TODO: localize
+      cell.innerHTML = "$messages.getString("count"): " + selectorPortlets[pID].count; // TODO: localize
    }
 }
 function performSearch()
@@ -122,24 +122,28 @@
              a.setAttribute("style", "font-weight:normal");
     }
 }
-function createPagination(Pagenumber,PageCount)
+function clearTable( tableNode )
 {
-    var pagtable1 = document.getElementById('pagtable1');   
-    while (pagtable1.hasChildNodes())
-    {
-      pagtable1.removeChild(pagtable1.lastChild);
-    }
-    var pagtable3 = document.getElementById('pagtable3');   
-    while (pagtable3.hasChildNodes())
+    if ( ! tableNode ) return;
+    while ( tableNode.hasChildNodes() )
     {
-      pagtable3.removeChild(pagtable3.lastChild);
+        var lastChild = tableNode.lastChild;
+        var childNodeName = lastChild.nodeName;
+        if ( childNodeName && childNodeName.toLowerCase() == "tbody" )
+            break;
+        tableNode.removeChild( lastChild );
     }
-    
+}
+
+function createPagination(Pagenumber,PageCount)
+{
+    var pagtable1 = document.getElementById('pagtable1');   
+    var pagtable3 = document.getElementById('pagtable3');
     var pagtable = document.getElementById('pagtable2');   
-    while (pagtable.hasChildNodes())
-    {
-      pagtable.removeChild(pagtable.lastChild);
-    }    
+    clearTable( pagtable1 );
+    clearTable( pagtable3 );
+    clearTable( pagtable );
+
     var pgRoww = null;
     var pgCol=null;
     var a = null;    
@@ -148,12 +152,12 @@
     if (Pagenumber != 1)
     {
         a = document.createElement("a");
-        a.innerHTML = 'Previous';
+        a.innerHTML = '$messages.getString("previous")';
         a.href = "javascript:displayPortlets(" + "\"" + (Pagenumber-1)+ "\"" + ")";
         pgCol.appendChild(a);              
         pgCol = pgRoww.insertCell(1);    
         a = document.createElement("a");
-        a.innerHTML = 'First';
+        a.innerHTML = '$messages.getString("first")';
         a.href = "javascript:displayPortlets(" + "\"" + 1+ "\"" + ")";
         pgCol.appendChild(a);              
     }
@@ -183,12 +187,12 @@
         if (PageCount > 1)	
         {
 			          a = document.createElement("a");
-          			a.innerHTML = 'Last';
+          			a.innerHTML = '$messages.getString("last")';
           			a.href = "javascript:displayPortlets(" + "\"" + PageCount+ "\"" + ")";
           			pgCol.appendChild(a);              
           			pgCol = pgRoww.insertCell(1);   
           			a = document.createElement("a");    
-          			a.innerHTML = 'Next';
+          			a.innerHTML = '$messages.getString("next")';
           			a.href = "javascript:displayPortlets(" + "\"" + (parseInt(Pagenumber)+1)+ "\"" + ")";
           			pgCol.appendChild(a);              
         		}
@@ -222,7 +226,7 @@
   c1.appendChild(a);
   var c2 = row.insertCell(i+1);
   var a2 = document.createElement("a");
-  a2.innerHTML = "[Go Back]";  // TODO: localize
+  a2.innerHTML = "[$messages.getString("goback")]";  // TODO: localize
   // TODO: determine if JETSPEED or DESKTOP 
   a2.href = getReturnURL();
   a2.setAttribute("style", "font-weight:normal");
@@ -236,10 +240,8 @@
   	//getting portlet table and deleting all items
   	//befor adding the new
   	var ptable = document.getElementById('ptable');
-  while (ptable.hasChildNodes())
-  {
-      ptable.removeChild(ptable.lastChild);
-  }
+    clearTable( ptable );
+
   	var outerRow = null;
   	var iz = 0;
   	var ri = 0;
@@ -289,12 +291,12 @@
    				 c0 = row3.insertCell(0);
    				 c0.setAttribute("style","font-size: 8pt; color: blue;");
    				 var a = document.createElement("a");
-   				 a.innerHTML = "Add"; // TODO: localize
+   				 a.innerHTML = "$messages.getString("add")"; // TODO: localize
    				 a.href = "javascript:addPortletToPage("+"\""+selectorPortlets[iz].name+"\""+",\"" + iz + "\")";
    				 c0.appendChild(a);
    				 c1 = row3.insertCell(1);
    				 // TODO: localize
-   				 c1.innerHTML = "Count: " + selectorPortlets[iz].count;
+   				 c1.innerHTML = "$messages.getString("count"): " + selectorPortlets[iz].count;
    				 c1.setAttribute("style","font-size: 8pt; color: blue;");
    				 c1.setAttribute("id", selectorPortlets[iz].name);
 
@@ -352,7 +354,7 @@
 {
    var jsLayoutId = jetspeed.url.getQueryParameter( document.location.href, "jslayoutid" );
    if ( jsLayoutId == null )
-		jsLayoutId = "$jslayoutid";
+		jsLayoutId = "$!jslayoutid";
    return jsLayoutId;
 }
 function getReturnURL()



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org