Dashboard workflow changes

Permalink
My client has asked that I implement certain workflows in the dashboard, some of which are slightly different to the way that C5 works out of the box.

For example, they would like a list of users who are registered with a 'Add Login Message' and 'Make Administrator' option next to each (see attached screenshot if this is unclear). To do this, I've overridden the 'search_results' file in elements to add the appropriate links. For the message aspect, I have a clause in the view which displays the form for the message and this form submits to the action in the controller which updates a 'Message' user attribute that I have added - and this all works fine.

However, for the Make Administrator option it's a little more tricky. I don't really want a completely separate confirmation page, so I guess the logical thing to do would be to have it display an 'Are you sure' dialog and then make the change via an Ajax call to the controller function. I was just wondering if anyone knows any examples of where this is done elsewhere in C5 so that I have something to reference (as I like to keep my dashboard changes as similar to the core functionality as possible) or if there is a better way of doing this.'


The other thing I need to do is to duplicate the the Search Users are, this time showing a list of users who are registered but not activated on the system, with the option of 'Activate user' next to each (working in the same way as the 'Make Administrator' functionality above).

To do this, I have duplicated the 'search' single page (calling it 'registrations') and the 'search' controller, changing the names as appropriate but it still uses the 'search_results' element. I was hoping someone can shed some light on how C5 knows to use this file, so that I can have it use my version instead.

Many thanks in advance,

Joe

EDIT: I've answered the second part of my own question. For others who stumble across this: Loader::element('users/search_results') in the single page is the magic line :)

1 Attachment

 
doctypedigital replied on at Permalink Reply
To try and elaborate a bit more on what I'm trying to achieve - at the moment, from the Search Users page it's possible to select some users, click on the dropdown, choose Activate (or Delete, or whatever) and it will show a confirmation dialog and then carry out the action.

I want my links (Activate, Delete) alongside the names to do the same thing as these dropdown options - pop open a dialog, confirm and do the action.

I've been experimenting trying to use the javascript in ccm.app.js and the bulk_activator.php file to try and do this, but no luck so far. Hopefully someone can shed some light on it :)

Thanks,

Joe

Edit: This bit is sorted too :) I added a data-uid attribute to each of the links and then used the following JS (amended from that in UI.js) to update the user:

<script type="text/javascript">
            $('.grant').click(function() {
               uIDstring='uID[]='+$(this).attr('data-uid');
               jQuery.fn.dialog.open({
                  width: 630,
                  height: 450,
                  modal: false,
                  href: CCM_TOOLS_PATH + '/users/bulk_activate?' + uIDstring,
                  title: "Grant Access"
               });               
               return false;
            });
         </script>


Hope this helps someone :)