@@ -39,13 +39,24 @@ function get_first_translation($trans) {
3939
4040$ textid = getreq ('text ' )+0 ;
4141$ editmode = getreq ('edit ' )+0 ;
42+ $ delmode = getreq ('del ' )+0 ;
4243$ ann_exists = ((get_first_value ("select length(TxAnnotatedText) as value from texts where TxID = " . $ textid ) + 0 ) > 0 );
4344
4445if ($ textid ==0 ) {
4546 header ("Location: edit_texts.php " );
4647 exit ();
4748}
4849
50+ if ( $ delmode ) { // Delete
51+ if ( $ ann_exists ) $ dummy = runsql ('update texts set ' .
52+ 'TxAnnotatedText = ' . convert_string_to_sqlsyntax ("" ) . ' where TxID = ' . $ textid , "" );
53+ $ ann_exists = ((get_first_value ("select length(TxAnnotatedText) as value from texts where TxID = " . $ textid ) + 0 ) > 0 );
54+ if ( ! $ ann_exists ) {
55+ header ("Location: print_text.php?text= " . $ textid );
56+ exit ();
57+ }
58+ }
59+
4960$ sql = 'select TxLgID, TxTitle from texts where TxID = ' . $ textid ;
5061$ res = mysql_query ($ sql );
5162if ($ res == FALSE ) die ("Invalid Query: $ sql " );
@@ -81,11 +92,15 @@ function get_first_translation($trans) {
8192if ($ editmode ) {
8293 echo "<input type= \"button \" value= \"Finish Editing and Display/Print... \" onclick= \"location.href='print_impr_text.php?text= " . $ textid . "'; \" /> " ;
8394} else {
84- echo "<input type= \"button \" value= \"Edit Annotations... \" onclick= \"location.href='print_impr_text.php?edit=1&text= " . $ textid . "'; \" /> | " ;
95+ echo "<input type= \"button \" value= \"Edit \" onclick= \"location.href='print_impr_text.php?edit=1&text= " . $ textid . "'; \" /> " ;
96+ echo " | " ;
97+ echo "<input type= \"button \" value= \"Delete \" onclick= \"location.href='print_impr_text.php?del=1&text= " . $ textid . "'; \" /> " ;
98+ echo " | " ;
8599 echo "<input type= \"button \" value= \"Print \" onclick= \"window.print(); \" /> (only the text below the line) " ;
86100}
87101echo "</p></div> <!-- noprint --> " ;
88102
103+
89104if ( $ editmode ) { // Edit Mode
90105
91106 if ( ! $ ann_exists ) { // No Ann., Create...
0 commit comments