您的位置:首页 > 其它

joomla异常处理之--文章编辑时单元下拉框无法显示细目

2015-05-13 21:36 459 查看
最近,完成了网站的迁移,然而在测试时,发现一个异常情况:文章编辑时单元下拉框无法显示细目,百般查找,没有头绪,后来在一篇文章(详见:参考资料)的启示下,查找并解决了这个问题

joomla异常处理之--文章编辑时单元下拉框无法显示细目

关键字:joomla,类别,单元,图片,新文章,MOSImage Control,com_content,drop-downs

最近,完成了网站的迁移,然而在测试时,发现一个异常情况:文章编辑时单元下拉框无法显示细目,百般查找,没有头绪,后来在一篇文章(详见:参考资料)的启示下,查找并解决了这个问题

问题现象:在写新文章时,有两个异常情况:
1:选中Section(单元)后,相应的Category(类别)下拉框只有一个“请选择类别”提示,没有明细的类别条目;
2:在文章图片(MOSImage Control )处,仅有根目录的图片,子目录图片均没有出现。

产生原因:因为com_content组件在处理文章编辑时,需要使用javascript装载数据库的类别、单元条目和图片路径下的所有文件列表,用于进一步编辑,如果其中的文件名存在单引号,产生解析错误。
最终导致无法正确装载设置的类别、单元条目和图片文件列表。

查找方法:在编辑界面,查看网页源码,查找包含单引号的有问题的文件名。可以在查找以前,将以下三种正确的情况替换为”---“等符号后,再查找那个可恶的单引号:三种正确的情况分别是。(', 和 ','以及,)
处理:改名或清除。

例如:以下是有问题的几个文件名:

¨?1905ūμ???,'??¨?1905ūμ??? );
a's2.jpg---Lilla's2.jpg---;

参考资料:"com_content/new" drop-downs misbehaving
http://forum.joomla.org/viewtopic.php?f=34&t=368702

Author :cgremlin
Post subject: "com_content/new" drop-downs misbehaving
Posted: Wed Feb 04, 2009 8:46 am

Hi all,
I'm just started having some difficulty with a site running on 1.0.12 - when attempting to add new content, the Section drop-down populates properly, but once a section is selected, the Category drop down doesn't populate, containing only the item "Select Category". If I edit existing content, the Category drop-down is populated properly, but does not re-populate if the Section selection is changed. Additionally, selecting the "Images" tab (MOSImage) brings its own issues - selecting a different folder no longer refreshes the list of available images. On a lark, I updated a backup of the site to 1.0.15, and am seeing exactly the same behavior there as well.
Everything was working great for the past year or so prior to a fairly large update, and while I can restore back to the state immediately prior to the update, I'd rather not have to re-enter a bunch of content if I can avoid it, plus it'd be nice to understand the nature of the failure. Given that it seemed to happen right after the content update, I'm guessing I've got something that's gotten corrupted in the database, but the PHP and MySQL logs don't indicate anything out of the ordinary. Does anyone have any ideas where I might start to look to fix this without having to slog through thousands of lines of PHP?
After a bit of debugging, I was finally able to determine what was causing this problem. Turns out, way down in the "image" hierarchy, there was a directory that contained a single quote in its name. This quoted directory name apparently was not parsed correctly and resulted in the generation of a faulty Javascript source line when creating/filling the folderimages[] array in admin.content.html.php (line 507), which ultimately resulted in a Javascript error being quietly generated. The generated Javascript line was setting almost 18,000 elements in the folderimages[] array, and the error in this particular case didn't actually occur until around the 13,000th element, and the generated source line was almost 2.5 megabytes long. It wasn't until I changed admin.content.html.php to put each element assignment on a separate line (instead of the tabbed separation it normally uses) that I was able to determine exactly what the browser was complaining about.
Through a Rube-Goldberg-like set of dependencies in the generated Javascript, this failure ultimately resulted in writeDynaList() being passed a bad source array, and it was this extremely indirect failure in writeDynaList() that was responsible for the problems I originally reported, as the bad source array prevented any drop-downs from being populated.
So, after all that, the fix ended up being just renaming the directory containing the single-quote in the name. If anyone else ever experiences this problem, check those directory names first thing to make sure they don't have any wacky characters.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