}
// formatting helpers
-function ul_start () { return '<ul class=menu>'; }
+function ul_start () { return '<ul class="menu">'; }
function ul_end () { return '</ul>'; }
-function leaf($text) { return '<li class=leaf>' . $text . '</li>'; }
-function expanded($text) { return '<li class=expanded>' . $text . '</li>'; }
+function leaf($text) { return '<li class="leaf">' . $text . '</li>'; }
+function expanded($text) { return '<li class="expanded">' . $text . '</li>'; }
function p($text) { return '<p>' . $text . '</p>'; }
// fake theme to look like menu
function menu_theme ($menu) {
foreach ( array( "build", "tags", "rpms" ) as $field) {
- print "<tr><th colspan=2 align='center'></th></tr>\n";
- print "<tr><th colspan=2 align='center'><h2>" . ucwords($field . " details") . "</h2></th></tr>\n";
+ print "<tr><th colspan='2' align='center'></th></tr>\n";
+ print "<tr><th colspan='2' align='center'><h2>" . ucwords($field . " details") . "</h2></th></tr>\n";
$keys=array_keys($release[$field]);
usort($keys,"__cmp_lower");
*.plc-warning a:visited { text-decoration: none; color:white }
*.plc-warning a:hover { text-decoration: none; color:black }
-/* separator below the linetabs area */
-p.plc-linetabs {
- height:15px;
-}
+.addresses { text-align: center; font-weight: bold; }
//////////////////////////////////////// tags
-$toggle=new PlekitToggle ('tags','Tags',array('trigger-tagname'=>'h2'));
+$toggle=new PlekitToggle ('tags','Tags');
$toggle->start();
$form = new PlekitForm (l_actions(),array('interface_id'=>$interface_id));
$tagnames = array_map ("get_tagname",$tags);
$nodegroups_hash=plc_nodegroup_global_hash($api,$tagnames);
- $toggle = new PlekitToggle ('tags',"Tags",array('trigger-tagname'=>'h2',
- 'trigger-bubble'=>'Inspect and set tags on that node',
- 'start-visible'=>$show_tags));
+ $toggle = new PlekitToggle ('tags',"Tags",
+ array('trigger-bubble'=>'Inspect and set tags on that node',
+ 'start-visible'=>$show_tags));
$toggle->start();
$headers=array("Name"=>"string",
//////////////////////////////////////////////////////////// interfaces
if ( $local_peer ) {
- $toggle=new PlekitToggle ('interfaces',"Interfaces",array('trigger-tagname'=>'h2',
- 'trigger-bubble'=>'Inspect and tune interfaces on that node',
- 'start-hidden'=>true));
+ $toggle=new PlekitToggle ('interfaces',"Interfaces",
+ array('trigger-bubble'=>'Inspect and tune interfaces on that node',
+ 'start-hidden'=>true));
$toggle->start();
// display interfaces
if( ! $interfaces ) {
// display slices
{
- $toggle=new PlekitToggle ('slices',"Slices",array('trigger-tagname'=>'h2',
- 'trigger-bubble'=>'Review slices running on that node',
- 'start-hidden'=>true));
+ $toggle=new PlekitToggle ('slices',"Slices",
+ array('trigger-bubble'=>'Review slices running on that node',
+ 'start-hidden'=>true));
$toggle->start();
if ( ! $slices ) {
plc_warning ("This node is not associated to any slice");
if( $has_primary ) {
print( "<table border=\"0\" cellspacing=\"4\">\n" );
- print( "<tr><th colspan=2><a href='index.php?id=$node_id'>Node Details</a></th></tr>" );
+ print( "<tr><th colspan='2'><a href='index.php?id=$node_id'>Node Details</a></th></tr>" );
print( "<tr><th>node_id:</th>" );
print( "<td>$node_id</td></tr>\n" );
print( "<tr><th>Hostname:</th>" );
print( "<td>" . $node_detail['hostname'] . "</td></tr>\n" );
$nn_id = $interface_detail['interface_id'];
- print( "<tr><th colspan=2><a href='interface.php?id=$nn_id'>Interface Details</a></th></tr>" );
+ print( "<tr><th colspan='2'><a href='interface.php?id=$nn_id'>Interface Details</a></th></tr>" );
print( "<tr><th>Method:</th>" );
print( "<td>" . $interface_detail['method'] . "</td></tr>\n" );
}
}
- print ("<tr><th colspan=2><a href='interface.php?id=$nn_id'>Additional Settings</a></th></tr>\n");
+ print ("<tr><th colspan='2'><a href='interface.php?id=$nn_id'>Additional Settings</a></th></tr>\n");
$nn_id = $interface_detail['interface_id'];
$settings=$api->GetInterfaceTags(array("interface_id" => array($nn_id)));
foreach ($settings as $setting) {
$details->form_end();
//////////////////// slices
-$toggle=new PlekitToggle ('slices','Slices',array('trigger-tagname'=>'h2'));
+$toggle=new PlekitToggle ('slices','Slices');
$toggle->start();
if( ! $slices) {
$form->start();
//////////////////// keys
-$toggle=new PlekitToggle ('keys',"Keys",array('trigger-tagname'=>'h2'));
+$toggle=new PlekitToggle ('keys',"Keys");
$toggle->start();
$can_manage_keys = ( $local_peer && ( plc_is_admin() || $is_my_account) );
$toggle->end();
//////////////////// sites
-$toggle=new PlekitToggle('sites','Sites',array('trigger-tagname'=>'h2'));
+$toggle=new PlekitToggle('sites','Sites');
$toggle->start();
if (empty( $sites ) ) {
$toggle->end();
//////////////////// roles
-$toggle=new PlekitToggle ('roles','Roles',array('trigger-tagname'=>'h2'));
+$toggle=new PlekitToggle ('roles','Roles');
$toggle->start();
if (! $roles) plc_warning ("This user has no role !");
if ( ! empty($item['comment'])) {
$comment=$item['comment'];
- print "<tr><td colspan=2> </td></tr>";
- print "<tr><td colspan=2> $comment: </td></tr>";
+ print "<tr><td colspan='2'> </td></tr>";
+ print "<tr><td colspan='2'> $comment: </td></tr>";
}
$title = $item['title'];
// Do not allow resubmits
if (empty($person['person_id'])) {
- print '<tr><td colspan=2><input type="submit" name="op" value="Register" class="form-submit" /></td></tr>';
+ print '<tr><td colspan='2'><input type="submit" name="op" value="Register" class="form-submit" /></td></tr>';
}
print <<<EOF
// display the buttons
print <<< EOF
<tr>
- <td colspan=2>
+ <td colspan='2'>
<table width="100%" border=0 cellspacing="0" cellpadding="5"> <tr>
<td align=center><input type="submit" name="submitted" value="Delete"></td>
<td align=center><input type="submit" name="submitted" value="Update"></td>
// display the buttons
print <<< EOF
<tr>
- <td colspan=2>
+ <td colspan='2'>
<table width="100%" border=0 cellspacing="0" cellpadding="5"> <tr>
<td align=center><input type="submit" name="submitted" value="Delete"></td>
<td align=center><input type="submit" name="submitted" value="Update"></td>
if ( ! $site['is_public'])
plc_warning("This site is not public!");
+$details->form_start(l_actions(),array('action'=>'update-site','site_id'=>$site_id));
+
$details->start();
-$details->form_start(l_actions(),array('action'=>'update-site','site_id'=>$site_id));
$details->th_td("Full name",$sitename,'name',array('width'=>50));
$details->th_td("Abbreviated name",$abbreviated_name,'abbreviated_name',array('width'=>15));
$details->th_td("URL",$site_url,'url',array('width'=>40));
else
$details->th_td("Max slices",$max_slices);
$details->tr_submit("submit","Update Site");
-$details->form_end();
if ( ! $local_peer) {
$details->space();
$details->th_td("Peer",$peers->peer_link($peer_id));
}
$details->end();
+$details->form_end();
//////////////////// mode details - for local object
if ( $local_peer ) {
$nodes_title = plc_warning_html ($nodes_title);
$nodes_title .= href(l_nodes_site($site_id)," (See as nodes)");
- $toggle=new PlekitToggle ('nodes',$nodes_title,array('trigger-tagname'=>'h2'));
+ $toggle=new PlekitToggle ('nodes',$nodes_title);
$toggle->start();
$headers=array();
$persons_title = plc_warning_html ($persons_title);
$persons_title .= href(l_persons_site($site_id)," (See as users)");
- $toggle=new PlekitToggle ('persons',$persons_title,array('trigger-tagname'=>'h2'));
+ $toggle=new PlekitToggle ('persons',$persons_title);
$toggle->start();
$headers = array ();
//////////////////// Slices
// xxx to review after slices gets reworked
- $toggle=new PlekitToggle ('slices',"Slices",array('trigger-tagname'=>'h2'));
+ $toggle=new PlekitToggle ('slices',"Slices");
$toggle->start();
$details=new PlekitDetails (false);
$details->start();
$toggle->end();
// Addresses
- $toggle=new PlekitToggle ('addresses',"Addresses",array('trigger-tagname'=>'h2',
- 'start-visible'=>false));
+ $toggle=new PlekitToggle ('addresses',"Addresses",array('start-visible'=>false));
$toggle->start();
if ( ! $addresses) {
- print "No known address for this site";
+ print "<p class='addresses'>No known address for this site</p>";
} else {
$details=new PlekitDetails (false);
$details->start();
// render the comment field
if ( ! empty($item['comment'])) {
$comment=$item['comment'];
- print "<tr><td colspan=2> $comment </td></tr>";
+ print "<tr><td colspan='2'> $comment </td></tr>";
}
// compute line attributes
$details->end();
// xxx : add & delete buttons would make sense here too
-$toggle=new PlekitToggle('nodes',"Nodes",array('trigger-tagname'=>'h2'));
+$toggle=new PlekitToggle('nodes',"Nodes");
$toggle=>start();
$headers["Hostname"]="string";
// xxx could outline values corresponding to a nodegroup
if (count ($node_tags)) {
- $toggle=new PlekitToggle('tag_nodes',"Nodes",array('trigger-tagname'=>'h2'));
+ $toggle=new PlekitToggle('tag_nodes',"Nodes");
$toggle->start();
$table=new PlekitTable ("tag_nodes",array("Hostname"=>"string","value"=>"string"),0,$table_options);
$table->start();
}
if (count ($interface_tags)) {
- $toggle=new PlekitToggle('tag_interfaces',"Interfaces",array('trigger-tagname'=>'h2'));
+ $toggle=new PlekitToggle('tag_interfaces',"Interfaces");
$toggle->start();
$table=new PlekitTable ("tag_interfaces",array("IP"=>"IPAddress","value"=>"string"),0,$table_options);
$table->start();
// xxx don't show hostnames yet
$slice_tags = array_merge ($slice_tags,$sliver_tags);
if (count ($slice_tags)) {
- $toggle=new PlekitToggle('tag_slices',"Slice and sliver tags",array('trigger-tagname'=>'h2'));
+ $toggle=new PlekitToggle('tag_slices',"Slice and sliver tags");
$toggle->start();
$table=new PlekitTable ("tag_slices",array("Slice"=>"string","value"=>"string","Node id"=>"int"),0,$table_options);
$table->start();
/* $Id$ */
+/* clear browser-dependant defaults */
+div.linetabs * {
+ padding: 0; margin: 0; border: 0;
+}
+
div.linetabs {
padding: 20px;
margin: 8px 0;
margin-bottom: 0px;
}
+/* separator below the linetabs area */
+p.linetabs {
+ height:15px;
+ clear: both;
+}
};
-window.onload = linetabs_namespace.init;
-window.onunload = linetabs_namespace.cleanUp;
-window.onresize = linetabs_namespace.resize;
+Event.observe(window, 'load',linetabs_namespace.init);
+Event.observe(window, 'unload', linetabs_namespace.cleanUp);
+Event.observe(window, 'resize', linetabs_namespace.resize);
--- /dev/null
+/*Nifty Corners Cube CSS by Alessandro Fulciniti\r
+The following classes are added dinamically by javascript,\r
+and their use should be avoided in the markup */\r
+\r
+b.niftycorners,b.niftyfill{display:block}\r
+b.niftycorners *{display:block;height: 1px;line-height:1px;font-size: 1px;\r
+ overflow:hidden;border-style:solid;border-width: 0 1px}\r
+/*normal*/\r
+b.r1{margin: 0 3px;border-width: 0 2px}\r
+b.r2{margin: 0 2px}\r
+b.r3{margin: 0 1px}\r
+b.r4{height: 2px}\r
+b.rb1{margin: 0 8px;border-width:0 2px}\r
+b.rb2{margin: 0 6px;border-width:0 2px}\r
+b.rb3{margin: 0 5px}\r
+b.rb4{margin: 0 4px}\r
+b.rb5{margin: 0 3px}\r
+b.rb6{margin: 0 2px}\r
+b.rb7{margin: 0 1px;height:2px}\r
+b.rb8{margin: 0;height:2px}\r
+b.rs1{margin: 0 1px}\r
+/*transparent inside*/\r
+b.t1{border-width: 0 5px}\r
+b.t2{border-width: 0 3px}\r
+b.t3{border-width: 0 2px}\r
+b.t4{height: 2px}\r
+b.tb1{border-width: 0 10px}\r
+b.tb2{border-width: 0 8px}\r
+b.tb3{border-width: 0 6px}\r
+b.tb4{border-width: 0 5px}\r
+b.tb5{border-width: 0 4px}\r
+b.tb6{border-width: 0 3px}\r
+b.tb7{border-width: 0 2px;height:2px}\r
+b.tb8{border-width: 0 1px;height:2px}\r
+b.ts1{border-width: 0 2px}
\ No newline at end of file
--- /dev/null
+/* Nifty Corners Cube - rounded corners with CSS and Javascript\r
+Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it)\r
+\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+*/\r
+\r
+var niftyOk=(document.getElementById && document.createElement && Array.prototype.push);\r
+var niftyCss=false;\r
+\r
+String.prototype.find=function(what){\r
+return(this.indexOf(what)>=0 ? true : false);\r
+}\r
+\r
+var oldonload=window.onload;\r
+if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};\r
+if(typeof(oldonload)=='function')\r
+ window.onload=function(){oldonload();AddCss('/plekit/niftycorner');NiftyLoad()};\r
+else window.onload=function(){AddCss('/plekit/niftycorner');NiftyLoad()};\r
+\r
+function AddCss(path){\r
+niftyCss=true;\r
+var l=CreateEl("link");\r
+l.setAttribute("type","text/css");\r
+l.setAttribute("rel","stylesheet");\r
+l.setAttribute("href",path+"/niftyCorners.css");\r
+l.setAttribute("media","screen");\r
+document.getElementsByTagName("head")[0].appendChild(l);\r
+}\r
+\r
+function Nifty(selector,options){\r
+if(niftyOk==false) return;\r
+if(niftyCss==false) AddCss('/plekit/niftycorner');\r
+var i,v=selector.split(","),h=0;\r
+if(options==null) options="";\r
+if(options.find("fixed-height"))\r
+ h=getElementsBySelector(v[0])[0].offsetHeight;\r
+for(i=0;i<v.length;i++)\r
+ Rounded(v[i],options);\r
+if(options.find("height")) SameHeight(selector,h);\r
+}\r
+\r
+function Rounded(selector,options){\r
+var i,top="",bottom="",v=new Array();\r
+if(options!=""){\r
+ options=options.replace("left","tl bl");\r
+ options=options.replace("right","tr br");\r
+ options=options.replace("top","tr tl");\r
+ options=options.replace("bottom","br bl");\r
+ options=options.replace("transparent","alias");\r
+ if(options.find("tl")){\r
+ top="both";\r
+ if(!options.find("tr")) top="left";\r
+ }\r
+ else if(options.find("tr")) top="right";\r
+ if(options.find("bl")){\r
+ bottom="both";\r
+ if(!options.find("br")) bottom="left";\r
+ }\r
+ else if(options.find("br")) bottom="right";\r
+ }\r
+if(top=="" && bottom=="" && !options.find("none")){top="both";bottom="both";}\r
+v=getElementsBySelector(selector);\r
+for(i=0;i<v.length;i++){\r
+ FixIE(v[i]);\r
+ if(top!="") AddTop(v[i],top,options);\r
+ if(bottom!="") AddBottom(v[i],bottom,options);\r
+ }\r
+}\r
+\r
+function AddTop(el,side,options){\r
+var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;\r
+d.style.marginLeft="-"+getPadding(el,"Left")+"px";\r
+d.style.marginRight="-"+getPadding(el,"Right")+"px";\r
+if(options.find("alias") || (color=getBk(el))=="transparent"){\r
+ color="transparent";bk="transparent"; border=getParentBk(el);btype="t";\r
+ }\r
+else{\r
+ bk=getParentBk(el); border=Mix(color,bk);\r
+ }\r
+d.style.background=bk;\r
+d.className="niftycorners";\r
+p=getPadding(el,"Top");\r
+if(options.find("small")){\r
+ d.style.marginBottom=(p-2)+"px";\r
+ btype+="s"; lim=2;\r
+ }\r
+else if(options.find("big")){\r
+ d.style.marginBottom=(p-10)+"px";\r
+ btype+="b"; lim=8;\r
+ }\r
+else d.style.marginBottom=(p-5)+"px";\r
+for(i=1;i<=lim;i++)\r
+ d.appendChild(CreateStrip(i,side,color,border,btype));\r
+el.style.paddingTop="0";\r
+el.insertBefore(d,el.firstChild);\r
+}\r
+\r
+function AddBottom(el,side,options){\r
+var d=CreateEl("b"),lim=4,border="",p,i,btype="r",bk,color;\r
+d.style.marginLeft="-"+getPadding(el,"Left")+"px";\r
+d.style.marginRight="-"+getPadding(el,"Right")+"px";\r
+if(options.find("alias") || (color=getBk(el))=="transparent"){\r
+ color="transparent";bk="transparent"; border=getParentBk(el);btype="t";\r
+ }\r
+else{\r
+ bk=getParentBk(el); border=Mix(color,bk);\r
+ }\r
+d.style.background=bk;\r
+d.className="niftycorners";\r
+p=getPadding(el,"Bottom");\r
+if(options.find("small")){\r
+ d.style.marginTop=(p-2)+"px";\r
+ btype+="s"; lim=2;\r
+ }\r
+else if(options.find("big")){\r
+ d.style.marginTop=(p-10)+"px";\r
+ btype+="b"; lim=8;\r
+ }\r
+else d.style.marginTop=(p-5)+"px";\r
+for(i=lim;i>0;i--)\r
+ d.appendChild(CreateStrip(i,side,color,border,btype));\r
+el.style.paddingBottom=0;\r
+el.appendChild(d);\r
+}\r
+\r
+function CreateStrip(index,side,color,border,btype){\r
+var x=CreateEl("b");\r
+x.className=btype+index;\r
+x.style.backgroundColor=color;\r
+x.style.borderColor=border;\r
+if(side=="left"){\r
+ x.style.borderRightWidth="0";\r
+ x.style.marginRight="0";\r
+ }\r
+else if(side=="right"){\r
+ x.style.borderLeftWidth="0";\r
+ x.style.marginLeft="0";\r
+ }\r
+return(x);\r
+}\r
+\r
+function CreateEl(x){\r
+return(document.createElement(x));\r
+}\r
+\r
+function FixIE(el){\r
+if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false)\r
+ el.style.display="inline-block";\r
+}\r
+\r
+function SameHeight(selector,maxh){\r
+var i,v=selector.split(","),t,j,els=[],gap;\r
+for(i=0;i<v.length;i++){\r
+ t=getElementsBySelector(v[i]);\r
+ els=els.concat(t);\r
+ }\r
+for(i=0;i<els.length;i++){\r
+ if(els[i].offsetHeight>maxh) maxh=els[i].offsetHeight;\r
+ els[i].style.height="auto";\r
+ }\r
+for(i=0;i<els.length;i++){\r
+ gap=maxh-els[i].offsetHeight;\r
+ if(gap>0){\r
+ t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px";\r
+ nc=els[i].lastChild;\r
+ if(nc.className=="niftycorners")\r
+ els[i].insertBefore(t,nc);\r
+ else els[i].appendChild(t);\r
+ }\r
+ }\r
+}\r
+\r
+function getElementsBySelector(selector){\r
+var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c;\r
+if(selector.find("#")){ //id selector like "tag#id"\r
+ if(selector.find(" ")){ //descendant selector like "tag#id tag"\r
+ s=selector.split(" ");\r
+ var fs=s[0].split("#");\r
+ if(fs.length==1) return(objlist);\r
+ f=document.getElementById(fs[1]);\r
+ if(f){\r
+ v=f.getElementsByTagName(s[1]);\r
+ for(i=0;i<v.length;i++) objlist.push(v[i]);\r
+ }\r
+ return(objlist);\r
+ }\r
+ else{\r
+ s=selector.split("#");\r
+ tag=s[0];\r
+ selid=s[1];\r
+ if(selid!=""){\r
+ f=document.getElementById(selid);\r
+ if(f) objlist.push(f);\r
+ return(objlist);\r
+ }\r
+ }\r
+ }\r
+if(selector.find(".")){ //class selector like "tag.class"\r
+ s=selector.split(".");\r
+ tag=s[0];\r
+ selclass=s[1];\r
+ if(selclass.find(" ")){ //descendant selector like tag1.classname tag2\r
+ s=selclass.split(" ");\r
+ selclass=s[0];\r
+ tag2=s[1];\r
+ }\r
+ }\r
+var v=document.getElementsByTagName(tag); // tag selector like "tag"\r
+if(selclass==""){\r
+ for(i=0;i<v.length;i++) objlist.push(v[i]);\r
+ return(objlist);\r
+ }\r
+for(i=0;i<v.length;i++){\r
+ c=v[i].className.split(" ");\r
+ for(j=0;j<c.length;j++){\r
+ if(c[j]==selclass){\r
+ if(tag2=="") objlist.push(v[i]);\r
+ else{\r
+ v2=v[i].getElementsByTagName(tag2);\r
+ for(k=0;k<v2.length;k++) objlist.push(v2[k]);\r
+ }\r
+ }\r
+ }\r
+ }\r
+return(objlist);\r
+}\r
+\r
+function getParentBk(x){\r
+var el=x.parentNode,c;\r
+while(el.tagName.toUpperCase()!="HTML" && (c=getBk(el))=="transparent")\r
+ el=el.parentNode;\r
+if(c=="transparent") c="#FFFFFF";\r
+return(c);\r
+}\r
+\r
+function getBk(x){\r
+var c=getStyleProp(x,"backgroundColor");\r
+if(c==null || c=="transparent" || c.find("rgba(0, 0, 0, 0)"))\r
+ return("transparent");\r
+if(c.find("rgb")) c=rgb2hex(c);\r
+return(c);\r
+}\r
+\r
+function getPadding(x,side){\r
+var p=getStyleProp(x,"padding"+side);\r
+if(p==null || !p.find("px")) return(0);\r
+return(parseInt(p));\r
+}\r
+\r
+function getStyleProp(x,prop){\r
+if(x.currentStyle)\r
+ return(x.currentStyle[prop]);\r
+if(document.defaultView.getComputedStyle)\r
+ return(document.defaultView.getComputedStyle(x,'')[prop]);\r
+return(null);\r
+}\r
+\r
+function rgb2hex(value){\r
+var hex="",v,h,i;\r
+var regexp=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;\r
+var h=regexp.exec(value);\r
+for(i=1;i<4;i++){\r
+ v=parseInt(h[i]).toString(16);\r
+ if(v.length==1) hex+="0"+v;\r
+ else hex+=v;\r
+ }\r
+return("#"+hex);\r
+}\r
+\r
+function Mix(c1,c2){\r
+var i,step1,step2,x,y,r=new Array(3);\r
+if(c1.length==4)step1=1;\r
+else step1=2;\r
+if(c2.length==4) step2=1;\r
+else step2=2;\r
+for(i=0;i<3;i++){\r
+ x=parseInt(c1.substr(1+step1*i,step1),16);\r
+ if(step1==1) x=16*x+x;\r
+ y=parseInt(c2.substr(1+step2*i,step2),16);\r
+ if(step2==1) y=16*y+y;\r
+ r[i]=Math.floor((x*50+y*50)/100);\r
+ r[i]=r[i].toString(16);\r
+ if(r[i].length==1) r[i]="0"+r[i];\r
+ }\r
+return("#"+r[0]+r[1]+r[2]);\r
+}\r
// start the details area, with an optional caption
function start ($caption="") { print $this->start_html("$caption");}
function start_html ($caption="") {
- $html="<table class=plc_details><thead>";
- if ($caption) $html .= "<caption>$caption</caption>";
- $html .= "</thead><tbody>";
+ $html="<table class='plc_details'>";
+ if ($caption) $html .= "<thead><caption>$caption</caption></thead>";
+ $html .= "<tbody>";
return $html;
}
else $height=$this->height;
$html="";
- $html .= "<tr><th><label for=$form_varname>$title</label></th>";
+ $html .= "<tr><th><label for='$form_varname'>$title</label></th>";
$html .= "<td>";
// xxx hack: if input_type is select : user provides the input field verbatim
if ( $input_type == "select" ) {
} else {
// set id too
$html .= "<input type='$input_type' name='$form_varname' id='$form_varname' value='$value'";
- if ($width) $html .= " size=$width";
+ if ($width) $html .= " size='$width'";
// handle event callbacks
$html .= PlekitForm::attributes($options);
$html .= "/>";
// 1 item, colspan=2
function tr($title,$align=NULL) { print $this->tr_html($title,$align);}
function tr_html($title,$align=NULL) {
- $result="<tr><td colspan=2";
+ $result="<tr><td colspan='2'";
if ($align) $result .= " style='text-align:$align'";
$result .=">$title</td></tr>";
return $result;
// a dummy line for getting some air
function space () { print $this->space_html(); }
- function space_html () { return "<tr><td colspan=2> </td></tr>\n"; }
+ function space_html () { return "<tr><td colspan='2'> </td></tr>\n"; }
}
if ( $url_values ) $values=array_merge($values,$url_values);
$this->values=$values;
- $this->method=$method;
+ // make strict xhtml happy
+ $this->method=strtolower($method);
}
function start () { print $this->start_html(); }
function start_html () {
- $html="<form method=$this->method action='$this->url' enctype='multipart/form-data'>";
+ $html="<form method='$this->method' action='$this->url' enctype='multipart/form-data'>";
if ($this->values)
foreach ($this->values as $key=>$value)
$html .= $this->hidden_html($key,$value);
static function input_html ($type,$name,$value,$options=NULL) {
if ( ! $options) $options=array();
$html="<input";
- $html="<input type='$type' name='$name' value='$value'";
+ $html .= " type='$type' name='$name' value='$value'";
$html .= PlekitForm::attributes ($options);
$html .= "/>";
return $html;
return "<label for=$name>$display</label>";
}
static function textarea_html ($name,$value,$cols,$rows) {
- return "<textarea name='$name' cols=$cols rows=$rows>$value</textarea>";
+ return "<textarea name='$name' cols='$cols' rows='$rows'>$value</textarea>";
}
// selectors is an array of hashes with the following keys
$url_values=$split['values'];
// create form
- $method=$todo['method'];
- print "<form name='$label' action='$url' method='$method'>";
+ $method=strtolower($todo['method']);
+ print "<form action='$url' method='$method'><fieldset>";
// set values
$values=$todo['values'];
if ( ! $values) $values = array();
if ($url_values) $values = array_merge($values,$url_values);
if ( $values ) foreach ($values as $key=>$value) {
- print "<input type=hidden name='$key' value='$value' />";
+ print "<input type='hidden' name='$key' value='$value' />";
}
- $tracer="class=linetabs-submit";
+ $tracer="class='linetabs-submit'";
// image and its companions 'height'
if ($todo['image']) {
- $type='type=image src="' . $todo['image'] . '"';
- if ($todo['height']) $type.= ' height=' . $todo['height'];
+ $what=$todo['image'];
+ $type="type='image' src='$what'";
+ if ($todo['height']) {
+ $what=$todo['height'];
+ $type .= " height='$what'";
+ }
} else {
- $type='type=button value="' . $label . '"';
+ $type="type='button' value='$label'";
}
$bubble=$todo['bubble'];
print "<span title='$bubble'>";
if ($todo['confirm']) $message=$todo['confirm'] . " ?";
print "<input $tracer $type onclick='linetabs_namespace.submit(\"$id\",\"$message\")' />";
print "</span>";
- print "</form></li>\n";
+ print "</fieldset></form></li>\n";
}
print '</ul>';
print '</div>';
- print "<p class='plc-minittabs'></p>\n";
+ print "<p class='linetabs'></p>\n";
}
?>
$width=count($this->headers);
$pagesize_text_id = $this->table_id . "_pagesize";
$result= <<< EOF
-<tr class=pagesize_area><td class=pagesize_area colspan=$width><form class='pagesize'>
- <input class='pagesize_input' type='text' id="$pagesize_text_id" value=$this->pagesize
+<tr class='pagesize_area'><td class='pagesize_area' colspan='$width'>
+<form class='pagesize' action='satisfy_xhtml_validator'><fieldset>
+ <input class='pagesize_input' type='text' id="$pagesize_text_id" value='$this->pagesize'
onkeyup='plekit_pagesize_set("$this->table_id","$pagesize_text_id", $this->pagesize);'
- size=3 maxlength=3 />
+ size='3' maxlength='3' />
<label class='pagesize_label'> items/page </label>
- <img class='table_reset' src="/planetlab/icons/clear.png"
+ <img class='table_reset' src="/planetlab/icons/clear.png" alt="reset visible size"
onmousedown='plekit_pagesize_reset("$this->table_id","$pagesize_text_id",$this->pagesize_def);' />
-</form></td></tr>
+</fieldset></form></td></tr>
EOF;
return $result;
}
$search_reset_id = $this->table_id . "_search_reset";
$search_and_id = $this->table_id . "_search_and";
$result = <<< EOF
-<tr class=search_area><td class=search_area colspan=$width><form class='table_search'>
+<tr class='search_area'><td class='search_area' colspan='$width'>
+<form class='table_search' action='satisfy_xhtml_validator'><fieldset>
<label class='table_search_label'> Search </label>
<input class='table_search_input' type='text' id='$search_text_id'
onkeyup='plekit_table_filter("$this->table_id","$search_text_id","$search_and_id");'
- size=$this->search_width maxlength=256 />
+ size='$this->search_width' maxlength='256' />
<label>and</label>
<input id='$search_and_id' class='table_search_and'
type='checkbox' checked='checked'
onchange='plekit_table_filter("$this->table_id","$search_text_id","$search_and_id");' />
- <img class='table_reset' src="/planetlab/icons/clear.png"
- onmousedown='plekit_table_filter_reset("$this->table_id","$search_text_id","$search_and_id");'>
-</form></td></tr>
+ <img class='table_reset' src="/planetlab/icons/clear.png" alt="reset search"
+ onmousedown='plekit_table_filter_reset("$this->table_id","$search_text_id","$search_and_id");' />
+</fieldset></form></td></tr>
EOF;
return $result;
}
////////////////////////////////////////
function notes_area_html () {
$default_notes = array(
- "Enter & or | in the search area to alternate between <bold>AND</bold> and <bold>OR</bold> search modes",
+ "Enter & or | in the search area to switch between <span class='bold'>AND</span> and <span class='bold'>OR</span> search modes",
"Hold down the shift key to select multiple columns to sort");
if ($this->notes)
public function cell_html ($text,$colspan=0,$align=NULL) {
$result="";
$result .= "<td";
- if ($colspan) $result .= " colspan=$colspan";
+ if ($colspan) $result .= " colspan='$colspan'";
if ($align) $result .= " style='text-align:$align'";
$result .= ">$text</td>";
return $result;
drupal_set_html_head('
<script type="text/javascript" src="/plekit/toggle/toggle.js"></script>
+<script type="text/javascript" src="/plekit/niftycorner/niftycube.js"></script>
<link href="/plekit/toggle/toggle.css" rel="stylesheet" type="text/css" />
');
if ( ! $this->options['start-hidden']) { $x1=""; $x2=" style='display:none'"; }
else { $x2=""; $x1=" style='display:none'"; }
$image_id=$this->id_name('image-visible');
- $html .= "<img id=$image_id class='plc-toggle-visible' src='/plekit/icons/toggle-visible.png'$x1>";
+ $html .= "<img id='$image_id' class='plc-toggle-visible' src='/plekit/icons/toggle-visible.png'$x1";
+ $html .= " alt='Hide this section' />";
$image_id=$this->id_name('image-hidden');
- $html .= "<img id=$image_id class='plc-toggle-hidden' src='/plekit/icons/toggle-hidden.png'$x2>";
+ $html .= "<img id='$image_id' class='plc-toggle-hidden' src='/plekit/icons/toggle-hidden.png'$x2";
+ $html .= " alt='Show this section' />";
return $html;
}
if (empty($tagname)) $tagname="span";
$html="<$tagname";
- $html .= " id=$trigger_id";
- $html .= " class=plc-toggle-trigger";
+ $html .= " id='$trigger_id'";
+ $html .= " class='plc-toggle-trigger'";
if ($bubble) $html .= " title='$bubble'";
$html .= " onclick=\"plc_toggle('$this->id')\"";
$html .= ">";
$area_id=$this->id_name('area');
$html="";
$html .= "<div";
- $html .= " class=plc-toggle-area";
- $html .= " id=$area_id";
+ $html .= " class='plc-toggle-area'";
+ $html .= " id='$area_id'";
if ($this->options['start-hidden']) $html .= " style='display:none'";
$html .= ">";
return $html;
/* if desired, you can embed the whole (trigger+area) in another div for visual effects */
function container_start () { print $this->container_start_html(); }
function container_start_html () {
- $html="<div class='plc-toggle-container'";
$id=$this->id_name('container');
+
+ // side-effects on the header
+ $nifty_init = "<script> Event.observe(window,'load', function () { Nifty ('div#$id','big'); } ); </script>";
+ drupal_set_html_head($nifty_init);
+
+ $html="<div class='plc-toggle-container'";
$html .= " id='$id'";
$html .= ">";
return $html;
table.plekit_table>thead>tr.pagesize_area, table.plekit_table>thead>tr.search_area {
border-left: 0px;
}
+table.plekit_table fieldset {
+ border: 0px; margin: 0px; padding: 0px;
+}
th.plekit_table {
font: bold 10px/22px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
text-align: center;
}
+span.bold {
+ font-weight:bold;
+}
+
/* for IE */
ul.fdtablePaginater {display:inline-block;}
mul.fdtablePaginater {display:inline;}
$Id$
*/
-.plc-toggle-trigger {
- padding-left: 15px;
-/* text-align:center; */
+/* containers - work with nifty corners*/
+div.plc-toggle-container {
+ background-color: #E6E6E6;
+ padding: 20px;
+ margin: 10px;
}
-/* containers */
-div.plc-toggle-container {
- border:2px solid #ccc;
+.plc-toggle-trigger {
+ padding: 0;
+ margin: 20px;
+ font-weight: bold;
+ cursor: crosshair;
}
/* the buttons */