Changeset 2874
- Timestamp:
- 01/13/11 01:17:44 (13 years ago)
- Location:
- plugins/myGmaps/branches
- Files:
-
- 6 deleted
- 7 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
plugins/myGmaps/branches/_prepend.php
r2868 r2874 1 1 <?php 2 2 3 $__autoload['myGmapsUtils'] = dirname(__FILE__).'/inc/lib.my.gmaps.ui.php'; 3 4 $__autoload['adminMyGmapsList'] = dirname(__FILE__).'/inc/lib.my.gmaps.ui.php'; 4 5 -
plugins/myGmaps/branches/inc/lib.my.gmaps.ui.php
r2870 r2874 1 1 <?php 2 3 class myGmapsUtils 4 { 5 public static function getMapIcons() 6 { 7 $list = files::getDirList(path::real(dirname(__FILE__).'/../icons')); 8 return $list['files']; 9 } 10 11 public static function getAdminIconURL($filename) 12 { 13 return sprintf('index.php?pf=myGmaps/icons/%s',$filename); 14 } 15 16 public static function getMapIconsJS() 17 { 18 $root = path::real(dirname(__FILE__).'/../icons'); 19 $icons = array(); 20 21 $mask = '#'.$root.'/(.*)#'; 22 23 foreach (self::getMapIcons() as $icon) 24 { 25 $icon = preg_replace('#'.$root.'/(.*)#',"'index.php?pf=myGmaps/icons/$1'",$icon); 26 array_push($icons,$icon); 27 } 28 29 return sprintf('myGmaps.icons = [%s];',implode(',',$icons)); 30 } 31 } 2 32 3 33 class adminMyGmapsList extends adminGenericList -
plugins/myGmaps/branches/js/_maps.js
r2872 r2874 27 27 28 28 var icon = new google.maps.MarkerImage( 29 'index.php?pf=myGmaps/i cons/target_icon.png',29 'index.php?pf=myGmaps/images/target_icon.png', 30 30 null, 31 31 null, … … 61 61 } 62 62 }); 63 64 // Icons tab 65 $('#icons-form li').each(function() { 66 var css = { 67 'background-position': 'middle center', 68 'cursor': 'pointer', 69 'height': '50px' 70 }; 71 $(this).css(css); 72 $(this).children('input').css('display','none'); 73 $(this).click(function() { 74 if ($(this).children('input').is(':checked')) { 75 $(this).children('input').removeAttr('checked'); 76 $(this).css('background-color','transparent'); 77 } 78 else { 79 $(this).children('input').attr('checked',true); 80 $(this).css('background-color','#ccc'); 81 } 82 }); 83 }); 84 $('#icons-form input[name=delete]').click(function() { 85 if ($('#icons-form li input:checked').size() == 0) { 86 alert(myGmaps.msg.no_icon_selected); 87 return false; 88 } 89 }); 63 90 }); -
plugins/myGmaps/branches/js/myGmaps.js
r2873 r2874 345 345 346 346 updIcon: function(marker) { 347 var icon = myGmaps.icons[ (myGmaps.iconIndex++)% myGmaps.icons.length];347 var icon = myGmaps.icons[myGmaps.iconIndex++ % myGmaps.icons.length]; 348 348 for (i in myGmaps.markers) { 349 349 myGmaps.markers[i].setIcon(icon); -
plugins/myGmaps/branches/map.php
r2873 r2874 330 330 dcPage::jsVar('myGmaps.msg.type',__('Type')). 331 331 dcPage::jsVar('myGmaps.msg.coordinates',__('Coordinates')). 332 $jsVar.332 myGmapsUtils::getMapIconsJS(). 333 333 '</script>'. 334 334 '</head>'. -
plugins/myGmaps/branches/maps.php
r2872 r2874 21 21 $core->blog->settings->myGmaps->put('scrollwheel',$_POST['scrollwheel']); 22 22 http::redirect($p_url.'&go=maps&tab=config&upd=0'); 23 } catch (Exception $e) { 24 $core->error->add($e->getMessage()); 25 } 26 } 27 # Add icon 28 if (!empty($_POST['send'])) { 29 try{ 30 files::uploadStatus($_FILES['upfile']); 31 $fm = new filemanager(dirname(__FILE__).'/icons'); 32 $fm->uploadFile($_FILES['upfile']['tmp_name'],$_FILES['upfile']['name']); 33 http::redirect($p_url.'&go=maps&tab=icons&add=1'); 34 } catch (Exception $e) { 35 $core->error->add($e->getMessage()); 36 } 37 } 38 # Delete icons 39 if (!empty($_POST['delete'])) { 40 try { 41 foreach ($_POST['ids'] as $filename) { 42 unlink(dirname(__FILE__).'/icons/'.$filename); 43 } 44 http::redirect($p_url.'&go=maps&tab=icons&del=1'); 23 45 } catch (Exception $e) { 24 46 $core->error->add($e->getMessage()); … … 221 243 dcPage::jsVar('myGmaps.msg.type',__('Type')). 222 244 dcPage::jsVar('myGmaps.msg.coordinates',__('Coordinates')). 245 dcPage::jsVar('myGmaps.msg.no_icon_selected',__('Please, select at leat one icon')). 223 246 '</script>'. 224 247 '</head>'. … … 228 251 if (isset($_GET['upd']) && $_GET['upd'] === '0') { 229 252 echo '<p class="message">'.__('Configuration has been successfully saved').'</p>'; 253 } 254 if (isset($_GET['add']) && $_GET['add'] === '1') { 255 echo '<p class="message">'.__('Icon has been successfully added').'</p>'; 256 } 257 if (isset($_GET['del']) && $_GET['del'] === '1') { 258 echo '<p class="message">'.__('Selected icons have been successfully deleted').'</p>'; 230 259 } 231 260 … … 335 364 '</form>'. 336 365 '</div>'; 366 367 echo 368 '<div class="multi-part" id="icons" title="'.__('Icons').'">'. 369 '<form method="post" action="'.$p_url.'&tab=icons" id="icons-form" enctype="multipart/form-data">'. 370 '<fieldset><legend>'.__('Add icon').'</legend>'. 371 '<p><label>'.__('Choose a file:'). 372 ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).')'. 373 '<input type="file" name="upfile" size="20" />'. 374 '</label></p>'. 375 '<p><input type="submit" name="send" value="'.__('send').'" /></p>'. 376 '</fieldset>'. 377 '<fieldset><legend>'.__('Delete icons').'</legend>'. 378 '<p>'.__('Select icons to delete by clicking on them').'</p>'. 379 '<ul>'; 380 foreach (myGmapsUtils::getMapIcons() as $icon) { 381 echo sprintf( 382 '<li style="background-image: url(%1$s); background-repeat: no-repeat; background-position: top center;">%2$s</li>', 383 myGmapsUtils::getAdminIconURL(basename($icon)), 384 form::checkbox(array('ids[]'),basename($icon),false) 385 ); 386 } 387 echo 388 '</ul>'. 389 '<p>'. 390 $core->formNonce(). 391 '<input type="submit" name="delete" value="'.__('Delete selected icons').'" />'. 392 '</p>'. 393 '</fieldset>'. 394 '</form>'. 395 '</div>'; 337 396 } 338 397 -
plugins/myGmaps/branches/style.css
r2868 r2874 52 52 background: transparent url(http://google.com/mapfiles/ms/t/Bpd.png) no-repeat top left; 53 53 } 54 /* Icons management */ 55 #icons-form ul { 56 overflow: hidden; 57 padding: 0; 58 margin: 0; 59 } 60 #icons-form ul li { 61 float: left; 62 margin: 0.2em; 63 list-style: none; 64 width: 50px; 65 height: 70px; 66 } 67 #icons-form ul li input{ 68 margin-top: 50px; 69 margin-left: 20px; 70 } 71 #icons-form ul li.jquery { 72 background-position: middle center; 73 cursor: pointer; 74 height: 50px; 75 }
Note: See TracChangeset
for help on using the changeset viewer.