[ http://jira.magnolia.info/browse/MAGNOLIA-800?page=all ]
Chris Miner reassigned MAGNOLIA-800:
------------------------------------
Assignee: Chris Miner (was: Philipp Bracher)
> URL manipulation in javascript does not take into account page level links (#)
> ------------------------------------------------------------------------------
>
> Key: MAGNOLIA-800
> URL: http://jira.magnolia.info/browse/MAGNOLIA-800
> Project: Magnolia
> Issue Type: Bug
> Components: admininterface
> Affects Versions: 2.1.5
> Reporter: Tom Jensen
> Assigned To: Chris Miner
> Priority: Minor
> Original Estimate: 5 minutes
> Remaining Estimate: 5 minutes
>
> This problem effects the following javascript functions:
> mgnlUpdateCK() in /admindocroot/js/general.js and
> mgnlAddParameter() and mgnlRemoveParameter() in /admindocroot/js/generic.js
> If a content editor clicks on a link that is within the current page (such as
> <a href="#bottom">) the url is appended with the #bottom. When clicking on
> the preview button after that it will not do a new request to the server
> because the parameters are appended AFTER the #bottom. Need to split off the
> page level link first. Suggest changing the methods like the following:
> function mgnlUpdateCK(href)
> {
> if (!href) href=document.location.href;
> tmp=href.split("#");
> anchor=(tmp[1]!=null ? "#"+tmp[1] : "");
> href=tmp[0];
> tmp=href.split("?");
> var href2=tmp[0]+"?mgnlCK="+new Date().getTime();
> if (tmp[1])
> {
> var qs=tmp[1].split("&");
> for (var elem=0; elem<qs.length; elem++)
> {
> if (qs[elem].indexOf("mgnlCK=")!=0) href2+="&"+qs[elem];
> }
> }
> return href2+anchor;
> }
> ------------
> function mgnlAddParameter(href,name,value)
> {
> tmp=href.split("#");
> anchor=(tmp[1]!=null ? "#"+tmp[1] : "");
> href=tmp[0];
>
> var delimiter;
> if (href.indexOf("?")==-1) delimiter="?";
> else delimiter="&";
> return href+delimiter+name+"="+value + anchor;
> }
> ------------
> function mgnlRemoveParameter(href,name)
> {
> //works only for a single paramter
> /*
> var nameExtended;
> var delimiter
> var tmp;
> if (href.indexOf("?"+name+"=")!=-1) delimiter="?";
> else delimiter="&";
> var tmp=href.split(delimiter+name+"=");
> var href2=tmp[0];
> if (tmp[1])
> {
> if (tmp[1].indexOf("&")!=-1)
> href2+=delimiter+tmp[1].substring(tmp[1].indexOf("&")+1);
> }
> return href2;
> */
> var tmp=href.split("#");
> anchor=(tmp[1]!=null ? "#"+tmp[1] : "");
> href=tmp[0];
> tmp=href.split("?");
> var newHref=tmp[0];
> if (tmp[1])
> {
> var paramObj=tmp[1].split("&");
> for (var i=0;i<paramObj.length;i++)
> {
> if (paramObj[i].indexOf(name+"=")!=0)
> {
> if (i==0) newHref+="?";
> else newHref+="&";
> newHref+=paramObj[i];
> }
> }
> }
> return newHref + anchor;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia.info/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------