Jump to content

bernhard

Members
  • Posts

    6,629
  • Joined

  • Last visited

  • Days Won

    358

Everything posted by bernhard

  1. Wow, how could I miss that one! ? Thx
  2. I've of course tried it in an incognito window... I'll try that next time with another installation ?
  3. Hi @Macrura, this looks brilliant! Thx for sharing it with us ? Do you think the module could also be used for text-block suggestions like shown here? On my quick glance it seems this would need extra steps, at least for multiline textblocks?
  4. Thx for clarifying. That doesn't work here on Win10 + Chrome ? I don't find any occurances of "favicon.ico" in the wire folder, so I guess your browser is making you see the favicon, not ProcessWire?
  5. I agree 100% to what @wbmnfktr said! If you want to get rid of repeated task jump into module development and build reusable components that you can share. Far better than putting many sites under one hood. I know what I'm talking about - I've also done that once and regretted it lateron ? Building modules also has the benefit of being more flexible (you don't end up in all sites having the 100% same setup) and last but not least: You can share them with the community ?
  6. Not sure if anybody is already using it... I'm using it every day and I'm extending the api from time to time. Today I added a setFieldOrder() method. Now it is quite easy to change the order of fields and set new column widths: // adjust field widths $rm->setFieldData('project', ['columnWidth'=>33], 'rockinvoice'); $rm->setFieldData('inv_date', ['columnWidth'=>33], 'rockinvoice'); $rm->setFieldData('type', ['columnWidth'=>34], 'rockinvoice'); $rm->setFieldData('invoicetomarkup', ['columnWidth'=>100], 'rockinvoice'); $rm->setFieldData('due', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldData('paid', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldData('num', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldData('sap', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldOrder([ 'type', 'invoicetomarkup', 'due', 'paid', 'num', 'sap', ], 'rockinvoice');
  7. Sorry, don't get what you are saying... Where do we have to add the favicon.ico to be desplayed in the backend? ?
  8. Have you had a look at PageArray.php? And in WireArray.php: Not sure if it should return a NullPage or null/false - but I guess it should be consistent... To add one more: findOne() returns "false" ?
  9. Likely _main.php is being appended automatically: https://www.google.com/search?q=site:processwire.com+appendtemplatefile
  10. Thank you @Robin S for that snippet! One can also use fontawesome icons with this service: https://gauger.io/fonticon/ Just download the .ico to your website and include it like robin showed above: $this->addHookAfter('AdminTheme::getExtraMarkup', function($event) { $extras = $event->return; $extras['head'] .= '<link rel="shortcut icon" href="/site/templates/img/favicon.ico">'; $event->return = $extras; }); ?
  11. Thx @Autofahrn, but my quick test was at first glance nice, but it seems it is not 100% what I want... I put this hook in ready.php $this->addHookBefore("ProcessPageView::finished", function() { bdb(debug_backtrace(), 'finished'); }); This looked ok, but then I cloned my site and the "coneInvoide()" method did not show up in the backtrace. I did a debug_backtrace() in that method and - of course - it showed up there and showed a somewhat helpful dump. BUT: The problem is, that often I don't know what is going on where, so you can't just place a debug_backtrace() somewhere in the code, because you simply don't know where you'd have to put it. Do you know what I mean? Maybe I have to give xdebug another try...
  12. Hi @Autofahrn, thx for that suggestion. I did not try that. But I'm not sure how I should/could do that to get a helpful output? I've found the issue, but would still be interested in a way to show a backtrace of all executed hooks ? I've added a file_put_contents(... FILE_APPEND) to WireHooks::runHooks() to dump all executed hooks to a file called hooks.txt. That could be a first step in the direction that I wish would exist already. The issue in my case was that my CRM module was loaded twice, so all methods added via hooks actually ran twice. I found that by inspecting the debug mode tools, where my cloneInvoice() method showed up twice (and so did all other CRM hook methods). The solution was to make the module "singular" (and do a module refresh). But still I think it would be great to have a chronological list of all executed hooks so that one can instantly see which hook fired when (and after/before what other hooks).
  13. Hello everybody, I have this allegedly simple hook to clone an invoice: public function cloneInvoice($event) { // check if this invoice is valid to clone $old = $event->object; if($old->template != 'invoice') throw new WireException("This is not a valid invoice to clone!"); // create clone $new = $this->pages->clone($old); $new->invoicenum = null; $new->date = time(); $new->datedue = null; $new->datesent = null; $new->datepaid = null; $new->pdfs->removeAll(); $new->save(); // return newly created page $event->return = $new; } The problem is, that $this->pages->clone() creates TWO copies of the page. There must be some other hook firing on page save or the like. But I can't find which one it is and I wonder how you debug such things? I've once tried something that I called hook-recorder, but that project never saw the light of day. Are you using XDebug? Or are there any tools that can help in such situations? Tracy maybe? The only thing that I know so far is that the code above fires ONCE but creates two copies. Thank you for your time ?
  14. Not sure if anybody is watching what's going on in the requests repo or here in the forum... nevertheless, if you find this idea good, please support it on github: https://github.com/processwire/processwire-requests/issues/305
      • 2
      • Like
  15. Hi @wiredny, welcome to the forum. Please be more precise. What navbar are you talking about? Are you using one of the default site profiles? Can you share the code that is rendering the menu?
  16. Glad it worked ? Yeah, it's good old SQL and RockFinder taking away the complexity of getting all fields related to a page/template and taking into account PW statuses. Though one has to be careful about access control related to fields, related pages, referenced page statuses etc...
  17. Hi Beluga, is this a tabulator grid? Is it a custom module or the rockgrid extension you've linked some time ago? Regarding your join: I think in that case it would be the easiest to join them via plain sql; Something like $foo = $finder1->getSQL(); $bar = $finder2->getSQL(); $sql = "SELECT * FROM ($foo) AS foo LEFT JOIN ($bar) as bar ON (foo.col1 = bar.col1 AND foo.col2 = bar.col2)"; $this->setData($sql); PS: Be careful when joining / listing tables that have same name columns! This can lead to different results in the grid than in the resulting sql table. Compare the results to a regular SQL client by copying the resulting sql and executing it in Adminer and similar...
  18. Important security update! Hi RockGrid users, I'm very sorry for that, but I have to announce a security update. If you are using RockGrid on a public site please upgrade to v0.0.22 (Fieldtype) immediately. It is a simple but important update: https://github.com/BernhardBaumrock/FieldtypeRockGrid/commit/0be2086139c84f775937246ed2985ac4c4a3e9c3; The proplem exists on all RockGrid fields with AJAX turned ON. In this case it was theoretically possible to expose the field data to a user that should not be allowed to see this data (in the worst case even a guest user) if the user knew how to do it and he also knew the name of the rockgrid field. The update now restricts access for AJAX field data to superusers only. You can easily adjust that via simple hooks: // rockgrid access control $wire->addHookAfter("InputfieldRockGrid::access", function(HookEvent $event) { // all grid data is accessible for all logged in users $event->return = $this->user->isLoggedin(); }); Or more granular via the fieldname: // rockgrid access control $wire->addHookAfter("InputfieldRockGrid::access", function(HookEvent $event) { $field = $event->arguments(0); $user = $this->user; $access = $event->return; switch($field) { case 'field1': case 'field2': case 'field3': $access = $user->isLoggedin(); break; case 'field4': $access = ($user->name == 'foo'); break; } $event->return = $access; }); Field 1-3 is allowed for logged in users, field4 only for user foo and all other fields only for superusers (default rule). I'm not totally happy any more with several aspects of RockFinder and RockGrid, but it is the best option I have so far (until I can build something totally new, maybe with tabulator if tests work well). Special thx to @Zeka for bringing this issue to my attention by coincidence in the other topic!
  19. Thx @LostKobrakai for pointing me to the right spot in the docs! I use math.format with a precicion of 14 now for all calculations. v0.0.6: v0.0.7:
  20. Not sure I understand your question. Why don't you just look them up in the css files or browsers devtools?
  21. Interesting topic, I'll need this soon. RockGrid is sending Requests to the current page appending ?field=myfield so that it makes sure it gets loaded (even if it's set to ajax). But I want to take a different route for the next version. It's easier and cleaner to have one single endpoint url imho. I think @Robin S mentioned that somewhere but can't find it..
  22. It's a WIKO phone, Android + Chrome https://www.amazon.de/gp/product/B01EM2SUL2/ Another thing I just found: https://mawsonshuts.antarctica.gov.au/preparation/australia-and-antarctica/ The edited date is in the footer, so for me this seems like the whole website was last updated in 2011... Maybe that could be moved to the content block of the site.
  23. Just try it without and see what happens: Nothing ? If you are not on a page edit screen PW doesn't know where to upload your file so you need do tell it manually. You could also do a move_uploaded_file() but that does not sanitize your data.
  24. Whenever you need something think "Where is it done in the core" and grab ideas from there ? You can see how it is done in ProcessModuleInstall.php I've done it that way recently: $tmpDir = $this->files->tempDir('upload_csv'); /** @var InputfieldFile $f */ $f = $this->modules->get('InputfieldFile'); $f->attr('id+name', "upload_csv"); $f->label = 'foo'; $f->icon = 'download'; $f->extensions = "csv"; $f->maxFiles = 1; $f->descriptionRows = 0; $f->destinationPath = $tmpDir; // when the form is submitted: /** @var WireUpload $ul */ $ul = $this->wire(new WireUpload($f->name)); $ul->setValidExtensions(explode(" ", $f->extensions)); $ul->setMaxFiles($f->maxFiles); $ul->setOverwrite($f->overwrite); $ul->setDestinationPath($f->destinationPath); $ul->setExtractArchives(false); $ul->setLowercase(false); $files = $ul->execute(); if(count($files)) { $file = $f->destinationPath . reset($files); // do something with your file } else { $this->error('No uploads found'); } There is an issue with ajax loaded fields: https://github.com/processwire/processwire-issues/issues/885 And it seems that ZIP is always added to the allowed file endings... Can anybody confirm that? PS: Don't you use TracyDebugger? It's a lot better than using print_r() ?
  25. https://github.com/processwire/processwire/tree/master/site-blank/templates https://github.com/processwire/processwire/tree/master/site-beginner/templates https://github.com/processwire/processwire/tree/master/site-classic/templates https://github.com/processwire/processwire/tree/master/site-default/templates https://github.com/processwire/processwire/tree/master/site-languages/templates https://github.com/processwire/processwire/tree/master/site-regular/templates Just compare your folder/file structure with the original one, especially /site/templates/readme.txt
×
×
  • Create New...