<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
p.emailquote, li.emailquote, div.emailquote
        {mso-style-name:emailquote;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:1.0pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
        {mso-style-name:msochpdefault;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:10.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
span.emailstyle19
        {mso-style-name:emailstyle19;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        color:black;}
span.EmailStyle26
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-CA link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks Tom and Pat, will look at this.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>RonM2<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> xerte-bounces@lists.nottingham.ac.uk [mailto:xerte-bounces@lists.nottingham.ac.uk] <b>On Behalf Of </b>Tom Reijnders<br><b>Sent:</b> Wednesday, January 01, 2014 12:46 PM<br><b>To:</b> Xerte discussion list<br><b>Subject:</b> [Xerte] Re: JS question in template_management.js<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Ron,<br><br>This is probably better for the developer list.<br><br>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.<br><br>delete_template(drag_manager.selected_items[x].id.substr(drag_manager.selected_items[x].id.indexOf("_"),drag_manager.selected_items[x].id.length));    <br><br>So: <br><br>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<br>2. To get the 43 out of the string, the text from '_' to the end of the string is taken:<br>    drag_manager.selected_items[x].id.substr(drag_manager.selected_items[x].id.indexOf("_"),drag_manager.selected_items[x].id.length<br>3. Then that string is passed to the delete_tempate function (in this case 43)<br><br>So perhaps, you should put your logic in the delete_template function...<br><br><br>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 using AJAX).<br><br>Regards,<br><br>Tom<br><br><o:p></o:p></p><div><p class=MsoNormal>KnowledgeWare schreef op 28-12-2013 0:40:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='color:#1F497D'>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.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>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.</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>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?</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>Thanks for any suggestions</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>RonM2 </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>//RGM if workspace folder selected and delete clicked:</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                        if(document.getElementById("folder_workspace").mainhighlight){</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                                    alert("You cannot delete the Workspace folder");</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                        }</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>            }else{  </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>//RGM if more than one workspace course is selected and delete clicked:</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                        if(drag_manager.selected_items.length!=1){</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                                    var response = confirm("Are you sure you with to delete these items?");</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                        }else{</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>//RGM if a single workspace course is selected and delete clicked: </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                                    var response = confirm("Are you sure you with to delete this item?");</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'>                        }</span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p>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.<o:p></o:p></p><p>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.<o:p></o:p></p><p class=MsoNormal><br><br><br><br><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>Xerte mailing list<o:p></o:p></pre><pre><a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><o:p></o:p></pre><pre><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><o:p></o:p></pre></blockquote><p class=MsoNormal><br><br><o:p></o:p></p><pre>-- <o:p></o:p></pre><pre>--<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Tom Reijnders<o:p></o:p></pre><pre>TOR Informatica<o:p></o:p></pre><pre>Chopinlaan 27<o:p></o:p></pre><pre>5242HM Rosmalen<o:p></o:p></pre><pre>Tel: 073 5226191<o:p></o:p></pre><pre>Fax: 073 5226196<o:p></o:p></pre><pre><o:p> </o:p></pre><p class=MsoNormal><o:p> </o:p></p><p>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.<o:p></o:p></p><p>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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>