portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/webapp/javascript util.js
Date Mon, 03 Nov 2003 18:21:41 GMT
taylor      2003/11/03 10:21:41

  Modified:    webapp/WEB-INF/templates/jsp/controllers/html
                        x-multicolumn-customize.jsp
  Added:       webapp   loadDoc.jsp
               webapp/javascript util.js
  Log:
  javascript for drag and drop customizer contributed by Jun Yang
  delay load JSP contributed by Jun Yang
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/webapp/loadDoc.jsp
  
  Index: loadDoc.jsp
  ===================================================================
  <%@ page import="java.net.URLDecoder" %>
  <%@ page import="org.apache.jetspeed.portal.portlets.GenericMVCPortlet" %>
  
  <%
  String portletId = request.getParameter(GenericMVCPortlet.PORTLET_ID);
  String docUrl = request.getParameter(GenericMVCPortlet.DOC_URL);
  docUrl = URLDecoder.decode(docUrl);
  %>
  
  <script type="text/javascript">
  var timerId;
  var waitCount = 0;
  function handleLoadDocOnLoad(portletId)
  {
  	// get frame
  	var frame = window.frames[portletId];
  	if (!frame) frame = document.body.firstChild;
  
  	// get delayed content
  	var delayedContent = '';
  	if (frame.contentDocument)
  	{
  		delayedContent = frame.contentDocument.body.innerHTML;
  	}
  	else if (frame.document)
  	{
  		delayedContent = frame.document.body.innerHTML;
  	}
  
  	// handle content
  	if (timerId) window.clearTimeout(timerId);
  	if (delayedContent.length > 0)
  	{
  		top.handleOnLoad(portletId, delayedContent);
  	}
  	else	// content not loaded yet: Mozilla bug
  	{
  		// window.status = 'frame.contentDocument missing; waitCount=' + (waitCount++);
  		// alert('delayedContent missing; waitCount=' + (waitCount++));
  		timerId = window.setTimeout('handleLoadDocOnLoad("' + portletId + '")', 200);
  	}
  }
  </script>
  
  <frameset rows="1" onLoad="handleLoadDocOnLoad('<%= portletId %>')">
  <frame name="<%= portletId %>" src="<%= docUrl %>"></frame>
  </frameset>
  
  
  
  1.2       +3 -3      jakarta-jetspeed/webapp/WEB-INF/templates/jsp/controllers/html/x-multicolumn-customize.jsp
  
  Index: x-multicolumn-customize.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/controllers/html/x-multicolumn-customize.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- x-multicolumn-customize.jsp	2 Nov 2003 20:07:17 -0000	1.1
  +++ x-multicolumn-customize.jsp	3 Nov 2003 18:21:40 -0000	1.2
  @@ -6,7 +6,7 @@
   <%@ page import = "org.apache.jetspeed.om.profile.psml.PsmlEntry" %>
   <%@ page import = "org.apache.jetspeed.om.SecurityReference" %>
   <%@ page import = "org.apache.jetspeed.util.template.*" %>
  -<%@ page import = "org.apache.jetspeed.modules.actions.controllers.Util" %>
  +<%@ page import = "org.apache.jetspeed.util.StringUtils" %>
   <%@ page import = "org.apache.jetspeed.services.customlocalization.CustomLocalizationTool"
%>
   
   <%
  @@ -14,7 +14,7 @@
   Object[] columns = (Object[]) context.get("portlets");
   PortletController controller = (PortletController) context.get("controller");
   Config myConfig = controller.getConfig();
  -String[] sizes = Util.convertStringsToArray(myConfig.getInitParameter("sizes"), ",");
  +String[] sizes = StringUtils.stringToArray(myConfig.getInitParameter("sizes"), ",");
   JetspeedLink jslink = (JetspeedLink) context.get("jslink");
   String action = (String) context.get("action");
   CustomLocalizationTool l10n = (CustomLocalizationTool) context.get("l10n");
  @@ -36,7 +36,7 @@
   }
   </style>
   
  -<script type="text/javascript" src="js/util.js"></script>
  +<script type="text/javascript" src="javascript/util.js"></script>
   <script type="text/javascript">
   
   // global variables
  
  
  
  1.1                  jakarta-jetspeed/webapp/javascript/util.js
  
  Index: util.js
  ===================================================================
  // $Revision: 1.1 $
  
  function isUndefined(v)
  {
  	return typeof(v) == 'undefined';
  }
  
  function isDefined(v)
  {
  	return typeof(v) != 'undefined';
  }
  
  function fillTemplate(template)
  {
  	var result = template;
  	for (var i = 1; i< arguments.length; i+= 2)
  	{
  		var name = arguments[i];
  		var rexp = new RegExp('\\$\\{' + name + '\\}', 'g');
  		var value = arguments[i + 1];
  		result = result.replace(rexp, value);
  	}
  
  	return result;
  }
  
  function toggleOpen(modelSource)
  {
  	var openFlagName = modelSource + '_open';
  	var open = eval(openFlagName);
  	if (open == undefined) open = false;
  	eval(openFlagName + '=' + !open);
  }
  
  function refreshElement(id)
  {
  	var elm = document.getElementById(id);
  	if (elm)
  	{
  		var widget = ElementWidgetMap[id];
  		if (widget)
  		{
  			widget.updateModel();
  			elm.innerHTML = widget.render();
  		}
  	}
  }
  
  function isAllCharsEmpty(s)
  {
  	for (var i = 0; i < s.length; i++)
  	{
  		if (s.charCodeAt(i) > 32)
  			return false;
  	}
  
  	return true;
  }
  
  function isEmpty(s)
  {
  	return isUndefined(s) || s == null || s.length == 0 || isAllCharsEmpty(s);
  }
  
  function processEmpty(s)
  {
  	return isEmpty(s) ? '' : s;
  }
  
  function nbsp(s)
  {
  	return isEmpty(s) ? '&nbsp;' : s;
  }
  
  function addStaticContentPrefix(rest)
  {
  	if (isDefined(staticContentPrefix) && staticContentPrefix != null)
  		return staticContentPrefix + rest;
  	else
  		throw "global variable staticContentPrefix undefined or null";
  }
  
  function renderWidgetWrapper(widget)
  {
  	return fillTemplate(
  		Template.widgetWrapperElement,
  		'elementId', widget.elementId,
  		'content', widget.render()
  	);
  }
  
  function getToday()
  {
  	var today = new Date();
  	return today.getDate() + '/' + MonthMap[today.getMonth()] + '/' + today.getFullYear();
  }
  
  var MonthMap = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
'Dec'];
  
  
  

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


Mime
View raw message