shuber      2005/09/02 15:49:14 CEST

  Modified files:
    core/src/webapp/jsp/jahia/engines/shared smalltext_field.jsp 
  Log:
  Fix for JAHIA-361 contributed by Benjamin Papez, thanks.
  http://www.jahia.org/jira/browse/JAHIA-361
  
  Revision  Changes    Path
  1.9       +36 -38    
jahia/core/src/webapp/jsp/jahia/engines/shared/smalltext_field.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/engines/shared/smalltext_field.jsp.diff?r1=1.8&r2=1.9&f=h
  
  
  
  Index: smalltext_field.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/engines/shared/smalltext_field.jsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- smalltext_field.jsp       5 Jul 2005 15:46:47 -0000       1.8
  +++ smalltext_field.jsp       2 Sep 2005 13:49:14 -0000       1.9
  @@ -74,61 +74,59 @@
     </ul>
   </logic:present>
   
  -<%  if (theField.getValue().indexOf("#") != -1 && 
theField.getValue().length() > 6 && theField.getValue().length() < 10) { %>
  +<%  if (theField.getValue().indexOf("#") == 0 && 
theField.getValue().length() > 6 && theField.getValue().length() < 10) { 
  +%>
  +<logic:notEqual name="dynapiInitialized" value="true">
  +  <bean:define id="dynapiInitialized" value='true' toScope="request"/>
  +  <SCRIPT language="javascript" 
src="<%=theURL%>jahiatools/javascript/dynapi.js"></SCRIPT>
   
  -<SCRIPT type="text/javascript" 
src="<%=theURL%>/jahiatools/javascript/dynapi.js"></SCRIPT>
  -<SCRIPT type="text/javascript">
  +  <SCRIPT language="javascript">
   
  -<!--
  -//DynAPI.setLibraryPath('<%=theURL%>/jahiatools/javascript/lib/');
  -//DynAPI.include('dynapi.api.*');
  -//-->
  +  <!--
  +  DynAPI.setLibraryPath('<%=theURL%>jahiatools/javascript/lib/');
  +  DynAPI.include('dynapi.api.*');
   
  -</SCRIPT>
  -<SCRIPT type="text/javascript">
  +  function getPageOffsetTop(el) {
   
  -<!--
  -DynAPI_<%=contextID%> = new DynAPIObject();
  -DynAPI_<%=contextID%>.hookLoad=window.onload;
  -DynAPI_<%=contextID%>.hookUnload=window.onunload;
  -onload = function() { DynAPI_<%=contextID%>.loadHandler(); }
  -onunload = function() { DynAPI_<%=contextID%>.unloadHandler(); }
  -onresize = function() { DynAPI_<%=contextID%>.resizeHandler(); }
  -onerror = function(msg, url, lno) { DynAPI_<%=contextID%>.errorHandler(msg, 
url, lno); }
  -
  -DynAPI_<%=contextID%>.addPackage('dynapi');
  -DynAPI_<%=contextID%>.addLibrary('dynapi.api'  
,["browser","dynlayer","dyndocument"]);
  
-DynAPI_<%=contextID%>.addLibrary('dynapi.event',["listeners","mouse","dragevent","keyboard"]);
  -DynAPI_<%=contextID%>.addLibrary('dynapi.ext'  
,["inline","layer","dragdrop","functions"]);
  -DynAPI_<%=contextID%>.addLibrary('dynapi.gui'  
,["viewport","dynimage","button","buttonimage","label","list","loadpanel","pushpanel","scrollbar","scrollpane","sprite"]);
  -DynAPI_<%=contextID%>.addLibrary('dynapi.util' 
,["circleanim","cookies","debug","thread","hoveranim","imganim","pathanim","console"]);
  +    // Return the y coordinate of an element relative to the page.
   
  
-DynAPI_<%=contextID%>.setLibraryPath('<%=theURL%>/jahiatools/javascript/lib/');
  -DynAPI_<%=contextID%>.include('dynapi.api.*');
  +    if (el.offsetParent != null)
  +      return el.offsetTop + getPageOffsetTop(el.offsetParent);
  +    else
  +      return el.offsetTop;
  +  }
  +  //-->
  +
  +  </SCRIPT>
  +</logic:notEqual>
  +
  +<SCRIPT type="text/javascript">
  +<!--
   
   var ViewColorBG_<%=contextID%>;
   var ViewColorPick_<%=contextID%>;
   
  -DynAPI_<%=contextID%>.onLoad = function() {
  -
  +function addDynLayer_<%=contextID%>() {
  +    y = getPageOffsetTop(document.imgcolmap_<%=contextID%>);
       if (document.layers) {
  -            ViewColorBG_<%=contextID%> = new 
DynLayer(null,474,152,67,67,'#000000');
  -        ViewColorPick_<%=contextID%> = new 
DynLayer(null,475,153,65,65,'#000000');
  +        ViewColorBG_<%=contextID%> = new 
DynLayer(null,474,y,67,67,'#000000');
  +        ViewColorPick_<%=contextID%> = new 
DynLayer(null,475,y+1,65,65,'#000000');
       } else if (parseInt(navigator.appVersion) == 5) {
  -        ViewColorBG_<%=contextID%> = new 
DynLayer(null,469,159,67,67,'#000000');
  -        ViewColorPick_<%=contextID%> = new 
DynLayer(null,470,160,65,65,'#000000');
  +        ViewColorBG_<%=contextID%> = new 
DynLayer(null,469,y,67,67,'#000000');
  +        ViewColorPick_<%=contextID%> = new 
DynLayer(null,470,y+1,65,65,'#000000');
       } else {
  -            ViewColorBG_<%=contextID%> = new 
DynLayer(null,469,159,67,67,'#000000');
  -        ViewColorPick_<%=contextID%> = new 
DynLayer(null,470,160,65,65,'#000000');
  +        ViewColorBG_<%=contextID%> = new 
DynLayer(null,469,y,67,67,'#000000');
  +        ViewColorPick_<%=contextID%> = new 
DynLayer(null,470,y+1,65,65,'#000000');
       }
   
  -        DynAPI_<%=contextID%>.document.addChild(ViewColorBG);
  -        DynAPI_<%=contextID%>.document.addChild(ViewColorPick);
  +    DynAPI.document.addChild(ViewColorBG_<%=contextID%>);
  +    DynAPI.document.addChild(ViewColorPick_<%=contextID%>);
   
       setTextColor_<%=contextID%>('<%=theField.getValue()%>');
  -    document.mainForm.elements["_<%=theField.getID()%>"].focus();
   }
   
  +DynAPI.addLoadFunction("addDynLayer_<%=contextID%>();");
  +
   function setTextColor_<%=contextID%>(color) {
       document.mainForm.elements["_<%=theField.getID()%>"].value= color;
       ViewColorPick_<%=contextID%>.setBgColor(color);
  @@ -171,7 +169,7 @@
           }
       }
   %>
  -</map><img usemap="#colmap_<%=contextID%>" 
src="<jahia:serverHttpPath/><jahia:engineResourceBundle 
resourceName="org.jahia.engines.jahiaTools.colorTable.image"/>" border="0" 
width="289" height="67"><img 
src="<jahia:serverHttpPath/><jahia:engineResourceBundle 
resourceName="org.jahia.pix.image"/>" border="0" width="73" height="1"><br><img 
src="<jahia:serverHttpPath/><jahia:engineResourceBundle 
resourceName="org.jahia.engines.jahiaTools.pix.image"/>" border="0" width="1" 
height="4"><br>
  +</map><img name="imgcolmap_<%=contextID%>" usemap="#colmap_<%=contextID%>" 
src="<jahia:serverHttpPath/><jahia:engineResourceBundle 
resourceName="org.jahia.engines.jahiaTools.colorTable.image"/>" border="0" 
width="289" height="67"><img 
src="<jahia:serverHttpPath/><jahia:engineResourceBundle 
resourceName="org.jahia.pix.image"/>" border="0" width="73" height="1"><br><img 
src="<jahia:serverHttpPath/><jahia:engineResourceBundle 
resourceName="org.jahia.engines.jahiaTools.pix.image"/>" border="0" width="1" 
height="4"><br>
   <input <% if ( !readOnly ){%>class="input"<%} else {%>class="text"<% } %> 
name="_<%=theField.getID()%>" type="text" size="12" 
value="<%=theField.getValue()%>" 
onChange="setTextColor_<%=contextID%>(document.mainForm.elements['_<%=theField.getID()%>'].value)"
 <% if ( readOnly ){%>disabled<%}%>>
   </TD>
   </TR>
  

Reply via email to