Source: site.view [edit]
Function name: portalRenderDragableFrames
Arguments: portletData
Description: Portal renderer using AJAX dragable box "frames"
Page type: html
Render function:  
Module: siteutil

Page source:

<html>

  <title>WubHub</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

<style type="text/css">
<webl>
   var s = WubCall("dragableFramesCSS", []);
   Markup(s);
</webl>
</style>

 <link rel="stylesheet" type="text/css" href="/static/basic.css"/>
	
	<script type="text/javascript">
          <webl>
   var js = WubCall("dragableFramesJS", []);

   var numColumns = (portletData["numColumns"] ? 2);
   js = Wub_ReplaceAll(js, "numberOfColumns = 2", "numberOfColumns = " + 
       ToString(numColumns));

   // Make sure cmds have been rendered using portlet command
   if Size(portletData.entries) > 0 then
      var h = (portletData.entries[0].html ? nil);
      if h == nil then
         portletData = WubCall("portlet", [portletData])
      end
   end;

   var col = 0;
   var s = "function createPortletBoxes() {";
   every p in portletData.entries do
      var html = (p.html ? "<p>MISSING HTML</p>");
      html = Wub_ReplaceAll(html, "\r\n", `\n`);
      html = Wub_ReplaceAll(html, "\n", `\n`);      
      html = Wub_ReplaceAll(html, "'", `\'`);
      col = col + 1;
      if col > numColumns then
         col = 1
      end;
      var fixedHeight = (ToString(p.height) ? "false");

      s = s + `
  var htmlContentOfNewBox = '<DIV>` + html + `</div>';
  var titleOfNewBox = '` + Str_Trim(p.title) + `';
  if(!staticObjectArray['static` + p.id + `']){
     var newIndex = createABox(` + ToString(col) + 
         `,` + fixedHeight + `,false,'static` + p.id + `');
     document.getElementById('dragableBoxContent' + newIndex).innerHTML = 
        htmlContentOfNewBox;
     document.getElementById('dragableBoxHeader_txt' + newIndex).innerHTML =
        titleOfNewBox; 
  }else{ 
     document.getElementById('dragableBoxContent' + 
       staticObjectArray['static` + p.id + `']).innerHTML = htmlContentOfNewBox;  
     document.getElementById('dragableBoxHeader_txt' + newIndex).innerHTML = 
        titleOfNewBox; 
  }
  hideHeaderOptionsForStaticBoxes(staticObjectArray['static` + p.id + `']);
`
   end;

   s = s + `} 

	function initDragableBoxesScript()
	{
		createColumns();	// Always the first line of this function
		createHelpObjects();	// Always the second line of this function
		initEvents();	// Always the third line of this function
		
		if(useCookiesToRememberRSSSources)createRSSBoxesFromCookie();	// Create RSS boxes from cookies
		createPortletBoxes();	// Create default boxes.
`;
   var readonly = (portletData.readonly ? false);
   if readonly then
      js = Wub_ReplaceAll(js, `okToMove = true`, `okToMove = false`)
   end;
   s = s + `}

	window.onload = initDragableBoxesScript;
`;

   js + s;
          </webl>
        </script>
</head>
<body>

<webl>
var reqinfo, cmdinfo, usermsg;

if wubinfo.user != nil then
   usermsg = `User: <a href="/webl/WubHub_DoIt?cmdline=` + wubinfo.user + `.profile">`+wubinfo.user + `</a> [<a href="/webl/WubHub_DoIt?cmdline=site.logout">logout</a>]`
else
   usermsg = `Anonymous [<a href="/webl/WubHub_DoIt?cmdline=site.login">login</a>]`
end;

if wubinfo.cmd != nil then
  reqinfo = "Source: "+wubinfo.cmd+` [<a href="/webl/WubHub_DoIt?cmdline=site.edit(`+wubinfo.cmd+`)">edit</a>]`;
  cmdinfo = "Command: "+wubinfo.cmdline;
else
  reqinfo = "Source: (none)";
  cmdinfo = "";
end;
 
var header = Markup(WubCall("siteheader",[usermsg]));
header;
</webl>

<h1><webl>portletData.title</webl></h1>

<div id="main-text">

<table width="100%">
<tr>
<webl>
   var res = "";
   var leftEntries = (portletData.leftentries ? nil);
   var leftWidth = (portletData.leftwidth ? 200);
   if leftEntries != nil then
      res = "<td valign=top width=" + ToString(leftWidth) + ">\n";
      every e in leftEntries do
         res = res + e.html + "\n<br>";
      end;
      res = res + "</td>"
   end;
   res;
</webl>
	<!-- START DRAGABLE CONTENT -->

<td valign=top>	
<div id="floatingBoxParentContainer">

<webl>
   var s = "";
   var cmd = (wubinfo.cmd ? "portal");
   if Size(portletData.entries) == 0 then
      s = `Use <a href="/webl/WubHub_DoIt?cmdline=addCmdToPortal(` + cmd + `)">addCmdToPortal(` + cmd + `)</a> to add content to this empty portal`;
   end;
   s;
</webl>

	<div class="clear" id="clear"></div>		
	</div>
</div>
</td>
</tr>
</table>
</body>
</html>