[Xerte-dev] Re: XOT - Deleting a folder throws a message with html in it.

Julian Tenney Julian.Tenney at nottingham.ac.uk
Tue Jul 17 09:58:31 BST 2012


If it works, it works.

From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 16 July 2012 22:25
To: 'For Xerte technical developers'
Subject: [Xerte-dev] XOT - Deleting a folder throws a message with html in it.

Hi all and I guess mainly Pat...

Julian previously reported this visual error e.g. the confirmation dialogue when trying to delete an empty folder works but shows some rogue html instead of the folder name as well as a typo in the message e.g. something like:

<img style="vertical-align:middle" src="website_code/images/Icon_Folder_Empty.gif"

Are you sure you with to delete?

As far as I can tell this has existed for ages and isn't new to 1.8 but still exists in 1.8.

Fixing the typo e.g. replacing 'with' with 'wish' in both  \website_code\scripts\template_management.js and \languages\en-GB\website_code\scripts\template_management.js is obviously easy and I have done that on the files I've been testing. However the main issue seems to be with the split used to display the name of the item selected...

in \website_code\scripts\template_management.js the relevant section is the following:

if(drag_manager.selected_items.length!=1){

            var response = confirm("Are you sure you wish to delete these item?");

        }else{

            data_string = drag_manager.selected_items[0].innerHTML;

            name_string = data_string.split(">");

            var response = confirm(name_string[1] + "\n\nAre you sure you wish to delete?");

        }

when a folder is selected for deletion data_string equals something like:
<P><IMG style="VERTICAL-ALIGN:middle" src="website_code/images/Icon_Folder_Empty.gif">new folder2</P>

when a file is selected for deletion data_string equals something like:
<IMG style="VERTICAL-ALIGN:middle" src="http://localhost/newxottrunktest//website_code/images/Icon_Page.gif">test lo

so when a file is selected for deletion var response = confirm(name_string[1] correctly results in just the file name but when a folder is selected var response = confirm(name_string[2] would be a closer match displaying the folder name but ending with </P

The easiest way I could think of to fix this is to first strip out the <P> and </P> so that the spit is correct for both file and folder deletion. So the section of code now looks like:

if(drag_manager.selected_items.length!=1){

            var response = confirm("Are you sure you wish to delete these item?");

        }else{

            data_string = drag_manager.selected_items[0].innerHTML;

                                             data_string = data_string.replace("<P>","");
                                             data_string = data_string.replace("</P>","");

            name_string = data_string.split(">");

            var response = confirm(name_string[1] + "\n\nAre you sure you wish to delete?");

        }

This seems to work fine and correctly displays the file name or folder name in the deletion confirmation dialogue.

So question mainly for Pat - is this ok and if so shall I commit the changes or is there a better way to fix this?

Cheers
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte-dev/attachments/20120717/d3c6006b/attachment-0001.html>


More information about the Xerte-dev mailing list