Jump to content
Pete

ProcessDashboard

Recommended Posts

This module creates a blank dashboard page in your site admin and sets it as default when you login instead of the page list.

It came from a need in a few projects where I was creating modules for various user roles to use and I didn't want them to see the page list at all, but needed to display various stats and quick access buttons.

For example, if you have a person who is creating invoices or doing other back-office stuff in various other Process modules then as an admin you wouldn't want them to access the page tree anyway, and there are other scenarios where you might want to have a dashboard instead of launching straight into the page list.

It also requires (and adds) a permission - "dashboard" - so you can create new roles and assign the dashboard permission to those roles - something you might want to do fairly commonly if you have a lot of admin modules that you want to restrict access to.

Editing the template is simple - there is a dashboard.php template file in the /site/modules/ProcessDashboard/ folder (decided to leave it in there to keep it safe, but I might be tempted to move it into /site/templates/ ) as well as .js and .css files ready to add your code to. You can use the API as you usually would to create your dashboard experience. For example, display data based on user roles or even specific users using code like this:

if ($user->hasRole('invoices') {
    echo "Hi staff member $user->name. View invoices to be processed below:
        ...
        ...";
}
 
if ($user->name == 'pete') {
    // Show some super-awesome stuff here
}

You can also do away with the dashboard.php template file and edit the module directly, putting your code and output in the execute() function (the way most Process modules are written) but I decided to include the separate template file to make it easier for more people to use.

This does touch on areas a few other modules have addressed to some degree (like diogo's Custom Admin Pages) but this is designed for one purpose - instant dashboard creation.

You can download the module here: http://modules.processwire.com/modules/process-dashboard/

This module also uses code from diogo's ProcessHomeAdmin module so that the default admin page can be overridden.

  • Like 20

Share this post


Link to post
Share on other sites

It's worth mentioning that whilst I've made it easy for newcomers to modules to create a dashboard template, it is worth learning how Process modules work so that you can create your own to do some amazing stuff in the ProcessWire admin.

See the ProcessHello module as a starting point: https://github.com/ryancramerdesign/ProcessHello

EDIT: There was also another way to do this module - I could have skipped creating a separate dashboard page under the admin page and simply made the admin page load the dashboard, however I quite like having the link in the menu at the top of the page so it's really obvious how to get back there.

  • Like 3

Share this post


Link to post
Share on other sites

This is very usable because there is a need to give clients a non destructive access to the back end.

Share this post


Link to post
Share on other sites

I forgot modules take a little while to become approved in the directory - you should be able to download and test this module out now.

  • Like 1

Share this post


Link to post
Share on other sites

I installed this and it seems a non admin user with dashboard permissions can see the dashboard or page list, but they can not click on the processwire logo to go back to the admin home / dashboard link.  It does a redirect loop.   They can only click the tabs on the right.

They also can not click admin in the breadcrumb trail on the page list to get back to the dashboard.

Do you know how to fix this?

Share this post


Link to post
Share on other sites

@joer80 I think the purpose of this module is exactly to avoid certain users to access to the standard PW admin, it's not an issue. 

Share this post


Link to post
Share on other sites

What this module does, is make the new dashboard page the new home for the admin section, instead of the page list, so shouldnt the process wire logo and breadcrum also go to this new home since that is where the login script takes all users after they login?

Share this post


Link to post
Share on other sites

On my installation clicking the PW logo or Admin link from the breadcrumb does take me to the dashboard as expected.

I can't remember, but I think at first install it appeared to the right of Pages in the menu - I think (trying to remember) it needs to be the first child page under /processwire/ in the tree in order to work like this.

Share this post


Link to post
Share on other sites

Yeah, it installed it as being not the first and I did have to move it, but it still seems to only work if you use the tabs.  Not sure why I am not the same as yours.  I am running the default admin even.

Share this post


Link to post
Share on other sites

After installing module on 2.6.20 dev only superuser can login without getting blank page or error. (( And applying rules makes nothing. Please help!

Share this post


Link to post
Share on other sites

Hi!

I'm using your Dashboard module. I want to make the bookmarks accessible there.

I'v already played with some of the admin helper functions like so:

$admin = $this->wire('pages')->get($config->adminRootPageID);

function printNav(Page $pa)
{
	echo "<ul>";
	foreach($pa->children("check_access=0") as $p) {
	        if(!$p->viewable()) continue;

	        $title = $p->title;
	        if(strlen($title)) {
	            //$icon = $this->getPageIcon($p);
	            echo "<li>";
	            echo "<a class='has-items has-ajax-items' data-from='topnav-page-$p' data-json='{$p->url}navJSON/' " .
	 "href='$p->url'>$title</a>";
	 			if($p->numChildren) printNav($p);
	 			echo "</li>";
	        }
	}
	echo "</ul>";
}

echo printNav($admin);

It's already displaying the Navbar. But I dont know how the ajax stuff works.

Also Ajax isnt required here.

So I hope, you can give me a hint how to solve this.

Thank you

robig

Share this post


Link to post
Share on other sites

@Pete -

i'm wondering how to 'addon' to this module in the sense that your module provides a blank canvas for setting up a dashboard, but i'd like to avoid changing anything in your module and also avoid putting anything custom into the module folder;

what i did to hack this was change the dashboard module like this:

public function execute() {
    // Redirect calls for the admin homepage to the dashboard (first child page)
    if ($this->page->id == 2) {
        $this->session->redirect($this->page->child->url);
    }

	$dashboard = $this->getDashboard();
	return $dashboard->render();
}

public function ___getDashboard() {
    $t = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php");
    return $t;
}

then in my dashboard widgets module, i have this:

public function init() {
    $this->addHookAfter('ProcessDashboard::getDashboard', $this, 'getCustomDashboard');
}

public function getCustomDashboard(HookEvent $event) {
    $template = $event->return;
    $event->replace = true;
    $template = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php");
    $event->return = $template;
}

let me know what you think, if this would be a possible change that wouldn't affect existing sites, but would allow other modules to hook into the main dashboard for rendering...

  • Like 1

Share this post


Link to post
Share on other sites

Is there any way to make the tab look active/open in the header when you are on the dashboard?

Share this post


Link to post
Share on other sites

@Pete

In PW 3.0.33 the users with permission 'dashboard' are not redirected to the dashboard after log in.

In my case I got stuck with a white screen (url /processwire/dashboard/ was working)

EDIT:

This code did the trick for me (for now): 

if ($this->page->id == 2) {
	// Before	
	// $this->session->redirect($this->page->child->url);
	
	// NOW
	$this->session->redirect($this->pages->get(1028)->url);
}

 

Share this post


Link to post
Share on other sites

@KarlvonKarton

so the issue you are having is that the child page is access restricted and that's why you get the blank screen; to solve this you just need to add a selector to the child api call like so:

if ($this->page->id == 2) {
    $childPage = $this->page->child('check_access=0');
    $this->session->redirect($childPage->url);
}

then you don't have to hardcode the ID of the dashboard page into the module...

Somehow this may have worked as it was originally in earlier versions of PW, but i encountered the same issue as you and had to make that change.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for this module! I had to change a few things to get this to work with PW 3.0.84

a) add PW namespace

b) change page id from 2 to 3 (2 = admin root, but 3 = page, which is the actual default landing page after login)

if ($this->page->id === 3) {

(and then the two lines from @Macrura above)

c) 

//        $t = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php"); // this creates a URL like site/modules\ProcessWire/ProcessDashboard/
        $t = new TemplateFile($this->config->paths->siteModules . "ProcessDashboard/dashboard.php");

Perhaps you could re-check, and publish a new version that officially supports PW 3 ?

  • Like 1

Share this post


Link to post
Share on other sites
On 11/18/2017 at 12:53 PM, dragan said:

Thanks for this module! I had to change a few things to get this to work with PW 3.0.84

a) add PW namespace

b) change page id from 2 to 3 (2 = admin root, but 3 = page, which is the actual default landing page after login)


if ($this->page->id === 3) {

(and then the two lines from @Macrura above)

c) 


//        $t = new TemplateFile($this->config->paths->siteModules . __CLASS__ . "/dashboard.php"); // this creates a URL like site/modules\ProcessWire/ProcessDashboard/
        $t = new TemplateFile($this->config->paths->siteModules . "ProcessDashboard/dashboard.php");

Perhaps you could re-check, and publish a new version that officially supports PW 3 ?

@dragan  thanks for this, it solved my issues with the module

Share this post


Link to post
Share on other sites

My dashboard child pages are not showing in breadcrumbs, how can I get them to display ?

for example, I added a page in admin under dashboard and when I navigate to it in the cms I can see it fine but the breadcrumb still shows "home > dashboard" instead of "home > dashboard > My Page".

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...