var $js = array();
var $js_min = array();
var $javascripts = array();
+ var $javascripts_loaded = array();
var $css = array();
var $css_min = array();
var $stylesheets = array();
+ var $stylesheets_loaded = array();
/**
* Layout() - Constructor
}
}
+ /**
+ * getJavascripts - include javascript in html page. check to load only once the file
+ */
function getJavascripts() {
$code = '';
foreach ($this->javascripts as $js) {
- $code .= "\t\t\t";
- $code .= '<script type="text/javascript" src="'.$js.'"></script>'."\n";
+ if (!in_array($js, $this->javascripts_loaded)) {
+ $code .= "\t\t\t";
+ $code .= '<script type="text/javascript" src="'.$js.'"></script>'."\n";
+ $this->javascripts_loaded[] = $js;
+ }
}
return $code;
}
+ /**
+ * getStylesheets - include stylesheet in html page. check to load only once the file
+ */
function getStylesheets() {
$code = '';
foreach ($this->stylesheets as $c) {
- $code .= "\t\t\t";
- if ($c['media']) {
- $code .= '<link rel="stylesheet" type="text/css" href="'.$c['css'].'" media="'.$c['media'].'" />'."\n";
- } else {
- $code .= '<link rel="stylesheet" type="text/css" href="'.$c['css'].'"/>'."\n";
+ if (!in_array($c, $this->stylesheets_loaded)) {
+ $code .= "\t\t\t";
+ if ($c['media']) {
+ $code .= '<link rel="stylesheet" type="text/css" href="'.$c['css'].'" media="'.$c['media'].'" />'."\n";
+ } else {
+ $code .= '<link rel="stylesheet" type="text/css" href="'.$c['css'].'"/>'."\n";
+ }
+ $this->stylesheets_loaded[] = $c;
}
}
return $code;
$this->headerCSS();
$this->headerJS();
$this->headerForgepluckerMeta();
+ $this->headerLinkedDataAutodiscovery();
?>
</head>
<?php
function headerHTMLDeclaration() {
global $sysDTDs, $sysXMLNSs;
- print '<?xml version="1.0" encoding="utf-8"?>'."\n";
+ print '<' . '?xml version="1.0" encoding="utf-8"?>'."\n";
if (!util_ifsetor($this->doctype) || !util_ifsetor($sysDTDs[$this->doctype])) {
$this->doctype = 'transitional';
}
}
}
+ /**
+ * headerLinkedDataAutodiscovery() - creates the link+meta links to alternate
+ * representations for Linked Data autodiscovery
+ */
+ function headerLinkedDataAutodiscovery() {
+ // Only activated for /projects or /users for the moment
+ $script_name = getStringFromServer('SCRIPT_NAME');
+
+ if ($script_name == '/projects' || $script_name == '/users') {
+
+ $php_self = getStringFromServer('PHP_SELF');
+
+ // invoke the 'alt_representations' hook
+ $params = array('script_name' => $script_name,
+ 'php_self' => $php_self,
+ 'return' => array());
+
+ plugin_hook_by_reference('alt_representations', $params);
+
+ foreach($params['return'] as $link) {
+ echo " $link"."\n";
+ }
+ }
+ }
+
function headerForgepluckerMeta() {
/*-
* Forge-Identification Meta Header, Version 1.0
echo $this->subMenu($subMenuTitle, $subMenuUrl, $subMenuAttr);
}
+
+ function displayStylesheetElements() {
+ /* Codendi/Tuleap compatibility */
+ }
}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
-
-?>