Roope Posted November 14, 2013 Share Posted November 14, 2013 OK, thanks for your help! Much appreciated. Segments must be unsuported in admin then. Link to comment Share on other sites More sharing options...
Soma Posted November 14, 2013 Share Posted November 14, 2013 Admin pages can have segments and they're mapped to the function in the process module attached to it. But that's not the urlSegments you can use on frontend. Like /adminpage/edit Will call executeEdit() method in the process module. I'm not sure how custom admin pages work and that's maybe not possible as you don't use process module to make the admin page. 1 Link to comment Share on other sites More sharing options...
diogo Posted November 14, 2013 Author Share Posted November 14, 2013 Thanks Soma, I will have a look at adding it to the module when I have some time. Link to comment Share on other sites More sharing options...
Roope Posted November 25, 2013 Share Posted November 25, 2013 @diogo, just for the record, I noticed that throw new Wire404Exception() also gets empty TemplateFile: error and does not work as expected. Link to comment Share on other sites More sharing options...
diogo Posted November 25, 2013 Author Share Posted November 25, 2013 Thanks Roope. I don't have time to work on it now, but adds to the list. Link to comment Share on other sites More sharing options...
Macrura Posted January 13, 2014 Share Posted January 13, 2014 @diogo - this is more of a status report - using the latest dev, where the admin theme is now module, the custom pages still use the old default admin theme.. cheers, marc Link to comment Share on other sites More sharing options...
adrian Posted January 14, 2014 Share Posted January 14, 2014 Just wanted to confirm that I am seeing the same issue as Macrura. If you need a quick fix for a live site, you can grab the templates-admin folder from the last PW version before Ryan introduced the module theme technique and this module will look as expected again. Link to comment Share on other sites More sharing options...
Macrura Posted January 15, 2014 Share Posted January 15, 2014 right - actually i'm not sure if i have that... i tend to overwrite my dev versions with the latest when i download them... it's not a huge deal except for the fact that i was using fontawesome on these custom pages and that no longer works.. i did try copying the admin-templates from the wire into the site, directory to see if i could get the fontawesome to work.. guess i either need to deal with it for the time being or revert to the old theme by uninstalling that admin theme module Link to comment Share on other sites More sharing options...
cstevensjr Posted January 15, 2014 Share Posted January 15, 2014 ... i tend to overwrite my dev versions with the latest when i download them... Hopefully you really mean that you replace the /wire/ directory and not actually overwrite it. 1 Link to comment Share on other sites More sharing options...
Macrura Posted January 15, 2014 Share Posted January 15, 2014 no i mean i don't have any old versions around on my hard drive; when upgrading sites i rename the wire directory to _wire and then put in the replacement, just in case i have to revert 1 Link to comment Share on other sites More sharing options...
diogo Posted January 15, 2014 Author Share Posted January 15, 2014 Hi guys, thanks for the report and a quick answer. I can't have a look at this that soon but If you guys would like to make a pull request on git I'll be happy to accept it. Link to comment Share on other sites More sharing options...
iNoize Posted January 21, 2014 Share Posted January 21, 2014 how do I adjust now the current admin theme to the module ? Link to comment Share on other sites More sharing options...
ryan Posted January 24, 2014 Share Posted January 24, 2014 how do I adjust now the current admin theme to the module ? Is this question specific to the AdminCustomPages module or specific to the admin theme in the PW dev branch? If admin theme in dev branch, you can remove or rename whatever theme you have in /site/templates-admin/. Then go to Admin > Modules > Core > Default Admin Theme and click "install". Link to comment Share on other sites More sharing options...
Macrura Posted January 24, 2014 Share Posted January 24, 2014 how do I adjust now the current admin theme to the module ? I think the issue here is that the Admin Custom Page module is not aware of the new admin theme being in a module, so your custom admin pages still retain the non-module theme. We'll have to take a look at the code and see if there's a way to make some adjustments to how the module loads the theme. 1 Link to comment Share on other sites More sharing options...
iNoize Posted January 24, 2014 Share Posted January 24, 2014 Is this question specific to the AdminCustomPages module or specific to the admin theme in the PW dev branch? If admin theme in dev branch, you can remove or rename whatever theme you have in /site/templates-admin/. Then go to Admin > Modules > Core > Default Admin Theme and click "install". Its specific to the AdminCustomPages , I've tried self to adjust the them but it doesnt really works. If im right then : I can insert my own code in the AdminCustomTheme template. For example I try to write currently an Real Estate XML import. So I can start the import from the AdminCustomPage ? Maybe on Press "Import Button" or something like this ? Link to comment Share on other sites More sharing options...
Soma Posted January 24, 2014 Share Posted January 24, 2014 You can also just create a new admin page without this module. It would be a simple process module. 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 24, 2014 Share Posted January 24, 2014 Take a look at ProcessHello, there you have a good boilerplate. 1 Link to comment Share on other sites More sharing options...
Pete Posted March 9, 2014 Share Posted March 9, 2014 @Diogo - with this module in PW 2.4, it loads the theme from /wire/templates-admin/ instead of the new admin theme. Not sure why there is still an admin theme in /wire/templates-admin/ in the latest download I have no idea why it's not defaulting to the new theme as every other admin page does Link to comment Share on other sites More sharing options...
kongondo Posted March 9, 2014 Share Posted March 9, 2014 @Diogo - with this module in PW 2.4, it loads the theme from /wire/templates-admin/ instead of the new admin theme. Not sure why there is still an admin theme in /wire/templates-admin/ in the latest download I have no idea why it's not defaulting to the new theme as every other admin page does 1. It is the translation source. See here and here 2. Is that because the new admin theme is a module? //Silly me; but other modules are working, duh! 2. It's not loading the new admin theme css files...why, I don't know... Link to comment Share on other sites More sharing options...
Macrura Posted March 9, 2014 Share Posted March 9, 2014 @Pete - yeah this issue has been sort of lurking here and there on different threads... the thing is that making your own process module really is not a replacement for what this module offers in terms of ease, flexibility and speed in setting up custom admin pages; I spent at least 1 hr trying to change stuff in the module code to make it use the admin theme module, but i just couldn't figure it out; In the end the only way was to modify the index.php as was mentioned here... I'll be really happy once this issue of the wrong template file loading is sorted on this module!! Link to comment Share on other sites More sharing options...
diogo Posted March 9, 2014 Author Share Posted March 9, 2014 Sorry guys. I still didn't have time to address this problem. Don't really know how to actually... Link to comment Share on other sites More sharing options...
apeisa Posted March 9, 2014 Share Posted March 9, 2014 the thing is that making your own process module really is not a replacement for what this module offers in terms of ease, flexibility and speed in setting up custom admin pages; I have to disagree. Never actually tried this module (since I don't fully understand it's purpose). If you compare instructions for this module (https://github.com/ocorreiododiogo/pw-admin-custom-pages) and those provided by boilerplate for Process modules (https://github.com/ryancramerdesign/ProcessHello), there is no much difference in complexity. I actually find latter easier (only changing file, class and constant names if you want to make it your own instead of "hello"). There is designed way to extend PW admin with own pages, and that is through Process modules (which are super simple, just install ProcessHello, play with it 15 minutes and you get it). Anything else is just looking for troubles in long run. I am sure there is something that makes Process-modules seem harder than they are. I guess that is the reason why Diogo has build this module..? 1 Link to comment Share on other sites More sharing options...
Pete Posted March 9, 2014 Share Posted March 9, 2014 For me, all I wanted it for was to create dashboards which I've just created a module for: http://processwire.com/talk/topic/5785-processdashboard/ Whilst I've made it really easy in my module for people to use a template file instead of touching the module, you're right in that ProcessModules are fairly easy to get along with once you take the plunge, so I've been sure to mention the ProcessHello module there as some encouragement for folks to roll their own modules. Link to comment Share on other sites More sharing options...
renobird Posted March 11, 2014 Share Posted March 11, 2014 I agree — ProcessModules are the way to go. They might look intimidating at first, but if you start with a very simple example, they really are very easy. Here is a super simple example that lists all pages with the template "news".(I'm sure there are others out there, but it only took a few minutes to write so...) <?php /** * Simple Process Module Example. * This is a very basic example to learn from. * I have no intention of expanding on this sample module. * * @author renobird * * ProcessWire 2.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class SimpleProcessModule extends Process { public static function getModuleInfo() { return array( 'title' => 'Process Module (basic example)', 'summary' => 'A very simple process module as an example on how easy they are to create.', 'version' => 100, 'href' => '', 'permission' => '' ); } public function init() { // initialize the parent parent::init(); } public function ___execute() { // Find some pages $items = $this->pages->find("template=news"); /** * Create a table to display results * There are other ways to do this using MarkupAdminDataTable module, but let's keep this simple for now. */ $out = "<table width='100%'>"; $out .= "<thead>"; $out .= "<th>Title</th>"; $out .= "<th>Date Created</th>"; $out .= "<th>User</th>"; $out .= "<thead>"; $out .= "<tbody>"; // If $items pageArray is not empty if ($items->count() > 0){ foreach ($items as $item) { $out .= "<tr>"; $out .= "<td><a href=". $this->config->urls->admin . "page/edit/?id=" . $item->id .">" .$item->title . "</a></td>"; // title $out .= "<td>" . date("F j, Y", $item->created) . "</td>"; // date created $out .= "<td>" . $item->createdUser->name. "</td>"; // user that created $out .= "</tr>"; } } else { // empty pageArray message $out = "<tr><td>No pages matching your criteria were found.</td></tr>"; } $out .= "</tbody>"; $out .= "</table>"; return $out; } } Usage: Install the module Create a new page under /admin/ Set the process for the new page to SimpleProcessModule If you have never created a module, just focus on the execute() method. Most of what is there is coded exactly as you might from a page template. 12 Link to comment Share on other sites More sharing options...
diogo Posted March 11, 2014 Author Share Posted March 11, 2014 I agree that it's not difficult to create simple process modules, but I think it's great to be able to use normal templates in the admin. The idea of the module is that people don't have to change the way that they write code in pw or learn a new concept just to create a couple of backend pages. I do think that the module makes it easier to create admin pages (when it's working at least). I'll try to fix it as soon as I have some time. Edit: I didn't use the module for some time, but I did it now and I'm always amazed with how easy it is to create a custom page with it 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now