Jump to content
adrian

Admin Actions

Recommended Posts

15 hours ago, tpr said:

I think the admin UI could be re-arranged into a table layout:

  • first column: action names
  • second column: description/notes
  • third column: applied roles + and Edit button, that opens a modal or perhaps only unhides the role asmSelector. Alternatively you can set the asmSelect to operate in "inline" mode, I've experimented with that and it worked.

I know it would take some time, but sooner or later this has to be done :)

 

You like to keep me busy don't you :)

How's this?

Screen Shot 2016-12-21 at 4.26.13 PM.png

That along with a few tweaks/fixes has been committed.

Don't forget to fork and contribute :)

  • Like 5

Share this post


Link to post
Share on other sites

Looks really sharp!  I'll print a screenshot and put it under the Christmas tree :)

One thing though. Doesn't cook coffee :)

  • Like 1

Share this post


Link to post
Share on other sites

Here are is a SCSS snippet if you would like to use inline roles (I'm not liking those big green asm items). It also enables removing roles by clicking on its label (not only on its icon), "user" icon instead trash and there's a line-through effect on hover too. You can use an online tool to make CSS from it.

Spoiler

table.adminactionsconfig {
  .Inputfield[id^="wrap_"] {
    background: transparent !important;
  }
  .InputfieldContent, label {
    padding: 0.25em 0.25em 0 !important;
    border: none !important;
    background: transparent !important;
  }
  .asmList {
    margin-top: 0.25em !important;
  }
  .asmListItem {
    padding-left: 8px !important;
    margin-right: 8px;
    display: inline-block !important;
    width: auto !important;
    font-size: 14px;
    background: transparent !important;
    border-color: transparent !important;
    color: inherit !important;
    &:hover {
      .asmListItemLabel {
        text-decoration: line-through !important;
      }
    }
    .asmListItemRemove {
      left: 0 !important;
      right: 0 !important;
      bottom: 0;
      top: 1px;
      &:not(:hover) {
        i {
          &:before {
            content: '\f007';
          }
        }
      }
    }
    i {
      margin-left: 2px;
      &:not(:hover) {
        color: #EA2262;
      }
    }
  }
}

 

 

adminactions-roles.gif

  • Like 3

Share this post


Link to post
Share on other sites

Thanks @tpr - I have implemented that, although I was a little hesitant. I certainly like the look, but I was worried about the consistency of the interface compared to what we're used to with ASM Selects. Curious why you haven't done this for the roles settings in AOS?

Share this post


Link to post
Share on other sites

Thanks! Good question - actually I haven't thought about that before your question. Perhaps because I didn't know that asmSelects can be used without the sort feature (although there's no need for that in AOS at all).

Share this post


Link to post
Share on other sites

The latest AOS contains this tweaked role selector appearance. Thanks for the tip! :)

The only difference is that I use the "user" icon even on hover, I think the line-through is enough signal for the removal.

Share this post


Link to post
Share on other sites

Merry Christmas, @adrian!

Want to try to use your action module in a slightly different way. I need to be able to execute actions from outside of PW (from emails). I am planning to solve this task kind of like in this module: I will have a page for each callable-from-outside action with some random security string and some options.

But I want to try to make it a little more customizable. I plan to write new actions for Admin Actions module, call them from API like you said it is possible to and pass options stored in some field of the callable-from-outside action page.

Do you see any caveats? Can you suggest a field to store options? Is there a way to turn off auto-backup feature (at least for the from-API usage or by configuration)?

  • Like 1

Share this post


Link to post
Share on other sites

Hi @Ivan Gretsky

I think I would store the options in a textarea in json format so you can easily convert to an array to pass to the action via the API call.

Are you planning on having the security string in the link from the email and handling the authentication in the logic on your pages? 

Currently the automatic backup can't be turned off, but I agree that this should be possible. I'll do it as a configurable option and also add an option to turn it off via an API call.

Let me know if you come across any issues once you start setting this up and I'll see what I can do to make AdminActions work as needed for you.

  • Like 2

Share this post


Link to post
Share on other sites

I did already managed to write a simple action and launch it via the API. I am currently going with a json in a textarea (but also looking at this field).

  1. Mandatory backup is problem 1.
  2. I had to give admin-action permission to the guest user. Not sure how dangerous is that. Is there a way to get around it?
  3. I am planning to have some security string stored in a dedicated field on the callable-from-outside action page which the token input value will have to match. Is there anything else you recommend?
  4. Not sure what you mean under handling authentication. Currently the script is running from the guest user.

Share this post


Link to post
Share on other sites

Hi @Ivan Gretsky - I've added some options for controlling the automatic backup (not committed yet) and I am thinking about the guest user access for making calls to actions via the API. I am considering a couple of different options and will put together something in the next couple of days. Hope that works for your timeframe?

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @Ivan Gretsky - ok, a new version has been committed that adds a new module config setting for determining whether database backups will be automatic, optional, or disabled.

1) Automatic - database backup will happen without user intervention.

