[Xerte-dev] Re: XOT - Deleting a folder throws a message with html in it.
Pat Lockley
patrick.lockley at googlemail.com
Tue Jul 17 08:44:15 BST 2012
Will fix later
On 17 Jul 2012, at 08:24, "Ron Mitchell" <ronm at mitchellmedia.co.uk> wrote:
> Hi Pat
> thanks for the updates. I've uploaded these to the test server as well as my
> local test install and unfortunately although the delete folder issue
> appears to be resolved now when trying to delete a file the following error
> occurs:
>
> 'name_string.2' is null or not an object
> template_management.js Line: 1003
> Code: 0 Char: 13
> URI: /website_code/scripts/template_management.js
>
>
> -----Original Message-----
> From: xerte-dev-bounces at lists.nottingham.ac.uk
> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat Lockley
> Sent: 16 July 2012 23:28
> To: For Xerte technical developers
> Subject: [Xerte-dev] Re: XOT - Deleting a folder throws a message with html
> in it.
>
> and internationalised the file involved.... again
>
> On Mon, Jul 16, 2012 at 11:27 PM, Pat Lockley
> <patrick.lockley at googlemail.com> wrote:
>> have commited a fix
>>
>> On Mon, Jul 16, 2012 at 10:24 PM, Ron Mitchell <ronm at mitchellmedia.co.uk>
> wrote:
>>> 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
>>>
>>>
>>> This message and any attachment are intended solely for the addressee
>>> and may contain confidential information. If you have received this
>>> message in error, please send it back to me, and immediately delete
>>> it. Please do not use, copy or disclose the information contained in
>>> this message or in any attachment. Any views or opinions expressed by
>>> the author of this email do not necessarily reflect the views of the
> University of Nottingham.
>>>
>>> This message has been checked for viruses but the contents of an
>>> attachment may still contain software viruses which could damage your
> computer system:
>>> you are advised to perform your own checks. Email communications with
>>> the University of Nottingham may be monitored as permitted by UK
> legislation.
>>>
>>>
>>> _______________________________________________
>>> Xerte-dev mailing list
>>> Xerte-dev at lists.nottingham.ac.uk
>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>>>
>>> This message and any attachment are intended solely for the addressee
>>> and may contain confidential information. If you have received this
> message in
>>> error, please send it back to me, and immediately delete it. Please do
> not
>>> use, copy or disclose the information contained in this message or in
>>> any attachment. Any views or opinions expressed by the author of
>>> this email do not necessarily reflect the views of the University of
> Nottingham.
>>>
>>> This message has been checked for viruses but the contents of an
>>> attachment may still contain software viruses which could damage your
> computer system:
>>> you are advised to perform your own checks. Email communications with
>>> the University of Nottingham may be monitored as permitted by UK
> legislation.
>>>
>>>
>
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>
>
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
More information about the Xerte-dev
mailing list