<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
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>
<br>
<div class="moz-cite-prefix">KnowledgeWare schreef op 28-12-2013
0:40:<br>
</div>
<blockquote cite="mid:001d01cf035d$0e415c00$2ac41400$@kccsoft.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
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";}
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";}
p.emailquote, li.emailquote, div.emailquote
{mso-style-name:emailquote;
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";}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
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";}
span.emailstyle19
{mso-style-name:emailstyle19;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.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]-->
<div class="WordSection1">
<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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></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?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks for any
suggestions<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">RonM2 <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">//RGM if
workspace folder selected and delete clicked:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
if(document.getElementById("folder_workspace").mainhighlight){<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
alert("You cannot delete the Workspace folder");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
}else{ <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">//RGM if more
than one workspace course is selected and delete clicked:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
if(drag_manager.selected_items.length!=1){<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
var response = confirm("Are you sure you with to delete
these items?");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
}else{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">//RGM if a
single workspace course is selected and delete clicked: <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
var response = confirm("Are you sure you with to delete this
item?");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">
}</span><o:p></o:p></p>
</div>
<br>
<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.</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.</p>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Xerte mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a>
<a class="moz-txt-link-freetext" href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
--
Tom Reijnders
TOR Informatica
Chopinlaan 27
5242HM Rosmalen
Tel: 073 5226191
Fax: 073 5226196
</pre>
</body>
</html>