-
Posts
2,010 -
Joined
-
Last visited
-
Days Won
21
Everything posted by dragan
-
Hello @yrglx and welcome to the forum. I have never used OL myself, but PW simply doesn't care what you put in your frontend-templates. Does OL require an API key like Googlemaps? If yes, then this is usually restricted to a certain domain. Do you see any JS errors in the browser console? Are you sure your CSS + JS paths are correct?
-
module Module: ConfigurationForm (multiple fields container)
dragan replied to OLSA's topic in Module/Plugin Development
Evo me opet ? I encountered a strange problem today when I wanted to setup something with required fields: I first hit the module's save-button, then I hit the PW field-save button. And PW can't save the field, because I get errors from the first field that is required (I don't want to prepopulate the fields or use placeholders). This is some kind of a Catch-22 problem I guess ? And also, I see JS errors in Chrome console: When I want to edit a page where I have this field inside, Tracy reports this error: ErrorException: count(): Parameter must be an array or an object that implements Countable in /home/sitecom/www/mysite/site/modules/FieldtypeConfigForm/FieldtypeConfigForm.module:69 Stack trace: #0 [internal function]: Tracy\Bar->Tracy\{closure}(2, 'count(): Parame...', '/home/zeixcom/w...', 69, Array) #1 /home/sitecom/www/mysite/site/modules/FieldtypeConfigForm/FieldtypeConfigForm.module(69): count(Object(stdClass)) #2 /home/sitecom/www/mysite/wire/core/Wire.php(389): ProcessWire\FieldtypeConfigForm->___formatValue(Object(ProcessWire\Page), Object(ProcessWire\Field), Object(ProcessWire\ConfigForm)) #3 /home/sitecom/www/mysite/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___formatValue', Array) #4 /home/sitecom/www/mysite/wire/core/Wire.php(413): ProcessWire\WireHooks->runHooks(Object(ProcessWire\FieldtypeConfigForm), 'formatValue', Array) #5 /home/sitecom/www/mysite/wire/core/Page.php(1436): ProcessWire\Wire->_callHookMethod('formatValue', Array) #6 /home/sitecom/www/mysite/wire/core/Page.php(1364): ProcessWire\Page->formatFieldValue(Object(ProcessWire\Field), Object(ProcessWire\ConfigForm)) #7 /home/sitecom/www/mysite/wire/core/Page.php(1116): ProcessWire\Page->getFieldValue('setup') #8 /home/sitecom/www/mysite/wire/core/Page.php(1600): ProcessWire\Page->get('setup') #9 /home/sitecom/www/mysite/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(470): ProcessWire\Page->getFormatted('setup') #10 /home/sitecom/www/mysite/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/Bar.php(159): RequestInfoPanel->getPanel() #11 /home/sitecom/www/mysite/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-master/src/Tracy/Bar.php(108): Tracy\Bar->renderPanels() #12 /home/sitecom/www/mysite/site/assets/cache/FileCompiler/site/modules/TracyDebugger/TracyDebugger.module(1487): Tracy\Bar->render() #13 /home/sitecom/www/mysite/wire/core/Wire.php(383): TracyDebugger->sessionHandlerDBAjaxFix(Object(ProcessWire\HookEvent)) #14 /home/sitecom/www/mysite/wire/core/WireHooks.php(825): ProcessWire\Wire->_callMethod('sessionHandlerD...', Array) #15 /home/sitecom/www/mysite/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessWire), 'finished', Array) #16 /home/sitecom/www/mysite/wire/core/ProcessWire.php(603): ProcessWire\Wire->__call('finished', Array) #17 /home/sitecom/www/mysite/wire/core/ProcessWire.php(499): ProcessWire\ProcessWire->__call('finished', Array) #18 /home/sitecom/www/mysite/wire/modules/Process/ProcessPageView.module(254): ProcessWire\ProcessWire->setStatus(16) #19 /home/sitecom/www/mysite/wire/core/Wire.php(380): ProcessWire\ProcessPageView->___finished() #20 /home/sitecom/www/mysite/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___finished', Array) #21 /home/sitecom/www/mysite/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'finished', Array) #22 /home/sitecom/www/mysite/index.php(56): ProcessWire\Wire->__call('finished', Array) #23 {main} Any ideas? Did you ever stumble across such a situation? -
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.