<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Web management</title>
<link rel="stylesheet" href="styles.css" type="text/css">
<?php include 'codes.php';?>
</head>
<body text="#000000" style="margin:0">
  <?php
$id = mysql_real_escape_string(stripslashes($_REQUEST['id']));
$room_id = mysql_real_escape_string(stripslashes($_REQUEST['room_id']));
$name = mysql_real_escape_string(stripslashes($_REQUEST['name']));
$name_en = mysql_real_escape_string(stripslashes($_REQUEST['name_en']));
$name_de = mysql_real_escape_string(stripslashes($_REQUEST['name_de']));
$name_fr = mysql_real_escape_string(stripslashes($_REQUEST['name_fr']));
$name_it = mysql_real_escape_string(stripslashes($_REQUEST['name_it']));
$name_es = mysql_real_escape_string(stripslashes($_REQUEST['name_es']));
$name_ru = mysql_real_escape_string(stripslashes($_REQUEST['name_ru']));
$name_zh = mysql_real_escape_string(stripslashes($_REQUEST['name_zh']));
$publish = mysql_real_escape_string(stripslashes($_REQUEST['publish']));	  
$priority = mysql_real_escape_string(stripslashes($_REQUEST['priority']));	  

if  (isset($_POST['submit'])) {
	$sql="UPDATE panoramas SET room_id='$room_id', name='$name', name_en='$name_en', name_de='$name_de', name_fr='$name_fr', name_it='$name_it', name_es='$name_es', name_ru='$name_ru', name_zh='$name_zh', priority='$priority' WHERE id='$id'";
	$result = mysql_query($sql);	
?>


                    <?php 
		 $newid = $id;
        $uploaddir = '../panoramas/'; 
		$uploaddir2 = '../panoramas/scene/';
		$uploadid = $newid; 
		$filetype = '.jpg'; 
		$uploadname = $newid . $filetype; 
		$filetype2 = '.jpe'; 
		$uploadname2 = $newid . $filetype2; 
		

        if (isset($_POST['submit'])){ 
        if( $_FILES['upload']['tmp_name'] != "" ){
		$uploadname2=$uploadname2;
		
       $dest = $uploaddir . $uploadname; 
		$dest2 = $uploaddir2 . $uploadname2;
       if (copy ( $_FILES['upload']['tmp_name'], $dest )){ 
                } 
				 if (@copy($upload2, $dest2)){ 
                } 
 }
?>
<?php } ?> 

<?php
 	$stringData= "<";
	$stringData=$stringData."?xml version=\"1.0\" encoding=\"UTF-8\"";
		$stringData=$stringData."?";
			$stringData=$stringData.">";
	$stringData=$stringData."
	<Root>
  <MainWindow>
    <className>TWMainWindow</className>
     <name>MainWindow</name>
    <bgColor>255,255,255</bgColor>
    <Image>
      <className>TWStillImage</className>
      <name>Image1</name>
      <zOrder>0</zOrder>
      <bounds>0,402,700,18</bounds>
      <sizeMode>fill Size</sizeMode>
      <image />
    </Image>
    <Button>
      <className>TWButton</className>
      <name>Button1</name>
      <zOrder>2</zOrder>
      <bounds>0,402,18,18</bounds>
      <normalImg>images/autoleft1.gif</normalImg>
      <overImg>images/autoleft2.gif</overImg>
      <pressImg>images/autoleft3.gif</pressImg>
      <hint>images/hint_left.jpg</hint>
      <type>normal</type>
      <action>left(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button2</name>
      <zOrder>3</zOrder>
      <bounds>18,402,18,18</bounds>
      <normalImg>images/autoright1.gif</normalImg>
      <overImg>images/autoright2.gif</overImg>
      <pressImg>images/autoright3.gif</pressImg>
      <hint>images/hint_right.jpg</hint>
      <type>normal</type>
      <action>right(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button3</name>
      <zOrder>4</zOrder>
      <bounds>36,402,18,18</bounds>
      <normalImg>images/autoup1.gif</normalImg>
      <overImg>images/autoup2.gif</overImg>
      <pressImg>images/autoup3.gif</pressImg>
      <hint>images/hint_up.jpg</hint>
      <type>normal</type>
      <action>up(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button4</name>
      <zOrder>5</zOrder>
      <bounds>54,402,18,18</bounds>
      <normalImg>images/autodown1.gif</normalImg>
      <overImg>images/autodown2.gif</overImg>
      <pressImg>images/autodown3.gif</pressImg>
      <hint>images/hint_down.jpg</hint>
      <type>normal</type>
      <action>down(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button5</name>
      <zOrder>6</zOrder>
      <bounds>72,402,18,18</bounds>
      <normalImg>images/zoomin1.gif</normalImg>
      <overImg>images/zoomin2.gif</overImg>
      <pressImg>images/zoomin3.gif</pressImg>
      <hint>images/hint_zoomin.jpg</hint>
      <type>normal</type>
      <action>zoomin(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button6</name>
      <zOrder>7</zOrder>
      <bounds>90,402,18,18</bounds>
      <normalImg>images/zoomout1.gif</normalImg>
      <overImg>images/zoomout2.gif</overImg>
      <pressImg>images/zoomout3.gif</pressImg>
      <hint>images/hint_zoomout.jpg</hint>
      <type>normal</type>
      <action>zoomout(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button7</name>
      <zOrder>8</zOrder>
      <bounds>108,402,18,18</bounds>
      <normalImg>images/stop1.gif</normalImg>
      <overImg>images/stop2.gif</overImg>
      <pressImg>images/stop3.gif</pressImg>
      <hint>images/hint_st.jpg</hint>
      <type>normal</type>
      <action>stop()</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button8</name>
      <zOrder>9</zOrder>
      <bounds>126,402,18,18</bounds>
      <normalImg>images/reset1.gif</normalImg>
      <overImg>images/reset2.gif</overImg>
      <pressImg>images/reset3.gif</pressImg>
      <hint>images/hint_reset.jpg</hint>
      <type>normal</type>
      <action>reset()</action>
    </Button>
    <SceneViewer>
      <className>TWSceneViewer</className>
      <name>SceneViewer</name>
      <zOrder>1</zOrder>
      <bgColor>255,255,255</bgColor>
      <bounds>0,0,700,420</bounds>
    </SceneViewer>
  </MainWindow>
  <FullScreenbar>
    <className>TWFullScreenbar</className>
    <name>FSbar</name>
    <bgImg1>images/toolbar.gif</bgImg1>
    <Button>
      <className>TWButton</className>
      <name>Button1</name>
      <zOrder>2</zOrder>
      <bounds>0,0,18,18</bounds>
      <normalImg>images/autoleft1.gif</normalImg>
      <overImg>images/autoleft2.gif</overImg>
      <pressImg>images/autoleft3.gif</pressImg>
      <hint>images/hint_left.jpg</hint>
      <type>normal</type>
      <action>left(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button2</name>
      <zOrder>3</zOrder>
      <bounds>18,0,18,18</bounds>
      <normalImg>images/autoright1.gif</normalImg>
      <overImg>images/autoright2.gif</overImg>
      <pressImg>images/autoright3.gif</pressImg>
      <hint>images/hint_right.jpg</hint>
      <type>normal</type>
      <action>right(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button3</name>
      <zOrder>4</zOrder>
      <bounds>36,0,18,18</bounds>
      <normalImg>images/autoup1.gif</normalImg>
      <overImg>images/autoup2.gif</overImg>
      <pressImg>images/autoup3.gif</pressImg>
      <hint>images/hint_up.jpg</hint>
      <type>normal</type>
      <action>up(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button4</name>
      <zOrder>5</zOrder>
      <bounds>54,0,18,18</bounds>
      <normalImg>images/autodown1.gif</normalImg>
      <overImg>images/autodown2.gif</overImg>
      <pressImg>images/autodown3.gif</pressImg>
      <hint>images/hint_down.jpg</hint>
      <type>normal</type>
      <action>down(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button5</name>
      <zOrder>6</zOrder>
      <bounds>72,0,18,18</bounds>
      <normalImg>images/zoomin1.gif</normalImg>
      <overImg>images/zoomin2.gif</overImg>
      <pressImg>images/zoomin3.gif</pressImg>
      <hint>images/hint_zoomin.jpg</hint>
      <type>normal</type>
      <action>zoomin(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button6</name>
      <zOrder>7</zOrder>
      <bounds>90,0,18,18</bounds>
      <normalImg>images/zoomout1.gif</normalImg>
      <overImg>images/zoomout2.gif</overImg>
      <pressImg>images/zoomout3.gif</pressImg>
      <hint>images/hint_zoomout.jpg</hint>
      <type>normal</type>
      <action>zoomout(String SceneViewer, int 20)</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button7</name>
      <zOrder>8</zOrder>
      <bounds>108,0,18,18</bounds>
      <normalImg>images/stop1.gif</normalImg>
      <overImg>images/stop2.gif</overImg>
      <pressImg>images/stop3.gif</pressImg>
      <hint>images/hint_st.jpg</hint>
      <type>normal</type>
      <action>stop()</action>
    </Button>
    <Button>
      <className>TWButton</className>
      <name>Button8</name>
      <zOrder>9</zOrder>
      <bounds>126,0,18,18</bounds>
      <normalImg>images/reset1.gif</normalImg>
      <overImg>images/reset2.gif</overImg>
      <pressImg>images/reset3.gif</pressImg>
      <hint>images/hint_reset.jpg</hint>
      <type>normal</type>
      <action>reset()</action>
    </Button>
  </FullScreenbar>
  <Scene>
    <className>SceneNode</className>
    <name>".$uploadid."</name>
    <type>Spherical</type>
    <effectType>FadeInFadeOut</effectType>
    <effectTime>2</effectTime>
    <pan>0</pan>
    <tilt>0</tilt>
    <fov>75</fov>
    <panMax>180</panMax>
    <panMin>-180</panMin>
    <tiltMax>90</tiltMax>
    <tiltMin>-90</tiltMin>
    <fovMax>150</fovMax>
    <fovMin>30</fovMin>
    <speed>20</speed>
    <hfov>360</hfov>
    <aboveFov>90</aboveFov>
    <path>/panoramas/scene/".$uploadid.".jpe</path>
  </Scene>
</Root>  ";
  ?>
      <?php
  $ourFileName = "../panoramas/".$uploadid.".txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fwrite($ourFileHandle, $stringData);
fclose($ourFileHandle);


?>
	
<meta http-equiv="refresh" content="0;URL=edit-panorama.php?id=<?php echo $id ?>">
<?php
} else {	
			$result = mysql_query("SELECT * FROM panoramas WHERE id='$id'",$dbh);
			$myrow=mysql_fetch_array($result); 
			$room_id=$myrow['room_id'];
			$id=$myrow['id'];
			$name=$myrow['name'];
			$name_en=$myrow['name_en'];
			$name_de=$myrow['name_de'];
			$name_fr=$myrow['name_fr'];
            $name_it=$myrow['name_it'];
            $name_es=$myrow['name_es'];
            $name_ru=$myrow['name_ru'];
			$name_zh=$myrow['name_zh'];
			$priority=$myrow['priority'];

?>

<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div><img src="img/frame-edit.png" width="180" height="37" alt=""></div>
<div class="frame">
<form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data">
  <input type="hidden" name="id" value="<?php echo $id ?>">
  <table width="100%" border="0" cellspacing="0" cellpadding="4" class="text">
    <tr>
      <td width="20">&nbsp;</td>
      <td width="200">Δωμάτιο </td>
      <td><select name="room_id" class="forms">
        <option value="0">ΚΑΝΕΝΑ</option>
        <?php
			$sql1 = "SELECT * FROM rooms ORDER BY priority";
			$result1 = mysql_query($sql1);
			while ($myrow=mysql_fetch_array($result1)) {
				$roomid=$myrow['id'];
				$room=$myrow['name'];
?>
        <?php
	if ($roomid==$room_id ) {
?>
        <option value="<?php echo $roomid ?>" selected> <?php echo $room ?>
          <?php } else { ?>
          <option value="<?php echo $roomid ?>"> <?php echo $room ?></option>
        <?php 
				}
				}
?>
      </select></td>
    </tr>
     <?php if ($lang1==1) { ?>
    <tr>
      <td width="20"><img src="img/lang1.png" width="16" height="16" alt=""></td> 
      <td width="200">Τίτλος 
        </td>
      <td> 
        <input type="text" name="name" size="100" value="<?php echo $name ?>" class="forms">
        </td>
    </tr>
    <?php } ?>
    <?php if ($lang2==1) { ?>
    <tr>
      <td><img src="img/lang2.png" width="16" height="16" alt=""></td> 
      <td>Τίτλος </td>
      <td> 
        <input type="text" name="name_en" size="100" value="<?php echo $name_en ?>" class="forms">
        </td>
      </tr>
      <?php } ?>
    <?php if ($lang3==1) { ?>
    <tr>
      <td><img src="img/lang3.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="name_de" size="100" value="<?php echo $name_de ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang4==1) { ?>
    <tr>
      <td><img src="img/lang4.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="name_fr" size="100" value="<?php echo $name_fr ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang5==1) { ?>
    <tr>
      <td><img src="img/lang5.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="name_it" size="100" value="<?php echo $name_it ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang6==1) { ?>
    <tr>
      <td><img src="img/lang6.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="name_es" size="100" value="<?php echo $name_es ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <?php if ($lang7==1) { ?>
    <tr>
      <td><img src="img/lang7.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="name_ru" size="100" value="<?php echo $name_ru ?>" class="forms"></td>
    </tr>
      <?php } ?>
     <?php if ($lang8==1) { ?>
    <tr>
      <td><img src="img/lang8.png" width="16" height="16" alt=""></td>
      <td>Τίτλος </td>
      <td><input type="text" name="name_zh" size="100" value="<?php echo $name_zh ?>" class="forms"></td>
    </tr>
      <?php } ?>
    <tr>
      <td>&nbsp;</td> 
      <td>Εικόνα</td>
      <td>
        <input type="hidden" name="max_file_size" value="3000000">
        <input name="upload" type="file" size="50" class="forms">   
        </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>Αρχείο .jpe</td>
      <td><input name="upload2" type="file" size="50" class="forms"></td> 
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>Αριθμός προτεραιότητας</td>
      <td><input type="text" name="priority" size="20" maxlength="11" value="<?php echo $priority ?>" class="forms"></td>
    </tr>
    </table>

  <div align="center" style="padding:5px">
   <input type="submit" name="submit" value="Καταχώρηση" class="button">
        <input type="reset" name="reset" value="Επαναφορά" class="button">  </div>
</form>  
</div>
<div align="right"><a href="all-panoramas.php" class="links">μεταφορά στην Λίστα</a></div></td>
  </tr>
</table><?php include 'menudown.php';?>
<?php } ?>
</body>
</html>
