Kaynağa Gözat

Anpassungen zentrale Report-Grafiken Iveco

gc-server3 1 yıl önce
ebeveyn
işleme
bd63051bb2

+ 125 - 37
apps/MISConfigurator/MISConfigurator.class.inc

@@ -1,4 +1,4 @@
-<?php
+<?php
 /*
  * DON'T REMOVE THE FOLLOWING LICENSE
  *           INFORMATION!
@@ -13,7 +13,7 @@
 class MISConfigurator extends App {	
 	static private $generatedSectionIDs = array();
     static private $generatedReportIDs = array();
-    static private $version = "20110812";
+    static private $version = "20110908";
     
 	public function __construct() {
 		parent::__construct(__file__);
@@ -53,7 +53,7 @@ class MISConfigurator extends App {
         $PP->setAttribute('ID',$newID);
         $PP->setAttribute('parentID',$p_parentID);
         $PP->setAttribute('User',utf8_to_latin1($p_username));
-        $PP->setAttribute('Name',utf8_to_latin1(str_replace(" ","_",$p_sectionName)));
+        $PP->setAttribute('Name',utf8_to_latin1("_".str_replace(" ","_",trim($p_sectionName,"_ "))."_"));
         $PP->setAttribute('Alert',utf8_to_latin1($p_showHauptampel));
         $PP->appendChild($projectDOM->createElement('Images'));
         $projectDOM->getElementsByTagName("Publishes")->item(0)->appendChild($PP);
@@ -61,14 +61,14 @@ class MISConfigurator extends App {
         $SS = $projectDOM->createElement("Scorecard");
         $SS->setAttribute("ID",$newID);
         $SS->setAttribute("Directory",utf8_to_latin1($p_username)."\\");
-        $SS->setAttribute("Name",utf8_to_latin1(str_replace(" ","_",$p_sectionName)));
+        $SS->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",trim($p_sectionName,"_ "))."_"));
         $SS->appendChild($projectDOM->createElement("Reports"));
         $projectDOM->getElementsByTagname("Scorecards")->item(0)->appendChild($SS);
         
         $SS = $projectDOM->createElement("Dashboard");
         $SS->setAttribute("ID",$newID);
         $SS->setAttribute("Directory",utf8_to_latin1($p_username)."\\");
-        $SS->setAttribute("Name",utf8_to_latin1(str_replace(" ","_",$p_sectionName)));
+        $SS->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",trim($p_sectionName,"_ "))."_"));
         $SS->appendChild($projectDOM->createElement("Reviews"));
         $projectDOM->getElementsByTagname("Dashboards")->item(0)->appendChild($SS);
 
@@ -85,7 +85,7 @@ class MISConfigurator extends App {
         $emailArr = explode(";",$p_emailStr);
         foreach($emailArr as $i => $email) {
         	$emailExists = $ProjectXpath->query("/Configuration/Emails/Email[. = '".trim($email)."']")->length > 0 ? true : false;
-        	if(!$emailExists) $MISConfig->setNodeValue("Email",trim($email),$ProjectDOM,$ProjectXpath->query("/Configuration/Emails")->item(0),$ProjectXpath->query("/Configuration/Emails/Email")->length);
+        	if(!$emailExists && $email != "") $MISConfig->setNodeValue("Email",trim($email),$ProjectDOM,$ProjectXpath->query("/Configuration/Emails")->item(0),$ProjectXpath->query("/Configuration/Emails/Email")->length);
         }
         $ProjectDOM->save($MISConfig->getConfigFile());
 	}
@@ -2188,7 +2188,7 @@ class MISConfigurator extends App {
             $ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
             foreach($ImageEmailArr as $email) {
             	if($email != "") {
-	            	$emailArr[trim($email)] = true;
+	            	array_push($emailArr,trim($email));
             	}
             }
             
@@ -2200,15 +2200,11 @@ class MISConfigurator extends App {
         	$ImageEmailArr = explode(";",$iEmailList->item($i)->nodeValue);
             foreach($ImageEmailArr as $email) {
             	if($email != "") {
-	            	$emailArr[trim($email)] = true;
+	            	array_push($emailArr,trim($email));
             	}
             }
         }
-        $i=0;
-        foreach($emailArr as $email => $value) {
-        	$MISConfig->setNodeValue("Email", $email, $ProjectDOM, $Emails,$i);
-        	$i++;
-        }
+
         $xPublishes = $ProjectXpath->query("./Publish",$Publishes); 
         foreach($xPublishes as $xPublish) {
         	$xPublish->setAttribute("parentID",$SectionIDs[str_replace("|"," ",str_replace("_"," ",$xPublish->getAttribute("User")))][$xPublish->getAttribute("parentID")]);
@@ -2254,7 +2250,7 @@ class MISConfigurator extends App {
         }
         $ProjectXpath->query("/Configuration")->item(0)->setAttribute("Version",self::$version);
 	    $ProjectDOM->save($MISConfig->getConfigFile());
-        
+        $this->_registerEmails(implode(";",$emailArr));
         $allUsersArr = $MISConfig->getAllUsernames();
         
         foreach($users as $username => $ansicht) {
@@ -2362,7 +2358,7 @@ class MISConfigurator extends App {
 	private function saveDeleteConfig($p_configFile,$p_deleteUserConfig) {
 		$MISConfig = new MISConfig();
 		
-		$authDOM = new DOMDocument('1.0', 'utf-8');
+		$authDOM = new DOMDocument('1.0', 'iso-8859-1');
 		$authDOM->load($MISConfig->authFile);
 		$authXpath = new DOMXpath($authDOM);
 		if($p_deleteUserConfig == "true") {
@@ -2430,19 +2426,29 @@ class MISConfigurator extends App {
 		$projectDOM->load($MISConfig->getConfigFile());
 		$projectXpath = new DOMXpath($projectDOM);
 		
+		$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
+		
 		$PP = $projectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$ID.'" and ./@User = "'.utf8_to_latin1($username).'"]')->item(0);
-		$PP->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",trim($p_name,"_ "))));
+		
+		@rename(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name"))."\\",
+				latin1_to_utf8($dataDir.$PP->getAttribute("User"))."\\".
+				"_".str_replace(" ","_",$p_name)."_\\");
+		
+		$PP->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",trim($p_name,"_ "))."_"));
 		$PP->setAttribute("Alert",utf8_to_latin1($p_showHauptampel));
 		
+
+		
 		$PSList = $projectXpath->query('/Configuration/Scorecards/Scorecard[./@ID = "'.$ID.'" and ./@Directory = "'.utf8_to_latin1($username).'\\"]');
 		for($i=0;$i<$PSList->length;$i++) {
 			$PS = $PSList->item($i);
-			$PS->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",$p_name)));
+			$PS->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",trim($p_name,"_ "))."_"));
 		}
 		$PSList = $projectXpath->query('/Configuration/Dashboards/Dashboard[./@ID = "'.$ID.'" and ./@Directory = "'.utf8_to_latin1($username).'\\"]');
 		for($i=0;$i<$PSList->length;$i++) {
 			$PS = $PSList->item($i);
-			$PS->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",$p_name)));
+			$PS->setAttribute("Name",utf8_to_latin1("_".str_replace(" ","_",trim($p_name,"_ "))."_"));
 		}
 		$projectDOM->save($MISConfig->getConfigFile());
 		if(count($IDsArr)>0){
@@ -2467,7 +2473,7 @@ class MISConfigurator extends App {
 			if(count($IDArr)>1) {
 				$ID = $IDArr[0];
 				$username = $IDArr[1];
-				array_push($PPNames, str_replace("_"," ",trim($projectXpath->query('/Configuration/Publishes/Publish/@Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue))." (".$username.")");
+				array_push($PPNames, str_replace("_"," ",trim($projectXpath->query('/Configuration/Publishes/Publish/@Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue))." (".utf8_to_latin1($username).")");
 			}else{
 				$deleteUsers = true;
 				array_push($newIDsArr,$IDArr[0]);
@@ -2478,7 +2484,7 @@ class MISConfigurator extends App {
 		$ret.= '<fieldset>';
 
 		$ret.= '<legend><img src="img/package.png">'.$this->_getI18N('deleteSection').'</legend>';
-		$ret.= '<input type="hidden" name="saveMethod" value="saveDeleteSection"><input type="hidden" name="ID" value="'.$p_ID.'">';
+		$ret.= '<input type="hidden" name="saveMethod" value="saveDeleteSection"><input type="hidden" name="ID" value="'.utf8_to_latin1($p_ID).'">';
 		$ret.= '<table><tr><td colspan="2">'.$this->_getI18N('deleteSectionInfoMsg1').' <i>'.implode(", ",$PPNames).'</i> '.$this->_getI18N('deleteSectionInfoMsg2').'<hr></td></tr>';
 		$ret.= '<tr><td colspan="2"><hr><input class="btn" type="button" value="'.$this->_getI18N('abort').'" onclick="';
 		if($deleteUsers) {
@@ -2535,7 +2541,12 @@ class MISConfigurator extends App {
 			
 		$PP = $projectXpath->query('/Configuration/Publishes/Publish[./@ID="'.$p_ID.'" and ./@User = "'.utf8_to_latin1($p_username).'"]');
 		if($PP->length>0) {
+			$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
+
 			$PP = $PP->item(0);
+			$this->deleteDir(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name"))."\\");
+			
 			$PP->parentNode->removeChild($PP);
 			$PS = $projectXpath->query('/Configuration/Scorecards/Scorecard[./@ID="'.$p_ID.'" and ./@Directory = "'.utf8_to_latin1($p_username).'\\"]');
 			for($i=0;$i<$PS->length;$i++){
@@ -2849,7 +2860,7 @@ class MISConfigurator extends App {
 		$ret.= '<fieldset>';
 
 		$ret.= '<legend><img src="img/report.png">'.$PI->getElementsByTagName("Name")->item(0)->nodeValue.' '.$this->_getI18N('editReport').'</legend>';
-		$ret.= '<input type="hidden" name="saveMethod" value="saveEditReport"><input type="hidden" name="ID" value="'.$p_ID.'">';
+		$ret.= '<input type="hidden" name="saveMethod" value="saveEditReport"><input type="hidden" name="ID" value="'.utf8_to_latin1($p_ID).'">';
 		$ret.= '<table><tr><td colspan="2">'.$this->_getI18N('editReportInfoMsg').'<hr></td></tr>';
 		$ret.= '<tr><td class="label"><label for="inp_name">'.$this->_getI18N('reportName').':</label></td><td><input id="inp_name" name="name" type="text" value="'.$PI->getElementsByTagName("Name")->item(0)->nodeValue.'"></td></tr>';
 		$ret.= '<tr><td class="label"><label for="inp_description">'.$this->_getI18N('reportDescription').':</label></td><td><textarea id="inp_description" name="description">'.$PI->getElementsByTagName("Description")->item(0)->nodeValue.'</textarea></td></tr>';
@@ -3009,6 +3020,7 @@ class MISConfigurator extends App {
 		
 		$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
 		$PI = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="J"]')->item(0);
+		$PP = $PI->parentNode->parentNode;
 
 		if($PIList->length == 2) {
 			$previewImage = true;
@@ -3018,6 +3030,8 @@ class MISConfigurator extends App {
 			$PIpreview = null;
 		}
 		
+		$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
+		
 		$p_gifGenerate = ($p_gifGenerate == "true") ? "J" : "N";
 		$p_jpgGenerate = ($p_jpgGenerate == "true") ? "J" : "N";
 		$p_ppxFile = ($p_ppxFile == "true") ? "J" : "N";
@@ -3040,9 +3054,34 @@ class MISConfigurator extends App {
 		$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PI);
 		$MISConfig->setNodeValue("ppx",$p_ppxFile,$projectDOM,$PI);
 		
+		
 		if($previewImage && $p_previewReport == "N") {
+			@unlink(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".gif"));
+			@unlink(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".jpg"));
+			@unlink(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".pdf"));
+			@unlink(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".xls"));
 			$PIpreview->parentNode->removeChild($PIpreview);
 		} else if($previewImage && $p_previewReport == "J") {
+			@rename(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".gif"),
+				latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+				.$PP->getAttribute("Name"))."\\".$p_reportName.".gif");
+			@rename(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".jpg"),
+				latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+				.$PP->getAttribute("Name"))."\\".$p_reportName.".jpg");
+			@rename(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".pdf"),
+				latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+				.$PP->getAttribute("Name"))."\\".$p_reportName.".pdf");
+			@rename(latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+					.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".xls"),
+				latin1_to_utf8($dataDir.$PP->getAttribute("User")."\\"
+				.$PP->getAttribute("Name"))."\\".$p_reportName.".xls");
 			$MISConfig->setNodeValue("Name",$p_reportName,$projectDOM,$PIpreview);
 			$MISConfig->setNodeValue("Description",$p_reportDescription,$projectDOM,$PIpreview);
 			$MISConfig->setNodeValue("Report",$p_pprReport."_Graf",$projectDOM,$PIpreview);
@@ -3109,6 +3148,9 @@ class MISConfigurator extends App {
 		}
 		
 		$projectDOM->save($MISConfig->getConfigFile());
+		
+
+		
 		$this->_registerEmails($p_email);
 		if(count($IDArr)>0){
 			$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editReport","'.implode("|",$IDArr).'");';
@@ -3133,7 +3175,7 @@ class MISConfigurator extends App {
 		$ret.= '<fieldset>';
 
 		$ret.= '<legend><img src="img/report.png">'.$PPName.' '.$this->_getI18N('deleteReport').'</legend>';
-		$ret.= '<input type="hidden" name="saveMethod" value="saveDeleteReport"><input type="hidden" name="ID" value="'.$p_ID.'">';
+		$ret.= '<input type="hidden" name="saveMethod" value="saveDeleteReport"><input type="hidden" name="ID" value="'.utf8_to_latin1($p_ID).'">';
 		$ret.= '<table><tr><td colspan="2">'.$this->_getI18N('deleteReportInfoMsg1').' <i>'.$PPName.'</i> '.$this->_getI18N('deleteReportInfoMsg2').'<hr></td></tr>';
 		$ret.= '<tr><td colspan="2"><hr><input class="btn" type="button" value="'.$this->_getI18N('abort').'" onclick="CMgr.getMODEL().abortRetrieveInput();"><input class="btn" type="submit" value="'.$this->_getI18N('delete').'"></td></tr>';
 		$ret.= '</table>';
@@ -3152,11 +3194,24 @@ class MISConfigurator extends App {
 		$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
 		$projectDOM->load($MISConfig->getConfigFile());
 		$projectXpath = new DOMXpath($projectDOM);
+		$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
 		foreach($IDArr as $ID) {
 			$ID = explode("_",$ID);
 			$ID = $ID[0];
 			$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
 			for($i=0;$i<$PIList->length;$i++) {
+				@unlink(latin1_to_utf8($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
+					.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
+					.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".pdf"));
+				@unlink(latin1_to_utf8($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
+					.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
+					.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".xls"));
+				@unlink(latin1_to_utf8($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
+					.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
+					.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".gif"));
+				@unlink(latin1_to_utf8($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
+					.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
+					.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".jpg"));
 				$PIList->item($i)->parentNode->removeChild($PIList->item($i));
 			}
 		}
@@ -3201,7 +3256,7 @@ class MISConfigurator extends App {
 		$ret.= '<select name="format">';
 		$PSFormatsArr = $MISConfig->getAllScorcardFormats();
 		foreach($PSFormatsArr as $key => $PSFormat) {
-			$ret.= '<option value="'.$key.'">'.utf8_to_latin1($PSFormat).'</option>';		
+			$ret.= '<option value="'.$key.'">'.$PSFormat.'</option>';		
 		}
 		$ret.= '</select>';
 		$ret.= '</td></tr>';
@@ -3248,7 +3303,7 @@ class MISConfigurator extends App {
 				break;
 			case 2: $format = "Zahl ohne Trennz";
 				break;
-			case 3: $format = "W�hrung";
+			case 3: $format = latin1_to_utf8("Währung");
 				break;
 			case 4: $format = "Prozent";
 				break;
@@ -3296,8 +3351,8 @@ class MISConfigurator extends App {
 		$ret.= '<legend><img src="img/scorecard.png">'.$PR->getElementsByTagName("Name")->item(0)->nodeValue.' '.$this->_getI18N('editScorecard').'</legend>';
 		$ret.= '<input type="hidden" name="saveMethod" value="saveEditScorecard"><input type="hidden" name="ID" value="'.$p_ID.'">';
 		$ret.= '<table><tr><td colspan="2">'.$this->_getI18N('editScorecardInfoMsg').'<hr></td></tr>';
-		$ret.= "<tr><td><label for='inp_name'>".$this->_getI18N('scorecardName').":</label></td><td><input id='inp_name' name='name' type='text' value='".$PR->getElementsByTagName("Name")->item(0)->nodeValue."'></td></tr>";
-		$ret.= "<tr><td><label for='inp_description'>".$this->_getI18N('scorecardDescription').":</label></td><td><textarea id='inp_description' name='description'>".$PR->getElementsByTagName("Description")->item(0)->nodeValue."</textarea></td></tr>";
+		$ret.= '<tr><td><label for="inp_name">'.$this->_getI18N('scorecardName').':</label></td><td><input id="inp_name" name="name" type="text" value="'.$PR->getElementsByTagName("Name")->item(0)->nodeValue.'"></td></tr>';
+		$ret.= '<tr><td><label for="inp_description">'.$this->_getI18N('scorecardDescription').':</label></td><td><textarea id="inp_description" name="description">'.$PR->getElementsByTagName("Description")->item(0)->nodeValue.'</textarea></td></tr>';
 		$ret.= '<tr><td><label for="inp_active">'.$this->_getI18N('active').':</label></td><td>';
 			$ret.= '<select id="inp_active" name="active"><option value="N">'.$this->_getI18N("no").'</option><option value="J"';
 			if($PR->getElementsByTagName("Active")->item(0)->nodeValue == "J") $ret.= " selected='selected'";
@@ -3333,7 +3388,7 @@ class MISConfigurator extends App {
                 break;
             case "Zahl ohne Trennz": $sec_key = 2;
                 break;
-            case "W�hrung":$sec_key = 3;
+            case "Währung":$sec_key = 3;
                 break;
             case "Prozent":$sec_key = 4;
                 break;
@@ -3342,7 +3397,7 @@ class MISConfigurator extends App {
 		foreach($PSFormatsArr as $key => $PSFormat) {
 			$ret.= '<option value="'.$key.'"';
 			if($key == $sec_key)$ret.= ' selected="selected"';
-			$ret.= '>'.utf8_to_latin1($PSFormat).'</option>';		 
+			$ret.= '>'.$PSFormat.'</option>';		 
 		}
 		$ret.= '</select>';
 		$ret.= '</td></tr>';
@@ -3379,7 +3434,7 @@ class MISConfigurator extends App {
                 break;
             case 2: $format = "Zahl ohne Trennz";
                 break;
-            case 3: $format = "W�hrung";
+            case 3: $format = latin1_to_utf8("Währung");
                 break;
             case 4: $format = "Prozent";
                 break;
@@ -3549,7 +3604,7 @@ foreach($langs as $lang) {
 			$ret.= '<select id="inp_lang" name="lang">';
 			$allLangsArr = $MISConfig->getAllLangs();
 			foreach($allLangsArr as $key => $lang) {
-				$ret.= '<option value="'.$key.'">'.utf8_to_latin1($lang).'</option>';
+				$ret.= '<option value="'.$key.'">'.$lang.'</option>';
 			}
 			$ret.= '</select>';
 		$ret.= '</td></tr>';
@@ -3574,7 +3629,7 @@ foreach($langs as $lang) {
 		if($this->isRole("master")) {
 		$MISConfig = new MISConfig();
 		
-		$authDOM = new DOMDocument('1.0', 'utf-8');
+		$authDOM = new DOMDocument('1.0', 'iso-8859-1');
 		$authDOM->load($MISConfig->authFile);
 		$authXpath = new DOMXpath($authDOM);
 		
@@ -3612,7 +3667,7 @@ foreach($langs as $lang) {
 		$ret="";
 		$eval="";
 		if(count($IDArr)==1) {
-			$authDOM = new DOMDocument('1.0', 'utf-8');
+			$authDOM = new DOMDocument('1.0', 'iso-8859-1');
 			$authDOM->load($MISConfig->authFile);
 			$authXpath = new DOMXpath($authDOM);
 		
@@ -3672,8 +3727,15 @@ foreach($langs as $lang) {
 	
 	private function saveEditUser($p_ID,$p_newUsername,$p_password,$p_passwordRepeat,$p_lang,$p_view="Info-User",$p_global="false") {
 		$MISConfig = new MISConfig();
+		$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
+		$projectDOM->load($MISConfig->getConfigFile());
+		$projectXpath = new DOMXpath($projectDOM);	
+		
 		$IDsArr = explode("|",$p_ID);
 		
+		$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
+		
+
 		
 		$username = utf8_to_latin1(array_shift($IDsArr));
 
@@ -3683,7 +3745,7 @@ foreach($langs as $lang) {
 		$projectDOM->load($MISConfig->getConfigFile());
 		$projectXpath = new DOMXpath($projectDOM);	
 
-		$authDOM = new DOMDocument('1.0', 'utf-8');
+		$authDOM = new DOMDocument('1.0', 'iso-8859-1');
 		$authDOM->load($MISConfig->authFile);
 		$authXpath = new DOMXpath($authDOM);
 
@@ -3729,6 +3791,8 @@ foreach($langs as $lang) {
         }
 		$projectDOM->save($MISConfig->getConfigFile());
 		$authDOM->save($MISConfig->authFile);
+		@rename(latin1_to_utf8($dataDir.$username)."\\",
+				latin1_to_utf8($dataDir.$newUsername)."\\");
 	    if(count($IDsArr)>0){
 			$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editUser","'.implode("|",$IDsArr).'");';
 		}else{
@@ -3781,7 +3845,7 @@ foreach($langs as $lang) {
 		$projectDOM->load($MISConfig->getConfigFile());
 		$projectXpath = new DOMXpath($projectDOM);	
 		
-		$authDOM = new DOMDocument('1.0', 'utf-8');
+		$authDOM = new DOMDocument('1.0', 'iso-8859-1');
 		$authDOM->load($MISConfig->authFile);
 		$authXpath = new DOMXpath($authDOM);
 		foreach($IDsArr as $IDStr) {
@@ -3946,8 +4010,8 @@ foreach($langs as $lang) {
         $ret.= '<legend><img src="img/dashboard.png">'.$PR->getElementsByTagName("Name")->item(0)->nodeValue.' '.$this->_getI18N('editDashboard').'</legend>';
         $ret.= '<input type="hidden" name="saveMethod" value="saveEditDashboard"><input type="hidden" name="ID" value="'.$p_ID.'">';
         $ret.= '<table><tr><td colspan="2">'.$this->_getI18N('editDashboardInfoMsg').'<hr></td></tr>';
-        $ret.= "<tr><td><label for='inp_name'>".$this->_getI18N('dashboardName').":</label></td><td><input id='inp_name' name='name' type='text' value='".$PR->getElementsByTagName("Name")->item(0)->nodeValue."'></td></tr>";
-        $ret.= "<tr><td><label for='inp_description'>".$this->_getI18N('dashboardDescription').":</label></td><td><textarea id='inp_description' name='description'>".$PR->getElementsByTagName("Description")->item(0)->nodeValue."</textarea></td></tr>";
+        $ret.= '<tr><td><label for="inp_name">'.$this->_getI18N('dashboardName').':</label></td><td><input id="inp_name" name="name" type="text" value="'.$PR->getElementsByTagName("Name")->item(0)->nodeValue.'"></td></tr>';
+        $ret.= '<tr><td><label for="inp_description">'.$this->_getI18N('dashboardDescription').':</label></td><td><textarea id="inp_description" name="description">'.$PR->getElementsByTagName("Description")->item(0)->nodeValue.'</textarea></td></tr>';
         $ret.= '<tr><td><label for="inp_pprname">'.$this->_getI18N('dashboardReport').':</label></td><td>';
         $ret.= '<select name="pprname">';
         $PPRArr = $this->_getAllDashboards();
@@ -4554,7 +4618,7 @@ foreach($langs as $lang) {
 	        $ProjectDOM->save($MISConfig->getConfigFile());
         	$this->saveRetrieveInput("dummy");
         }else {
-        	$UserDOM = new DOMDocument('1.0', 'utf-8');
+        	$UserDOM = new DOMDocument('1.0', 'iso-8859-1');
         	$UserDOM->load($this->authFile);
         	$UserXpath = new DOMXpath($UserDOM);
 
@@ -4981,5 +5045,29 @@ foreach($langs as $lang) {
 			print "<script type='text/javascript'>window.history.back();</script>";
         }
     }
+
+	private function info(){
+		$ret = '<form id="administrationForm" name="administrationForm" encoding="utf-8" action="" target="_self" method="post" class="adminListForm" onsubmit="return Form.submit(this,\'MISConfigurator\',\'saveMain\',\'DashboardPath:PATH\',\'WebCreatorPath:PATH\',\'CubePath:PATH\',\'ReportPath:PATH\',\'WebReportPath:PATH\',\'PublishPath:PATH\',\'PublishImagePath:PATH\',\'PublishAlarmPath:PATH\',\'WebServerName\',\'PortalStartPage\',\'PDFURL\',\'ReportURL\',\'CubeURL\',\'GatewayURL\',\'SecURL\');">
+				<fieldset>
+					<legend><label style="font-size:1.2em;">'.$this->_getI18N("info").'</label></legend>
+					<table>';
+		$ret .= '<tr><td class="label">'.$this->_getI18N("info_welcome").'</td></tr>';
+		$ret.= '	</table>
+				</fieldset>
+			</form><br>';
+		$ret.= '<form id="administrationForm" name="administrationForm" encoding="utf-8" action="" target="_self" method="post" class="adminListForm" onsubmit="return Form.submit(this,\'MISConfigurator\',\'saveMain\',\'DashboardPath:PATH\',\'WebCreatorPath:PATH\',\'CubePath:PATH\',\'ReportPath:PATH\',\'WebReportPath:PATH\',\'PublishPath:PATH\',\'PublishImagePath:PATH\',\'PublishAlarmPath:PATH\',\'WebServerName\',\'PortalStartPage\',\'PDFURL\',\'ReportURL\',\'CubeURL\',\'GatewayURL\',\'SecURL\');">
+				<fieldset>
+					<legend><label style="font-size:1.2em;">'.$this->_getI18N("changelog").'</label></legend>
+					<table>';
+		$ret .= '<tr><td class="label">30.11.2011 - New feature - PDF Layer at Email export</td></tr>';
+		$ret .= '<tr><td class="label">30.11.2011 - Fixed bug - Freeze of andministration module</td></tr>';
+		$ret .= '<tr><td class="label">30.11.2011 - New feature - Infoscreen in administration module</td></tr>';
+		$ret .= '<tr><td class="label">30.11.2011 - Fixed bug - Blank screen of administration module on offline systems</td></tr>';
+		$ret .= '<tr><td class="label">15.11.2011 - Fixed bug - Switching between reportpreview YES/NO</td></tr>';
+		$ret.= '	</table>
+				</fieldset>
+			</form>';
+		return array($ret,'');
+	}
 }
 ?>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
apps/MISConfigurator/MISConfigurator.i18n.xml


+ 199 - 121
apps/MISView/MISView.class.inc

@@ -70,7 +70,7 @@ class MISView extends App {
 										$ret.= $arr[0];$eval.=implode(";",$arr[1]);
 										if($this->isRole("admin")) {
 											$sectionLabel = new Label(new Icon("img/configurator.png"),$this->_getI18N("configurator"));
-											$eval .= ';CMgr.getMODEL().setLeftFootbar(\'<div id="sectionItem" onclick="CMgr.getMODEL().getMain(\\\'MISConfigurator\\\',\\\'configSettings\\\');">'.$sectionLabel.'</div>\');';
+											$eval .= ';CMgr.getMODEL().setLeftFootbar(\'<div id="sectionItem" onclick="CMgr.getMODEL().getMain(\\\'MISConfigurator\\\',\\\'info\\\');">'.$sectionLabel.'</div>\');';
 										}
                                         break;
 				case "reports":			$arr = call_user_func_array(array($this, $p_view), $p_args);
@@ -203,22 +203,10 @@ class MISView extends App {
 	}
 	
 	public function getSectionStatusImg($p_sectionID) {
-			ob_start();
-		if(!isset($_SESSION["Config"]) && !isset($_SESSION["Config"]["General"]) && !isset($_SESSION["Config"]["General"]["PublishImagePath"])){
-		$MISConfig = new MISConfig();
-        $projectDOM = new DOMDocument('1.0', 'iso-8859-1');
-        $projectDOM->load($MISConfig->getConfigFile());
-        $projectXpath = new DOMXpath($projectDOM);
-		$_SESSION["Config"]["General"]["PublishImagePath"] = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
-		}
-		$publishImagePath = $_SESSION["Config"]["General"]["PublishImagePath"];
+		ob_start();
 
-		
+		$xpath = $this->getScorecardFileDOM();
 		$datensatz = array();
-		$dom = new DOMDocument('1.0', 'iso-8859-1');
-	   
-		$dom->load(latin1_to_utf8($publishImagePath . $this->getUsername() . "/data.xml"));
-		$xpath = new DOMXPath($dom);
 		$berichte = $xpath->query('/Daten/child::*[@ID = ' . $p_sectionID . ']/Scorecards/Bericht');
 	
 		for ( $i = 0; $i < $berichte->length; $i++ ) {
@@ -229,7 +217,7 @@ class MISView extends App {
 			   $niedrigerwert = $xpath->query('NiedrigerWert', $element)->item(0)->nodeValue;
 	
 			   $hoherwert = $xpath->query('HoherWert', $element)->item(0)->nodeValue;
-	           $ampel = getImgAlarmstufeSrc($wert, $niedrigerwert, $hoherwert, $hoherzielwert);
+	           $ampel = $this->getImgAlarmstufeSrc($wert, $niedrigerwert, $hoherwert, $hoherzielwert);
 	           array_push($datensatz, $ampel);
 		}
 	   
@@ -262,30 +250,30 @@ class MISView extends App {
 		$farbe['r8'] = array(173, 0, 0);
 	    $error = ob_get_clean();
 	    if($error =="") {
-	   	$im = new Imagick("./img/MISView/sectionStatus.png");
-		$i=0;
-		foreach ($datensatz as $key => $value) {
-		     if (($start > $key)) {
-				$draw = new ImagickDraw();
-				$draw->setFillColor(new ImagickPixel( 'rgb('.implode(",",$farbe[$value]).')' ));
-				$draw->rectangle($matrix[$i][0],$matrix[$i][1],$matrix[$i+1][2],$matrix[$i+1][3]);
-				$im->drawImage($draw);
-				$i+=2;
-        	} else {
-				$draw = new ImagickDraw();
-				$draw->setFillColor(new ImagickPixel( 'rgb('.implode(",",$farbe[$value]).')' ));
-				$draw->rectangle($matrix[$i][0],$matrix[$i][1],$matrix[$i][2],$matrix[$i][3]);
-				$im->drawImage($draw);
-				$i++;
-        	}
-		}
-	    }else {
+			$im = new Imagick("./img/MISView/sectionStatus.png");
+			$i=0;
+			foreach ($datensatz as $key => $value) {
+				 if (($start > $key)) {
+					$draw = new ImagickDraw();
+					$draw->setFillColor(new ImagickPixel( 'rgb('.implode(",",$farbe[$value]).')' ));
+					$draw->rectangle($matrix[$i][0],$matrix[$i][1],$matrix[$i+1][2],$matrix[$i+1][3]);
+					$im->drawImage($draw);
+					$i+=2;
+				} else {
+					$draw = new ImagickDraw();
+					$draw->setFillColor(new ImagickPixel( 'rgb('.implode(",",$farbe[$value]).')' ));
+					$draw->rectangle($matrix[$i][0],$matrix[$i][1],$matrix[$i][2],$matrix[$i][3]);
+					$im->drawImage($draw);
+					$i++;
+				}
+			}
+	    } else {
+			return $error;
 			$im = new Imagick("./img/MISView/sectionStatusError.png");
 		}
-		$data = $im->getImageBlob ();
 
 		header ("Content-Type: image/{$im->getImageFormat()}");
-		echo $data; 
+		echo $im->getImageBlob (); 
 	}
 	
 	private function reports($p_sectionID,$p_reportID=null) {
@@ -368,8 +356,16 @@ class MISView extends App {
 				$_SESSION["Config"]["General"]["PublishImagePath"] = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
 			}
 			$publishImagePath = $_SESSION["Config"]["General"]["PublishImagePath"];
-            
-            $filename = latin1_to_utf8($publishImagePath.$this->getUsername()."\\".$sectionName."\\".$reportName.".pdf");
+			
+			$layer = $report->getElementsByTagName("PDFImageLayer")->item(0)->nodeValue;
+			$configFile = substr($_SESSION[CONFIG_SESSION]['configFile'], 0, -4);
+								
+			
+			$filename = latin1_to_utf8($publishImagePath . $configFile . "\\" . $reportFile . "_" . $layer . ".pdf");
+						
+			if (!file_exists($filename)) {
+				$filename = latin1_to_utf8($publishImagePath.$this->getUsername()."\\".$sectionName."\\".$reportName.".pdf");
+			}
         } 
         if (!file_exists($filename)) {
             $tpl->assign("reportLink",'javascript:alert(\''.$this->_getI18N('missingReportFile').'\');');
@@ -405,7 +401,7 @@ class MISView extends App {
 	}
 	
 	public function reportPreview($p_sectionID,$p_reportID=null) {
-
+		
 		if($this->getAuth()) {
 		if(!isset($_SESSION["Config"]) && !isset($_SESSION["Config"]["General"]) && !isset($_SESSION["Config"]["General"]["PublishImagePath"])){
 		$MISConfig = new MISConfig();
@@ -428,44 +424,39 @@ class MISView extends App {
 				$imageNodeListJpg = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID = "'.$p_sectionID.'" and ./@ID = "'.$p_reportID.'" and ./Directory = "'.$this->getUsername().'\\" and ./Active = "N" and ./JPGGenerate = "J"]');
 				
 				$reportName = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image/Name[./../../../@ID="'.$p_sectionID.'" and ./../@ID = "'.$p_reportID.'" and ./../Directory = "'.$this->getUsername().'\\" and ./../Active = "N"]')->item(0)->nodeValue;
-				
 				$sectionName = $projectXpath->query("/Configuration/Publishes/Publish[./@ID='".$p_sectionID."']")->item(0)->getAttribute("Name");
-								
-				if(count($imageNodeListGif) > 0) {
-					$filename = $publishImagePath.$this->getUsername()."/".$sectionName."/".$reportName.".gif";
-					$file_extension = "gif";
-				} else if(count($imageNodeListJpg) > 0) {
-					$filename = $publishImagePath.$this->getUsername()."/".$sectionName."/".$reportName.".png";
-					$file_extension = "jpg";
+				
+				$pprName = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image/Report[./../../../@ID="'.$p_sectionID.'" and ./../@ID = "'.$p_reportID.'" and ./../Directory = "'.$this->getUsername().'\\" and ./../Active = "N"]')->item(0)->nodeValue;
+				if (preg_match("/_graf/is", $pprName)) {
+					$pprName = substr($pprName, 0, -5);
+				}
+				$layer = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image/ImageLayer[./../../../@ID="'.$p_sectionID.'" and ./../@ID = "'.$p_reportID.'" and ./../Directory = "'.$this->getUsername().'\\" and ./../Active = "N"]')->item(0)->nodeValue;
+				if ($layer == 0) {
+					$layer = 1;
+				}
+				$configFile = substr($_SESSION[CONFIG_SESSION]['configFile'], 0, -4);
+				
+				$filename = latin1_to_utf8($publishImagePath . $configFile . "\\" . $pprName . "_" . $layer . ".jpg");
+				$file_extension = "jpg";
+				
+				if (!file_exists($filename)) {
+					if(count($imageNodeListGif) > 0) {
+						$filename = $publishImagePath.$this->getUsername()."/".$sectionName."/".$reportName.".gif";
+						$file_extension = "gif";
+					} else if(count($imageNodeListJpg) > 0) {
+						$filename = $publishImagePath.$this->getUsername()."/".$sectionName."/".$reportName.".png";
+						$file_extension = "jpg";
+					}
+					$filename = latin1_to_utf8($filename);
 				}
 			}
 			
-	        $filename = latin1_to_utf8($filename);
+	        
 		    if (file_exists($filename)) {
 
 		        $im = new Imagick($filename);
 			    $im->scaleImage(750,0);
-/*
-	            if(date('j-m-y',time()) > date('j-m-y',filemtime(latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml")))+3) {
-
-				    $draw = new ImagickDraw();
-				
-				    $draw->setFont( "SociaLAnimaL" );
-				    
-				    $draw->setFillColor(new ImagickPixel('red'));
-				
-				    $draw->setFontSize( 45 );
-				
-				    $draw->setFillAlpha( 0.7 );
-				
-				    $draw->setGravity( Imagick::GRAVITY_CENTER );
-				
-				    $im->annotateImage( $draw, 0, 0, 25, "BERICHT IST NICHT AKTUELL!" );
-				    
-				    $im->annotateImage( $draw, 0, 65, 15, "STAND: ".date('j.m.y',filemtime(ROOT_DIR."daten/".$this->getUsername()."/data.xml")) );
-			    
-	             }
-*/			}else{
+			}else{
                 $im = new Imagick();
                 $im->setResolution(750,500);
                 $im->newImage(750, 500, new ImagickPixel('white'));
@@ -494,8 +485,6 @@ class MISView extends App {
                     
                     $im->setImageFormat('png');
                     
-                    /*** set the font size ***/
-                    //$im->annotateImage( $draw, 0, 65, 15, "STAND: ".date('j.m.y',filemtime(ROOT_DIR."daten/".$this->getUsername()."/data.xml")) );
 			}
 
 	           header("Pragma: public");
@@ -505,6 +494,7 @@ class MISView extends App {
 	           header ("Content-Type: image/".$im->getImageFormat());
 			 $data = $im->getImageBlob ();
 			 echo $data; 
+			 //echo $filename;
 		}
 	}
 	
