Jump to content

Recommended Posts

Posted

Sorry, I wasn't really thinking when I did that... I guess my head is still on vacation mode (does this answer to your question kongondo? ;))

Should be working now.

  • Like 1
  • 3 weeks later...
Posted

Just used this for the first time - so easy! 

I am using 1.04 with the latest dev (as of today)

Thought everything was working great, but then when I went to test to see if general admin users could see it, I discovered that they could see the new page just below "Access", but then when I clicked on it, I get a "You don't have permission" error. I have looked through all the permission options I can think of and can't seem to get it working.

Any thoughts please?

Posted

Adrian,

What do you mean by just below "Access". Is your new custom admin page appearing as a child of "Access" or as direct child of "Admin"?

Posted

I confess I didn't think of this when I created the module... Thanks for finding it :)

I already corrected it on github, but if you don't want to download it again, just add these changes to the module file:

static public function getModuleInfo() {
    return array(
        'title'   => 'Admin Custom Pages',
        'summary' => 'Create custom admin pages without building a Process Module',
        'version' => 105, // <-- change the version number 
        'author'  => 'Diogo Oliveira', // <-- add this comma
        'permission' => 'page-view' // <-- add this line
    );
} 

This gives permission to anyone to use the process, but you still can control the permissions for the pages in their templates.

Edit: kongondo, he means the process itself. Even if the page is viewable by the user, the process wouldn't run, and throw that message.

  • Like 1
  • 1 month later...
Posted

Nikola, try this one (needs the DEV branch of PW because it uses render($filename)).

Create a new template (can be named "customAdmin" for example) and put this on the template file:

<?php

$page->process = "ProcessAdminCustomPages2";

require($config->paths->adminTemplates . 'controller.php');

Create two fields and put them in the template:

  1. "render_file" (text field)
  2. "scripts_and_styles" (text area)

Now, if you create a page under admin and assign this template to it, you can specify a file to render the page.

To load scripts and styles add all the urls in each line (this is still a bit rough).

To add custom fields to the page, just create a new template without file, and specify "customAdmin" as the alternate template filename. Use this one instead of the "customAdmin". Add the "render_file" field to it and, optionally the "scripts_and_styles" field.

This version doesn't have configuration options

Unfortunately this did not work for me, the custom admin page throws the following exception (by PageRender):

Invalid output file location or specified file does not exist. 

I also checked in in ProcessAdminCustomPages2.module via:

file_exists($this->config->paths->templates . $this->page->render_file . ".php") 

It is there.

Tried it with 2.3.3.3

  • 1 month later...
Posted

Hi,

I have just added the 'Admin Custom Page' module to a dev site. What I am not sure about is how to use it. This is what I have done so far. I am using PW 2.3.0.

1. Installed 'Admin Custom Page' module v1.05 via the admin.

2. Created template called 'test-custom-page' without a .php file.

3. Added 'admin' as the Alternate Template Filename.

4. Added the field 'ACP_scripts_and_styles' to 'test-custom-page' template.

5. Created new page under Admin called' test-custom-page' with template 'test-custom-page'.

6. Added the following scripts and styles url's to the 'ACP_scripts_and_styles' textarea:

  • site/templates/scripts/jquery-ui-1.10.3.custom/css/ui-lightness/jquery-ui-1.10.3.custom.css
  • site/templates/skeleton/stylesheets/skeleton.css
  • site/templates/skeleton/stylesheets/base.css
  • site/templates/styles/main.css
  • site/templates/styles/theme.css
  • site/templates/skeleton/stylesheets/layout.css
  • site/templates/scripts/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js
  • site/templates/scripts/main.js
  • site/templates/scripts/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js

7. Created template called 'test-child' with fields: title; headline; body; images. This is based on my basic-page template and has a .php file called 'test-child.php'.

8. Created a child page of 'test-custom-page' called 'test-child' with template 'test-child'. Tree = Admin > Test Custom Page > Test Child.

When I view Test Custom Page the page is loaded in the admin with mssg: 'This page has no Process assigned.'

I'm not quite sure what should happen here?

If I view the child page ('Test Child') it is rendered as normal with header, body, footer etc.

Any help appreciated as always.

Posted

Thanks Adrian, that was the answer. Just to clarify for anyone else reading this, the admin.php file in the templates folder should have been modified to add this code when the module was installed, but for some reason it did not happen, so I manually added it and it now works. What I mean is the child page is now rendered in the parent in the admin.

// line added for the Custom Admin Pages Module
if($page->template->id !== 2) $page->process = "ProcessAdminCustomPages"; 

I wonder if someone could clarify if this is the right 'tool' for my needs:

I would like to have an admin only page that produces a report (table), effectively a report generator where you select the fields (all existing fields) you want in the report from dropdowns in each column or just select the fields and the table is created based on the selected fields, one field per column. I haven't thought this through 100% but any ideas are welcome.

  • Like 1
Posted

A quick permissions question. I have this module installed and it works fine for the superuser. Are there any tricks involved in allowing another user to use this admin panel, i.e. I would like users with the role of 'author' to also see/use it.

Posted

The pages of the module are normal PW pages, so the permissions apply like with any other page. Go to the page template and give the permissions there.

Posted

I had a click while reading this post http://processwire.com/talk/topic/4642-keeping-a-page-in-a-fixed-position-last-in-the-sorting-order/ and quickly implemented something I was thinking about for some time already.

I added a new functionality on the DEV version. Now the module allows to easily create a "settings" kind of page. Putting it simply, you can create a tab in the admin that shows the "edit" page of that same page.

See it for yourself https://github.com/ocorreiododiogo/pw-admin-custom-pages/tree/dev ;)

edit: for those interested on how it works, don't look on the module file, look on the admin.php file.

  • Like 4
  • 1 month later...
Posted

I've installed the module and followed the most up to date instructions and I'm using PW 2.3.0.

My new admin page's name does appear at the top of my PW admin area: "Pages", "Setup", "Modules", "Access", "myadminpage".

BUT, when I click on myadminpage, I get a 500 server error.

Is there something else I need to check?

Posted

Did you follow the instruction for the stable version of PW? For the stable version you need to create a child of the page to hold the template.

  • 2 weeks later...
Posted
Hello diogo, thanks for great module!

Has anybody used this with url segments? I tried but noticed some bug on latest dev. It throws TemplateFile: Unrecognized path error notice when there is some url segment in use. Not any content from template file.

Posted

Hi Roope, thanks for reporting. I can't have a look at it now, but can you clarify how you are using the url segments? is it on the admin side? I never tried that...

edit: ok, i can recreate this behaviour. I'm not sure if Ryan established some kind of limitation to using URL segments in the admin (all other admin pages use get), but it's something to find out :)

  • Like 1
Posted

True, and sorry. Just made a quick assumption here..

Well, I'm totally fine with get if there is some limitation to url segments in admin. I'm sure Ryan will clarify us on this one.

Posted

Can't be. The admin template doesn't have segments activated. I did activate them just to try out, and I get the same error anytime I add a segment to any page in the admin.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...