2) Optional - adds a new checkbox at the bottom of every action's "options" form before the user clicks "Execute Action". 

3) Disabled - this means no database backup will occur.

If you do want to do a backup when calling an action via the API, simply add a new item to the options array: 

'dbBackup' => true

 

I am still working on figuring out the best approach for guest access. The biggest problem I see is that adding the "admin-actions" permission to the guest role means that any logged in user can now see the Setup > Admin Actions menu, even though they don't have permission to view or execute any of the actions.

I have been playing around with adding a new helper module to handle the API calls, rather than calling the main ProcessAdminActions module directly, but there are a couple of inheritance issues I am not thrilled about, so looking into other options. Will hopefully have a good solution soon.

Please let me know if the backup side of things handles your needs on that front.

 

  • Like 3

Share this post


Link to post
Share on other sites

Hi everyone,

I have committed a new version that takes care of @Ivan Gretsky's issues with guest access for calling actions via the API.

The new version also includes the ability to add actions to the Setup > Admin Actions submenu which could be really handy for quick access to key actions that you use regularly. At the moment you could add them all if you want, but perhaps in the future we'll have too many to make this usable, which is why I have made these configurable.

Screen Shot 2017-01-02 at 7.52.53 AM.png

 

See the new "In Menu" column:

Screen Shot 2017-01-02 at 7.53.40 AM.png

  • Like 6

Share this post


Link to post
Share on other sites

Thank you @adrian! It is amazing to watch something being created with such an amazing pace by people like you and ryan. And so much to learn from. I recommend everybody to go through these guys' code to learn how you can be really powerful using ProcessWire.

Another little idea. Not sure it is necessary, but seems logical to me to separate "core" actions and those specific to the site. Like core ans site modules. I can see this module to be a base to easily create little things that would other way need their own process modules. In that case, most of the time I would use only custom actions... A filter option or a tab. What do you think?

I know, that for everybody but admin I can achieve about the same with by-action role assignment. But as I almost always login a superuser myself...

  • Like 4

Share this post


Link to post
Share on other sites
6 hours ago, Martijn Geerts said:

Just to chime in: Fantastic Module @adrian

Thanks @Martijn Geerts - glad you're finding it useful - I appreciate the feedback!

 

20 hours ago, Ivan Gretsky said:

Another little idea. Not sure it is necessary, but seems logical to me to separate "core" actions and those specific to the site. Like core ans site modules. I can see this module to be a base to easily create little things that would other way need their own process modules. In that case, most of the time I would use only custom actions... A filter option or a tab. What do you think?

Hi @Ivan Gretsky - just to clarify - are you talking about simply separating the "core" actions in the module's "action" folder from those "site specific" ones in the /site/templates/AdminActions/ folder?

I think tabs sounds like a good approach - I'll take a look at doing that. Also something else to consider is the tables filter feature of @tpr's awesome AOS module - that will make finding actions nicer once there are lots more, although to be honest sometimes I just like good old CTRL/CMD + F :)

 

20 hours ago, Ivan Gretsky said:

