modxbot / migrate

A testground for migrating issues and other such fun
0 stars 0 forks source link

Custom Manager Theme Bug: Create New Resource Pages Ignore Custom Themes #7706

Open cbalfour opened 12 years ago

cbalfour commented 12 years ago

cbalfour created Redmine issue ID 7706

When creating a new resource, the manager ignores custom a custom theme set with the manager_theme system setting, and reverts to the default theme. Edit Resources, Create or Edit Elements, or other Manager pages show the custom theme without a problem. It is only when creating a resource, web link, symlink, or static resource does the manager revert to the default theme. Looking through firebug, I can confirm that the page is looking for css files in the /manager/templates/default/ directory, though nowhere in the custom them directory is there a hard-coded call to the default directory. So this seems to be something the manager is writing into the page, or ignoring the manager_theme setting in these particular instances.

prioritypie commented 11 years ago

rosshume@hotmail.com submitted:

I also experienced this. By any chance, have you got files for your custom theme in the "templates" directory, but not in the "controllers"?

In @/manager/controllers/default/resource/resource.class.php@ on ~line 69 (modx 2.2.4pl) the controller checks what kind of action to perform. When the action is to create a resource, the "isDerivative" flag is true, which then lets the following code run that determines whether the "create" controller file for the current theme exists, and if not it sets the manager_theme setting to "default":

            $delegateView = $modx->call($resourceClass,'getControllerPath',array(&$modx));
            $action = strtolower(str_replace(array('Resource','ManagerController'),'',$className));
            $className = str_replace('mod','',$resourceClass).ucfirst($action).'ManagerController';
            $controllerFile = $delegateView.$action.'.class.php';
            if (!file_exists($controllerFile)) {
                $modx->setOption('manager_theme','default');
                $delegateView = $modx->call($resourceClass,'getControllerPath',array(&$modx));
                $controllerFile = $delegateView.$action.'.class.php';
            }

You can get around it by copying the resource.class.php and create.class.php files to a folder for your custom theme in the controllers directory, i.e. you end up with: @/manager/controllers/[your_custom_theme]/resource/resource.class.php@ @/manager/controllers/[your_custom_theme]/resource/create.class.php@