Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by bernhard

  1. hi abdus, thanks for your effort on helping others maybe i can suggest you to take a tool that lots of people are using here for creating micro-screencasts as animated gifs: http://www.cockos.com/licecap/ very easy, very helpful
  2. hi codecoffeecode, you can try to use something like my solution for your import if you are only doing the import once (and not need your users to be able to import anything). it's very easy to import all kinds of data like this. adrian will be offline for some weeks... hope that helps
  3. just wanted to let you know that i found a very nice jsdiff library today that is ideal for this usecase (line-based diff): https://github.com/kpdecker/jsdiff/ i'm not sure any more if a module like this would make sense, though. i built a module that makes adding and removing fields and templates very easy: public function ___upgrade($from, $to) { // define variables $fat = $this->wire->modules->get('FieldsAndTemplatesHelper'); $pages = $this->wire->pages; // upgrade if($from < $to) { // 001 if($from < 1 AND $to >= 1) { $this->message("upgrade v001"); // create templates and fields $t_clients = $fat->createTemplate('clients'); $t_client = $fat->createTemplate('client'); $f_domain = $fat->createField('domain', 'text'); $f_nossl = $fat->createField('nossl', 'checkbox'); // early exit if anything went wrong if(!$t_clients) return; if(!$t_client) return; if(!$f_domain) return; if(!$f_nossl) return; // apply settings $t_clients->noParents = -1; $t_clients->childTemplates = [$t_client->id]; $t_clients->childNameFormat = 'title'; $t_clients->save(); $t_client->noChildren = 1; $t_client->parentTemplates = [$t_clients->id]; $t_client->save(); $t_client->fieldgroup ->add($f_domain) ->add($f_nossl) ->save(); // create page $p = new Page(); $p->template = $t_clients; $p->parent = 1; $p->addStatus(Page::statusHidden); $p->addStatus(Page::statusLocked); $p->name = $p->title = 'MyClients'; $p->save(); } // 002 if($from < 2 AND $to >= 2) { $this->message("upgrade v002"); } [...] in many occasions it would not make much sense to have the diff-tool because you would have to change the code anyway, eg: $t_clients->childTemplates = [$t_client->id]; and all the correct names of the options can easily be inspected via code inspector: so... i guess i will not take this further or are there other opinions?
  4. i came up with this solution today: WARNING: your site/config.php should NOT be writable by your php user, so you would have to be careful about file permissions: https://processwire.com/docs/security/file-permissions/ usage: updateConfig('/path/to/your/site/config.php', [ 'httpHosts' => ['domain1.example.com', 'domain2.example.com'], 'dbName' => 'my_db', 'dbUser' => 'my_db_user', 'dbPass' => 'my_db_password', ]); function: /** * update config file */ function updateConfig($file, $options = []) { if(!is_file($file)) return 'file not found'; $content = file_get_contents($file); // loop all set options foreach($options as $key => $val) { $search = '/\$config->'.$key.'(.*);/'; if(is_array($val)) $replace = '$config->'.$key.' = array(\'' . implode("','", $val) . '\');'; elseif(is_int($val)) $replace = '$config->'.$key.' = ' . $val . ';'; elseif(is_string($val)) $replace = '$config->'.$key.' = \'' . $val . '\';'; else return 'value must be array, integer or string'; $content = preg_replace($search, $replace, $content); } return file_put_contents($file, $content); } maybe it helps someone
  5. just wanted to mention that there could be another option if somebody is not happy with an ajax solution: https://processwire.com/api/modules/lazy-cron/ not enough time to investigate further, but i wanted to put the reference here...
  6. hi tpr, is it already possible to disable the datatable filter via adding a class like .no-aos-filter to a parent element? if yes, could you show me how (or where it is in the docs, i didn't find any information). if no, would you be willing to accept this as a feature request? i'm building some custom tables with my datatables module and your filterbox is interfering with my UI thank you
  7. yeah, i also thought about that, but caching the whole table is a lot easier in my scenario and is good enough regarding user experience i'm using datatables with the ajax option. i had some bad performance issues using the markup/html option first. the ajax option is nice to show a loading indicator and to be able to do an easy update of the data - as simple as DataTable().ajax.reload() thank you for all your feedback
  8. so simple, i didn't think of that! thank you
  9. hi all, i have a complex table where it takes 20sec to generate the data. i use markupcache to reduce loading time if nothing has changed since the last display. now it would be great to be able to regenerate this cache everytime a page of a special template was saved. i know how to do that via pages::saved but thats not exactly what i want because then it takes 20sec to display the page after saving it. is it possible to execute this code AFTER the page is rendered and sent to the visitor? I'm working only in the admin, so i tried ProcessPageView::finished() but that also delays the output of the page render. any ideas? is this technically possible or would i have to use a cronjob checking for changes every x seconds? other question: can i limit the amout of CPU used somehow? the problem is, that the server does not react while calculating my table data... thank you for your help!
  10. thank you for the quick reply. i tried a lot yesterday without progress. i just had idea 4 while writing the post and it was really easy: $this->addHookBefore('Pages::save', function($event) { $user = $this->wire->user; // checks depending on the page that was saved? // $page = $event->arguments(0); // early return if user is allowed to save in general if($user->isSuperuser()) return; if($user->hasRole('senior')) return; if($user->hasRole('marketing')) return; if($user->hasRole('office-management')) return; // throw error if user is not allowed to save throw new WireException('You are not allowed to edit this page!'); }); this works quite well. of course with the drawback that all save and add-new buttons are visible (also on pagetable fields and some other spots). but i think that's the quickest and cleanest solution for my setup... but still i would be interested how to hook the editable state of a field. so i would still appreciate some advice here
  11. hi everybody, i developed an intranet application for a client. now we want to grant access to some more employees that get the "employee" role. employees should be able to see all the data (meaning they have to have edit access to see all the input forms holding data for all the fields) but not EDIT this data. which approach would you go? i see this options change all field access settings to make fields non-editable by this role but visible in page editor (would work, but i want to save me from that work) set field access settings via api (how?) hook Field::editable --> does not work. i guess it is only called when field->useRoles is true. Don't know how to hook correctly here. prevent only the page save for this pages totally different approach? thanks for your help!
  12. That sounds like a baby on steroids!!! Congratulations!
  13. https://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-conditional-hooks
  14. awesome screencast, nurguly. easy to follow, well explained and well spoken. it helped me a lot to get a better understanding what your module does and what could be done! i'm curious what will be built on top of this
  15. hi @kongondo what do you think of adding a feature that the field loads files with the same filename automatically when they exist? for example a field "runtime_demo" would load /somefolder/runtime_demo.php and /somefolder/runtime_demo.js i do it manually right now. for sure no problem but i think that would help to keep everything clear if you are using custom markup a lot edit: is there a reason why my file is loaded 3 times when using wirerenderfile? if i only put bd('test!'); into the file, then i see it 3 times in the tracy log. i setup a datatable with my module and loaded the code in the runtime markup field. i had my columns 3 times. i fixed it with an if-statement, but still i would be interested why the file is called 3 times...
  16. thanks for making me aware of this! works only on left-aligned panels though... https://github.com/processwire/processwire/blob/50f2834a0ae2a9f9f2ac53439184ebdc04db2f54/wire/modules/Jquery/JqueryUI/panel.js#L411-L432 better than nothing
  17. I'm talking about the built in panel. Just add the class "pw-panel pw-panel-right" to a link and it opens in a sidebar panel like this: It's similar to the modal, but newer and i prefer it over modals. It's great to open PDFs for a preview for example. Or to open items in my datatables. See \wire\modules\Jquery\JqueryUI\panel.js for details. Would be awesome to make those panels draggable
  18. hi tpr, the draggable devider looks great. would it be possible to add this feature also to the core pw-panel?
  19. i guess the browser strips your form because it is inside the processwire form that contains all the inputfields and a form inside another form is not valid html. the inspector shows you the code after browser and javascript manipulations. if you view the raw sourcecode you maybe see your form element. http://stackoverflow.com/questions/555928/is-it-valid-to-have-a-html-form-inside-another-html-form
  20. i am quite busy those days so i missed that yeah i was not sure about that as well. i thought of placing it beside the open/close toggle of the field label.
  21. hi @tpr, it would be nice to have a "fullscreen" button for some of my inputfields in my current project. it seems to be quite easy to make the inputfields content div fullscreen like this: .fullscreen { height: 100%; width: 100%; left: 0; top: 0; overflow: scroll; position: fixed; z-index: 999; } i need it for my datatables fields, but i'm thinking if that would maybe also interesting for other fields. that's why i thought creating a module. and then i thought that could maybe be interesting for AOS as well. like having a toggle icon to make CKE fields fullscreen? with fullscreen i mean full browser window what do you think?
  22. hm... i looked to your github docs and it seemed that it has more features than only populating fields from github. even though it would be nice to get the bigger picture. are you listing several github projects on your site? like listing several tutorials that are hosted on github?
  23. very nice, thanks for bringing my attention to jasonette! i created this shorturl to save me from typing: https://goo.gl/XUB7jb unfortunately the all links do not work for me. neither with the original url. only link working is the external link to your website... any ideas? (android)
  24. as i said: maybe you took care of it on mobile just wanted to let you know: http://ohmspeaker.com/speaker-filter/?width=14&height=15&price=3200&distance=21
  25. same request as with your guid module. could you please provide a simple usecase what you use it for? sometimes that brings up new ideas in my head
×
×
  • Create New...