Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/14/2019 in all areas

  1. hi, as you might noticed I'm no longer active in the field of PHP and ProcessWire. I tried to continue supporting my modules and wireshell but it turned out that it just doesn't work well if you don't work with it yourself anymore. I would be very happy if someone would be interested in taking over and developing this further. Just write me a message. ? ?
    9 points
  2. ? @justb3a Good luck on your (new) way and many, many thanks for all your contributions !! ? ❤️ ?
    6 points
  3. Yes, perfect use case for RockFinder2 + RockTabulator - built exactly for situations like that. Build a custom admin page, as simple as that (https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/ ) <?php // ... public function execute() { $this->headline("Demo"); $this->browserTitle("Demo"); /** @var InputfieldForm $form */ $form = $this->modules->get('InputfieldForm'); $form->add([ 'type' => 'RockTabulator', 'name' => 'yourlist', 'label' => 'Yourlist Label', ]); return $form->render(); } Set the data: <?php namespace ProcessWire; // set role that is allowed to access this tabulator $grid->access = 'your-role'; // set selector to find pages to show $selector = ['template' => 'yourtemplate']; if(!$this->user->isSuperuser()) { $selector['created_users_id'] = $this->user; } // setup finder $rf = new RockFinder2(); $rf->find($selector); // add columns to show $rf->addColumns(['title', 'foo', 'bar']); // setup grid and return it $grid->setData($rf); return $grid; Then a hook to prevent page edit of pages that where not created by the user (I think there's even a module for that) and some custom JS + PHP and you have exactly what you need. Just clone the repo at https://github.com/BernhardBaumrock/tabulator.test and see the examples ?
    3 points
  4. Looks like a good use for $page->meta ? If you stored the data raw (userid + timestamp) and created the german string + date on render you'd be safe for future updates (multilanguage for example) and you'd be able to change the date time format instantly for all files.
    2 points
  5. That's not a recommendation and a little offtopic, but that sounds a little bit like what I'm always doing with grids (be it RockGrid or RockTabulator). I'm storing everything as pages and I'm listing everything in a grid. That has the benefit of being extremely flexible and extremely user friendly. Users can filter, sort, export, etc and you can colorize and add icons to everything. And (thanks to PW) you can add as many and as custom fields as you want (uploaded by, last edited at etc). For example I'm handling invoices, each invoice is a pw-page and has several fields (date, pdf, date_due, date_sent, etc). This might theoretically also be possible now that we have the new custom image fields, but as ryan mentioned there might be some situations where things will not work). And pages will work ? I'm then creating a Tabulator to list all invoices on a grid (usually that's a lot better for users than finding their way through the pagetree). That's a simple RockFinder2->find(). On a client's edit screen you can even re-use this grid and show the same information but show only invoices that belong to that client. That's a simple $selector['client'] => $client in the grid's data setup file. Using repeaters or file fields is usually a lot more complicated in the long run. IMHO they are great for websites or website content (like showing bullet points of one page or showing a handful of downloadable files on a blog post), but as soon as you are doing some kind of database application it's best to avoid them as much as possible and stick to the "pages and page relations paradigm" using regular pages and referencing them via page reference fields. -- If you really want to show that information directly on the file entry I think that's nothing that the core needs. Just hook in the field markup and show that information. IMHO it does not really matter where you store that info. It could be a custom db table, a hidden textarea storing a json string linking filenames to additional data. Or it could be the new file fields (which - I guess - technically would be quite similar to a solution that uses custom pages + fields and RockTabulator). Maybe you could even use https://processwire.com/api/ref/page/meta/ instead of a hidden textarea + json. Never tried it though ? Sounds like $page->meta + hook could be worth a try ?
    2 points
  6. @Jens Martsch - dotnetic Heh, no problem, that happens here regularly too. :) Let's get back to your first video—I'm trying to figure out how to duplicate this one. I think you could be on to something here because many Fieldtype methods require a Page object, and there is no Page object associated with each image. As a result, we use a fake Page without an ID, and I'm guessing this is the source of the error you are seeing, but I can't figure out how to duplicate the scenario here. Here's what I've done to attempt to duplicate: I've started with a new instance of the "Regular" site profile, added a field-images template, and added fields to it. Logged in as superuser, I edited the /about/ page, uploaded an image to the image fields, and populated all my custom fields with text, and saved. I created a new role named "editor" and checked the box so that it has page-edit permission to "home" (which inherits through the tree). The user doesn't have any other permissions. I created a new user with this role, logged in with it, and edited the /about/ page and clicked to open the images field. I can see all the field text, and modify and save it as well, and changes are retained. So I'm not sure what to try next in terms of duplicating the issue, so I'll ask a few questions; Do you have any field-level access control involved here on your images field, or on any of the fields defined on your field-images template? Did you enable access control on your field-images template? (it should be disabled) Do you have any modules installed that add access control hooks or modify the way access control works? Do you have any optional core permissions installed? (like page-edit-created, page-publish, page-edit-images)? Any other factors you can think of? Thanks!
    2 points
  7. One work-around is to use this package, which I've used with success: https://github.com/tijsverkoyen/CssToInlineStyles
    2 points
  8. *Facepalm* I did not upload an image in the second example *ROFL* . It has been 3 long weeks without resting, please forgive me. After uploading an image, the fields appear. I will test it out further tomorrow.
    2 points
  9. @Jens Martsch - dotnetic Thanks for the videos. Let's focus on your 2nd example first, because I see things in first one that I don't recognize, and it looks like there is access control at the field level too, so lots of factors—let's come back to that one. In your 2nd example (blank installation) you haven't yet uploaded an image into the field, so it doesn't look to me like it should be showing any fields yet. But you are circling something with your mouse, so I'm not sure I understand. But you shouldn't see any of your custom fields if you haven't yet uploaded any files/images yet, so can you try that example again or let me know if I misunderstood? (no need to record it to a video, just wanted to make sure I wasn't missing something).
    2 points
  10. Is my 100th post I wanted to do something special. I edited a video, hope you like it Just for fun Edited: Now with subtitles
    1 point
  11. Yes, there is a way. Just go to permissions -> add new permission. Then under "Install predefined system permissions" choose "page-edit-created" and maybe even "page-edit-trash-created" if you would like that users can trash their own created pages. After saving, add those permissions to the role/s you want to restrict. I did not checked if this is working in the Frontend editor or Fredi, it is working in the ProcessWire admin.
    1 point
  12. Here is my working solution, which looks not exactly as in my example screenshot, because for that I had to use a str_replace. So I added the information below the file. The process is the following: User uploads file. The URL of the file and my custom information string are saved via $page->meta. Then before rendering the PageFile item the URL in the $page->meta is looked up and the custom information appended to the markup. I do this only on pages with a specific template. Here is the code: $this->addHookBefore("InputfieldFile::fileAdded", function ($event) { $pagefile = $event->arguments[0]; //$pagefile->description = "Hochgeladen von {$this->user->name} am " . date("Y-m-d H:i:s"); // not used, because description can be altered by users if ($event->object->data["hasPage"]) { $page = $event->object->data["hasPage"]; if ($page->template->name == "abteilung" || $page->template->name == "fachbereich") { $page->meta($pagefile->url, "Hochgeladen von {$this->user->name} am " . date("m.d.Y H:i:s")); } } }); $this->addHookAfter('InputfieldFile::renderItem', function ($event) { $url = $event->arguments[0]["url"]; $page = $event->object->data["hasPage"]; if ($page->template->name == "abteilung" || $page->template->name == "fachbereich") { $event->return .= "<p>{$page->meta($url)}</p>"; } });
    1 point
  13. I don't see a problem and that's exactly how ProcessWire itself does it...
    1 point
  14. Hey @Sevarf2, the module is using WireHttp. It seems like wirehttp introduced a curl fallback as mentioned here You could try to play around with the options of the send methods in the mailchimp module e.g. trying socket instead of auto (=curl?) as a fallback (here are the options of the send method of http wire https://github.com/processwire/processwire/blob/dev/wire/core/WireHttp.php#L434). Let me know if this makes a difference! Another possibility: Have you made the module work on that same server already? Maybe there are some serversided settings that make problems with curl.
    1 point
  15. @bernhard Regarding a log module: I wrote a hook that logs all deletion of pages into a log file. This is very easy to accomplish. Depending on what you want to log, this can be a big task or a small one. Are you aware of MarkupActivityLog, which logs changes to a page? But maybe that's not what you want, as you talked about admin (superuser) related activities.
    1 point
  16. My goal is to show which user uploaded a file and when in the PW admin when editing a page. Custom fields for files/images in ProcessWire 3.0.142 seem to be a solution for this, but I have to test them a little bit more in my environment, but they seem to work fine in a fresh install.
    1 point
  17. Why? What is your exact goal? Maybe a simple file log would be enough? user foo added image foo-img-1.jpg user foo added image foo-img-2.jpg user bar added image bar-img-3.jpg This could be stored in /site/assets/files/123 and showed on the page edit screen when editing page 123. Even better would be a module that logs serveral kinds of admin activity. I'd need such a module myself - so if that is what you are trying to achieve let's see if we can put something together that is reusable for everybody ?
    1 point
  18. @Kiwi Chris not sure I got all that but I had a scenario where what users could see depended on their roles, ie different data sets. I achieved this with RockFinder (now is RockFinder2). Maybe @bernhard can help?
    1 point
  19. Here's a great step by step guide of what you have to do: https://processwire.com/docs/tutorials/hello-worlds/
    1 point
  20. Hey, @ngrmm! Check out this module by @Martijn Geerts. The description says it has css inliner built in.
    1 point
  21. Latest version adds support for ignoring specific users and/or roles, so that may help a bit. There's no clean way to figure out what is a system action, so I think ignoring the guest user (or some other user/role you use to perform these automated actions) is the best solution we have at the moment. Shorter duration for log rows matching some rule (such as a specific role/user) could be a potential future addition as well, in case there's demand for that sort of thing ? It's been a while (sorry!) so hopefully this has been resolved already. If not, let me know (preferably via GitHub issues, these are much easier for me to keep track of). If this is still occurring, please open a GitHub issue (if possible). I've just tested the module with both Reno and (old) default admin theme's, and was unable to reproduce this. I'm not entirely sure of the specifics, but it seems that adding any published (and non-hidden) page under /processwire/setup/ brings it up in the menu, so not really sure where to start, except that perhaps make sure that you're not using any hooks / modules that might somehow alter menu behaviour. It would be best if you could try this on a blank install: if the issue occurs there, it should be much easier for me to reproduce as well. If not, it's probably something specific to your current setup, which means that we'd have to start by figuring out what exactly is going on there ? Latest version (1.7.1) has two new configuration options (ProcessChangelogHooks config settings): ignored roles and ignored users. I think one of these should help with this ?
    1 point
  22. All good if another way is added to open files in PhpStorm, but I use the editor:// protocol with PhpStorm and never had any problem with it. It's been a long time since I set it up but I expect I followed the PhpStorm docs and I don't remember it being difficult.
    1 point
  23. Thanks for the explanation @Jens Martsch - dotnetic - I wonder if you'd be willing to submit a PR with changes to https://github.com/adrianbj/TracyDebugger/blob/master/docs/configuration.md that detail your approach? Thanks, Adrian
    1 point
  24. Yeah thought often about it, but PHPStorm offers me features that VScode does not have (yet) or are not that comfortable and that are important for me. And I don't switch my editor/IDE just because of this small issue.
    1 point
  25. Hi everyone, Sorry for the silence on this thread. This module is now generously being managed and updated by @wbmnfktr - I have updated the modules directory entry to point to his fork. I am sure he will be able to better support and improve this module than I can.
    1 point
  26. Behind the scenes, repeater entries are individual pages, so when you iterate over an entry (your second loop), you iterate over all the properties of the repeater page. You can see that if you change your code to: foreach ($child->Portrait_Repeater as $data) { $i = 1; foreach($data as $prop => $person_data){ $content .= $i.": $prop => ".$person_data."<br />"; $i++; } } The solution is to remove the inner loop and address the properties by name instead, like $person_data->email, $person_data->position etc.
    1 point
  27. From my experience: Jumplinks and ProCache play really nice together.
    1 point
  28. As @LostKobrakai pointed out on the thread below: You can disable it though.
    1 point
  29. Right, I understand now. You are wanting to give a role (let's call the role "manager") the ability to edit roles/permissions and add new roles/permissions. First thing to know is that in doing this you would be going well off the map of what is documented in ProcessWire and straying into some potentially dangerous territory. Normally only superusers manage roles and permissions, and if you decide to deviate from that you'll want to do your own thorough testing. It sounds risky to me and not something to be done lightly. But I took a look at what's needed to enable this and it seems that the steps are... Manage roles 1. Create new permission "role-admin". 2. Give this permission to the manager role. 3. Open the "role" template at Setup > Templates (you'll need to show system templates in the filter section). On the Access tab allow the manager role to "Edit Pages" and "Add Pages". 4. Open the "admin" template, and on the Access tab allow the manager role to "Add Children". Manage permissions 1. Create new permission "permission-admin". 2. Give this permission to the manager role. 3. Open the "permission" template at Setup > Templates (you'll need to show system templates in the filter section). On the Access tab allow the manager role to "Edit Pages" and "Add Pages". 4. Open the "admin" template, and on the Access tab allow the manager role to "Add Children". You can skip this step if you already did it.
    1 point
×
×
  • Create New...