-
Posts
2,007 -
Joined
-
Last visited
-
Days Won
21
Everything posted by dragan
-
I searched for this module, but found nothing. Do you have a link?
-
Thanks for your time + patience. Unfortunately, this doesn't work at all here, i.e. the hook is not even fired.
- 6 replies
-
- pages::saveready
- hook
-
(and 1 more)
Tagged with:
-
I'd much rather be in a swimming pool with these temperatures outside, alas.... work ? Has anyone ever built Gantt charts with PW? The idea is to visualize somehow who is responsible for which task, when working in a team (e.g. we as agency, client, and a sub-contractor). You have some sort of timeline (week-numbers), and can see who is supposed to work on which tasks from date A to date B. There can be time-overlaps, of course. Is a Gantt chart the established way to go for such things? Or are there other types of charts / graphics that I'm not aware of? So far I came across these JS libraries: https://jsganttimproved.github.io/jsgantt-improved/ https://developers.google.com/chart/interactive/docs/gallery/ganttchart https://frappe.io/gantt If somebody has experience with such tools, I'd happy to hear your opinions. If you've done something like this with data coming from PW, how did you do it? (not asking for a full-fledged tutorial or even code-snippets, just some pointers). I guess you'd setup something like Pro Table, with text and datepicker fields, then create XML/JSON/JS vars from that.
- 2 replies
-
- 1
-
- gantt
- data visualization
-
(and 2 more)
Tagged with:
-
Weird. I've never seen a forward slash in an email address. If I enter the above address in the TO field in Gmail, it's being converted to incoming@incoming.gitlab.com https://www.jochentopf.com/email/chars.html says it's "maybe" allowed:
- 6 replies
-
- formbuilder
- configure
-
(and 2 more)
Tagged with:
-
$this->addHookAfter("ProcessPageEdit::buildForm", function (HookEvent $event) { $page = $event->object->getPage(); if ($page->template->id == 89 && $page->parent->parent->id == 11180) { $repeater = $page->pro_table; $itemCount = $repeater->count(); $c = 1; $grandTotal = 0; foreach ($repeater as $rep) { if($c < $itemCount ) { $num_days = (float) $rep->days; $day_rate = (float) $rep->day_rate; $row_total = $num_days * $day_rate; $rep->row_total = $row_total; $grandTotal = $grandTotal + $row_total; $page->save(); unset($num_days); unset($day_rate); unset($row_total); } if ($c === ($itemCount)) { $rep->row_total = $grandTotal; $page->save(); } $c++; } } }); OK, got it now. Used another hook. Works like a charm.
- 6 replies
-
- 1
-
- pages::saveready
- hook
-
(and 1 more)
Tagged with:
-
I'm trying to update certain repeater fields with a hook. This almost works, but is somehow buggy. Each repeater is supposed to represent a row: service, remarks, number of days, day-rate, row total. The last repeater should then show the grand total. I've tried this: $this->addHookAfter("Pages::saveReady", function (HookEvent $event) { $page = $event->object->getPage(); if ($page->template->id == 89 && $page->parent->parent->id == 11180) { $repeater = $page->offer_calc_repeater; $itemCount = $repeater->count(); $c = 0; $grandTotal = 0; foreach ($repeater as $rep) { if($c < ($itemCount - 1) ) { if (!empty($rep->days) && !empty($rep->daily_rate)) { $num_days = $rep->days; $day_rate = $rep->daily_rate; $row_total = $num_days * $day_rate; $rep->row_total = $row_total; $grandTotal = $grandTotal + $row_total; $page->save(); unset($num_days); unset($day_rate); unset($row_total); $c++; } } if ($c == $itemCount) { $rep->row_total = $grandTotal; } } } }); Most calculations are correct, but: The first one is empty. The second one is calculated wrong. I've tried typecasting (float), or checking with strlen instead of !empty, but that doesn't make any difference. Is the Pages::saveReady the ideal hook for such stuff? (placed in site/ready.php). Also, I get an error message: Session: Method Pages::getPage does not exist or is not callable in this context. Any ideas? Would you perhaps rather do stuff like this via JS?
- 6 replies
-
- pages::saveready
- hook
-
(and 1 more)
Tagged with:
-
Creating New users: addRole doesn't work (sometimes)
dragan replied to Rich Torres's topic in API & Templates
Just a guess: Maybe you need to save the new user first, and then add the role. Also, this looks strange: for ($number; ;) { -
@adrian Thanks for this awesome module! Until now, I didn't have a real use-case for this module, but for an upcoming project I think I might use it. Is it possible to define more than one single branch tree? Let's say I have three areas (parents) I want to allow user x to see/edit, would I define this via "Branch parent to restrict access to"? Is that the way to go?
-
I'm not a UIKit expert by any means. In fact, you should have posted this question in the "dev talk" thread. This doesn't have anything to do with ProcessWire per se. I guess you have the most control if you trigger the alert via JS, and setTimeout(). I don't know if you can fine-tune the animation duration. Maybe someone else who uses this framework regularly knows more.
-
add the classes uk-animation-fade uk-animation-reverse
-
use setTimeout? https://github.com/uikit/uikit/issues/463#issuecomment-47188534
-
There are lots of forum posts with tips, hints and code-snippets, e.g.
-
Ay, that was it. Changed it to $(document).on('afterInit.rht', '.handsontable', function(e, hot) { etc. and it all works as before ?
-
Any idea why this all of a sudden stops working? My config: var colheaders = ['service', 'remarks', 'days', 'day_rate', 'total']; hot.updateSettings({ colHeaders: colheaders, minCols: colheaders.length, maxCols: colheaders.length, rowHeaders: false, minRows: 1, copyPaste: true, autoWrapRowBoolean: true, autoWrapColBoolean: true, wordWrap: true, minSpareRows: 1, maxSpareRows: 1, dropdownMenu: true, columns: [ {}, {}, {}, {}, {}, ] }); In my browser console, I see Uncaught ReferenceError: hot is not defined. The CSS + JS is loaded. in page-edit mode, I only see the field label and: "Please save this page to be able to change this content". No matter how many times I save, the JS error persists and nothing is shown (inline styles set to display: none - even when overriding it, I just see a blank textarea).
-
You should check your template file and all include-files (_init.php, _func.php or whatever you use). As the error msg says: you are re-declaring a function somewhere. With a good IDE you should be able to search across all files and spot it easily.
-
I don't think there will be any problems, but to be sure I'd suggest you backup everything, download the site locally, and try it out with something like Laragon. And while you're at it, it doesn't hurt to upgrade at least to 2.8.62 (latest stable master legacy).
- 1 reply
-
- 2
-
Congrats to such a nice-looking, professional and big site-launch! It depends how you are using it. If you already have the ProFields package, you should have used https://processwire.com/blog/posts/functional-fields/ That way, you can have one central tpl/page, and store every single string that needs to be translateable in one place. For bigger sites, it's a godsend. Read the above post and try it out sometime.
-
@tpr nice portfolio site. You might want to fix your AdminOnSteroids link at the top though ?
-
module Module: ConfigurationForm (multiple fields container)
dragan replied to OLSA's topic in Module/Plugin Development
May I suggest to simply exclude button and file inputs - it's kinda pointless to see them there as available input fields, when in fact they don't (yet?) work. And the mulitlanguage part would be really really awesome. Most sites we build are multilang, so this feature would be almost a must-have, rather than a nice-to-have. Did you post your module to the official PW module directory? https://modules.processwire.com/add/ That way, it would be easier for other people to find your module. And (afaik) this is a pre-requisite if you want people to use the "check for updates" feature in the PW-backend. Zelim ti lep vikend ? -
This is just a wild guess, but from one of the links posted here (the official mySQL docs), I guess this can be also a performance factor: Use the multiple-row INSERT syntax to reduce communication overhead between the client and the server if you need to insert many rows: INSERT INTO yourtable VALUES (1,2), (5,5), ...; This tip is valid for inserts into any table, not just InnoDB tables. I don't know if this syntax is being used by either PW core or the Batch Child Editor module. But I can imagine that it really makes a difference with lots of data being manipulated in one big query...
-
Intermediate site profile: 'foreach' combined with 'and'?
dragan replied to Hans0L0's topic in Getting Started
The second-last example explains it quite well: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } -
Try to increase memory_limit and/or upgrade to PHP 7.2. Are there a lot of files/images inside those pages/repeaters? Perhaps try a clone() action in Tracy Debugger, maybe you'll see some hints what's slowing it down.
-
I just pulled from the dev branch and still get the same error as before (right after new image upload) $title = $language->title->getLanguageValue($language); // line 398 Call to a member function getLanguageValue() on string And also: line 229-231: PHP Warning: stripos() expects parameter 1 to be string, array given latest PW dev installed, PHP 7.2
-
Creating a Photo gallery with the new FancyBox Jquery script
dragan replied to PhotoWebMax's topic in General Support
Do you get error messages? Activate debug-mode and see if you get errors. Perhaps also install Tracy Debugger. "it doesn't work" is not a helpful bug-report ? If you show us the lines of code you're using and the corresponding error messages, we might be able to help. Not that I'm aware of. afaik there hasn't changed that much in terms of image-handling in PW. Additions and modules: yes, but the basic API methods still work the same. I can recommend this script: http://photoswipe.com/ It doesn't depend on jQuery or any other framework, it's vanilla JS, and very flexible.