Jump to content

Cybermano

Members
  • Posts

    81
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Cybermano

  1. Very cool! As for all the improvements. Big thanks to all! Maybe, could be this filtering setted into the parent template also for children fields/subfields? Like the override page label ( {fieldA} - {fieldB.subfield} - {title} ).
  2. Hi everybody. I was playing with the @Macrura PrevNextTab module, (forking it); but actually I started from here, adding previuos and next action (with logics) to the Save button, as suggested a while ago by @bernhard. Every time I’m annoyed by the boaring "There is no editable next page to edit." after "Save + Next" click: so I decided to implement a "stop" when reached the last item (and same way for previous when reached the first one). This is the results for First and Last items dropdown menu of the Save button: I would like to share the code to put into ready.php, if somebody find it useful: Bye.
  3. Hi @Macrura, thanks for this module. I have played a bit and found it useful, but at first time not very friendly. I try to explain... The Next/Prev links seems like to be in "loop" when at last/first items; I feel it quite unfriendly and not very helpful. When lot of siblings are present, it's difficult to understand if we are at the beginning or ending to stop editing/checking pages (for example, I find very annoying when you click on "Save + Next" and only then the message "There is no editable next page to edit." appears...) But your work is very intersting, so I tried to edit your code (I forked it from your repo and pulled a request). Basically, I think that if the next or prev page id is "0", so we can decide to hide the relative links and show First/Last, as needed. I added few code lines into your module to implement last and first placeholders and labels, new logics into .js file to check ajax response (ids and urls) and few rules into .css file. Also added a condition to hide links if only one items is present (so no navigation needed). Currently I tested all only in Tabs, and all works fine. Hope this could be helpful. I think I will try to insert also a link to parent page (just to complete a full nav "scheme"), and maybe to go further and finish the editin also for UI specific settings. PS This idea was initially born implementing new actions for Save and Next admin button (see here the post).
  4. Hi @torf, thanks for sharing that.
  5. Or maybe this edited code of your first post works? $map = $modules->get('MarkupLeafletMap'); echo $map->getLeafletMapHeaderLines(); $mappoints = new PageArray(); foreach ($page->map_repeater as $point) { $mappoints->add($point) // the repater is a page } echo $map->render($mappoints, 'your_map_field_name', array('height' => '270px')); ?>
  6. Hi @torf, maybe I didn't get it at all or maybe I didn't explain well my idea. So I'll try again... 😉 Surely I could be wrong, but for me a PageArray is not only for admin side, but all the pw pages collected into a php variable created with pw selectors in a script file. For shortness I have created 2 pages with two repeaters each (repeater name is "multipoints"), with a title and a leaflet map field (named 'fm_mappa') into. This is the simply code for testing. Please note that I didn't get the repeater with a foreach statement, but with a pw search with a selector for all the templates with name equals to "repeater_NAMEOFTHEREPEATER", as pw builds. Obviously into your selector you can build your search to the desired points, e.g with sorting or something other. echo $pagesWithMultipointsRepeater = wire('pages')->find('template=repeater_multipoints'); if (count($pagesWithMultipointsRepeater)){ $map = $modules->get('MarkupLeafletMap'); $options = array( 'height' => 800, 'markerColour' => 'red', ); echo '<div class="g-mb-25">'; echo $map->render($pagesWithMultipointsRepeater,'fm_mappa',$options); echo '</div>'; } The numbers before the map are the repeater ids (note the "echo" on the first line of the code). And these are the admin pages: I hope that's clearer.
  7. Hi @torf Never used Leaflet Map with repeaters, but in past I had to collect lot of points into a single map. I simply used a PageArray with wire('pages')-find('template=MY_TEMPLATE, and so on...') and then I passed the PageArray to the $map->render($MY_PAGE_ARRAY, 'MY_MAP_FIELD', $options); it works. So I suggest to collect your points in a PageArray with proper selectors. Don't forget that your repeater has a template, and if useful you can get the parents of them. Let me know if this solution can fit your needs.
  8. Hi. Thanks for the clarifications, now I understand the basic idea better. As I said, I would fork your module to work on it in my free time: I can't assure you of short times, or the completion of my ideas, but I will definitely let you know if there will be any developments. Best regards.
  9. Please, note that in the last linked repository your "jk_publish_until" field still has a "none" output format (instead of a [d-m-Y]), that causes a parsing date issue. Furthermore I found a little misunderstanding the unpublish description in scheduled plan if the page will be moved in new parent: this page will be remain unpubilshed? It seems no: the page will be unpublished from it's first parent, but it will remain published in the new one. So the page will not be unpublished at all. Or am I wrong?
  10. Hi @Juergen Thanks for your answers. I will try your module and if possible ask if I can fork it. In my free time, I will try to add features according to my needs and if everything goes well, I will share my code with you. Thanks again.
  11. Hi Juergen, thanks for your hard work: it sounds awesome and I will try it asap. As I understood, this module can operate on the single page when almost one date fields is setted. Right? Did you considered to perform a batch execution (always based on -a date and time) for all children of a page? Maybe based only to their template? Let’s imagine this scenario: A parent page (the main container) having lots of children (more than 1k created by formbuilder with a specific template) and some sub container (backup folders with another template, eg “backup”, so we can have subpages as “backup 2024”, “backup 2025” and so on). On your experience, do you think it could be possible to move the yearly formbuilder children into the relative backup (even setted by hand into module each year, not necessary programmatically) in one shot? Could be possible to have any execution time issue?
  12. Hi everybody. I pull up this post for the same problem exporting/importing pages with Export/Import. I have the same template with same fields into two site ( let's call them "A" and "B") and same installation. Well, from site A to site B I can correctly export and import the pages. But the odd behaviour is that from site B to site A, after the import test performed correctly, the "Fatal Error: Uncaught Error: Call to a member function setLanguageValue() on null in wire/modules/LanguageSupport/FieldtypeTextLanguage.module:160 " occours on the import "commit". It seems that the PageTitleLanguage can't save the value: I find the created pages only with the name (url), but not the title (mandatory field)... Anybody has an idea? Many thanks in advance. P.S. line 160 in FieldtypeTextLanguage.module is in a foreach into the public function ___importValue(...) : $importValue->setLanguageValue($language->id, $languageValue); If it's important, but I dont't belive, into both sites the languages id are exactly the same (default = 1010, en = 1021). Also the fields have the same name. I can't explain why is "null" the $importValue, that is derived from line 156: $importValue = $page->get($field->name);
  13. I would advice all you that the geocoder API is no longer accessible in the format of the current module. I have an error geocoding address and the return message from nominatim.openstreetmap is: Using the URL /search/ and /reverse/ (with slashes) is no longer supported. Change url from /search/?q=Berlin in /search?q=Berlin Also complete addresses are changed, see below: File not found: API no longer accessible via this URL Using the URL /search/ and /reverse/ (with slashes) is no longer supported. Please use URLs as given in the documentation. Examples how to change the URL: You use: https://nominatim.openstreetmap.org/search/?q=Berlin Change to: https://nominatim.openstreetmap.org/search?q=Berlin You use: https://nominatim.openstreetmap.org/search/US/Texas/Huston Change to: https://nominatim.openstreetmap.org/search?q=Huston, Texas, US See github issue #3134 for more details. See github issue #3134 for more details. Maybe editing ControlGeocoder.js fixes partially the problem? :343 L.Control.Geocoder.jsonp(this.options.serviceUrl + 'search/', L.extend({ change in L.Control.Geocoder.jsonp(this.options.serviceUrl + 'search', L.extend({ :370 L.Control.Geocoder.jsonp(this.options.serviceUrl + 'reverse/', L.extend({ change in L.Control.Geocoder.jsonp(this.options.serviceUrl + 'reverse', L.extend({ I have tested with simple addresses (italian street, number and city) ad it works fine again, both search and reverse. Posted a commit on Github: https://github.com/FriendsOfProcessWire/FieldtypeLeafletMapMarker/commit/63254dffea9bd504eb45b124d64fd5832e38f013
  14. Hi there, I'm testing a static call with JS to set a new view of the map (I need it on event change without refreshing the page), as found on Github and Stackoverflow: // frontend var mymap = L.map($('#mleafletmap1')).setView([45.53, 10.21], 2); // backend var mymap = L.map($('#_Inputfield_fm_mappa_map')).setView([45.53, 10.21], 2); This produces a TypeError: t.className is undefined. I looking for a solution, but didn't found it (...and I'm not a skilled js coder). Does anybody have an idea?
  15. Hi @Ivan Gretsky, thanks for your reply. I hope to create it asap. I will update you.
  16. Hi, is there anybody that knows how to easly disable "scrollWheelZoom" on admin page editing? Or is there a "module/field" settings development plan for map options in admin? (an overrideble setting in the field options could be great). I find a little annoying the zooming in/out of the map on page scroll. At the moment I put manually a js line of code in InputfieldLeafletMapMarker.js after line 24 // line 24 var map = L.map(mapElement).setView([lat, lng], options.zoom); // new line map.scrollWheelZoom.disable(); But I'm not so happy to modify original modules... (on updates the modifications could be lose). The second approach that I have succesfully tested is to load a js file in admin, but it needs to completely initialize a new map, only with the add of an option in the declaration of the map init: var map = L.map('_Inputfield_fm_mappa_map', {center: [lat, lng], zoom: parseInt($('#_Inputfield_fm_mappa_zoom').val()), scrollWheelZoom: 0,} ); Any suggestions?
  17. Hi to everybody and special thanks to @Mats for sharing this big porting, to @gebeer @netcarver @dab for the hard implementations and to @Ivan Gretsky to keep it alive again, but also to all the contributors and maintainers of this awesome module. I'm testing it and it works really fine and easy. I would try to add an extra class to the markers and I followed this linked tip to Leaflet.AwesomeMarker properties for the main page with all the markers: $options = array( 'useMarkerSettings' => true, 'markerFormatter' => function($page, $marker_options) { $marker_options['icon'] = $page->icon; // Override the default icon for this marker. $marker_options['markerColor'] = $page->color; // Override the default color for this marker. // Adding extra classes to this marker ?? $marker_options['extraClasses'] = 'music-stage'; // Or dynamically from an option field: $page->stage_kind->value return $marker_options; }, ... ); But as you can see from the screenshot below, no classes are added to the icon (there is a blank space instead between the classes into <i></i> tag; actually it's always present, with or without the 'extraClasses' index into $marker_options). Am I missing something? P.S. The JS correctly loads the object properties: mleafletmap1.addMarkerIcon(L.AwesomeMarkers.icon({prefix: 'fa', icon: 'music', markerColor: 'red', iconColor: 'white', extraClasses: 'music-stage'}) Basically it would be nice to add extra classes to the whole marker (not only to the icon) to manipulate it with js (eg. filtering by type/class on a triggered event such as a button click or select change, or hiding from page if an event date is passed, like for exibitions/music lives and so on). Does anybody have any suggestions to do this? Thanks in advance.
  18. Hello, I'm back ... I spent a week of full immersion at work. I fixed the installation error (and pulled a request on GitHub). It was a bad condition in a public function. Sorry, I had missed it. P.S. Please, check your part of read.me (more or less, at line 14) ```<?php echo buildGoogleTranslateUrl('es');?>``` Do you mean calling the function from the module as: ```<?php echo $translate->buildGoogleTranslateUrl('es');?>```
  19. Hi @JayGee, of course yes! Thanks for all and don't worry: you did well to take a break after a hard work. I am very happy to have been useful: as soon as I can I check the error in the front end, but as you said I think it is possible to avoid it by assigning default values during module init. I'll get back to you shortly! Bye!
  20. I will surely do. Many thanks. Thanks again @bernhard: perfect as always, of course. I will indagate the _added prop as suggested (maybe there is the reason that fires my hook without the _cloning return).
  21. I'm trying to upload two screencasts to better explain... You can see those screencasts here: https://drive.google.com/drive/folders/15JgYJDwTKowOX2zUw14yy1S9RcF4YAwg?usp=sharing
  22. Hi @bernhard, thank you for your suggestions and for your time too. You are right, there are unecessary $page->save(), but: let's say that I have a hook that check if there are pages with the same title (on page saved). Well, this hook warns every time on cloning despite the title changing. The only way that I have found to not be warned is to set the original page as unpublished and, after cloning, to restore the original status. Otherwise with RobinS's hook, but activating "Make the new page unpublished" on cloning mask (but this is a one more passage respect your hook). Maybe I missing something or I making any mistake...
  23. Thanks a lot! Do you know if someone has ever thought about to insert those kind of features into the core? *edit* If sombody may need the same behaviour of Pagelist cloning (with unpublished status), I made a little hack to the @bernhard code: ... if($action === 'clone') { // get original page status $status = $page->status(); // set unpublished $page->setStatus(2049); $page->save(); // clone $copy = $this->wire->pages->clone($page); // get original name and store in an array $nameArr = explode('-',$page->name); // save cloned name (microtime style + 1) $copy->setAndSave('name', $nameArr[0] . '-' . ($nameArr[1] + 1)); // add ' (copy ... + incremented timestamp)' to title $copy->setAndSave('title', $page->title . ' (copy ' . ($nameArr[1] + 1) . ')'); // set unpublished status $copy->setStatus(2049); $copy->save(); // restore original status to original page $page->setStatus($status); $page->save(); $this->wire->session->redirect($copy->editUrl); } ... N.B. I used this trick (unpublishing the original page) due a personal hook that checks pages with same title (and warn if found one or more dupicates). Without the unpublished status for the original page, it seems that at first saving the title is the same also for cloned item... The same results is obtained with the @Robin S hook, but flagging "Keep page unpublished" in the cloning mask.
  24. In the meantime, I have packed the backup site with its db, that looks correct. Looking into page differences, I've found that if I add a new item in the repeater field on the main page, this item uses a new template for the repeater: "repeater_vouchers1" instead of the original "repeater_vouchers". New template is created yesterday. Obviously the php code doesn't extract nothing, becuse all the selectors points to "template=repeater_vouchers, ... " But if I delete this item from the main page, it is deleted also from the admin for-page-XXXX container. This did not happen for the original articles... Very strange. For completeness, these updates were made yesterday: The only one I think might have affected is core 3.0.210 (updated to migrate to TinyMCE): current repeater field is a FieldTypeRepeater, not the Matrix bundeled with pro ones. 01/06 - 10:44 Just finished to apply the same upgrades, step by step with double check on backup version of the site and all is fine: no repeater problems...
  25. Check on table is ok: $q = "check table field_vouchers"; $statement = wire('database')->query($q); $results = $statement->fetchAll(PDO::FETCH_ASSOC); echo '<pre>'; var_dump($results); echo '</pre>'; // dump result array(1) { [0]=> array(4) { ["Table"]=> string(29) "vouchers_newmc.field_vouchers" ["Op"]=> string(5) "check" ["Msg_type"]=> string(6) "status" ["Msg_text"]=> string(2) "OK" } }
×
×
  • Create New...