Jump to content

gebeer

Members
  • Posts

    1,554
  • Joined

  • Last visited

  • Days Won

    48

Everything posted by gebeer

  1. @Pretobrazza It might be related to the jQuery version you are using. 1.11.0 is a bit outdated. You might want to try a newer one. My map is rendering fine on 2.2.4
  2. @Pretobrazza Did you also update the leaflet-markercluster files? Because the inputfield map is not using the marker cluster plugin.
  3. @Juergen In leaflet JS there is a method invalidateSize() which checks if the size of the map container has changed and then updates the map. When you call the UIKit modal, the size of the map container changes and therefore your map needs to be updated manually. So you need to listen to the show.uk.modal event and attach a handler that updates the leaflet map. The problem here is that the map object is not easily accessible from the global document scope because the JS that renders the map is executed inside an anonymous function call. You should find a script like this just before the closing </body> tag: <script type="text/javascript"> $(function() { var mleafletmap1 = new jsMarkupLeafletMap(); mleafletmap1.setOption('zoom', 18); mleafletmap1.init('mleafletmap1', 49.572056, 10.878165, 'OpenStreetMap.Mapnik'); var default_marker_icon = L.AwesomeMarkers.icon({ icon: 'home', iconColor: 'white', prefix: 'fa', markerColor: 'darkblue' }); mleafletmap1.addMarkerIcon(default_marker_icon, 49.572056, 10.878165, '/maptest/', 'maptest', ''); }); </script> So if you try and get the map object with $(mleafletmap1), this will not return what you need. In order to have the map object available in global scope, you need to change some module code. You can find the changes at my fork in MarkupLeafletMap.module. Just copy this over your local file. Now the script before the closing </body> tag should look something like this: <script type="text/javascript"> var mymap; $(function() { var mleafletmap1 = new jsMarkupLeafletMap(); mleafletmap1.setOption('zoom', 18); mleafletmap1.init('mleafletmap1', 49.572056, 10.878165, 'OpenStreetMap.Mapnik'); var default_marker_icon = L.AwesomeMarkers.icon({ icon: 'home', iconColor: 'white', prefix: 'fa', markerColor: 'darkblue' }); mleafletmap1.addMarkerIcon(default_marker_icon, 49.572056, 10.878165, '/maptest/', 'maptest', ''); mymap = mleafletmap1; }); </script> And you can now access the map object in your script with mymap.map. Example code: <script> var myModal = $('#yourmodalID'); mymodal.on('show.uk.modal', function(){ mymap.map.invalidateSize(true); }) </script> While this is just a workaround it should help to display the map correctly. @Mats Maybe we should add something like this to the module code so in future versions a map object will be returned by default? Or do you see another way to access the map object with the module as is?
  4. @abdus As the $config variable inherits all methods and properties from WireData, you can try and use the set method $config->paths->set('assets', $config->paths->root . 'test/'); I don't have the time to try this right now. So give it a try yourself and let me know.
  5. @abdus ok, I see. When I echo $config->paths->assets in a template file I get '/DATA/htdocs/test. So it seems to be working and picking up the changed path from config.php.
  6. @abdus your code throws an error for me: `Uncaught Error: Call to undefined function ProcessWire\config()` And this code works ( note the $config instead of config() ): $config->paths->assets = $config->paths->root . 'test/'; $config->urls->assets = $config->urls->root . 'test/';
  7. @Pretobrazza I just installed latest version of this module on PW 3.0.47 I updated the getLeafletMapHeaderLines method for injecting JS and CSS then lines 168 and 173 to load @1.0.3. Then I got a JS error about the MarkerCluster. I updated all 3 files in the module's assets/leaflet-markercluster/ folder to the latest 1.0.4 versions. You can find them here: https://github.com/Leaflet/Leaflet.markercluster/tree/v1.0.4/dist After that the map is showing up fine with no errors. Pls let us know how it goes for you.
  8. @abdus In the cheatsheet there is $config->paths->assets linked to from the API docs about $config. Haven't tried it but you should be able to override it like you did with $config->paths->files.
  9. @Pretobrazza trying to answer your questions: 1. As stated in the MarkupLeaflet.module file, you are required to add the link to leaflet.js yourself. You can change the version to 1.0.3. Then you also have to change the link to the leaflet css in the same file line 106. If you decide to use the getLeafletMapHeaderLines method for injecting JS and CSS then you need to change lines 168 and 173. 2. This module does not support wms layers out of the box. You would need to expand the JS logic to use them. Over at leafletjs.com they have a tutorial on how to implement wms layers. The relevant code section in the module can be found in MarkupLeafletMap.js line 47. Following the tutorial on leaflet.js you might have to alter some other code in that file, too. 3. There is a shapefile plugin for leaflet.js that you could use to draw layers from your shape file. You can use the PW API and some PHP logic to create that shape file from the data in your pages, but I'm afraid this goes beyond the scope of this thread. This module is designed to draw markers of locations on a map where you can choose different map tile providers and assign custom fontawesome icons to your markers. All in all I think ProcessWire fits the job very well. But you might be better off just using the inputfield from this module on your pages to input the location data. And then setup the map rendering from scratch in your template file rather then using the render method that MarkupLeaflet.module provides. This should be easier than tweaking the render logic that this module provides. I can definitly encourage you trying to do this with PW and leaflet.js.
  10. Thank you for this very valuable piece of information. After implementing this in the head I still got a JS error: ReferenceError: config is not defined. I had to adjust the code like this to make it work: <script type="text/javascript"> <?php $jsConfig = $config->js(); ?> var ProcessWire = {config: <?php echo json_encode($jsConfig); ?>}; var config = ProcessWire.config; </script> No idea why my frontend form didn't pick up config from the ProcessWire object.
  11. @LostKobrakai thank you for clarifying. For me the original code did not work, even with the $event->replace = true part. That was why I was looking for a solution.
  12. This hook didn't work for me. Maybe something in the API has changed? Reading up on hooks that modify the return value, I found that only After hooks can modify it. I modified @Macrura 's code and this is working for me on 3.0.42 wire()->addHookAfter('Page::path', function($event) { $page = $event->object; if($page->template == 'landing-page') { // ensure that pages with template 'landing-page' live off the root $event->return = "/$page->name/"; } });
  13. UPDATE: I couldn't find anything suspicious in the DB dump diff. So after tinkering for a while I decided to try a workaround. I added a new role and gave it the same template-level permissions as the 'faulty' role that caused the problems. Then I assigned this new role to the admin user with the old, 'faulty' role (in addition to the old one). And this helped, the JS error is now gone. Not sure, though, what to make of this. It seems to be pointing to a problem in the settings for that 'faulty' role. But I went through the role and permission settings numerous times and couldn't find anything unusual. So for now I will let it be as it is. Although I really would like to find the real cause of the problem. Just don't know where else to look for it. Feels a bit uncomfortable to have a site running in production with a strange admin error that might reappear anytime... So if anyone reading this has an idea, please let me know. But thanks for reading anyways.
  14. @ank you may try echo $input->post['field_optionselect']->title . Or you can do a var_dump($input->post['field_optionselect']) in your template. That will tell you in which format the data is there and how you can access subfields like 'title'. For using field data on the redirect page, youcould take the values of the fields and attach them as URL query strings to the redirect URL. Dummy code // in the template with your form process the fields from your form $valueField1 = $sanitizer->text($input->post['field1']); // send them to the redirect page as url querie strings $session->redirect("yourredirecturl" . "?field1=$valueField1"); // in the template of your redirect page, you can now get the value $valueField1 = $input->get['field1']; // and then do with it what you want
  15. Hello, I'm getting a JS error in the admin backend when editing pages with template basic-page as non superuser: TypeError: a.ProcessPageList is not a function in InputfieldPageListSelect.min.js Investigating the JS, I found that the ProcessPageList function is not available on the page when I am logged in as a non superuser. The function is defined in /wire/modules/Process/ProcessPageList/ProcessPageList.min.js which is not loaded when logged in as non superuser. When logged in as a superuser, the file gets loaded. I have no fancy permission settings for that template for the role admin that the non superuser belongs to: This started happening on a site that is in development but online for some time now. I can't say which actions might have caused this. But it is a consistent error only for this one template. The site is running on 3.0.42 EDIT: The inputfield triggering the error is an image field (in fact there are 2 of them in that template) Any pointers to potential causes for this problem would be much appreciated. EDIT: The problem is not related to any file changes. When I run the same install with a DB backup, the error disappears. So it must be something that has changed in the DB. Trying to diff the DB dumps and see if I can find anything suspicious
  16. @adrian Thank you for the input. I have been able to get the query like mentioned in the post above yours. This is quite some time back now. In the meantime I've come to love Tracy Debugger. It is very easy to setup and makes debugging fun. Wouldn't want to miss it now
  17. For hosting environments where you cannot change my.cnf and make settings persistent, you can do this: https://github.com/processwire/processwire-issues/issues/28#issuecomment-252870084 I just implemented it and it is working fine.
  18. Spot on, thank you. In my case it was ONLY_FULL_GROUP_BY that caused the problem This helped solving it:
  19. @LostKobrakai That did the trick. Site is back to normal now. Thanks a lot!
  20. @rastographics Which operating system are you on and which docker version are you using?
  21. @felic Yes, it is possible on the console and through phpadmin. But the changes can only be made by a user with root privileges and they will not persist. So after a restart of mysql they will be lost. In most shared hosting environments we are not allowed to do these changes ourselves...
  22. @Robin S Thanks for the tip. In 3.x there is a setting $config->dbSqlModes = array( "5.7.0" => "remove:STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY" ); in https://github.com/processwire/processwire/blob/master/wire/config.php#L869 But it seems that 2.8 is not supporting those mode settings. At least I cant find anything related in https://github.com/processwire/processwire-legacy/blob/master/wire/core/WireDatabasePDO.php or https://github.com/processwire/processwire-legacy/blob/master/wire/config.php
  23. @justb3a Did you change the settings in the my.cnf file or through phpmyadmin? I read that in order to make the changes persist across DB server restarts, we have to change my.cnf. What for shared hosting where we only have access through phpmyadmin?
  24. @adrianmak We're ecperiencing problems on a PW 2.7.0 install after MySQL upgrade to 5.7. Do you have any further findings, are PW 2.7 and MySQL 5.7 versions not compatible or did you get it to work?
  25. Hello, on a page that is live for over a year now, we get this error when trying to add a new child page to a certain parent: "Field 'sort' doesn't have a default value" EDIT: here's the whole error message: Couldn't find anything related on Google so I post here. The parent page has set sort for children by created date. No errors in eeror or exception log. When trying to save the new child page, the system also says that the name is already taken. But page under same parent with same name does not exist. Page is created in the background, though. When manually changing the name of the page (adding "-1" to the name), a new page is saved in the background but the system still says that the name is already taken. Now I'm clueless of what to do. Any help would be much appreciated.
×
×
  • Create New...