@@ -561,13 +551,25 @@ class MISView extends App {
 					            set_time_limit(0);
 					            readfile($filename) or die("File not found."); 
 					            break;
-				case "Info-User":$name = $report->getElementsByTagName("Name")->item(0)->nodeValue;
+				case "Info-User":
+								$name = $report->getElementsByTagName("Name")->item(0)->nodeValue;
 								$reportPath = $projectXpath->query("/Configuration/General/PublishImagePath")->item(0)->nodeValue;
 								$sectionName = $projectXpath->query("/Configuration/Publishes/Publish[./Images/Image/@ID = '".$p_reportID."']")->item(0);	
-					            $filename = latin1_to_utf8($reportPath.$this->getUsername()."\\".$sectionName->getAttribute("Name")."\\".$name.".pdf");
+								
+								$pprName = $report->getElementsByTagName("Report")->item(0)->nodeValue;
+								$layer = $report->getElementsByTagName("PDFImageLayer")->item(0)->nodeValue;
+								$configFile = substr($_SESSION[CONFIG_SESSION]['configFile'], 0, -4);
+								
+								$filename = latin1_to_utf8($reportPath . $configFile . "\\" . $pprName . "_" . $layer . ".pdf");
+								
+								if (!file_exists($filename)) {
+									$filename = latin1_to_utf8($reportPath.$this->getUsername()."\\".$sectionName->getAttribute("Name")."\\".$name.".pdf");
+								}
+								
+								
 	
 					            $file_extension = strtolower(substr(strrchr($filename,"."),1));
-								$filename = $filename;
+								
 					            switch ($file_extension) {
 					                case "pdf": $ctype="application/pdf"; break;
 					                case "exe": $ctype="application/octet-stream"; break;
@@ -608,37 +610,75 @@ class MISView extends App {
 	
 	public function getScorecardStatusImg($p_sectionID,$p_scorecardID) {
         try {
-		$MISConfig = new MISConfig();
-        $projectDOM = new DOMDocument('1.0', 'iso-8859-1');
-        $projectDOM->load($MISConfig->getConfigFile());
-        $projectXpath = new DOMXpath($projectDOM);
-        $publishImagePath = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
-		$dataDOM = new DOMDocument('1.0', 'iso-8859-1');
-		$dataDOM->load(latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml"));
-		$dataXpath = new DOMXpath($dataDOM);
-		
-		$report = $dataXpath->query('/Daten/child::*/Scorecards/Bericht[../../@ID = "'.$p_sectionID.'"]')->item($p_scorecardID);
-		
-	    $aktwert = $report->getElementsByTagName("Wert")->item(0)->nodeValue;
-	    $niedriger = $report->getElementsByTagName("NiedrigerWert")->item(0)->nodeValue;
-	    $hoher = $report->getElementsByTagName("HoherWert")->item(0)->nodeValue;
-	    $positiv = $report->getElementsByTagName("HoherZielwert")->item(0)->nodeValue;
-		$farbe = getImgAlarmstufeSrc($aktwert,$niedriger,$hoher,$positiv);
+			$dataXpath = $this->getScorecardFileDOM();
+			
+			$report = $dataXpath->query('/Daten/child::*/Scorecards/Bericht[../../@ID = "'.$p_sectionID.'"]')->item($p_scorecardID);
+			
+			$aktwert = $report->getElementsByTagName("Wert")->item(0)->nodeValue;
+			$niedriger = $report->getElementsByTagName("NiedrigerWert")->item(0)->nodeValue;
+			$hoher = $report->getElementsByTagName("HoherWert")->item(0)->nodeValue;
+			$positiv = $report->getElementsByTagName("HoherZielwert")->item(0)->nodeValue;
+			$farbe = $this->getImgAlarmstufeSrc($aktwert,$niedriger,$hoher,$positiv);
 
-		$im = new Imagick(ROOT_DIR."apps/MISView/images/".$farbe.".gif");
+			$im = new Imagick(ROOT_DIR."apps/MISView/images/".$farbe.".gif");
 
-		header ("Content-Type: image/{$im->getImageFormat()}");
-		$data = $im->getImageBlob ();
+			header ("Content-Type: image/{$im->getImageFormat()}");
+			$data = $im->getImageBlob ();
         }catch(Exception $e) {
-        $im = new Imagick(ROOT_DIR."apps/MISView/images/gerror.gif");
+			$im = new Imagick(ROOT_DIR."apps/MISView/images/gerror.gif");
 
-        header ("Content-Type: image/{$im->getImageFormat()}");
-        $data = $im->getImageBlob ();
+			header ("Content-Type: image/{$im->getImageFormat()}");
+			$data = $im->getImageBlob ();
         }
 		echo $data; 
 		
 	}
 	
+	private function getImgAlarmstufeSrc($aktwert,$niedriger,$hoher,$positiv) {
+		$aktwert = $this->convertValue($aktwert);
+		$niedriger = $this->convertValue($niedriger);
+		$hoher = $this->convertValue($hoher);
+		$differenz = $hoher - $niedriger;
+		$faktor = 8;
+
+		if ($hoher == 0 || $niedriger == 0) {
+			$hoher = $hoher + 0.001;
+			$niedriger = $niedriger + 0.001;
+		}
+		if ($positiv=="J") {
+			$basis = pow($faktor,(1/7));
+			if (($aktwert-$niedriger) > ($differenz/$faktor)) {
+			   $exp = log10((($aktwert-$niedriger) / $differenz) * $faktor) / log10($basis);
+			} elseif ($aktwert > $niedriger) {
+			   $exp = 0;
+			} else {
+			   $exp = -1;
+			}
+		} else {
+			$basis = pow((1/$faktor),(1/7));
+			if (($hoher-$aktwert) > ($differenz/$faktor)) {
+			   $exp = log10(-(($aktwert-$hoher) / ($differenz * $faktor))) / log10($basis);
+			   $exp = ceil(13 - $exp);
+			} elseif ($aktwert < $hoher) {
+			   $exp = -0;
+			} else {
+			   $exp = -1;
+			}
+		}
+		$stufe = floor($exp+0.001);
+
+		if ($stufe < 7) {
+		  $stufe = 7 - $stufe;
+		  if ($stufe > 8) { $stufe = 8; }
+		  $farbe = "red";
+		} else {
+		  $stufe = round($stufe - 6);
+		  if ($stufe > 7) { $stufe = 7; }
+		  $farbe = "green";
+		}
+		return substr($farbe,0,1) . $stufe;
+	}
+	
 	private function scorecards($p_sectionID,$p_scorecardID=0) {
 		$MISConfig = new MISConfig();
 		$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
@@ -647,16 +687,14 @@ class MISView extends App {
 
 		$publishImagePath = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
 		
-		$dataDOM = new DOMDocument('1.0', 'iso-8859-1');
-		$dataDOM->load(latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml"));
-		$dataXpath = new DOMXpath($dataDOM);
+		$dataXpath = $this->getScorecardFileDOM();
 		
 		$p_reportID = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./../../@ID = "'.$p_sectionID.'"]')->item($p_scorecardID)->getAttribute("ID");
 		$scorecardList = $dataXpath->query('/Daten/child::*/Scorecards/Bericht[./../../@ID = "'.$p_sectionID.'"]');
 		
 		$tree = new Tree("contentMenu");
 		
-		for($i=0;$i<$scorecardList->length;$i++){
+		for($i=0;$i<$scorecardList->length;$i++) {
 			$report = $scorecardList->item($i);
 			$reportName = $report->getElementsByTagName("Titel")->item(0)->nodeValue;
 			$icon = new Icon("?&rc=MISView&rm=getScorecardStatusImg&ras[]=".$p_sectionID."&ras[]=".$i);
@@ -712,9 +750,9 @@ class MISView extends App {
 		$tpl->assign('Name',array('desc'=>$this->_getI18N('name'),'value'=>$scorecard->getElementsByTagname("Titel")->item(0)->nodeValue));
 		$tpl->assign('Description',array('desc'=>$this->_getI18N('description'),'value'=>$scorecard->getElementsByTagName("Beschreibung")->item(0)->nodeValue));
 		$tpl->assign('Status',array('desc'=>$this->_getI18N('status'),'value'=>'?&rc=MISView&rm=getScorecardDetailStatusImg&ras[]='.$p_sectionID.'&ras[]='.$p_scorecardID));
-		$tpl->assign('Value',array('desc'=>$this->_getI18N('value'),'value'=>$scorecard->getElementsByTagName("Wert")->item(0)->nodeValue));
-		$tpl->assign('HighValue',array('desc'=>$this->_getI18N('highValue'),'value'=>$scorecard->getElementsByTagName("HoherWert")->item(0)->nodeValue));
-		$tpl->assign('LowValue',array('desc'=>$this->_getI18N('lowValue'),'value'=>$scorecard->getElementsByTagName("NiedrigerWert")->item(0)->nodeValue));
+		$tpl->assign('Value',array('desc'=>$this->_getI18N('value'),'value'=>$this->numberFormat($scorecard->getElementsByTagName("Wert")->item(0)->nodeValue)));
+		$tpl->assign('HighValue',array('desc'=>$this->_getI18N('highValue'),'value'=>$this->numberFormat($scorecard->getElementsByTagName("HoherWert")->item(0)->nodeValue)));
+		$tpl->assign('LowValue',array('desc'=>$this->_getI18N('lowValue'),'value'=>$this->numberFormat($scorecard->getElementsByTagName("NiedrigerWert")->item(0)->nodeValue)));
 		$tpl->assign('Tolerance',array('desc'=>$this->_getI18N('tolerance'),'value'=>$scorecard->getElementsByTagName("Toleranz")->item(0)->nodeValue));
 		$tpl->assign('Weight',array('desc'=>$this->_getI18N('weight'),'value'=>$scorecard->getElementsByTagName("Gewichtung")->item(0)->nodeValue));
 		$tpl->assign('PositiveValue',array('desc'=>$this->_getI18N('positiveValue'),'value'=>$scorecard->getElementsByTagName("HoherZielwert")->item(0)->nodeValue));
@@ -750,8 +788,9 @@ class MISView extends App {
         
         $publishImagePath = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
         
-        $dataDOM = new DOMDocument('1.0', 'iso-8859-1');
-        $dataDOM->load(latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml"));
+        $dataFilename = $this->getScorecardFilename();
+		$dataDOM = new DOMDocument('1.0', 'iso-8859-1');
+		$dataDOM->load($dataFilename);
         $dataXpath = new DOMXpath($dataDOM);
 
         
@@ -803,7 +842,7 @@ class MISView extends App {
             $MISConfig->setNodeValue("NiedrigerWert",str_replace(".",",",number_reformat($p_lowValue, 2, ',',"."))."",$dataDOM,$PRR);
             $MISConfig->setNodeValue("HoherWert",str_replace(".",",",number_reformat($p_highValue, 2, ',',"."))."",$dataDOM,$PRR);
         }
-        $dataDOM->save(latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml"));
+        $dataDOM->save($dataFilename);
         $projectDOM->save($MISConfig->getConfigFile());
         return array('CMgr.getMODEL().__construct();');     
     }
@@ -858,31 +897,70 @@ class MISView extends App {
             print "<script type='text/javascript'>window.history.back();</script>";
         }
     }
-	
-	public function getScorecardDetailStatusImg($p_sectionID,$p_scorecardID) {
-		header("Content-Type: image/png\n\n");
-		
-        $MISConfig = new MISConfig();
-        $projectDOM = new DOMDocument('1.0', 'iso-8859-1');
-        $projectDOM->load($MISConfig->getConfigFile());
-        $projectXpath = new DOMXpath($projectDOM);
 
-        $publishImagePath = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
-        
+	private function getPublishImagePath () {
+		if (!isset($_SESSION["Config"]) && !isset($_SESSION["Config"]["General"]) && !isset($_SESSION["Config"]["General"]["PublishImagePath"])) {
+			$MISConfig = new MISConfig();
+			$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
+			$projectDOM->load($MISConfig->getConfigFile());
+			$projectXpath = new DOMXpath($projectDOM);
+			$_SESSION["Config"]["General"]["PublishImagePath"] = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
+		}
+		return $_SESSION["Config"]["General"]["PublishImagePath"];
+	}
+	
+	private function getConfigFilename () {
+		$MISConfig = new MISConfig();
+		return basename($MISConfig->getConfigFile(), ".xml");
+	}
+	
+	private function getScorecardFilename() {
+        $publishImagePath = $this->getPublishImagePath();
+		$configFile = $this->getConfigFilename();
+				
+		$dataFilename = latin1_to_utf8($publishImagePath . $configFile . "\\" . $this->getUsername() . ".xml");
 		
+		if (!file_exists($dataFilename)) {
+			$dataFilename = latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml"); // alte Variante
+		}
+		return $dataFilename;
+	}
+	
+	private function getScorecardFileDOM () {
 		$dataDOM = new DOMDocument('1.0', 'iso-8859-1');
-		$dataDOM->load(latin1_to_utf8($publishImagePath.$this->getUsername()."/data.xml"));
-		$dataXpath = new DOMXpath($dataDOM);
+		$dataDOM->load($this->getScorecardFilename());
+		return new DOMXpath($dataDOM);
+	}
+	
+	private function convertValue ($value) {
+		if (preg_match("/[%,]/is", $value)) {
+			$value = str_replace("%","",$value);
+			$value = str_replace(".","",$value);
+			$value = str_replace(",",".",$value);
+		}
+		return floatval($value);
+	}
+	
+	private function numberFormat ($value) {
+		if (preg_match("/[%,]/is", $value)) {
+			return $value;
+		}
+		return number_format($value * 100, 2, ",", "") . " %";
+	}
+	
+	public function getScorecardDetailStatusImg($p_sectionID,$p_scorecardID) {
+		header("Content-Type: image/png\n\n");
 		
+		$dataXpath = $this->getScorecardFileDOM();
 		$scorecard = $dataXpath->query('/Daten/child::*/Scorecards/Bericht[../../@ID = "'.$p_sectionID.'"]')->item($p_scorecardID);
 		
 	    $anzeige = ImageCreateFromPNG (ROOT_DIR."apps/MISView/scDetail_".$scorecard->getElementsByTagName("HoherZielwert")->item(0)->nodeValue.".png");
 	    $pfeil = ImageCreateFromPNG (ROOT_DIR."apps/MISView/dart.png");
 	    
 	    $faktor = 8;
-	    $aktwert = umwandeln($scorecard->getElementsByTagName("Wert")->item(0)->nodeValue);
-	    $niedriger = umwandeln($scorecard->getElementsByTagName("NiedrigerWert")->item(0)->nodeValue);
-	    $hoher = umwandeln($scorecard->getElementsByTagName("HoherWert")->item(0)->nodeValue);
+	    $aktwert = $this->convertValue($scorecard->getElementsByTagName("Wert")->item(0)->nodeValue);
+	    $niedriger = $this->convertValue($scorecard->getElementsByTagName("NiedrigerWert")->item(0)->nodeValue);
+	    $hoher = $this->convertValue($scorecard->getElementsByTagName("HoherWert")->item(0)->nodeValue);
 	
 	    $delta = $hoher - $niedriger;
 	    if ($scorecard->getElementsByTagName("HoherZielwert")->item(0)->nodeValue == "J") {

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor