Martijn Geerts Posted November 3, 2017 Author Share Posted November 3, 2017 @matjazp If you need the old AdminCustomFiles: https://github.com/Da-Fecto/AdminCustomFilesLegacy There's so much changed in the admin of PW3 so AdminCustomFiles (the old) would not fully work in PW3 without a lot of extra code. Thereby I think we should move on and drop non namespaced PW. Then there's the reason I have/had ~~almost~~ no spare time this year. We restaurated our old house (stripped bare & build up), next I had a job, for 40 hours a week plus the insane driving hours to the job. Link to comment Share on other sites More sharing options...
matjazp Posted November 3, 2017 Share Posted November 3, 2017 Thx for info and for legacy link. I must be lucky since I drive like 5 mins to work Link to comment Share on other sites More sharing options...
tpr Posted November 3, 2017 Share Posted November 3, 2017 You can load JS/CSS with AOS, isn't that an option? Link to comment Share on other sites More sharing options...
matjazp Posted November 4, 2017 Share Posted November 4, 2017 15 hours ago, tpr said: You can load JS/CSS with AOS, isn't that an option? Of course. And I can do it even without AOS ;-) Link to comment Share on other sites More sharing options...
Robin S Posted November 28, 2017 Share Posted November 28, 2017 Hi @Martijn Geerts This module does not upgrade cleanly from earlier versions. For instance, in earlier versions the Dependencies field was a textarea with each dependency separated by newline. In more recent versions, JSON data is expected for this field value. So after upgrading the module config page doesn't render properly due to a JS error when attempting to decode the field data. To fix this I have to edit the module config data directly in phpMyAdmin. Could you please add an upgrade() method to the module to translate module config values from earlier versions to the current format? 1 Link to comment Share on other sites More sharing options...
matjazp Posted November 28, 2017 Share Posted November 28, 2017 I can confirm this. That's why I still use 0.8.7 and not 0.9.4 ... Link to comment Share on other sites More sharing options...
Beluga Posted September 19, 2018 Share Posted September 19, 2018 I upgraded to 0.9.4 without thinking. I don't think I had any newline-separated dependencies, only a config.js, but I am still getting an error. In the db, modules, AdminCustomFiles, the data field has {"files_folder":"AdminCustomFiles","process_filter":["ProcessPageAdd","ProcessPageEdit"],"js_config":1,"theme_files":"","dependencies":"AdminCustomFiles\/config.js"} When I am in the module config page, I get this in the console: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" pointing to the line with data = input.value ? JSON.parse(input.value) : [], Being in debug mode, I get this on all admin pages: Warning: Invalid argument supplied for foreach() in /path/to/site/modules/AdminCustomFiles/AdminCustomFiles.module on line 249 What should I do? Link to comment Share on other sites More sharing options...
Macrura Posted September 19, 2018 Share Posted September 19, 2018 @Beluga i found that if you run into a problem with upgrading this, it works to uninstall the old one, and then install the new one; you can take a screenshot to remember your settings from old version 1 Link to comment Share on other sites More sharing options...
Beluga Posted September 19, 2018 Share Posted September 19, 2018 24 minutes ago, Macrura said: @Beluga i found that if you run into a problem with upgrading this, it works to uninstall the old one, and then install the new one; you can take a screenshot to remember your settings from old version Thanks. I had to delete the row from the modules db table and then I was able to reinstall it. Works now! Link to comment Share on other sites More sharing options...
netcarver Posted September 23, 2018 Share Posted September 23, 2018 Hi @Martijn Geerts, ran into an issue with ACF issuing notices on L123 of AdminCustomFiles.module due to unguarded access of the "theme" and "process" indexes on the index array. Changed code to: if (isset($this->index['theme'])) { foreach ($this->index['theme'] as $prop) $config->get($prop['type'])->add($prop['url']); } if (isset($this->index['process'])) { foreach ($this->index['process'] as $prop) $config->get($prop['type'])->add($prop['url']); } to fix this. 2 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 26, 2018 Author Share Posted September 26, 2018 @netcarver Thanks for lookin' into this. I will take a little time this week to update the module. Thanks steve. 2 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 4, 2018 Author Share Posted October 4, 2018 Hi Guys, AdminCustomFiles received some well-deserved love. (an update to version 0.9.61) There were several bug fixes and some major changes. I did break compatibility on several aspects of this module but after this update everything should be fine. - You can upgrade from 0.8.7 and below. (we take care of all settings) - The JSON output is now fully customizable. Previously I hooked *ProcessController::execute* and inserted the files to the config->scripts and files but with ProcessWire 3.x these were not the last files. Now we use Page::render to insert the files that should fix it. For the config.AdminCustomFiles javascript object we now have a base class that can be extended easily. When you created the class, you can select the class and save the module configuration. More info in the module configuration and in the example class below. /** * AcfConfigCustom * * Create a file in your AdminCustomFiles folder and start the filename with * ‘AcfConfig’ then ‘a custom name’ and add ‘.php’. * * In this file create a class with the basename of the file without the * extension. This class should extend AcfConfig and implements Module. * * Properties of the subclass * * @var AdminCustomFiles $adminCustomFiles Instance of AdminCustomFiles may you need it. * @var Page|NullPage $editPage In processPageEdit it would be the page you are editting. * @var Template $editTemplate Template from the page above. */ class AcfConfigCustom extends AcfConfig implements Module { /** * Optional ready method * * - Use it or leave out. * - We call ready() before calling jsConfig(). */ public function ready() {} /** * Required jsConfig method * * Return a PHP array ready to be used for $config->js * * @return array */ public function jsConfig() { $process = $this->wire('process'); return array( "activeProcess" => $process->className(), "editPage" => $this->editPage->id, "editTemplate" => $this->editTemplate->name, ); } } 4 Link to comment Share on other sites More sharing options...
NorbertH Posted October 5, 2018 Share Posted October 5, 2018 When Trying to install i get this error : Quote Compile Error: require(): Failed opening required '/volume1/web/dokuverwaltung/site/modules/AdminCustomFiles/acfConfig.php' (include_path='.') (line 91 of /volume1/web/dokuverwaltung/site/modules/AdminCustomFiles/AdminCustomFiles.module) It seems he is trying to load acfConfig.php while the file is called AcfConfig.php . 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 6, 2018 Author Share Posted October 6, 2018 Thanks @NorbertH issue has been fixed. 2 Link to comment Share on other sites More sharing options...
Macrura Posted October 16, 2018 Share Posted October 16, 2018 I can't seem to go past 0.9.4, i always get this error screen of death: 1 Link to comment Share on other sites More sharing options...
NorbertH Posted October 16, 2018 Share Posted October 16, 2018 Maybe we should use empty() instead of isset? Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 16, 2018 Author Share Posted October 16, 2018 @Macrura What is $ext at that moment? Could you try to replace the isset line with: if ($ext !== 'js' && $ext !== 'css') return false; Link to comment Share on other sites More sharing options...
Macrura Posted October 16, 2018 Share Posted October 16, 2018 not sure, this just happens when i try and install the new version; It may be something to do with the settings? I always uninstall the 0.8.7 and then do a clean install of the 0.9.4; then i noticed the upgrade, ran that from the upgrades module and got this screen, so i'm not interacting with the module, but i could try clearing out everything int he AdminCustomFiles folder and see if that helps.. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 16, 2018 Author Share Posted October 16, 2018 Actually I don't understand the error, the only thing I can imagine is that ext is not there... Are you willing to replace the isset line with the code above? Link to comment Share on other sites More sharing options...
NorbertH Posted October 17, 2018 Share Posted October 17, 2018 Whats your PHP version ? 1 Link to comment Share on other sites More sharing options...
Macrura Posted October 17, 2018 Share Posted October 17, 2018 23 hours ago, Martijn Geerts said: Actually I don't understand the error, the only thing I can imagine is that ext is not there... Are you willing to replace the isset line with the code above? yes, will test later today. 2 hours ago, NorbertH said: Whats your PHP version ? the sites with the error are all running 5.6; the sites running 7.x seem to work ok with past 0.9.4 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 18, 2018 Author Share Posted October 18, 2018 Thanks @Macrura, I will update the module to make it backwards compatible with old PHP soon.... Link to comment Share on other sites More sharing options...
Macrura Posted October 18, 2018 Share Posted October 18, 2018 6 hours ago, Martijn Geerts said: Thanks @Macrura, I will update the module to make it backwards compatible with old PHP soon.... Ok cool, thanks, I just realized i can't install on those sites because it basically tanks the whole site, even the front end... Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 18, 2018 Author Share Posted October 18, 2018 Updated ACF to make it compatible. (Hope this fixes it.) 3 Link to comment Share on other sites More sharing options...
Macrura Posted April 18, 2021 Share Posted April 18, 2021 Not sure why this is happening, but I can't use the latest version on Mac OS, local development (i can only use the 0.8.7). The module doesn't seem to understand the paths - i can't actually add dependencies, even though I know i'm adding the correct path, i even copied all of the dependency files into the ACF folder and it still report that it can't find the file and it won't add the dependency. Relative to ACF folder also can't use something like ./ to get to templates. If i put in the root relative path, the module outputs the wrong url to the file, it puts the subdomain twice. here is an example, on localhost, the root URL is http://localhost:8888/ and the subdomain is processwire_test1 the root relative url is presumably "/processwire_test1/site/templates/libraries/path-to-some-file.js" but the module outputs this: processwire_test1/processwire_test1/site/templates/libraries/path-to-some-file.js 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