Code

Activated own icon
[gosa.git] / html / main.php
index 50cee3fafa69798aa20f28a47815a60ee1f1b612..c73b24a8f39cc44f7f30cc39d091f35db7f4b008 100644 (file)
@@ -202,11 +202,19 @@ if(isset($_SESSION['POST'])){
 /* show web frontend */
 $smarty->assign ("date", date("l, dS F Y H:i:s O"));
 $smarty->assign ("must", "<font class=\"must\">*</font>");
+if (isset($plug)){
+  $plug= "?plug=$plug";
+} else {
+  $plug= "";
+}
 if ($_SESSION['js']==FALSE){
   $smarty->assign("javascript", "false");
+  $smarty->assign("help_method", "href='helpviewer.php$plug' target='_new'");
 } else {
   $smarty->assign("javascript", "true");
+  $smarty->assign("help_method","href='' onclick=\"return popup('helpviewer.php$plug','GOsa help');\"");
 }
+
 $smarty->assign ("username", $ui->username);
 $smarty->assign ("go_logo", get_template_path('images/go_logo.png'));
 $smarty->assign ("go_base", get_template_path('images/dtree.png'));
@@ -218,12 +226,9 @@ $smarty->assign ("go_left", get_template_path('images/go_left.png'));
 $smarty->assign ("go_help", get_template_path('images/help.png'));
 $plist->gen_menu();
 $smarty->assign ("menu", $plist->menu);
-if (isset($plug)){
-  $smarty->assign ("plug", "?plug=$plug");
-} else {
-  $smarty->assign ("plug", "");
-}
-$mtmp="<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
+$smarty->assign ("plug", "$plug");
+
+$header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
 
 
 /* React on clicks */
@@ -258,7 +263,6 @@ if (isset ($_SESSION['post_cnt'])){
 /* Load plugin */
 if (is_file("$plugin_dir/main.inc")){
   require_once ("$plugin_dir/main.inc");
-  print $plugin_dir."/main.inc";
 } else {
   print_red(sprintf(_("Can't find any plugin definitions for plugin '%s'!"), $plug));
   echo $_SESSION['errors'];
@@ -275,14 +279,29 @@ if ($error_collector != ""){
 } else {
   $smarty->assign("php_errors", "");
 }
-$display = $mtmp.$smarty->fetch(get_template_path('framework.tpl'));
-print $display;
+$smarty->assign("w3c", "");
+$display= $header.$smarty->fetch(get_template_path('framework.tpl'));
+
+/* For development, perform a W3C conformance check if specified in gosa.conf */
+if (isset($config->data['MAIN']['W3CTEST'])) {
+  $fp = fopen("/tmp/gosa.html","w+");
+  fwrite($fp, $display, strlen($display));
+  $url= $config->data['MAIN']['W3CTEST'];
+  $str = shell_exec( "curl -F uploaded_file=@/tmp/gosa.html $url/check");
+  if(!preg_match("/This Page Is Valid/i",$str )){
+    /* Show errors */
+    echo $str;
+  } else {
+    /* Re-render page with W3C logo */
+    $smarty->assign("w3c", "<a href=\"$url/check?uri=referer\"><img alt=\"\" border=\"0\" src=\"$url/images/vh401.png\" alt=\"Valid HTML 4.01!\" height=\"31\" width=\"88\"></a>");
+    $display= $header.$smarty->fetch(get_template_path('framework.tpl'));
+  }
+}
 
-$fp = fopen("/tmp/current.html","w+");
-fwrite($fp,$display,strlen($display));
-$str = shell_exec( "curl -F uploaded_file=@/tmp/current.html http://127.0.0.1/w3c-markup-validator/check ");
-print $str;
+/* Show page... */
+echo $display;
 
+/* Save plist */
 $_SESSION['plist']= $plist;
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: