Jump to content

Admin Custom Pages Module


diogo

Recommended Posts

Kongondo,

yes and no.

I know, that is not elegant way, but I try to find page parent that have the same name with user to provide access.

$p->set('id', 15729) = working

$p->set('id', $p_page) = no

$p_user = $user->name; // set user name
$p_page = $pages->find("title=$user->name"); // try to find page with the same with user name
$p = $this->modules->get('ProcessPageList'); // kongondo's code goes here
$p->set('id', $p_page); // setting the parent page to user name page

May be you know the reason?

Link to comment
Share on other sites

I think $p->set('id', '12345') requires and integer. $p_page is not an id but an object. Try:

$p->set('id', $p_page->id)

Untested...

If that is not the problem, then it is the $pages->find. If you are getting only one page, use $pages->get instead...since you only need one ID..

Edited by kongondo
Link to comment
Share on other sites

Tested. This should work...

$p_user = wire('user')->name;// set user name
$p_page = wire('pages')->get("title=$p_user");// try to get page with the same with user name
$p = $this->modules->get('ProcessPageList');
$p->set('id', $p_page->id);// setting the parent page to user name page

Edits:

Edited code above to show class/module use context...

Also edited some typos in your original code (which I also subsequently copy pasted  :D)

Edited by kongondo
  • Like 2
Link to comment
Share on other sites

  • 1 month later...
I took this code https://processwire.com/talk/topic/6315-processpagelist-to-hide-some-pages/?hl=backend for custom page template:
 
<?php
$form = $this->modules->get('InputfieldForm'); // prep the form

$wrapper = new InputfieldWrapper; // a wrapper
$wrapper->attr('value', 'List of available articles');

$p = $this->modules->get('ProcessPageList'); // kongondo's code goes here
$p->set('id', 4049); // setting the parent page

$pageTree = new InputfieldMarkup; // the placeholder
$pageTree->value = $p->execute(); // fill the InputfieldMarkup form field...

$wrapper->add($pageTree); // put inside the wrapper...

$form->append($wrapper); // append the wrapper
?>

One question: what should i consider if i wanna two or tree pageList's in the same template?

i've different "main" contentareas that would be great to show up in a dashboard like adminpage

Tree 1 Images

-images

 -cat

   -img

   -img

Tree 2 News

-news

  -post

  -post

  -post

...

i did run the code above twice with different id's but it seems that the last id overwrite the first one?

Could ProcessPageList only run once on a page?

For that i will only create a dashboard for "fast create" the mainthings (image, newspost, special of the week and so on).

Link to comment
Share on other sites

One question: what should i consider if i wanna two or tree pageList's in the same template?

anyone? or a hint if this was possible or is it not possbible to get two pagelist's working on one page, i don't think since i've seen this in other complicated processadmintools, too but i didn't get an idea what i've overlooked?

Link to comment
Share on other sites

did change all the varnames into different on the two calls:

<?php
$formImages = $this->modules->get('InputfieldForm'); // prep the form

$wrapperImages = new InputfieldWrapper; // a wrapper
$wrapperImages->attr('value', '<h2>Bilder</h2>');

$i = $this->modules->get('ProcessPageList'); // kongondo's code goes here
$i->set('id', 1015); // setting the parent page

$pageTreeImages = new InputfieldMarkup; // the placeholder
$pageTreeImages->value = $i->execute(); // fill the InputfieldMarkup form field...

$wrapperImages->add($pageTreeImages); // put inside the wrapper...
$formImages->append($wrapperImages); // append the wrapper

echo $formImages->render();

$formFiles = $this->modules->get('InputfieldForm'); // prep the form

$wrapperFiles = new InputfieldWrapper; // a wrapper
$wrapperFiles->attr('value', '<h2>Dateien</h2>');

$f = $this->modules->get('ProcessPageList'); // kongondo's code goes here
$f->set('id', 1033); // setting the parent page

$pageTreeFiles = new InputfieldMarkup; // the placeholder
$pageTreeFiles->value = $f->execute(); // fill the InputfieldMarkup form field...

$wrapperFiles->add($pageTreeFiles); // put inside the wrapper...
$formFiles->append($wrapperFiles); // append the wrapper

echo $formFiles->render();

if i comment out the first - second works

if i comment out the second - first works....

so that was my base question:

One question: what should i consider if i wanna two or tree pageList's in the same template?

if this doesn't work with the PageList i could work arround with a own created list with pagination and a add new button.....with the tree it would be more comfortable...

Link to comment
Share on other sites

  • 1 month later...

Hi, I am trying to setup this as a new page and I am getting this error:

 You have to assign a template file to this 'Admin Custom Page'.

But when I go in and edit the page I do not see anywhere to add a template as described in the setup instructions.

Link to comment
Share on other sites

1. First you have to create a new page with the admin template (under the admin!)

2. Choose the right "Admin" Process on this adminpage on the first tab (content)

3. Then a new row shows up and you can choose your own template that lives in /site/templates/

In this template you could work like with Frontendtemplate with the API and show some stuff there no borders...

Link to comment
Share on other sites

  • 2 weeks later...

i just upgraded this module and installed the helper module, but i don't get a field to select a template

do i need to also add ACP scripts to the admin template?

... edit: i uninstalled the main module and then reinstalled, and it added the necessary field to the admin template..

it's all working now...

btw - thanks Nico for working on this, it's great to be able to use the custom pages with the new admin themes..

Link to comment
Share on other sites

What version?

I use 1.1.1. from http://modules.processwire.com/modules/process-admin-custom-pages/

ACP scripts and styles are optional to load .js and .css on the template

but the choice for template on the admin page should appear if you choose the Process - see screenshot?

You even didn't need a template under the template section since the template select lists all .php files in site/templates....

regards mr-fanpost-2327-0-45921500-1414429945_thumb.pn

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
  • 5 months later...

I'm confused about how to add styles and scripts to my custom admin page. The docs say:

Create a new page under "Admin" and give it the "admin" template.

...and then...

Add the "ACP_scripts_and_styles" to the page template (the field that was created automaticaly on instalation)

So I take this to mean I have to add the "ACP_scripts_and_styles" field to the "admin" template, but admin is a system template and so is hidden unless Advanced Mode is activated. So do I need to activate Advanced Mode in order to add this field?

---

Edit: After going ahead and trying it I think I can answer my question above with a "yes". This isn't obvious though, and I think the module would be easier to get started with if the "ACP_scripts_and_styles" field was added to the admin template when the module is installed, like the "ACP_template" field is.

Edited by Cerulean
Link to comment
Share on other sites

Hi Cerulean, Thanks for the feedback. I think adding a field to a system template should be done in an informed way by the user of the module, especially if it's a quite quick thing to do and if it won't be needed in all cases. I will update the documentation to be more explicit, though. 

Link to comment
Share on other sites

  • 4 months later...

hi diogo,

thanks for the great module! i just moved a site from dev to live server and got an open basedir restriction error. it looked for the template file unter /var/www/site/... instead of /var/www/vhosts/xyz.com/site/...

i had to go to that page and assign the template again. maybe you can change this to use relative paths down the PW rootpath?

thanks

PS: no problems with the scripts and styles paths!

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hello Great Module,

Just wondering if its possible to not show to show a dashboard in the I have 2. The first one links into the other but I dont want people going to the second one without clicking the link in the first. 

Link to comment
Share on other sites

Hello Great Module,

Just wondering if its possible to not show to show a dashboard in the I have 2. The first one links into the other but I dont want people going to the second one without clicking the link in the first. 

I think it should just be a matter of setting the page to hidden.

  • Like 1
Link to comment
Share on other sites

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