I know, that for everybody but admin I can achieve about the same with by-action role assignment. But as I almost always login a superuser myself...

Just an FYI - if you don't want certain/any core actions available, you can remove the superuser role from those actions and they won't clog up your list of actions.

  • Like 1

Share this post


Link to post
Share on other sites

How about letting a dedicated AdminActions.module handle all the serious work (e.g. like WireActions), so actions are also triggerable via the api? I can imagine that some actions might be useful to be run as part of a migration (shameless plug :D) and not just via the backend.

  • Like 1

Share this post


Link to post
Share on other sites
22 hours ago, LostKobrakai said:

How about letting a dedicated AdminActions.module handle all the serious work (e.g. like WireActions), so actions are also triggerable via the api? I can imagine that some actions might be useful to be run as part of a migration (shameless plug :D) and not just via the backend.

 

They are already triggerable via the API: 

$options = array(
   'field' => 99, 
   'sourcePage' => 1131, 
   'destinationPage' => 1132
);
$modules->get("ProcessAdminActions")->CopyFieldContentToOtherPage($options);

I did think about separating into a core AdminActions.module and then have the ProcessAdminActions.module run on top of that, but went for the self-contained approach.

Let me know if this doesn't suit your needs though and I can revisit separating them out.

Share this post


Link to post
Share on other sites
On 1/2/2017 at 11:01 AM, Ivan Gretsky said:

Another little idea. Not sure it is necessary, but seems logical to me to separate "core" actions and those specific to the site.

Hi @Ivan Gretsky - I have implemented this - now both the modules settings and the Setup > AdminActions are split into "Site" and "Core" tabs. I haven't committed just yet. I will PM you the new version. Would appreciate it if you could test and let me know if it suits your needs and if you find any problems.

Thanks!

  • Like 2

Share this post


Link to post
Share on other sites

@Ivan Gretsky - I ended up doing some more tweaking on this and decided to commit it so you can get the new version from the modules directory now. Here's a screenshot of the tabs in action:

Screen Shot 2017-01-06 at 10.57.11 PM.png

 

I have also added a new: FTP Files to Page action based on this request: 

It works with files and images and looks like this:

Screen Shot 2017-01-06 at 6.57.31 PM.png

  • Like 2

Share this post


Link to post
Share on other sites

@adrian, I know function names are case-insensitive, but maybe you could change this line  from

 $destinationPage->$fieldName->add($item->getPathName());

to...

 $destinationPage->$fieldName->add($item->getPathname());// @note: lower 'n' in getPathname

to match what's in the docs...Just me being silly.:)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @kongondo - I was PHP was strict on function name case!

I think I inadvertently copied the case of $fieldName through to the getPathname() method.

Anyway, it's fixed in the latest version - thanks for noticing and pointing it out.

  • Like 1

Share this post


Link to post
Share on other sites

Just added a new "Email Batcher" action, which has the following features:

  • Select recipients by user role, or using a pages selector for any pages on the site
  • Parsing of field tags in the body so you can do something like: Dear {first_name}
  • Option to send a test email
  • HTML body, with automated text only version also sent
  • Special {fromEmail} and {adminUrl} tags.
  • Ability to hook EmailBatcher::parseBody to apply other custom replacements

