| 1 | <? |
|---|
| 2 | require_once( './user_base.php' ); |
|---|
| 3 | require_once( LSK_PATH_ENGINE.'/fckeditor/fckeditor.php'); |
|---|
| 4 | |
|---|
| 5 | $con = new LskDBConnector(); |
|---|
| 6 | $Sections = new LskSections( $con ); |
|---|
| 7 | $Book = new LskGuestbook( $con ); |
|---|
| 8 | $ItemID = $_GET['item_id']; |
|---|
| 9 | $Row=$Book->GetRowInfo($ItemID); |
|---|
| 10 | |
|---|
| 11 | $IS_Comment=(strtolower($_GET['mode'])=='comment'); |
|---|
| 12 | ?> |
|---|
| 13 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|---|
| 14 | <html> |
|---|
| 15 | <head> |
|---|
| 16 | <title>Ãîñòåâàÿ êíèãà</title> |
|---|
| 17 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> |
|---|
| 18 | <link rel=stylesheet type=text/css href="./style.css"> |
|---|
| 19 | </head> |
|---|
| 20 | <script> |
|---|
| 21 | //------------------------------------------------------------------------------ |
|---|
| 22 | function selectOption( element_id, value ) |
|---|
| 23 | { |
|---|
| 24 | var obj = document.getElementById( element_id ); |
|---|
| 25 | |
|---|
| 26 | for (var i=0; i < obj.options.length; i++) |
|---|
| 27 | { |
|---|
| 28 | if (obj.options[i].value == value ) |
|---|
| 29 | obj.options[i].selected = true; |
|---|
| 30 | } |
|---|
| 31 | } |
|---|
| 32 | </script> |
|---|
| 33 | <body bgcolor="#CCCCCC"> |
|---|
| 34 | |
|---|
| 35 | <? |
|---|
| 36 | PrintHeader( 'Ãîñòåâàÿ êíèãà' ); |
|---|
| 37 | ?> |
|---|
| 38 | |
|---|
| 39 | <!---------------------------------------------------------> |
|---|
| 40 | <!-- NAVIGATOR --> |
|---|
| 41 | <!---------------------------------------------------------> |
|---|
| 42 | <? include('./navigator.php'); ?> |
|---|
| 43 | |
|---|
| 44 | <?php |
|---|
| 45 | |
|---|
| 46 | $Pars['visible'] = 0; |
|---|
| 47 | $Pars['name'] = $_POST['NewName']; |
|---|
| 48 | $Pars['mail'] = $_POST['NewMail']; |
|---|
| 49 | $Pars['text'] = $_POST['NewText']; |
|---|
| 50 | $Pars['comment'] = $Row['comment']; |
|---|
| 51 | |
|---|
| 52 | if ( isset($_POST['Add']) ) { |
|---|
| 53 | $Pars['comment'] = 'Êîììåíòàðèé îòñóòñòâóåò.'; |
|---|
| 54 | $Book->Add($Pars); |
|---|
| 55 | } |
|---|
| 56 | elseif ( isset($_POST['Update']) ){ |
|---|
| 57 | $Pars['visible'] = 1; |
|---|
| 58 | if ($IS_Comment) { |
|---|
| 59 | $Pars['text'] = $Row['text']; |
|---|
| 60 | $Pars['comment']= $_POST['NewText']; |
|---|
| 61 | } |
|---|
| 62 | $Book->Update( $ItemID, $Pars); |
|---|
| 63 | echo '<script>location.replace( \'guestbook_edit.php\' )</script>'; |
|---|
| 64 | } |
|---|
| 65 | elseif ( isset($_POST['Delete']) ) $Book->RemoveArray( $_POST['todelete'] ); |
|---|
| 66 | elseif ( isset($_POST['Approve']) ) |
|---|
| 67 | { |
|---|
| 68 | $Book->SetVisibleAll( false ); |
|---|
| 69 | $Book->SetVisibleArray( $_POST['approved'], true ); |
|---|
| 70 | } |
|---|
| 71 | ?> |
|---|
| 72 | |
|---|
| 73 | <!---------------------------------------------------------> |
|---|
| 74 | <!-- SECTIONS --> |
|---|
| 75 | <!---------------------------------------------------------> |
|---|
| 76 | <table align="left" border="1" bordercolor="#000000" bgcolor="#C6D0E9" style="border-collapse:collapse;"> |
|---|
| 77 | <form name="form_link" action="" method="post" enctype="multipart/form-data"> |
|---|
| 78 | <tr><td><strong>Ðàçäåëû (Âèäèìîñòü):</strong> |
|---|
| 79 | <tr><td><? include('./sections.php'); ?> |
|---|
| 80 | </form> |
|---|
| 81 | </table> |
|---|
| 82 | |
|---|
| 83 | <!---------------------------------------------------------> |
|---|
| 84 | <!-- WORK --> |
|---|
| 85 | <!---------------------------------------------------------> |
|---|
| 86 | <table align="center" border="1" bordercolor="#000000" bgcolor="#C6D0E9" > |
|---|
| 87 | <form name="form_spots" action="" method="post" enctype="multipart/form-data"> |
|---|
| 88 | <tr> |
|---|
| 89 | <td> |
|---|
| 90 | <table width="600"> |
|---|
| 91 | <? |
|---|
| 92 | $Template = ' |
|---|
| 93 | <tr><th align="left" width="50%">Ñîîáùåíèe îò <i>$_name</i> ( $_mail )<th align="left" width="50%">Êîììåíòàðèé: |
|---|
| 94 | <tr><td colspan="2"><table border="0" width="100%"><tr><td width="50%">$_text<td>$_comment</table> |
|---|
| 95 | <tr><td><input type="button" onclick="location.replace( \'guestbook_edit.php?mode=Correct&item_id=$_id\' )" value="Ðåäàêòèðîâàòü"> |
|---|
| 96 | <input type="button" onclick="location.replace( \'guestbook_edit.php?mode=Comment&item_id=$_id\' )" value="Êîììåíòèðîâàòü"> |
|---|
| 97 | <td align="right">Óäàëèòü<input name="todelete[]" value="$_id" type="checkbox"><br>Ðàçðåøèòü<input name="approved[]" value="$_id" type="checkbox" $_cvisible>'; |
|---|
| 98 | $Book->PrintAllTemplate( $Template, true ); |
|---|
| 99 | ?> |
|---|
| 100 | <tr><td colspan="2" align="left"><hr> |
|---|
| 101 | Èìÿ: <input type="text" name="NewName" align="left" value="<?=$Row['name']?>"><br> |
|---|
| 102 | Àäðåñ:<input type="text" align="left" name="NewMail" value="<?=$Row['mail']?>"> |
|---|
| 103 | <input type="submit" name="Approve" value="Ðàçðåøèòü îòìå÷åííûå"> |
|---|
| 104 | <input type="submit" name="Delete" onclick=<?=_CONFIRM?> value="Óäàëèòü îòìå÷åííûå"> |
|---|
| 105 | |
|---|
| 106 | <tr><td colspan="2"> |
|---|
| 107 | <? |
|---|
| 108 | $oFCKeditor = new FCKeditor( 'NewText' ); |
|---|
| 109 | $oFCKeditor->BasePath = '../lsk_engine/fckeditor/'; |
|---|
| 110 | $oFCKeditor->Value = $IS_Comment?$Row['comment']:$Row['text']; |
|---|
| 111 | $oFCKeditor->ToolbarSet = 'lskNewsToolbar'; |
|---|
| 112 | $oFCKeditor->Width = '100%'; |
|---|
| 113 | $oFCKeditor->Height = '200'; |
|---|
| 114 | $oFCKeditor->Create(); |
|---|
| 115 | |
|---|
| 116 | $SubmitName=isset($_GET['item_id'])?'Update':'Add'; |
|---|
| 117 | ?> |
|---|
| 118 | <input type="hidden" name="mode_t" id="_mode_t" value="<?=$_GET['mode']?>"> |
|---|
| 119 | <tr><td><input type="submit" name="<?=$SubmitName?>" value="<?=isset($_GET['item_id'])?'Èçìåíèòü':'Äîáàâèòü'; ?>"> |
|---|
| 120 | <td> |
|---|
| 121 | </table> |
|---|
| 122 | </form> |
|---|
| 123 | </table> |
|---|
| 124 | </body> |
|---|
| 125 | </html> |
|---|