Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Cybermano

  1. Hi Robin, many thanks for your time and for your "academic" exposition. πŸ‘ You have clarified me a lot. Surely I have misunderstood your exposition for the sorting by index, into the the linked thread. foreach($r_items as $index => $r) { // Update the sort value of the repeater page // See: https://processwire.com/api/ref/pages/sort/ $pages->sort($r, $index); } I had assumed that in this foreach $pages->sort() stands for $page->repeater_item->sort() I beg your pardon... πŸ™‚ And for the record, now with your help (πŸ˜‡) my whole mess (🀣) is working perfectly ...
  2. Don't worry, in fact I'm sorry for invading your post. Now I'm looking deeper into RobinS indication and affectively it works fine. Surely the fault is mine. Thanks again. πŸ˜‰
  3. Hi MarkE, sorry for bothering you... Unfortunately, compared to expectations, it didn't work out as I hoped. In my case, I have a matrix of scores stored by race, but when I add one or more races (repeater items) for all the competitors, some of this items shift randomly (4 digits are the id of the items, only for debug). Not all the times, but "sometimes"... also randomly... Completing the blank scores, the ID clarify the shift of the repeater items... The ADD/REMOVE items process is done by hook, with getNew() and add() methods (also tried append(), but nothing changed)... In Tracy Debug I can order the repeaters properly, but nothing more: it seems that after sorting the page is not saved ... And into the single competitor page, with Tracy all seems working good, but on each page refresh the repater items are always shifted. The repeater is not saved... Looking for other posts besides your, I found this one by @Robin S but the sorting by index didn't work... 😢 Do you have any suggestion?
  4. Hi Mark, you are my hero of the day! πŸ™‚
  5. You’re welcome, and I hope you could enjoy it! πŸ™‚ Please, let me know if it could be helpful.
  6. This is the updated link to GitHub: https://github.com/cybermano/CustomNotes.git And attached the zipped file for the updated module. CustomNotes-main.zip
  7. Hi wbmnfktr, Don't worry, you didn't offend me πŸ˜‰ : maybe I could be too verbose and not clear. First of all, this module doesn't install a kind of "tool" that manages food allergens in an automatic way. It moved from a need of this kind. Let's me explain better, if I can. Admin editors (webmaster or their clients too) may need to check recursively some data when edit lot of pages, e.g. inserting allergens in food menu (for each dish). So I thinked to a kind of "post-it" (or a sticky note) to check when I need to edit a page: for example, I'm not a chef nor a restaurant manager and I don't know by heart all the food allergens. So, for many clients that asked to us to maintain web editing and data entry, I built an admin page where I can check the list of allergens. But this slows down the editing process, because the page is loaded as a new page (or it could be loaded as a new tab, switching between it and the page that I'm editing). With the help of many people here, I have developed this module do build a system of "links" that they make appear a "panel" or a "modal" with the list of allergens. Obviously, you must have already setted all your fields, templates and logics. In my case, we have Hanna Code shortcuts to put into "Allergens" field, into a "menu repeater", that will be rendered as a button with tooltip. My Hanna Code item, in this case, is : <button type="button" class="btn btn-sm btn-warning rounded" data-container="body" data-html="true" data-toggle="popover" data-placement="top" data-content="<strong>Mustard</strong> and foods containing mustard."> 10 </button> In other way, you can set a SelectOptions field with Checkboxes: The code logics to display these buttons could be very similar, it doesn't matter. Here comes the help of my module: you can set where to insert the link to the list (e.g. the notes of the "allergens" field, or a sticky button that follow your scrolling). So you can limit the visibility of the link only to specific template, pages, and/or fields. Ad you don't have to open new tab or switching between them: it's available immediately. It helps me very much and speeds up my workflow for data entry. 07-CustomNotes-lr.m4v But this is not only for List of Allergens, of course. You could embed video (with the powerful tool of Video Emebed TextFormatter) , pdf manuals (just insert a link with target="_self", and it will be displayed into the panel or modal windows. In the second case it will be displayed into the whole modal like a "preview", very useful...), and other stuff. Let's think about technical manuals, videotutorials and text abstracts: pdf-docs.mp4.0a806606f78dcd86cecfe22f074c0b80.mp4 All you need to do, it's simply edit the CKEditor textarea into the settings of the module, as you do for each page that you edit. Then you will find a "reminder" where you would to see it. I hope I have explained better the use of this module to you and maybe to everybody that would try it. Now I will upload the upgrades with the corrections of @teppo .
  8. Thanks to @teppo for his support and help. Currently a new PR is merged on GitHub. ASAP I will update the attachments of this thread.
  9. Hi @teppo PR merged on the trust. πŸ˜‰ As posted on GitHub , your eyes will surely solve my newbie errors. ASAP I will check deeply all. Thanks again.
  10. Hi Teppo. First of all, many thanks for you time and for your suggestions. Very appreciated. At the moment I’m on mobile and far from my pc. ASAP I will check it and fix as you pointed. In the meantime, please split the discussion as you see fit and as it’s more convenient for the forum. Many thanks again for your support.
  11. Hi to everybody! I found this useful module and it works fine on desktop (either pc and mac, Chrome/Safari/Opera/FireFox/Vivaldi and IE), but sometimes I've encountered different behaviours on mobile (tested on Android and iOs, with Chrome, Firefox, Opera, and Safari). Briefly, I built an html table in delayed output (a race ranking, one for each different race pages), I collect it into a variable and passed it throug a $_SESSION index to another page where it's grabbed with a ob_start()/ob_get_contents()/ob_end_clean() statement (no echos are present out of this one ob_start/ob_end). Despite the desktop pdf output it's ok (I can show()/save()/download() the files and open them with Acrobat, and into docs properties I found each custom setting, e.g. title, author, application and so on) on mobile, instead, I encountered two kind of issues: 1) Most of times, in Chrome, I was alerted of a non valid file, or FireFox it's not able to save pdf file. 2) Some times the file is outputted also on mobile and it's perfectly readble, but on save and on open by Acrobat App I found the content empty with the notice of the $_SESSION['nameofindex'] undefined. N.B. Same results also calling directly mPdf after RockPdf and setting it's proper methods. No problems with a "static" html code passed to the write() method, but I'm getting crazy figuring why it works fine on desktop and not on mobile (or it's ok also on mobile, but can't save a correct file) with $_SESSION. Does anyone encontered same kinds of these strange behaviours? Any suggestion about that? Many thanks in advance.
  12. Hi to everybody. I developed a bit this works and I would like to share it with you. Install, uninstall, tabs and minor improvements added and debugged. I've also opened a github repo: https://github.com/cybermano/CustomNotes Do you suggest me to open a new thread? CustomNotes.zip CustomNotes.module README.md CustomNotes.js
  13. Thanks for pointing me out those solutions: really rocks! For CKEditor field they are the first solution we'll considering in future. At the point of our production code, also page reference didn't suits well (we would maintain simple textarea and HC). Surely we will change templates and code to use these powerful tools for the next uses. Currently I think the first idea is really flexible (even if less powerful) to adopt it in a lot of ways, for lot of ready-made sites, and with different solutions without efforts. E.g. for food related sites we could use it as the List of Allergens, for many others could be used like a docs repo or a shortcut to a help-desk, tuts o more... pdf-docs.mp4
  14. Thanks Bernhard, your advice spurred me not to settle. I will surely give a look at the solution of BitPoet, it sounds very interesting... P.S. Everyday I discover a mine of treasures...
  15. Hi Robin, thanks for your reply and your suggestions. I totally missed your HC dialogue: I can't wait to study that module, I will look in depth asap πŸ™‚ And the page reference (yes, I use a repeater) is also a great idea ... I hadn't thought of that. Tks!
  16. As promised: I've posted here my little contribution. For who could be interested. πŸ˜‰
  17. Food Allergens Module A simple List of Food Allergens My needs were to provide a simple list of food allergens for our clients with restaurant related activity. The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window. This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea. This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens. --- Main features The basis All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module). Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list). A step further With the tips of @bernhard, @Soma (and many others), see here , the magic happens. The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list. A little further Why scroll to the top of the page to click a link? The next step was to create a sticky button only in the food menu pages. Again with a @bernhard tip I moved into the customization of this simple module and the related hook. --- How to use this module After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM): View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens". At the same way, the option for the sticky button, but with a plus The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>. Video Explanation In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call. This because I've set a specific one for each allergen to show up a tooltip in the front end. Registrazione #33.mp4 Registrazione #34.mp4 --- Last but not the least Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible. I always learn a lot here, so I would share my code for whom it could be interested. I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module. Obviously you are free to modify the code as per your needs. Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). πŸ˜‰ I hope be helpful or for inspiration. Bye ready.phpList-ITA.htmlList-ENG.htmlAllergens.module README.md
  18. Thanks again. I already wrote only few hooks by myself, but a pro tip is always welcome. πŸ™‚
  19. Hello. I confirm you that I was able to implement the panel view. Thank you so much. I owe you a truck of beers! πŸ˜‰ I dare, for those who may then use the same snippet you posted, that the url of the link must be between the quotes (and in my case I also had to remove #pw-masthead, not having a specific id). $(document).ready(function() { pwPanels.addPanel($("a[href='/your/admin/link/url']")); }); I also thank @Soma for publishing this tutorial, otherwise I would sail in the deepest dark ...;) All you are my hero! πŸ™‚ P.S. My next target is to hook my restaurant menu repeater to create a button with the same link, (so editors could obtain the list in place, without scrolling to top). If all will go right, I will share the code of the hook, the button and the List of Allergens (Hanna Code). Of course I will use your suggestion for the button... πŸ˜‰ admin-pw-panel.mp4
  20. Many thanks Bernhard, for your reply and your time. I’ll surely look at this and try. Then I will update you. Thanks again.
  21. Hi and thanks, From the admin menu (img 01), selecting the relative list-item... Currently it opens as a normal page, but I'm trying to obtain as img 02. .
  22. Hi, I'm setting a custom page via this module ( many thanls to @bernhard for this, to @Soma @bernhard @adrian for their posts, and to all others that raise my level every day ). Awesome stuff! My scenario is to prepare a sort of little vademecum for safe-editors: a simply list of suggestion that they could open while edidting a page, without exit their page and read the custom admin one added via this module, accessible with a specific permission. I've setted all and it works perfectly, but I'm looking for how dispaly this page in panel mode: I suppose (surely I'm wrong... πŸ™‚ ) to have to set a class "pw-panel" in the html link. Well, I've serched along the forum and on the web but I've not find anything useful. I've also tryed (pure guess) to set "link" and "attrs" into the declaration of the page array (at the beginnin of the module), like this way (but it doesn't work): 'page' => [ 'name' => 'allergens', // You guessed! It's the list of the food allergens for a restaurant site :) 'parent' => 'page', 'title' => 'Allergen List', // Could this be correct? // 'link' => $config->urls->admin . "page/allergens/", // 'attrs' => 'class="pw-panel" ' ], Anybody has a suggestion how set panel mode behaviour? Many thanks in advance
  23. Hi all! In free time, I've played a bit with WireMailSmtp. Thanks to a lot of tutorials/explanation found on these forum and in the API pages, I find my way and my settings. For future readers taht maybe could need somthing similar, I've started here, here and here ( tks @ryan, @horst and many other contributors) . The power of PW always impresses... Bye!
  • Create New...