## Blocks: PaperCut Print Quotas

block_papercut
Maintained by Mark Johnson
Displays the Papercut Web Widgets in a Moodle block, allowing the user to see their current balance and environmental impact.
18 sites

Papercut is a print management system designed to cut the cost of printing.  The system provides some web widgets to display users' remaining credit, and the environmental impact of their printing.  This block acts as a wrapper for those widgets allowing them to be displayed on Moodle pages.

The Moodle 1.9 version of this block was written by SchoolsICT.  This update provides Moodle 2 support, and allows the widgets to be called over HTTPS (if the papercut sever is configured to serve HTTPS requests).

### This block is no longer maintained.

Unfortunately I'm no longer working in an institution that uses PaperCut, so am unable to debug or fix issues with the block.  As such, I wont be making any new releases.  If anyone wishes to take over maintenance of the block, please contact me.

### Contributors

• Mon, 13 Aug 2012, 4:10 PM
Sorry, correction to that:
Currently it'll only try to include the widgets if the workstation you're accessing Moodle from is on the same subnet as the papercut server. This is by design as you're unlikely to have your Papercut server open to the public Internet. However it is feasible that the papercut server will be on a seperate subnet while still being accessible, so I'll try and think of a way to make it work.
• Wed, 15 Aug 2012, 11:38 PM
As it stands our clients are on a different subnet unfortunately and this would also mean that this block will not work off-site if I understand the problem? The Moodle server however, is on the same subnet as the PaperCut server if that helps!
Thanks,
Chris
• Tue, 21 Aug 2012, 5:57 PM
I have the problem of the widget showing "Balance not available" which I thought must be the subnet issue (it works fine on my local test machine) but I am reliably informed by the IT Networks guy here that our papercut server and web server are on the same subnet?
When I look in the console I can see the request is being blocked, does that mean it's a port issue? I can't see how, but I'm definitely no expert in that area?
• Tue, 21 Aug 2012, 6:08 PM
Chris:
You can try editing block_papercut.php to add the line $internal = true; after the line$internal = address_in_subnet(.... which will force it to try including the script regardless of subnets. This will work as long as the client's workstation can access the papercut server.

Derek:
Your problem sounds different - if your workstation isn't on the same subnet as the papercut server, the widgets shouldn't be requested at all. If it's trying but failing, its likely to be an issue with the firewall or similar - perhaps the client isn't allowed to access the port that papercut's web interface is running on? Try manually requesting the widgets file by going to http://$url:$port/content/widgets/widgets.js in a browser where $url and$port are the Papercut server URL and port number you defined in the block's config.
• Tue, 21 Aug 2012, 7:07 PM
Hi Mark,
thanks for the quick response, I tried what you suggested. If I run it on my local machine (in the office) it works fine (ie downloads the js file).
I VNC'd onto the webserver and tried it there and I get a 404 error with the error
Which to me suggest there is something wrong on the papercut server?
I should stress that I have had nothing to do with the papercut server, I only deal with the webserver(s), but they are both sat about ten foot from me right next to each other.
• Tue, 21 Aug 2012, 7:13 PM
Hi Mark,
I've solved it, it was to with the ports that the secure cert had been installed on. I wasn't told that there was a different port for the secure version until now.
Thanks again for the help though.
• Wed, 14 Nov 2012, 4:24 AM
Hi Mark!
Thank you for this block, but I have a problem: The Moodle 2.3.3-Server runs in the dmz in a 192.168.0-subnet, the novellserver with papercut in the intranet in a 10.0-subnet and I get the error "Balance not available". The ldap-authentication from the moodle-server to the same novell-server works and I opend port 9191 for papercut. For papercut we use the user-authentication and not the pc-authentication - is this a problem?
Thanks,
Hartwig
• Thu, 15 Nov 2012, 5:38 PM
Hi Hartwig, you've got the same problem as Chris had above. The block currently wont try to load the widget from a server on a different subnet. If you follow my instructions above for editing block_papercut.php you might be able to get it working, but your milage may vary depending on your firewall rules.
• Thu, 15 Nov 2012, 6:16 PM
Hi Mark!
Thanks for the answer! Now it works There is just one thing: You write " This will work as long as the client's workstation can access the papercut server" - so it works from the clients in school, but not from the clients at home, when the students try it at home - will there be an update, that this will also work?
Thanks from Austria,
Hartwig
• Thu, 15 Nov 2012, 6:34 PM
The reason there's currently a hard-coded limitation on when it will try to display the widget, is that in the vast majority of cases, the Papercut server will not be available over the public Internet (since it's an internal service) - the server will usually only have a private IP address. It's much friendlier for the block to display "Balance not available" in this case than causing browser errors becuase the widget can't be loaded. There's no update I can provide to make it possible for the block to work when the students are at home in this case.

If I can think of a tidy enough way of doing it, I might try and produce an update that will quietly check if the client can access the papercut server and load the widget if it can, rather than basing it on IP addresses (which is inexact as it is).
• Thu, 15 Nov 2012, 7:59 PM
Alright, thank you. It's also fine, like it works now - thanks for your work!
• Sun, 16 Dec 2012, 1:10 AM
To anyone who's had problems with clients and servers on different subnets:

I've just pushed a new branch called "noip" to github. This will try and load the widgets regardless, and if it can't after 10 seconds you'll get a message in your javascript error console rather than on the page.
However, I don't currently have a Papercut server to test this out on. If you do and are willing to give it a try, please download the code from here: https://github.com/marxjohnson/moodle-block_papercut/tree/noip and let me know if it works as expected.
• Thu, 17 Jan 2013, 1:44 PM
Great block. As I am running the papercut server on another subnet, I grabbed the noip branch.

Installs find.

However... sadly.. when I try an put the block on the front page, it comes up with this error

I am not even able to edit the block settings.

I am running NTLM Single Sign On (SSO) for authentication. Is that going to be an issue ?

Regards
• Thu, 17 Jan 2013, 2:18 PM
Sorry ... more

The following comes up in the block on the page

ConfigurationDeleteHideAssign roles
Widget Error: User details not loaded. Call pcGetUserDetails() first.
Widget Error: User details not loaded. Call pcGetUserDetails() first.
• Thu, 17 Jan 2013, 6:42 PM
Peter,
Thanks very much for your feedback. I'm unable to work on the block for the next couple of weeks but after that I'll take a look at these issues and get in touch with you.