Coldfusion 10 AJAX replace content in cfdiv - ajax

I have an href that throws an error when trying to replace the contents of its parent cfdiv.
In the efforts to keep this short, the link looks something like this:
<cfdiv id="managerDiv">
<a href="javascript:ColdFusion.navigate('theURL?theVariables','managerDiv');" >add a new thing</a>
</cfdiv>
The error that I'm getting is a dialog box that indicates the following:
Error retrieving markup for element managerDiv : /manager/CFIDE/administrator/templates/errors.jsp [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
A few things to note:
On my Coldfusion 10 development environment, I have no problems. This error only occurs on my hosting server.
The directory structure of both my hosting and development environments is EXACTLY the same
I do NOT have a pointer or mapping to "errors.jsp" anywhere in my source code or Coldfusion settings.
manager is a sub-directory at the root level
"theURL" is any coldfusion file, I have tried with a simple blank.cfm file, and it still passes the same error
Thoughts
Obviously, it seems like Coldfusion is looking for a file that doesn't exist to replace the contents of the cfdiv. However, I really have no idea why it is looking for something other than the contents of "theURL", and why it is looking for it in the directory specified in the error (manager/CFIDE/...)
I did some more testing.
It appears that the coldfusion.navigate URL parameter does not like the relative path (again, it works fine on my dev environment, but not on production).
For example, this works:
<a href='javascript.Coldfusion.navigate('test.cfm');'>
but this does NOT:
<a href='javascript.Coldfusion.navigate('folder/test.cfm');'>
thoughts?

All:
It appears that I should have been more specific, as this is a very targeted answer.
The file that I was attempting to load was coming from a directory that I had named "manager". After some testing, it appears that the name "manager" is the issue. We renamed the directory, and the problem was solved.
In other words, here was my link (I omitted the names, because I thought them irrelevant initially, but here is the actual link):
<a href='javascript.Coldfusion.navigate('manager/test.cfm');'>
I was forwarded this page by the support team, which seems to reinforce this point:
http://www.giancarlogomez.com/2012/06/directory-of-manager-in-webroot-not.html
Bottom line, don't name a directory in your root folder "manager". Coldfusion/TomCat reserves that name (at least at the root level).
I'm not sure why they did this (given the occassional use of the word "Manager" as an admin role, and therefore, a common trend to have a directory for this role), but oh well :)

Related

How to name api routing on a webhost sub folder

I have always thought the api controllers where not found by physical paths. The reason I ask is I have a website example.com I created a folder example.com/testing and uploaded my project to there. When I ran it I got errors saying that none of the apiControllers could be found. So I changed /api/apiCustomers to /testing/api/apiCustomers. It then worked, well not the actual posting of any new records. It did locate and retrieve all the records from the database though. But it doesn't seem like that is what I would actually need to do? I have a domain with WinHost and the default publish folder is example.com/myApp
AM I looking at this the wrong way?
To handle request where you do not know the root path, you can use (as in ASP.NET) the ~-character like this:
~/api/apiCustomers
~ will then be replaced by the root (i.e. /api/apiCustomers for prod and /testing/api/apiCustomers for your test environment)

With GroceryCrud, how can I put uploads above application root?

I'm using GroceryCRUD to act as a front end for a database containing news releases. Secretaries can go in and add/edit/delete news releases in the database easily now. Only qualified users are able to access the application root via an .htaccess password. The problem with this is that GroceryCRUD uploads assets such as photos are uploaded to the directory /www/approot/assets/uploads/ which is password protected since /approot/ is protected.
My ideal solution would be to set an upload directory outside of the application root which is where I'm running into trouble. By default this is how GroceryCRUD handles uploads:
$this->grocery_crud->set_field_upload('photo1','assets/uploads/');
I've tried changing it to something like this:
$this->grocery_crud->set_field_upload('photo1','/public/assets/uploads/');
I was hoping this / would make the path start from the document root instead of the application root, but it throws this error:
PHP Fatal error: Uncaught exception 'Exception' with message 'It
seems that the folder "/Users/myusername/www/approot//public/assets/uploads/"
for the field name "photo1" doesn't exists.
This seems to suggest that CI or GroceryCRUD just takes the second argument in set_upload field and just concatenates it onto the end of the site URL that is defined. Is there any way around this that doesn't involve creating a user login system?
Try using relative path.
$this->grocery_crud->set_field_upload('photo1','../assets/uploads/');
.. -> Go up one directory
I ended up implementing a login system outlined in this tutorial:
http://net.tutsplus.com/tutorials/php/easy-authentication-with-codeigniter/
It was quite simple to set up and suits my needs. I found ways to give access to the directory using httpd.conf directives but I feel like this was a more viable solution since I don't have direct access to server configuration files.
Maybe in the future GroceryCRUD will allow placement of uploads outside the application folder.

Magento - Mage::getModel not working on Linux server

I'm struggling with an issue for which I can't find an explanation. I have two development environments that I use for my projects. I created a simple module for Magento and I tested it on one environment. After overcoming all Magento's complications, the module works as expected. This is on XAMPP.
I then copied the module to the development Linux environment, on a hosted server, and it crashes miserably. I did some debugging, and I found out that a call to Mage::getModel() returns bool(false) instead of the instance of the Model I requested.
I double checked all files and directories, and they match. Database is not involved (not from my side, at least, I don't need tables) and both environments have only me as a User, with Admin permissions.
Any suggestion on where should I start looking is welcome, thanks.
Added on 2012/07/09
Model contains a class named Diego_ClientCustomModule_Model_ExternalUserData, which is invoked with $model = Mage::getModel('clientcustommodule/externaluserdata');. Model file resides in Diego_ClientCustomModule\code\local\Diego\ClientCustomModule\Model\. The curious thing is:
If model file is named Externaluserdata.php, it works.
If model file is named ExternalUserData.php (i.e. it matches the class name), it doesn't work.
I'm aware of case sensitivity stuff etc, but, if the alias is all lower-case, how comes it can load a file having the first letter capitalized?
Configuration file
0.1.0
Diego_ClientCustomModule_Helper
Diego_ClientCustomModule_Model
Diego_ClientCustomModule_Block
standard
Diego_ClientCustomModule
ClientCustomModule
Snarking about the framework for which you are asking for help may not be the best strategy for receiving help.
Your issue is likely one of cache (remove var/cache folder to check) or one of improper casing. Note that the first letter of each directory and filename for files loaded by the autoloader (blocks, models, and helpers).
It seems I have found the root cause of the issue, although I can't figure out what kind of logic has been implemented to make it happen.
Model's file name was UserCustomModule.php, which reflected the class name UserCustomModule. That made sense, and worked wonderfully in XAMPP. Once I installed the same module on a Linux box, Magento silently ignored the file and, as previously stated, there's been no way to track down Magento's actions.
Following benmark suggestion, I went through all the files again to check the casing, and everything seemed to match. I then made something, in my opinion, completely stupid, and I renamed the Model file to Usercustommodule.php, leaving the class name untouched (after all, PHP should behave the same on both platforms, unlike the file system). Magically, the module now works! The file name looks cr*p, but it works.
This solved the problem, yet it raises more questions:
For what reason Magento has troubles loading a file with a CamelCase name? If it's Autoloading, it should simply find a file and load it. After all, it loads the Controller, the Block and everything else, and they are all in CamelCase.
Is it written anywhere that one or more files must have only the first letter capitalized? I got enough surprises already, I'd like to avoid new ones, if possible.
Thanks again for the help.

file/page not found when uploaded online

I am working on a new module of existing live project. It is a website developed in PHP Zend Framework. New module is on admin side. It runs properly on my localhost/virtualhost.
When I uploaded it online with correct directory path it is found that one file is not found.
It is called like
www.example.com/admin/controllerName/actionName
All the actions works except one action that doesn't display anything and returns exception error mentioning that page or file not found.
What could be the issue? I have checked folders. If one action for the same controller works than why doesn't other. Both have their .phtml files in View section.
Help would be appreciated.
Would I be right if I guessed your local development environment was Windows?
It's probably a filename case sensitivity issue.
Assuming your request looks like
www.example.com/admin/fusionmaps/newpage
I'm not sure how you've setup your modules but if it's reasonably standard, you should have something like this (note the upper and lowercase characters)
application/modules/admin/controllers/FusionmapsController.php
The controller classname should be Admin_FusionmapsController with action public function newpageAction()
The view script should be at
application/modules/admin/views/scripts/fusionmaps/newpage.phtml

ColdFusion error after hosting transfer

I recently moved a ColdFusion site from one domain to the other with no issue (practically) besides one which I am having some trouble figuring out. I am a LAMP developer / designer and CF is a bit foreign to me so pardon my ignorance.
The site is working properly except for the store component, I am getting the following error "The .cart.models.store name is not a valid component or interface name.Component and interface names cannot be empty and cannot start or end with a period.". The only piece of code that I have changed throughout this process has been the config.ini, I changed the vmap=SitenameDev to vmap= as the notes in this file recommneded to do if the directory housing the site was the webroot directory.
Any insight on this error or common issues when transferring will be greatly appreciated, as always.
JN
FYI, the config.ini is something specific to the app you're dealing not a ColdFusion convention of any sort. Most likely the "vmap" entry therein means "virtual mapping". Its value is probably being used to resolve a path to an object (i.e. [value of vmap] + ".cart.models.store". With it empty, you're getting an error because ColdFusion wants its paths to not start with a period, and is unable to resolve the location of the file its looking for to create an object.
So previously this path was "SitenameDev.cart.models.store". What you need to do is figure out what directory houses the "cart\models\store" hierarchy. Then in the ColdFusion administrator setup a mapping to its parent directory - that is an alias to a physical directory that ColdFusion recognizes. Then whatever alias you choose should be set as the "vmap" value in the config.ini file.

Resources