1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
<?php session_start(); include ("function_import_request.php"); echo"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>"; echo"<link href='coremain/ccs/style.php' rel='stylesheet' type='text/css'>"; import_request_variables('pG', 'p_'); //#5.3#//if($p_folder_name!="") { $folder_name=trim($p_folder_name); } $folder_name = isset($p_folder_name) ? $p_folder_name : ''; //#5.3#//if($_SESSION[folder_name]=="") { $_SESSION[folder_name]=$folder_name; } $_SESSION['folder_name'] = $folder_name; //#5.3#//if($p_add_menu!="") { $add_menu=trim($p_add_menu); } $add_menu = isset($p_add_menu) ? $p_add_menu : ''; //#5.3#//if($p_name!="") { $name=trim($p_name); } $name = isset($p_name) ? $p_name : ''; //#5.3#//if($p_namemenu!="") { $namemenu=trim($p_namemenu); } $namemenu = isset($p_namemenu) ? $p_namemenu : ''; //#5.3#//if($p_type_module!="") { $type_module=trim($p_type_module); } $type_module = isset($p_type_module) ? $p_type_module : ''; //#5.3#//if($p_left_right!="") { $left_right=trim($p_left_right); } $left_right = isset($p_left_right) ? $p_left_right : ''; //#5.3#//if($p_theme_!="") { $theme_=trim($p_theme_); } $theme_ = isset($p_theme_) ? $p_theme_ : ''; $_SESSION['themes_'] = $_SESSION['themes_'] == '' ? $theme_ : $_SESSION['themes_']; //#5.3#//if($p_id_modules!="") { $id_modules=trim($p_id_modules); } $id_modules = isset($p_id_modules) ? $p_id_modules : ''; //#5.3#//if($p_id_graph!="") { $id_graph=trim($p_id_graph); } $id_graph = isset($p_id_graph) ? $p_id_graph : ''; //#5.3#//if($p_web_name!="") { $web_name=trim($p_web_name); $_SESSION[web_name]=$web_name; } $web_name = isset($p_web_name) ? $p_web_name : ''; //#5.3#//if($p_name_select!="") { $name_select=trim($p_name_select); } $name_select = isset($p_name_select) ? $p_name_select : '';
//#5.3#//if($_SESSION[themes_]=="") $_SESSION[themes_]=$theme_; include("../coremain/connec_out.php"); include("function_form.php"); include("function_msg.php"); include("function_sql_query.php"); echo "<title>เพิ่ม Blog</title>";
if($id_modules=="" and $add_menu=="" and $name_select=="") { $id_modules=1; }
//if($name_select!="" and $add_menu!="") { // $x=explode("&",$name_select); // $cc=explode("=",$x[0]); // $id_modules=$cc[1]."<br>"; // // $xx=explode("=",$x[1]); // $type_module=$xx[1]; // // $yy=explode("=",$x[2]); // $left_right=$yy[1]; //}
if($namemenu!=""){ $theme=$namemenu;
// Max id include("../$_SESSION[web_name]/connect.php"); $sql="select max(id_top+1) from cms_menu_top";
$result=mysql_query($sql); $data=mysql_fetch_row($result); // Max Position $sql="select max(`position`+1) from cms_menu_top"; $result=mysql_query($sql); $data1=mysql_fetch_row($result); $sql = "INSERT INTO cms_menu_top (id_top,name,position,left_right,`status`,`lock`,module_type,permission)values('$data[0]','$theme','$data1[0]','$left_right','1',1,'$type_module',0)"; $result = mysql_query($sql) or die(mysql_error()); }
if($add_menu==1){ ?> <script language="JavaScript"> // window.opener.location.href='../index.php'; // window.close(); $('#dialog-popup').dialog('close'); </script> <?php }
// Find type of main module $sql_main_module = "SELECT * FROM cms_main_module WHERE status=1"; $res_main_module = mysql_query ($sql_main_module); ?> <fieldset><center> <form name="fm_add_blog"> <!--<FORM METHOD=POST ACTION='header_addblog.php?id_top=$id_top&left_right=$left_right;' name='add' onSubmit='return checkadd()'>";--> <table align=center> <tr> <td><img src='coremain/images/marker.gif'> Blog หลัก (จะสร้างกรอบหลักในระบบ) : </td> <td> <select name='name_select' style='width:200' class="sl_name_select"><!-- onchange=change_link(this.value);>--> <option value="5" <?= $id_modules==5 ? "selected" : '' ?>>ใส่ Code Freed RSS</option> <option value="4" <?= $id_modules==4 ? "selected" : '' ?>>สาส์นจากผู้บริหาร</option> <option value="3" <?= $id_modules==3 ? "selected" : '' ?>>ลิงค์แสดงรูปใน Blog</option> <option value="2" <?= $id_modules==2 ? "selected" : '' ?>>สถานที่ท่องเที่ยว / OTOP</option> <option value="1" <?= $id_modules==1 ? "selected" : '' ?>>เมนูย่อย</option> </select> </td> </tr> <tr height='40'> <td colspan=2><img src='coremain/images/marker.gif'> เลือกข้อความเมนูตามประเภทที่เพิ่ม</td> </tr> <tr> <td colspan=2> <?php include("../coremain/connec_out.php"); ?> <table width=98% border=0 align=center cellpadding=1 cellspacing=1> <tr> <td>ชื่อเมนู</td> <td colspan="2"><input type="text" name="namemenu" size="30" value="" /></td> </tr> <?php /*$s="SELECT * FROM cms_graphic WHERE id_module='$id_modules' order by id_graphic"; $r=mysql_query($s); $count=0; while($da=mysql_fetch_array($r)){ if(file_exists('images/menu/'. $_SESSION['themes_'] .'/1/'. $da['name'])){ $mots=$count%3; if($mots==0){ ?> <tr height='50'> <td width='33%'> <img src='coremain/images/menu/<?= $_SESSION['themes_'] ?>/1/<?= $da['name'] ?>'> <br/> <input name='namemenu' type='radio' value='<?= $da['name'] ?>'> <br><br> </td> <?php }else if($mots==1){ ?> <td width='33%'> <img src='coremain/images/menu/<?= $_SESSION['themes_'] ?>/1/<?= $da['name'] ?>'> <br> <input name='namemenu' type='radio' value='<?= $da['name'] ?>'> <br><br> </td> <?php }else if($mots==2){ ?> <td width='33%'> <img src='coremain/images/menu/<?= $_SESSION['themes_'] ?>/1/<?= $da['name'] ?>'> <br> <input name='namemenu' type='radio' value='<?= $da['name'] ?>'> <br><br> </td> </tr> <?php } $count++; } }*/ ?> </table> </td> </tr> <tr height='10'> <td colspan=2 align='center'> <!--<INPUT TYPE='submit' value='เพิ่ม Blog' onmouseover=this.style.cursor='hand'>--> <!--<INPUT TYPE='hidden' name='add_menu' value='1'>--> <button type="button" class="ui-button ui-widget ui-corner-all" id="btn_addblog">เพิ่ม Blog</button> </td> </tr> </table> </form> </center></fieldset>
<script language="javascript"> function checkadd() { if(document.fm_add_blog.namemenu.value=="") { alert("กรุณาเลือก Blog !") ; document.fm_add_blog.namemenu.focus() ; return false ; }else return true ; }
var arr_select = { '1' : 'link', '2' : 'picture', '3' : 'sponser', '4' : 'boss_message', '5' : 'code', }; $('.sl_name_select').change(function(){ var name_select = $(this).val(); var arrData = [ { name: 'id_modules', value: name_select }, { name: 'type_module', value: arr_select[name_select] }, { name: 'left_right', value: '<?= $left_right ?>' } ]; header_addblog(arrData); }); $('#btn_addblog') .button() .click(function(){ if(checkadd()){ var name_select = $('select[name=name_select]').val(); var arrData = [ { name: 'id_modules', value: name_select }, { name: 'type_module', value: arr_select[name_select] }, { name: 'namemenu', value: $('input[name=namemenu]').val() },//{ name: 'namemenu', value: $('input[name=namemenu]:checked').val() }, { name: 'left_right', value: '<?= $left_right ?>' }, { name: 'add_menu', value: '1' } ]; header_addblog(arrData); } }); function header_addblog(arrData){ $.ajax({ type: 'post', url: 'coremain/header_addblog.php', data: arrData, success: function(result){ $('#dialog-popup').html(result); } }); } //header_addblog.php?id_top=$id_top&left_right=$left_right // function change_link(clink){ // window.location = clink; // } </script>
|