Adding a new administrative script

6 views
Skip to first unread message

Charles Fulton

unread,
Jul 13, 2011, 12:28:23 PM7/13/11
to Reason Discussion
I've been working on formalizing the Google Analytics code written by
Carolyn Zinn at Kalamazoo and I've run into a slight problem. The code
itself lives in lib/core/scripts/ga and I've added an admin link in
the admin interface. Yet whenever I try to hit the link from the admin
interface I'm getting a 404 error. I'm pretty sure I haven't mangled
any URLs so I'm starting to think there's some restriction in place
that I don't know about. Any pointers would be appreciated.

Charles

Matt Ryan

unread,
Jul 13, 2011, 4:07:15 PM7/13/11
to reason-d...@googlegroups.com
Hi, Charles --

First, I should mention that "naked" scripts of this type are not the
preferred way of building administrative tools. It is much better to
create an Admin Module and register it, as then you get a lot of
sanity checking and input cleanup for free, not to mention
allowing you to remain inside the Reason interface.

That, said, here's the answer to your immediate question:

Every administrative script that lives in lib/core/scripts/ has to
have a counterpart file in www/scripts/ that includes the file in the
core.

The idea is that all functional code lives in the core, and that these
"stubs" under www exist to provide http access.

An example is the Allowable Relationship Manager, which lives at
lib/core/scripts/alrel/alrel_manager.php but access is through a
script at www/scripts/alrel/alrel_manager.php. The contents of the
latter file are:

<?php
/**
* Stub for the Allowable Relationship Manager
* @package reason
* @subpackage scripts
*/
include_once( 'reason_header.php' );
reason_include_once( 'scripts/alrel/alrel_manager.php' );
?>

I hope that helps!

Matt

> --
> You received this message because you are subscribed to the Google Groups "Reason Discussion" group.
> To post to this group, send email to reason-d...@googlegroups.com.
> To unsubscribe from this group, send email to reason-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/reason-discussion?hl=en.
>
>

Charles Fulton

unread,
Jul 14, 2011, 4:27:52 PM7/14/11
to reason-d...@googlegroups.com
Thanks--that's exactly what I was looking for!

On a related note, is there a sample Admin Module I could look at?
Ultimately that's probably the direction to go in.

--Charles

Reply all
Reply to author
Forward
0 new messages