- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / fotolab / fotos-preview.php
bloba120af79f63e10987e30df93b48c58885fd4aaa6
1 <?php
2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
5 /**
6 * CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005 Elpidio Latorilla
9 * elpidio@care2x.org,
11 * See the file "copy_notice.txt" for the licence notice
15 # Define here the width of the preview image
17 define('PREVIEW_SIZE',400);
20 # The ImageJ applet control panel height
21 # Microsoft = ~100
22 # Linux = ~90
24 define('IMAGEJ_PANEL_HEIGHT', 100);
26 # The ImageJ applet control panel height
28 define('IMAGEJ_PANEL_WIDTH_MIN', 250);
30 $lang_tables=array('images.php');
31 define('LANG_FILE','nursing.php');
32 define('NO_2LEVEL_CHK',1);
33 require_once($root_path.'include/inc_front_chain_lang.php');
34 require($root_path.'global_conf/inc_remoteservers_conf.php');
35 /* Load date formatter */
36 include_once($root_path.'include/inc_date_format_functions.php');
38 if($disc_pix_mode){
39 $final_path="$root_path$fotoserver_localpath$pn/";
40 }else{
41 $final_path="$fotoserver_http$pn/";
43 if(isset($pn)&&$pn){
44 /* Create image object */
45 include_once($root_path.'include/care_api_classes/class_image.php');
46 $img_obj=new Image();
47 //$db->debug=true;
48 if(isset($mode)&&$mode=='save'){
50 //$HTTP_POST_VARS['history']="CONCAT(history,'Notes ".date('Y-m-d H:i:s')." ".$HTTP_SESSION_VARS['sess_user_name']."\n')";
51 $HTTP_POST_VARS['history']=$img_obj->ConcatHistory("Notes ".date('Y-m-d H:i:s')." ".$HTTP_SESSION_VARS['sess_user_name']."\n");
52 $HTTP_POST_VARS['modify_id']=$HTTP_SESSION_VARS['sess_user_name'];
53 $HTTP_POST_VARS['modify_time']=date('YmdHis');
54 //$img_obj->setDataArray($HTTP_POST_VARS);
55 if($img_obj->updateImageNotes($HTTP_POST_VARS)){
56 header('Location:'.basename(__FILE__).URL_REDIRECT_APPEND.'&pn='.$pn.'&nr='.$nr.'&bShowImageJApplet='.$bShowImageJApplet);
57 exit;
61 if($img_data=$img_obj->getImageData($nr)){
62 $image=$img_data->FetchRow();
63 $sImgFileName = $image['nr'].'.'.$image['mime_type'];
64 $picsource=$final_path.$sImgFileName;
69 <?php html_rtl($lang); ?>
70 <head>
71 <script language="javascript">
72 <!--
74 function check(d) {
75 if(d.notes.value=="") return false;
76 else return true;
78 //-->
79 </script>
80 <?php echo setCharSet(); ?>
81 </head>
82 <body topmargin=0 marginheight=0>
83 <form name="picnotes" method="post" onSubmit="return check(this)">
84 <?php //echo $LDPreview ?>
85 <?php
87 if(file_exists($picsource)){
89 # If java applet class exists, show link
91 if(file_exists($root_path.'modules/fotolab/IJBasicViewer.class') && file_exists($root_path.'modules/fotolab/ij.jar')){
92 echo '<font face=arial><a href="'.basename(__FILE__).URL_APPEND.'&pn='.$pn.'&nr='.$nr.'&bShowImageJApplet='.(!$bShowImageJApplet).'">';
93 if($bShowImageJApplet) echo $LDHideJavaApplet;
94 else echo $LDShowJavaApplet;
95 echo '</a>&nbsp;</font>';
98 # If ImageJ applet class exists, show link
100 if(file_exists($root_path.'modules/fotolab/IJApplet.class') && file_exists($root_path.'modules/fotolab/ij.jar')){
101 echo '<font face=arial>
102 <a href="ijapplet_launcher.php'.URL_APPEND.'&pn='.$pn.'&img='.$sImgFileName.'&bShowImageJApplet='.(!$bShowImageJApplet).'">'.$LDEditWithImageJ.'</a>
103 </font>';
107 <table border=0 cellspacing=0 cellpadding=0>
108 <tr>
109 <td><font size=2 face=arial color=maroon><?php echo $LDShotDate ?>:
110 </td>
111 <td><font size=2 face=arial><?php echo formatDate2Local($image['shot_date'],$date_format); ?></td>
112 </tr>
113 <tr>
114 <td><font size=2 face=arial color=maroon><?php echo $LDShotNr ?>:</td>
115 <td><font size=2 face=arial><?php echo $image['shot_nr'] ?></td>
116 </tr>
117 </table>
118 <?php
119 if(!isset($preview_size)) $preview_size=0;
121 list($w,$h,$t,$wh)=getImageSize($picsource); // get the size of the image
123 if(isset($bShowImageJApplet) && $bShowImageJApplet){
125 # Set appletĀ“s dimensions
127 $iAppletHeight=$h + IMAGEJ_PANEL_HEIGHT;
129 if($w < IMAGEJ_PANEL_WIDTH_MIN ) $iAppletWidth = IMAGEJ_PANEL_WIDTH_MIN;
130 else $iAppletWidth = $w;
132 echo '<applet codebase="." code="ij.ImageJApplet.class" archive="ij.jar" width='.$iAppletWidth.' height='.$iAppletHeight.'>
133 <param name=url value='.$picsource.'>
134 </applet>';
135 }else{
137 if(PREVIEW_SIZE<$w){
138 $toggle_pic=true;
139 if($preview_size) $preview_size=0;
140 else $preview_size=PREVIEW_SIZE;
141 }else{
142 $toggle_pic=false;
143 $preview_size=$w;
146 if($toggle_pic) echo '<a href="'.basename(__FILE__).URL_APPEND.'&pn='.$pn.'&nr='.$nr.'&preview_size='.$preview_size.'">';
148 if($t==1){
152 <img src="<?php echo $picsource; ?>" <?php if($preview_size) echo 'width="'.$preview_size.'"'; else echo $wh; ?> border=0 name="preview"
153 <?php
155 }elseif(($toggle_pic&&!$preview_size)||(!$toggle_pic&&$preview_size)){
157 <img src="<?php echo $picsource; ?>" <?php if($preview_size) echo 'width="'.$preview_size.'"'; else echo $wh; ?> border=0 name="preview"
158 <?php
159 }else{
161 <img src="<?php echo $root_path.'main/imgcreator/thumbnail.php?mx='.$preview_size.'&my='.$preview_size.'&imgfile=/'.$fotoserver_localpath.$pn.'/'.$image['nr'].'.'.$image['mime_type'] ?>" border=0 name="preview"
162 <?php
165 if($toggle_pic){
167 alt="<?php if($preview_size) echo $LDTogglePreviewOrig; else echo $LDToggleOrigPreview; ?>"
168 title="<?php if($preview_size) echo $LDTogglePreviewOrig; else echo $LDToggleOrigPreview; ?>"
169 <?php
172 <?php
173 if($toggle_pic) echo '</a>';
176 <br>
177 <?php
178 if(!empty($image['notes'])){
179 $notes=str_replace('[[','<font size=1 color="#abcdef">',htmlspecialchars($image['notes']));
180 $notes=str_replace(']]','</font>',$notes);
182 <table border=0 width="100%" cellspacing=0 cellpadding=1 bgcolor="#abcdef">
183 <tr>
184 <td>
185 <table border=0 width="100%" cellspacing=0 cellpadding=5 bgcolor="#ffffff">
186 <tr>
187 <td><font size=2 face="arial,verdana,helvetica">
188 <?php echo nl2br($notes); ?>
189 </td>
190 </tr>
191 </table>
192 </td>
193 </tr>
194 </table>
195 <?php
198 <textarea name="notes" cols=40 rows=4 wrap="physical"></textarea><br>
199 <input type="hidden" name="pn" value="<?php echo $pn ?>">
200 <input type="hidden" name="nr" value="<?php echo $nr ?>">
201 <input type="hidden" name="sid" value="<?php echo $sid ?>">
202 <input type="hidden" name="lang" value="<?php echo $lang ?>">
203 <input type="hidden" name="bShowImageJApplet" value="<?php echo $bShowImageJApplet ?>">
204 <input type="hidden" name="preview_size" value="<?php if(isset($preview_size)) echo $preview_size ?>">
205 <input type="hidden" name="mode" value="save">
206 <input type="image" <?php echo createLDImgSrc($root_path,'savedisc.gif','0'); ?>>
207 <?php
210 </form>
211 </body>
212 </html>