Project

General

Profile

« Previous | Next » 

Revision b9b45ddb

Added by Scott Dale about 18 years ago

add tab for widgets function; check if file exists before loading

View differences:

usr/local/www/index.php
312 312
		Effect.Fade('niftyOutter', {to: 1.0});
313 313
}
314 314

  
315

  
316
function changeTabDIV(selectedDiv){
317
	var dashpos = selectedDiv.indexOf("-");
318
	var tabclass = selectedDiv.substring(0,dashpos);
319
	d = document;
320

  
321
	//get deactive tabs first
322
	tabclass = tabclass + "-class-tabdeactive"; 
323
	var tabs = document.getElementsByClassName(tabclass);
324
	var incTabSelected = selectedDiv + "-deactive";
325
	for (i=0; i<tabs.length; i++){
326
		var tab = tabs[i].id;
327
		dashpos = tab.lastIndexOf("-");
328
		var tab2 = tab.substring(0,dashpos) + "-deactive";
329
		if (tab2 == incTabSelected){
330
			tablink = d.getElementById(tab2);
331
			tablink.style.display = "none";
332
			tab2 = tab.substring(0,dashpos) + "-active";
333
			tablink = d.getElementById(tab2);
334
			tablink.style.display = "table-cell";
335
			
336
			//now show main div associated with link clicked
337
			tabmain = d.getElementById(selectedDiv);
338
			tabmain.style.display = "block";
339
		}
340
		else
341
		{	
342
			tab2 = tab.substring(0,dashpos) + "-deactive";
343
			tablink = d.getElementById(tab2);
344
			tablink.style.display = "table-cell";
345
			tab2 = tab.substring(0,dashpos) + "-active";
346
			tablink = d.getElementById(tab2);
347
			tablink.style.display = "none";		
348
			
349
			//hide sections we don't want to see
350
			tab2 = tab.substring(0,dashpos);
351
			tabmain = d.getElementById(tab2);
352
			tabmain.style.display = "none";
353
				
354
		}
355
	}	
356
}
357

  
315 358
</script>
316 359
EOD;
317 360
$closehead = false;
......
569 612
				<div style="clear:both;"></div>
570 613
			</div>
571 614
			<div id="<?php echo $widgetname;?>" style="display:<?php echo $display; ?>;">
572
				<?php include($directory . $widget); ?>
615
				<?php 
616
					if (file_exists($directory . $widget))
617
					{
618
						include($directory . $widget);
619
					}
620
					else 
621
					{
622
						echo "Widget does not exists in the widget folder. <br>Please reinstall the dashboard package to correct this issue.";	
623
					}				
624
				 ?>
573 625
			</div>
574 626
			<div style="clear:both;"></div>
575 627
		</div>

Also available in: Unified diff