[Xerte] Re: JS question in template_management.js
reijnders at tor.nl
Wed Jan 1 20:46:17 GMT 2014
This is probably better for the developer list.
Anyhow, on line 1007 (of the latest version) of template_management.js,
you see the expression that is used to get the tempate_id to be deleted.
1. drag_manager.selected_items[x].id contains a string that determines
whther this item to be deleted is a folder or an LO. In this case it is
expected to be an LO and conatins something like 'file_43' for templateId 43
2. To get the 43 out of the string, the text from '_' to the end of the
string is taken:
3. Then that string is passed to the delete_tempate function (in this
So perhaps, you should put your logic in the delete_template function...
Or even better, in the php function :
website_code/php/templates/delete_template.php because that's the
function that does all the work (it's called from delete_template by
KnowledgeWare schreef op 28-12-2013 0:40:
> I'm in toolkits V1.7 (trying to move to 2 -- this is part of the
> process) in websitecode/scripts/template_management.js down around
> line 1030. This is the section where courses are deleted. Since my
> customizations use a SQL Server dbase to also store info on the
> courses, I want run a script to make sure that the course(s) to be
> deleted are not assigned to students.
> First I need to get the 'templateID' of the course, but not sure how
> to do that, I'm not good with js. Does anyone know if I can pull the
> 'templateID' of the course(s) that have been clicked in the workspace
> delete window at this point? I'm wondering if the document object
> contains the templateID(s) at this point and if so what syntax I'd use
> to get them.
> Next, any suggestion on what is socially acceptable to js in terms of
> running a query on my SQL Server database to see if students are
> currently assigned?
> Thanks for any suggestions
> //RGM if workspace folder selected and delete clicked:
> alert("You cannot delete the Workspace folder");
> //RGM if more than one workspace course is selected and delete clicked:
> var response = confirm("Are you sure you with to delete these items?");
> //RGM if a single workspace course is selected and delete clicked:
> var response = confirm("Are you sure you with to delete this item?");
> 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 mailing list
> Xerte at lists.nottingham.ac.uk
Tel: 073 5226191
Fax: 073 5226196
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Xerte