1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of myGmaps, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2010 Philippe aka amalgame |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | |
---|
13 | require_once DC_ROOT.'/inc/admin/prepend.php'; |
---|
14 | |
---|
15 | dcPage::check('usage,contentadmin'); |
---|
16 | |
---|
17 | global $core; |
---|
18 | |
---|
19 | $p_url = 'plugin.php?p='.basename(dirname(__FILE__)); |
---|
20 | $default_tab = isset($_GET['tab']) ? $_GET['tab'] : 'entries-list'; |
---|
21 | |
---|
22 | $s =& $core->blog->settings->myGmaps; |
---|
23 | |
---|
24 | $myGmaps_center = $s->myGmaps_center; |
---|
25 | $myGmaps_zoom = $s->myGmaps_zoom; |
---|
26 | $myGmaps_type = $s->myGmaps_type; |
---|
27 | |
---|
28 | $page_title = __('Add a map to entry'); |
---|
29 | |
---|
30 | # Getting categories |
---|
31 | try { |
---|
32 | $categories = $core->blog->getCategories(array('post_type'=>'map')); |
---|
33 | } catch (Exception $e) { |
---|
34 | $core->error->add($e->getMessage()); |
---|
35 | } |
---|
36 | |
---|
37 | # Getting authors |
---|
38 | try { |
---|
39 | $users = $core->blog->getPostsUsers(); |
---|
40 | } catch (Exception $e) { |
---|
41 | $core->error->add($e->getMessage()); |
---|
42 | } |
---|
43 | |
---|
44 | # Getting dates |
---|
45 | try { |
---|
46 | $dates = $core->blog->getDates(array('type'=>'month','post_type'=>'map')); |
---|
47 | } catch (Exception $e) { |
---|
48 | $core->error->add($e->getMessage()); |
---|
49 | } |
---|
50 | |
---|
51 | # Creating filter combo boxes |
---|
52 | if (!$core->error->flag()) |
---|
53 | { |
---|
54 | # Filter form we'll put in html_block |
---|
55 | $users_combo = $categories_combo = array(); |
---|
56 | $users_combo['-'] = $categories_combo['-'] = ''; |
---|
57 | while ($users->fetch()) |
---|
58 | { |
---|
59 | $user_cn = dcUtils::getUserCN($users->user_id,$users->user_name, |
---|
60 | $users->user_firstname,$users->user_displayname); |
---|
61 | |
---|
62 | if ($user_cn != $users->user_id) { |
---|
63 | $user_cn .= ' ('.$users->user_id.')'; |
---|
64 | } |
---|
65 | |
---|
66 | $users_combo[$user_cn] = $users->user_id; |
---|
67 | } |
---|
68 | |
---|
69 | $categories_combo[__('None')] = 'NULL'; |
---|
70 | while ($categories->fetch()) { |
---|
71 | $categories_combo[str_repeat(' ',$categories->level-1).'• '. |
---|
72 | html::escapeHTML($categories->cat_title). |
---|
73 | ' ('.$categories->nb_post.')'] = $categories->cat_id; |
---|
74 | } |
---|
75 | |
---|
76 | $status_combo = array( |
---|
77 | '-' => '', |
---|
78 | __('pending') => '-2', |
---|
79 | __('online') => '1' |
---|
80 | ); |
---|
81 | |
---|
82 | $post_maps_combo = array( |
---|
83 | '-' => '', |
---|
84 | __('none') => 'none', |
---|
85 | __('point of interest') => 'point of interest', |
---|
86 | __('polyline') => 'polyline', |
---|
87 | __('included kml file') => 'included kml file' |
---|
88 | ); |
---|
89 | |
---|
90 | # Months array |
---|
91 | $dt_m_combo['-'] = ''; |
---|
92 | while ($dates->fetch()) { |
---|
93 | $dt_m_combo[dt::str('%B %Y',$dates->ts())] = $dates->year().$dates->month(); |
---|
94 | } |
---|
95 | |
---|
96 | $sortby_combo = array( |
---|
97 | __('Date') => 'post_dt', |
---|
98 | __('Title') => 'post_title', |
---|
99 | __('Category') => 'cat_title', |
---|
100 | __('Author') => 'user_id', |
---|
101 | __('Status') => 'post_status' |
---|
102 | ); |
---|
103 | |
---|
104 | $order_combo = array( |
---|
105 | __('Descending') => 'desc', |
---|
106 | __('Ascending') => 'asc' |
---|
107 | ); |
---|
108 | } |
---|
109 | |
---|
110 | # Actions combo box |
---|
111 | $combo_action = array(); |
---|
112 | if ($core->auth->check('publish,contentadmin',$core->blog->id)) |
---|
113 | { |
---|
114 | $combo_action[__('Status')] = array( |
---|
115 | __('Publish') => 'publish', |
---|
116 | __('Mark as pending') => 'pending' |
---|
117 | ); |
---|
118 | } |
---|
119 | |
---|
120 | $combo_action[__('Change')] = array(__('Change category') => 'category'); |
---|
121 | if ($core->auth->check('admin',$core->blog->id)) |
---|
122 | { |
---|
123 | $combo_action[__('Change')] = array_merge($combo_action[__('Change')], |
---|
124 | array(__('Change author') => 'author')); |
---|
125 | } |
---|
126 | if ($core->auth->check('delete,contentadmin',$core->blog->id)) |
---|
127 | { |
---|
128 | $combo_action[__('Delete')] = array(__('Delete') => 'delete'); |
---|
129 | } |
---|
130 | |
---|
131 | /* Get posts |
---|
132 | -------------------------------------------------------- */ |
---|
133 | |
---|
134 | $post_id = !empty($_GET['post_id']) ? $_GET['post_id'] : ''; |
---|
135 | $user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : ''; |
---|
136 | $cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : ''; |
---|
137 | $status = isset($_GET['status']) ? $_GET['status'] : ''; |
---|
138 | $month = !empty($_GET['month']) ? $_GET['month'] : ''; |
---|
139 | $post_maps = !empty($_GET['post_maps']) ? $_GET['post_maps'] : ''; |
---|
140 | $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'post_dt'; |
---|
141 | $order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; |
---|
142 | |
---|
143 | $show_filters = false; |
---|
144 | |
---|
145 | $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; |
---|
146 | $nb_per_page = 30; |
---|
147 | |
---|
148 | if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { |
---|
149 | if ($nb_per_page != $_GET['nb']) { |
---|
150 | $show_filters = true; |
---|
151 | } |
---|
152 | $nb_per_page = (integer) $_GET['nb']; |
---|
153 | } |
---|
154 | |
---|
155 | if ($post_id != '') { |
---|
156 | $meta =& $GLOBALS['core']->meta; |
---|
157 | $my_params['post_id'] = $_GET['post_id']; |
---|
158 | $my_params['no_content'] = true; |
---|
159 | |
---|
160 | $rs = $core->blog->getPosts($my_params); |
---|
161 | while ($rs->fetch()) { |
---|
162 | $my_post_maps = $meta->getMetaStr($rs->post_meta,'map'); |
---|
163 | } |
---|
164 | $my_post_maps_options = $meta->getMetaStr($rs->post_meta,'map_options'); |
---|
165 | |
---|
166 | if ($my_post_maps_options) { |
---|
167 | $map_options = explode(",",$my_post_maps_options); |
---|
168 | $myGmaps_center = $map_options[0].','.$map_options[1]; |
---|
169 | $myGmaps_zoom = $map_options[2]; |
---|
170 | $myGmaps_type = $map_options[3]; |
---|
171 | } |
---|
172 | |
---|
173 | if ($my_post_maps !='') { |
---|
174 | $maps_array = explode(",",$my_post_maps); |
---|
175 | $has_map = true; |
---|
176 | $page_title = __('Edit map'); |
---|
177 | } |
---|
178 | } |
---|
179 | |
---|
180 | $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); |
---|
181 | $params['no_content'] = true; |
---|
182 | $params['post_type'] = 'map'; |
---|
183 | $params['post_status'] = '1'; |
---|
184 | |
---|
185 | # - User filter |
---|
186 | if ($user_id !== '' && in_array($user_id,$users_combo)) { |
---|
187 | $params['user_id'] = $user_id; |
---|
188 | $show_filters = true; |
---|
189 | } |
---|
190 | |
---|
191 | # - Categories filter |
---|
192 | if ($cat_id !== '' && in_array($cat_id,$categories_combo)) { |
---|
193 | $params['cat_id'] = $cat_id; |
---|
194 | $show_filters = true; |
---|
195 | } |
---|
196 | |
---|
197 | # - Month filter |
---|
198 | if ($month !== '' && in_array($month,$dt_m_combo)) { |
---|
199 | $params['post_month'] = substr($month,4,2); |
---|
200 | $params['post_year'] = substr($month,0,4); |
---|
201 | $show_filters = true; |
---|
202 | } |
---|
203 | |
---|
204 | # - Map type filter |
---|
205 | if ($post_maps != '' && in_array($post_maps,$post_maps_combo)) { |
---|
206 | $params['sql'] .= "AND post_meta LIKE '%".$post_maps."%' "; |
---|
207 | $show_filters = true; |
---|
208 | } |
---|
209 | |
---|
210 | # - Sortby and order filter |
---|
211 | if ($sortby !== '' && in_array($sortby,$sortby_combo)) { |
---|
212 | if ($order !== '' && in_array($order,$order_combo)) { |
---|
213 | $params['order'] = $sortby.' '.$order; |
---|
214 | } |
---|
215 | |
---|
216 | if ($sortby != 'post_dt' || $order != 'desc') { |
---|
217 | $show_filters = true; |
---|
218 | } |
---|
219 | } |
---|
220 | /* Pager class |
---|
221 | -------------------------------------------------------- */ |
---|
222 | class adminGmapList extends adminGenericList |
---|
223 | { |
---|
224 | public function display($page,$nb_per_page,$enclose_block='') |
---|
225 | { |
---|
226 | if ($this->rs->isEmpty()) |
---|
227 | { |
---|
228 | echo '<p><strong>'.__('No element').'</strong></p>'; |
---|
229 | } |
---|
230 | else |
---|
231 | { |
---|
232 | $pager = new pager($page,$this->rs_count,$nb_per_page,10); |
---|
233 | $pager->html_prev = $this->html_prev; |
---|
234 | $pager->html_next = $this->html_next; |
---|
235 | $pager->var_page = 'page'; |
---|
236 | |
---|
237 | $html_block = |
---|
238 | '<table class="clear"><tr>'. |
---|
239 | '<th colspan="2">'.__('Title').'</th>'. |
---|
240 | '<th>'.__('Date').'</th>'. |
---|
241 | '<th>'.__('Category').'</th>'. |
---|
242 | '<th>'.__('Author').'</th>'. |
---|
243 | '<th class="nowrap">'.__('Map element type').'</th>'. |
---|
244 | '</tr>%s</table>'; |
---|
245 | |
---|
246 | if ($enclose_block) { |
---|
247 | $html_block = sprintf($enclose_block,$html_block); |
---|
248 | } |
---|
249 | |
---|
250 | echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
---|
251 | |
---|
252 | $blocks = explode('%s',$html_block); |
---|
253 | |
---|
254 | echo $blocks[0]; |
---|
255 | |
---|
256 | global $core; |
---|
257 | $meta =& $GLOBALS['core']->meta; |
---|
258 | $my_params['post_id'] = $_GET['post_id']; |
---|
259 | $my_params['no_content'] = true; |
---|
260 | |
---|
261 | $rs = $core->blog->getPosts($my_params); |
---|
262 | while ($rs->fetch()) { |
---|
263 | $my_post_maps = $meta->getMetaStr($rs->post_meta,'map'); |
---|
264 | } |
---|
265 | if ($my_post_maps !='') { |
---|
266 | $maps_array = explode(",",$my_post_maps); |
---|
267 | } |
---|
268 | |
---|
269 | while ($this->rs->fetch()) |
---|
270 | { |
---|
271 | if (!isset($maps_array) || !in_array($this->rs->post_id,$maps_array)) { |
---|
272 | echo $this->postLine(); |
---|
273 | } |
---|
274 | } |
---|
275 | |
---|
276 | echo $blocks[1]; |
---|
277 | |
---|
278 | echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
---|
279 | } |
---|
280 | } |
---|
281 | |
---|
282 | private function postLine() |
---|
283 | { |
---|
284 | if ($this->core->auth->check('categories',$this->core->blog->id)) { |
---|
285 | $cat_link = '<a href="category.php?id=%s">%s</a>'; |
---|
286 | } else { |
---|
287 | $cat_link = '%2$s'; |
---|
288 | } |
---|
289 | $p_url = 'plugin.php?p='.basename(dirname(__FILE__)); |
---|
290 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
291 | switch ($this->rs->post_status) { |
---|
292 | case 1: |
---|
293 | $img_status = sprintf($img,__('published'),'check-on.png'); |
---|
294 | break; |
---|
295 | case -2: |
---|
296 | $img_status = sprintf($img,__('pending'),'check-wrn.png'); |
---|
297 | break; |
---|
298 | } |
---|
299 | if ($this->rs->cat_title) { |
---|
300 | $cat_title = sprintf($cat_link,$this->rs->cat_id, |
---|
301 | html::escapeHTML($this->rs->cat_title)); |
---|
302 | } else { |
---|
303 | $cat_title = __('None'); |
---|
304 | } |
---|
305 | |
---|
306 | $res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'. |
---|
307 | ' id="p'.$this->rs->post_id.'">'; |
---|
308 | |
---|
309 | $meta =& $GLOBALS['core']->meta; |
---|
310 | $meta_rs = $meta->getMetaStr($this->rs->post_meta,'map'); |
---|
311 | |
---|
312 | $res .= |
---|
313 | '<td class="nowrap">'. |
---|
314 | form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable()).'</td>'. |
---|
315 | '<td class="maximal"><a href="plugin.php?p=myGmaps&do=edit&id='.$this->rs->post_id.'" title="'.__('Edit map element').' : '.html::escapeHTML($this->rs->post_title).'">'.html::escapeHTML($this->rs->post_title).'</a></td>'. |
---|
316 | '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. |
---|
317 | '<td class="nowrap">'.$cat_title.'</td>'. |
---|
318 | '<td class="nowrap">'.$this->rs->user_id.'</td>'. |
---|
319 | '<td class="nowrap">'.__($meta_rs).'</td>'. |
---|
320 | '</tr>'; |
---|
321 | |
---|
322 | return $res; |
---|
323 | } |
---|
324 | } |
---|
325 | |
---|
326 | # Get posts |
---|
327 | try { |
---|
328 | $posts = $core->blog->getPosts($params); |
---|
329 | $counter = $core->blog->getPosts($params,true); |
---|
330 | $post_list = new adminGmapList($core,$posts,$counter->f(0)); |
---|
331 | } catch (Exception $e) { |
---|
332 | $core->error->add($e->getMessage()); |
---|
333 | } |
---|
334 | |
---|
335 | # Save activation |
---|
336 | |
---|
337 | if (isset($_POST['addmap'])) { |
---|
338 | try { |
---|
339 | $entries = $_POST['entries']; |
---|
340 | $post_id = $_POST['post_id']; |
---|
341 | $myGmaps_center = $_POST['myGmaps_center']; |
---|
342 | $myGmaps_zoom = $_POST['myGmaps_zoom']; |
---|
343 | $myGmaps_type = $_POST['myGmaps_type']; |
---|
344 | $meta =& $GLOBALS['core']->meta; |
---|
345 | $meta->delPostMeta($post_id,'map'); |
---|
346 | $meta->delPostMeta($post_id,'map_options'); |
---|
347 | |
---|
348 | $entries = implode(',',$entries); |
---|
349 | foreach ($meta->splitMetaValues($entries) as $tag) { |
---|
350 | $meta->setPostMeta($post_id,'map',$tag); |
---|
351 | } |
---|
352 | $map_options = $myGmaps_center.','.$myGmaps_zoom.','.$myGmaps_type; |
---|
353 | $meta->setPostMeta($post_id,'map_options',$map_options); |
---|
354 | |
---|
355 | http::redirect(DC_ADMIN_URL.'post.php?id='.$_POST['post_id']); |
---|
356 | |
---|
357 | } catch (Exception $e) { |
---|
358 | $core->error->add($e->getMessage()); |
---|
359 | } |
---|
360 | |
---|
361 | } elseif (isset($_POST['updmap'])) { |
---|
362 | try { |
---|
363 | |
---|
364 | $post_id = $_POST['post_id']; |
---|
365 | $myGmaps_center = $_POST['myGmaps_center_upd']; |
---|
366 | $myGmaps_zoom = $_POST['myGmaps_zoom_upd']; |
---|
367 | $myGmaps_type = $_POST['myGmaps_type_upd']; |
---|
368 | $meta =& $GLOBALS['core']->meta; |
---|
369 | |
---|
370 | $meta->delPostMeta($post_id,'map_options'); |
---|
371 | |
---|
372 | $map_options = $myGmaps_center.','.$myGmaps_zoom.','.$myGmaps_type; |
---|
373 | $meta->setPostMeta($post_id,'map_options',$map_options); |
---|
374 | |
---|
375 | http::redirect(DC_ADMIN_URL.'post.php?id='.$_POST['post_id']); |
---|
376 | |
---|
377 | } catch (Exception $e) { |
---|
378 | $core->error->add($e->getMessage()); |
---|
379 | } |
---|
380 | |
---|
381 | } |
---|
382 | |
---|
383 | /* DISPLAY |
---|
384 | -------------------------------------------------------- */ |
---|
385 | ?> |
---|
386 | <html> |
---|
387 | <head> |
---|
388 | <title><?php echo $page_title; ?></title> |
---|
389 | <?php |
---|
390 | echo |
---|
391 | dcPage::jsToolMan(). |
---|
392 | dcPage::jsPageTabs($default_tab). |
---|
393 | dcPage::jsLoad(DC_ADMIN_URL.'?pf=myGmaps/js/_maps_list.js'). |
---|
394 | dcPage::jsLoad(DC_ADMIN_URL.'?pf=myGmaps/js/_addmap_map.js'); |
---|
395 | ?> |
---|
396 | <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> |
---|
397 | |
---|
398 | <style type="text/css"> |
---|
399 | #map_canvas{height:400px;padding:3px;border:1px solid #999999;margin:-10px 0 1px 0; } |
---|
400 | </style> |
---|
401 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> |
---|
402 | <body class="popup"> |
---|
403 | <?php |
---|
404 | |
---|
405 | if (!$core->error->flag()) |
---|
406 | { |
---|
407 | |
---|
408 | echo '<h2>'.html::escapeHTML($core->blog->name).' › '.__('Google Maps').' › '.$page_title.'</h2>'; |
---|
409 | // |
---|
410 | echo '<div class="multi-part" id="entries-list" title="'.__('Add elements').'">'; |
---|
411 | |
---|
412 | if (!$show_filters) { |
---|
413 | echo |
---|
414 | dcPage::jsLoad('js/filter-controls.js'). |
---|
415 | '<p><a id="filter-control" class="form-control" href="#">'. |
---|
416 | __('Filters').'</a></p>'; |
---|
417 | } |
---|
418 | |
---|
419 | echo |
---|
420 | '<form action="'.$p_url.'" method="get" id="filters-form">'. |
---|
421 | '<fieldset><legend>'.__('Filters').'</legend>'. |
---|
422 | '<div class="three-cols">'. |
---|
423 | '<div class="col">'. |
---|
424 | '<label>'.__('Author:'). |
---|
425 | form::combo('user_id',$users_combo,$user_id).'</label> '. |
---|
426 | '<label>'.__('Category:'). |
---|
427 | form::combo('cat_id',$categories_combo,$cat_id).'</label> '. |
---|
428 | '<label>'.__('Status:'). |
---|
429 | form::combo('status',$status_combo,$status).'</label> '. |
---|
430 | '</div>'. |
---|
431 | |
---|
432 | '<div class="col">'. |
---|
433 | '<label>'.__('Month:'). |
---|
434 | form::combo('month',$dt_m_combo,$month).'</label> '. |
---|
435 | '<label>'.__('Map element type:'). |
---|
436 | form::combo('post_maps',$post_maps_combo,$post_maps).'</label> '. |
---|
437 | '</div>'. |
---|
438 | |
---|
439 | '<div class="col">'. |
---|
440 | '<p><label>'.__('Order by:'). |
---|
441 | form::combo('sortby',$sortby_combo,$sortby).'</label> '. |
---|
442 | '<label>'.__('Sort:'). |
---|
443 | form::combo('order',$order_combo,$order).'</label></p>'. |
---|
444 | '<p><label class="classic">'. form::field('nb',3,3,$nb_per_page).' '. |
---|
445 | __('Maps per page').'</label> '. |
---|
446 | $core->formNonce(). |
---|
447 | '<input type="submit" value="'.__('filter').'" /></p>'. |
---|
448 | '<p>'.form::hidden(array('add_map_filters'),'myGmaps'). |
---|
449 | form::hidden(array('post_id'),$post_id). |
---|
450 | form::hidden(array('p'),'myGmaps').'</p>'. |
---|
451 | '</div>'. |
---|
452 | '</div>'. |
---|
453 | '<br class="clear" />'. //Opera sucks |
---|
454 | '</fieldset>'. |
---|
455 | '</form>'; |
---|
456 | |
---|
457 | # Show posts |
---|
458 | $post_list->display($page,$nb_per_page, |
---|
459 | '<form action="'.$p_url.'" method="post" id="form-entries">'. |
---|
460 | |
---|
461 | '%s'. |
---|
462 | |
---|
463 | '<div class="two-cols">'. |
---|
464 | '<p class="col checkboxes-helpers"></p>'. |
---|
465 | |
---|
466 | '<p class="col right">'.__('Add selected map elements').' '. |
---|
467 | |
---|
468 | '<input type="submit" name="addmap" value="'.__('ok').'" /></p>'. |
---|
469 | '<p>'.form::hidden(array('post_id'),$post_id). |
---|
470 | form::hidden(array('user_id'),$user_id). |
---|
471 | form::hidden(array('cat_id'),$cat_id). |
---|
472 | form::hidden(array('status'),$status). |
---|
473 | form::hidden(array('month'),$month). |
---|
474 | form::hidden(array('sortby'),$sortby). |
---|
475 | form::hidden(array('order'),$order). |
---|
476 | form::hidden(array('page'),$page). |
---|
477 | form::hidden(array('nb'),$nb_per_page). |
---|
478 | $core->formNonce().'</p>'. |
---|
479 | '</div>' |
---|
480 | ); |
---|
481 | |
---|
482 | if (isset($maps_array)) { |
---|
483 | for ($i = 0; $i < sizeof($maps_array); ++$i) { |
---|
484 | echo '<p style="display:none">'.form::checkbox(array('entries[]'),$maps_array[$i],'true','','','').'</p>'; |
---|
485 | } |
---|
486 | } |
---|
487 | |
---|
488 | echo |
---|
489 | '<p><input type="hidden" name="myGmaps_center" id="myGmaps_center" value="'.$myGmaps_center.'" />'. |
---|
490 | '<input type="hidden" name="myGmaps_zoom" id="myGmaps_zoom" value="'.$myGmaps_zoom.'" />'. |
---|
491 | '<input type="hidden" name="myGmaps_type" id="myGmaps_type" value="'.$myGmaps_type.'" /></p>'. |
---|
492 | '</form>'; |
---|
493 | |
---|
494 | echo '</div>'; |
---|
495 | |
---|
496 | echo '<div class="multi-part" id="settings" title="'.__('Settings').'">'; |
---|
497 | |
---|
498 | |
---|
499 | $meta =& $GLOBALS['core']->meta; |
---|
500 | $my_params['post_id'] = $post_id; |
---|
501 | $my_params['no_content'] = true; |
---|
502 | |
---|
503 | $rs = $core->blog->getPosts($my_params); |
---|
504 | if(isset($post)) { |
---|
505 | $meta_rs = $meta->getMetaStr($post->post_meta,'map_options'); |
---|
506 | if ($meta_rs) { |
---|
507 | $map_options = explode(",",$meta_rs); |
---|
508 | $myGmaps_center = $map_options[0].','.$map_options[1]; |
---|
509 | $myGmaps_zoom = $map_options[2]; |
---|
510 | $myGmaps_type = $map_options[3]; |
---|
511 | } |
---|
512 | } |
---|
513 | |
---|
514 | echo |
---|
515 | '<form action="'.$p_url.'" method="post" id="map-options">'. |
---|
516 | '<fieldset><legend>'.__('Map parameters').'</legend>'. |
---|
517 | '<p>'.__('Choose map center, zoom level and map type.').'</p>'. |
---|
518 | '</fieldset>'. |
---|
519 | '<p class="area" id="map_canvas"></p>'. |
---|
520 | '<p><input type="hidden" name="myGmaps_center_upd" id="myGmaps_center_upd" value="'.$myGmaps_center.'" />'. |
---|
521 | '<input type="hidden" name="myGmaps_zoom_upd" id="myGmaps_zoom_upd" value="'.$myGmaps_zoom.'" />'. |
---|
522 | '<input type="hidden" name="myGmaps_type_upd" id="myGmaps_type_upd" value="'.$myGmaps_type.'" /></p>'. |
---|
523 | $core->formNonce(); |
---|
524 | |
---|
525 | if (isset($has_map) && $has_map == true) { |
---|
526 | echo '<p>'.($post_id ? form::hidden('post_id',$post_id) : '').'<input type="submit" value="'.__('Save').'" name="updmap" /></p>'; |
---|
527 | } |
---|
528 | |
---|
529 | echo '</form></div>'; |
---|
530 | } |
---|
531 | |
---|
532 | dcPage::helpBlock('myGmapsadd'); |
---|
533 | ?> |
---|
534 | </body> |
---|
535 | </html> |
---|