Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by bernhard

  1. You could try https://electronjs.org/ - I haven't tried it yet but I guess this should be quite simple to learn/use for a webdev ?
  2. Hey guys, I played around with this idea a little more, because I have 3 projects where I need similar functionality and I really don't want to build all that functionality over and over again for every single project (and all future ones). I created a short screencast that shows how it works. The concept is to hook into ProcessLogin::execute, because this method is what every guest user will see regardless of what admin page he requested: $wire->addHookAfter("ProcessLogin::execute", function(HookEvent $e) { $requestedPage = $this->session->getFor('ProcessPageView', 'loginRequestPageID'); $process = $this->pages->get($requestedPage)->process; $segment = $this->input->urlSegment1; $method = 'execute' . ucfirst($segment); // debug info if(function_exists('bd')) { bd($requestedPage, 'requestedPage'); bd($process, 'process'); bd($segment, 'url segment'); bd($method, 'method'); } // prevent infinite loop if($process == 'ProcessLogin') return; // prevent warning on loginpage without /login urlsegment if($process == 'ProcessPageList') return; try { $e->return = $this->modules->get($process)->{$method}(); } catch (\Exception $e) { $this->error($e->getMessage()); } }); ProcessGuest.module is a simple module that shows that this concept actually works pretty well: <?php namespace ProcessWire; class ProcessGuest extends Process { public static function getModuleInfo() { return array( 'title' => 'GuestAdmin', 'summary' => 'GuestAdmin to ProcessWire', 'version' => 106, 'permission' => 'page-view', 'page' => [ 'name' => 'guest', 'title' => 'Public Guest Page', ], ); } public function execute() { $this->headline('execute()'); $this->wire('processBrowserTitle', 'execute()'); $form = $this->modules->get('InputfieldForm'); // create fieldset $fs = $this->modules->get('InputfieldFieldset'); $fs->label = 'This is a public backend page demo'; // add status inputfield $f = $this->fields->get('title')->getInputfield(new NullPage()); $f->label = 'foo'; $f->columnWidth = 30; $fs->add($f); // add button field $b = $this->modules->get('InputfieldButton'); $b->value = 'Demo button'; $b->icon = 'bolt'; $f = $this->modules->get('InputfieldMarkup'); $f->columnWidth = 70; $f->value = 'Vestibulum rutrum, mi nec elementum vehicula, eros quam gravida nisl, id fringilla neque ante vel mi. Duis leo. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Sed aliquam ultrices mauris. Vivamus euismod mauris.<br><br>'; $f->value .= $b->render(); $fs->add($f); $form->add($fs); $form->add([ 'submit' => [ 'type' => 'submit', 'value' => 'submit', ], ]); return $form->render(); } public function executeFoo() { $this->wire('processBrowserTitle', 'executeFoo()'); $this->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.js'); return 'foo <div id="moment"></div><script>$("#moment").text(moment().format());</script>'; } } See it in action (and notice that the user is NOT logged in): Of course, this is a dirty hack, but it seems to work quite well and it might be good enough for a first proof of concept implementation to get ryans attention about it. What do you think? Unsolved problems so far where I could neet your input: Everything is centered - where does this styling come from? I know that the login-form get's centered, but I didn't find the exact class/script that is responsible for it so I couldn't remove it. Any ideas how we could use a similar technique but with a custom admin url so that we could mask the original admin url of the backend? Maybe hooking into a 404 exception? Or creating a custom frontend page? But how could one render an admin page then? $this->headline() does not work, so there might be other things not working with this technique...
  3. Great!! Thank you very much, will try it soon ?
  4. Hi Adrian, just tried your suggested method on another website where I only have guest + superuser. It does not work as expected, or I'm missing something. When I start a user switcher session and logout, I get the debug bar, but I still cannot open the console. So it is not possible on that site to do some quick console tests and dumps... This would be really helpful on that setup. Or is there another hidden way how I could use the console as guest user? Would be great to have the guest user available in the switcher! Thx
  5. Why don't you just render a submit button in your field? When sending is ON you could just display the emergency-stop-button. When sending is OFF you could disable something like a continue-sending-button. Don't know how your module works regarding the starting of a sending process... Is it done via AJAX or via a regular form submit? You checkbox toggle looks nice though. Many roads as always ?
  6. ProcessWire does not dictate which Framework you use on the frontend. The blog profile is just an example, and in this example Uikit is used. You could though, also use any other framework. Or none. That's up to you. Have a look at the blank profile. Do the Hello World Tutorial again and then add your three.js library there. While I guess that nothing really changed since when you did it the first time, your brain might be happy to get a refresher ? Putting Code into Textarea fields is possible, but I'd not recommend it unless you are advanced and really know what you are doing.
  7. +1 for dropping support. Maybe adding a check before upgrade and showing a warming/hint that older php versions can use the old tracy module (that is already great) with a link where to download it?
  8. Hello gbball and welcome to the forum, WebGL is a browser technology, so everything happens on the client side and has nothing to do with ProcessWire. You just have to make sure your library gets loaded on your page. The docs of three.js show you how you do that: https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene This sounds good to me ? Did you do (DO, not READ ? ) the hello worlds tutorial? https://processwire.com/docs/tutorials/hello-worlds/ This might help you to understand the basics of PW and might make it easier to do the right things when going through the three.js docs.
  9. Hi mel47, sorry to hear that. Check your finder with RockFinderTester, maybe it is somehow broken. If that does not work you can write me a PM support request and maybe provide a login to your system so that I can check what is going on. You need to make sure that the response of the AJAX requests are valid JSON. Also check all your error logs, maybe you find some helpful information there.
  10. Hm... Just got reminded about this post. Actually I think it's not the best idea to have a render() and renderReady() method in a Fieldtype module. That are methods that belong to an Inputfield module and I think it's not good to mix them up... I'd be more than happy though to have a good and extensive documentation about developing fieldtypes for ProcessWire...
  11. They need to have the permission of the module and the permission of the page. If you don't assign any permissions the pages should be visible for all users.
  12. https://processwire.com/api/ref/sanitizer/test-all/ can be helpful in such cases
  13. $photos = $pages->find("template=portfolio_image, city=[template=city, has_parent=$country]"); This does not work?
  14. You could also use sub-selectors: https://processwire.com/docs/selectors/#sub-selectors
  15. Dont know if that's the best option, but you could use two selectors: $cities = $pages->findIDs("template=city, parent=yourcity"); $photos = $pages->find([ 'template' => 'photo', 'city' => $cities, ]); Another option would be a saveReady hook that populates the country on each photo save. And I'm quite sure there are even better solutions ?
  16. If you don't need minification then just don't use it ? RockLess is enough to make your uikit less work. I built it exactly for that... If you need minification for performance reasons I'd also recommend using ProCache, because it will not only minify your site but also deliver it via htaccess as static files and the performance benefit will be huge!
  17. Ok, I understand ? But even then I'd say it's easier to build in the backend than in the frontend: And that's all the code that is needed: public function ___execute() { /** @var InputfieldForm $form */ $form = $this->modules->get('InputfieldForm'); $form->add([ 'credit' => [ 'type' => 'markup', 'label' => 'Guthaben', 'value' => $this->files->render(__DIR__ . '/markup/credit'), 'columnWidth' => 25, ], 'trainings' => [ 'type' => 'markup', 'label' => 'Trainings', 'value' => $this->files->render(__DIR__ . '/markup/trainings'), 'columnWidth' => 25, ], 'shop' => [ 'type' => 'markup', 'label' => 'Buchung', 'value' => $this->files->render(__DIR__ . '/markup/shop'), 'columnWidth' => 50, ], 'dashboard_history' => [ 'type' => 'RockGrid', 'label' => 'Verlauf', 'ajax' => false, ], ]); return $form->render(); }
  18. I strongly disagree. The admin is built exactly for such tasks. It's a content MANAGEMENT SYSTEM. So why should it not be capable of managing projects? You have all you need in the admin: Access control, forms, hooks, fields, conditional fields, several listing tools (*hint* RockGrid *hint*), etc. That would be a LOT of work to rebuild on the frontend! I know it feels hard in the beginning, but it just makes a lot of sense to use the tools we already have instead of rebuilding it from scratch. You'll learn a lot of useful stuff for other PW projects and you'll build modules that you can reuse (or share).
  19. A different approach that has already been discussed would be an image reference field: https://www.google.com/search?q=site:processwire.com+image+reference+field
  20. You can also just change your login credentials or take the site offline ?
  21. This does not help because tracy and the file editor panel do not work on this host. Also, you should never make any admin login data public, please remove it from your post, even if it is a temporary host. Did you do (and I mean DO, not READ) the hello world tutorial? https://processwire.com/docs/tutorials/hello-worlds/ PS: I got several 502 bad gateway errors on your install, so you might have server issues that cause several problems...
  22. Thx adrian, I see your intention now ? I just tried the user switcher and I have everything I need there. Is there a reason for the guest user not being selectable in this panel? It might be helpful to switch to a guest user as well and have tracy for debugging (console, dumps, etc)?
  23. Thank you very much adrian!
  24. no change. the debug bar is here, but the console does not show up:
×
×
  • Create New...