Don't forget TracyDebugger's Mail panel when testing - it will capture the outgoing emails (so they won't actually be sent):
http://processwire.com/blog/posts/introducing-tracy-debugger/#mail-panel

joxi_screenshot_1484004786187.png

 

 

 

  • Like 4

Share this post


Link to post
Share on other sites

Just added a new "Copy Repeater Items To Other Page" action.

It lets you append or overwrite items from a repeater on one page to one on another.

  • Like 2

Share this post


Link to post
Share on other sites

Another quick update. Both the new "Copy Repeater Items To Other Page" and "Copy Table Field Rows To Other Page" actions now include an optional selector so you can define what repeater items / table rows will be copied.

 

  • Like 5

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.56
      Composer: rockett/jumplinks
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! :)
    • By BitPoet
      As threatened in Ryan's announcement for 3.0.139, I built a little module for sliding toggles as a replacement for checkboxes. Styling of the input is CSS3 only (with all the usual caveats about older browsers), no JS necessary, and may still be a bit "rough around the edges", so to speak, since I didn't have much time for testing on different devices or brushing things up enough so I'd feel comfortable pushing it to the module directory. But here's the link to the GitHub repo for now:
      InputfieldSlideToggle
      Fieldtype and Inputfield that implements smartphone-style toggles as replacement for checkbox inputs. The visualization is CSS-only, no additional JS necessary.
      Status
      Still very alpha, use with caution!
      Features / Field Settings
      Size
      You can render the toggles in four different sizes: small, medium, large and extra large.
      Off Color
      Currently, "unchecked" toggles can be displayed either in grey (default) or red.
      On Color
      "Checked" toggles can be rendered in one of these colors: blue (default), black, green, grey, orange or red.
      Screenshots

      Some examples with checkbox label


      View all Size and Color Combinations
      Small toggles Medium toggles Big toggles Extra big toggles  









    • By Orkun
      Hi Guys
      I needed to add extended functionalities for the InputfieldDatetime Module (module is from processwire version 2.7.3) because of a Request of Customer.
      So I duplicated the module and placed it under /site/modules/.
      I have added 3 new Settings to the InputfieldDatetime Module.
      1. Day Restriction - Restrict different days based on weekdays selection (e.g. saturday, sunday) - WORKING

       
      2. Time Slots - Define Time slots based on custom Integer Value (max is 60 for 1 hour) - WORKING

       
      3. Time Range Rules per Weekday - Define a minTime and MaxTime per Weekday (e.g. Opening Hours of a Restaurant) - NOT WORKING PROPERLY

       
      The Problem
      Time Slots and Day Restriction working fine so far. But the Time Range Rules per Weekday doesn't work right.
      What should happen is, that when you click on a date, it should update the minTime and maxTime of the Time Select.
      But the change on the select only happens if you select a date 2 times or when you select a date 1 time and then close the datepicker and reopen it again.
      The time select doesn't get change when you select a date 1 time and don't close the picker.
      Here is the whole extended InputfieldDatetime Module.
      The Files that I have changed:
      InputfieldDatetime.module InputfieldDatetime.js jquery-ui-timepicker-addon.js (https://trentrichardson.com/examples/timepicker/) - updated it to the newest version, because minTime and maxTime Option was only available in the new version  
      Thats the Part of the JS that is not working correctly:
      if(datetimerules && datetimerules.length){ options.onSelect = function(date, inst) { var day = $(this).datetimepicker("getDate").getDay(); day = day.toString(); var mintime = $(this).attr('data-weekday'+day+'-mintime'); var maxtime = $(this).attr('data-weekday'+day+'-maxtime'); console.log("weekday: "+day); console.log("minTime: "+mintime); console.log("maxTime: "+maxtime); var optionsAll = $(this).datetimepicker( "option", "all" ); optionsAll.minTime = mintime; optionsAll.maxTime = maxtime; $(this).datetimepicker('destroy'); $(this).datetimepicker(optionsAll); $(this).datetimepicker('refresh'); //$.datepicker._selectDate($(this).attr("id"),date); //$.datepicker._base_getDateDatepicker(); // var inst = $.datepicker._getInst($(this)); // $.datepicker._updateDatepicker(inst); /*$(this).datetimepicker('destroy'); InputfieldDatetimeDatepicker($(this), mintime, maxtime); $(this).datetimepicker('refresh'); */ // $(this).datetimepicker('option', {minTime: mintime, maxTime: maxtime}); } } Can you have a look and find out what the Problem is?
      InputfieldDatetime.zip
       
      Kind Regards
      Orkun
    • By teppo
      This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened.
      At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide
      https://modules.processwire.com/modules/process-changelog/
      https://github.com/teppokoivula/ProcessChangelog
      How does it work?
      Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table.
      How do you use it?
      When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while.
      For detailed installation instructions etc. see README.md.
       


    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




×
×
  • Create New...