+++ /dev/null
-<?php\r
-/************************************************************************/\r
-/* ATutor */\r
-/************************************************************************/\r
-/* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/\r
-/* Adaptive Technology Resource Centre / University of Toronto */\r
-/* http://atutor.ca */\r
-/* */\r
-/* This program is free software. You can redistribute it and/or */\r
-/* modify it under the terms of the GNU General Public License */\r
-/* as published by the Free Software Foundation. */\r
-/************************************************************************/\r
-// $Id: patch_edit_interface.tmpl.php 7208 2008-03-13 16:07:24Z cindy $\r
-\r
-require ('include/json.inc.php');\r
-require (AT_INCLUDE_PATH.'header.inc.php');\r
-?>\r
-\r
-<form enctype="multipart/form-data" action='<?php echo $url; ?>' method="post" name="form" target="messageIFrame">\r
-\r
-<div class="input-form">\r
-\r
-<iframe id="messageIFrame" name="messageIFrame" src='' style='width:1px;height:1px;border:0' onload="show_message()"></iframe>\r
-<div id="messageDIV"></div>\r
- \r
- <div class="row">\r
- <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="atutor_patch_id"><?php echo _AT('atutor_patch_id'); ?></label><br />\r
- <small>· <?php echo _AT('contain_only'); ?></small><br />\r
- <input id="atutor_patch_id" name="atutor_patch_id" type="text" maxlength="100" size="30" value="<?php echo $row_patches['atutor_patch_id']; ?>" /><br />\r
- </div>\r
-\r
- <div class="row">\r
- <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="atutor_version_to_apply"><?php echo _AT('atutor_version_to_apply'); ?></label><br />\r
- <input id="atutor_version_to_apply" name="atutor_version_to_apply" type="text" maxlength="100" size="30" value="<?php echo $row_patches['applied_version']; ?>" /><br />\r
- </div>\r
-\r
- <div class="row">\r
- <label for="description"><?php echo _AT('description'); ?></label><br />\r
- <textarea id="description" name="description" cols="40" rows="4"><?php echo $row_patches['description']; ?></textarea><br />\r
- </div>\r
-\r
- <div class="row">\r
- <label for="sql_statement"><?php echo _AT('sql_statement'); ?></label><br />\r
- <textarea id="sql_statement" name="sql_statement" cols="40" rows="8"><?php echo $row_patches['sql_statement']; ?></textarea><br />\r
- </div>\r
-\r
- <div class="row">\r
- <label for="dependent_patches"><?php echo _AT('dependent_patches'); ?></label><br />\r
- </div>\r
-\r
- <div class="row">\r
- <table id="dependent_patches" class="data" rules="cols" align="left" style="width: 50%;">\r
- <thead>\r
- <tr>\r
- <th scope="col"><?php echo _AT('dependent_patch_id'); ?></th>\r
- </tr>\r
- </thead>\r
-\r
- <tbody>\r
-<?php\r
-// when edit existing patch\r
-if ($result_patch_dependent) \r
-{\r
- $num_of_dependents = mysql_num_rows($result_patch_dependent);\r
- while ($row_patch_dependent = mysql_fetch_assoc($result_patch_dependent))\r
- {\r
- ?>\r
- <tr>\r
- <td><input id="dependent_patch" name="dependent_patch[]" value="<?php echo $row_patch_dependent['dependent_patch_id']; ?>" type="text" maxlength="100" size="100" style="max-width:100%; display:block" /></td>\r
- </tr>\r
- <?php\r
- }\r
-}\r
-\r
-// when creating new patch\r
-if ($num_of_dependents == 0)\r
-{\r
-?>\r
- <tr>\r
- <td><input id="dependent_patch" name="dependent_patch[]" type="text" maxlength="100" size="100" style="max-width:100%; display:block" /></td>\r
- </tr>\r
- </tbody>\r
-<?php\r
-}\r
-?>\r
- \r
- <tfoot>\r
- <tr>\r
- <td colspan="4">\r
- <div class="buttons" style="float:left">\r
- <input type="button" name="add_dependent_patch" value="<?php echo _AT('add_dependent_patch'); ?>" onclick="add_dependent()" />\r
- </div>\r
- </td>\r
- </tr>\r
- </tfoot>\r
-\r
- </table>\r
- </div>\r
- \r
- <br /><br /><br /><br /><br /><br />\r
- <div class="row">\r
- <label for="filesDiv"><?php echo _AT('files'); ?></label><br />\r
- <small>· <?php echo _AT('relative_directory'); ?></small>\r
- </div>\r
-\r
- <div id="filesDiv" class="row">\r
- </div>\r
-\r
- <div class="row buttons" style="float:left">\r
- <input type="button" name="add_a_file" value="<?php echo _AT('add_a_file'); ?>" onClick="add_file()" />\r
- </div>\r
- \r
- <br /><br />\r
- \r
- <div class="row buttons">\r
- <input type="submit" name="create" value=" <?php echo _AT('create_patch'); ?> " accesskey="c" />\r
- <input type="submit" name="save" value=" <?php echo _AT('save'); ?> " accesskey="s" onClick="document.form.target=''; "/>\r
- <input type="button" name="cancel" value=" <?php echo _AT('cancel'); ?> " onClick="location.href='mods/patcher/myown_patches.php'" />\r
- </div>\r
-\r
-</div>\r
-</form>\r
-\r
-<script language="JavaScript" type="text/javascript">\r
-//<!--\r
-\r
-myescape = function(/*string*/ str) {\r
- return str.replace(/(['"\.*+?^${}()|[\]\/\\])/g, "\\$1").replace(/\n/g, '\\n');\r
-}\r
-\r
-function show_message()\r
-{\r
- var messageDIV = document.getElementById("messageDIV"); \r
- var i = document.getElementById("messageIFrame"); \r
- \r
- if (i.contentDocument) {\r
- var d = i.contentDocument;\r
- } else if (i.contentWindow) {\r
- var d = i.contentWindow.document;\r
- } else {\r
- var d = window.frames[id].document;\r
- } \r
- messageDIV.innerHTML = d.body.innerHTML;\r
-}\r
-\r
-function add_dependent() {\r
- var dependentPatchesTable = document.getElementById("dependent_patches").tBodies[0];\r
- var dependentPatch = dependentPatchesTable.rows[dependentPatchesTable.rows.length - 1].cloneNode(true);\r
- dependentPatchesTable.appendChild(dependentPatch);\r
- dependentPatch.cells[0].firstChild.value='';\r
- \r
- var dependents = document.form["dependent_patch[]"];\r
- dependents[dependents.length - 1].focus();\r
- // document.form['dependent_patch['+ pos +']'].focus();\r
-}\r
-\r
-var num_of_files = 0;\r
-function add_file(filedata) {\r
- var newDiv = document.createElement("div");\r
- \r
- newDiv.innerHTML = ACTION_HTML_TEMPLATE.replace(/\{1\}/g, num_of_files);\r
- document.getElementById("filesDiv").appendChild(newDiv);\r
- \r
- document.form['rb_action[' +num_of_files +']'][0].focus();\r
- \r
- if(filedata) {\r
- var srcElement = null;\r
-\r
- if(filedata.action=="add") {\r
- // set focus on radio button "add"\r
- document.form['rb_action[' +num_of_files +']'][0].checked = true;\r
- document.form['rb_action[' +num_of_files +']'][0].focus();\r
-\r
- // set value\r
- srcElement = document.form['rb_action[' +num_of_files +']'][0];\r
- document.form['add_filename[' +num_of_files +']'].value = filedata.name;\r
- document.form['add_dir[' +num_of_files +']'].value = filedata.location;\r
- \r
- // set uploaded file\r
- if (filedata.uploaded_file != "")\r
- {\r
- document.form['add_uploaded_file[' +num_of_files +']'].value = filedata.uploaded_file;\r
- var tables = newDiv.getElementsByTagName('TABLE');\r
- tables[0].rows[2].style.display=''; // display the row of uploaded file\r
- tables[0].rows[2].cells[1].innerHTML=filedata.uploaded_file; // display uploaded file name\r
- tables[0].rows[3].cells[0].innerHTML='<?php echo _AT("replace_file"); ?>'; // change label from "upload file" to "replace file"\r
- }\r
- \r
- // set uploaded file\r
- } else if(filedata.action=="alter") {\r
- document.form['rb_action[' +num_of_files +']'][1].checked = true;\r
- document.form['rb_action[' +num_of_files +']'][1].focus();\r
-\r
- srcElement = document.form['rb_action[' +num_of_files +']'][1];\r
- document.form['alter_filename[' +num_of_files +']'].value = filedata.name;\r
- document.form['alter_dir[' +num_of_files +']'].value = filedata.location;\r
- document.form['alter_code_from[' +num_of_files +']'].value = filedata.code_from;\r
- document.form['alter_code_to[' +num_of_files +']'].value = filedata.code_to;\r
- } else if(filedata.action=="delete") {\r
- document.form['rb_action[' +num_of_files +']'][2].checked = true;\r
- document.form['rb_action[' +num_of_files +']'][2].focus();\r
-\r
- srcElement = document.form['rb_action[' +num_of_files +']'][2];\r
- document.form['delete_filename[' +num_of_files +']'].value = filedata.name;\r
- document.form['delete_dir[' +num_of_files +']'].value = filedata.location;\r
- } if(filedata.action=="overwrite") {\r
- document.form['rb_action[' +num_of_files +']'][3].checked = true;\r
- document.form['rb_action[' +num_of_files +']'][3].focus();\r
-\r
- srcElement = document.form['rb_action[' +num_of_files +']'][3];\r
- document.form['overwrite_filename[' +num_of_files +']'].value = filedata.name;\r
- document.form['overwrite_dir[' +num_of_files +']'].value = filedata.location;\r
-\r
- // set uploaded file\r
- if (filedata.uploaded_file != "")\r
- {\r
- document.form['overwrite_uploaded_file[' +num_of_files +']'].value = filedata.uploaded_file;\r
- var tables = newDiv.getElementsByTagName('TABLE');\r
- tables[3].rows[2].style.display=''; // display the row of uploaded file\r
- tables[3].rows[2].cells[1].innerHTML=filedata.uploaded_file; // display uploaded file name\r
- tables[3].rows[3].cells[0].innerHTML='<?php echo _AT("replace_file"); ?>'; // change label from "upload file" to "replace file"\r
- }\r
- \r
- }\r
- \r
- show_content({srcElement:srcElement});\r
- }\r
-\r
- num_of_files++;\r
-}\r
-\r
-function del_file(evt) {\r
- var target =(evt.srcElement)?evt.srcElement:evt.currentTarget;\r
- var div = target.parentNode.parentNode ;\r
- div.parentNode.removeChild(div);\r
-}\r
-\r
-function show_content(evt) {\r
- var target =(evt.srcElement)?evt.srcElement:evt.currentTarget;\r
- var tables = target.parentNode.parentNode.getElementsByTagName('TABLE');\r
- tables[0].style.display='none';\r
- tables[1].style.display='none';\r
- tables[2].style.display='none';\r
- tables[3].style.display='none';\r
- if(target.value == 'add') tables[0].style.display='';\r
- if(target.value == 'alter') tables[1].style.display='';\r
- if(target.value == 'delete') tables[2].style.display='';\r
- if(target.value == 'overwrite') tables[3].style.display='';\r
-}\r
-\r
-var ACTION_HTML_TEMPLATE = ' \\r
-<div style="border-width:thin; border-style:solid; padding: 5px 5px 5px 5px; margin:5px 5px 5px 5px"> \\r
- <div style="float:left">Action: \\r
- <input type="radio" name="rb_action[{1}]" value="add" id="add" checked onclick="show_content(event);" /><label for="add"><?php echo _AT("add"); ?></label> \\r
- <input type="radio" name="rb_action[{1}]" value="alter" id="alter" onclick="show_content(event);" /><label for="alter"><?php echo _AT("alter"); ?></label> \\r
- <input type="radio" name="rb_action[{1}]" value="delete" id="delete" onclick="show_content(event);" /><label for="delete"><?php echo _AT("delete"); ?></label> \\r
- <input type="radio" name="rb_action[{1}]" value="overwrite" id="overwrite" onclick="show_content(event);" /><label for="overwrite"><?php echo _AT("overwrite"); ?></label> \\r
- </div> \\r
- <br /><br /> \\r
- <div> \\r
- <table style="display:" width="100%"> \\r
- <tr> \\r
- <td width="150px"><?php echo _AT("file_name"); ?></td> \\r
- <td><input name="add_filename[{1}]" type="text" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("directory"); ?></td> \\r
- <td><input name="add_dir[{1}]" type="text" /></td> \\r
- </tr> \\r
- <tr style="display: none"> \\r
- <td><?php echo _AT("file"); ?></td> \\r
- <td></td> \\r
- <td><INPUT TYPE="hidden" NAME="add_uploaded_file[{1}]" SIZE="40" style="max-width:100%" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("upload_file"); ?></td> \\r
- <td><INPUT TYPE="file" NAME="add_upload_file[{1}]" SIZE="40" style="max-width:100%" /></td> \\r
- </tr> \\r
- </table> \\r
- <table style="display: none" width="100%"> \\r
- <tr> \\r
- <td width="150px"><?php echo _AT("file_name"); ?></td> \\r
- <td><input name="alter_filename[{1}]" type="text" maxlength="100" size="100" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("directory"); ?></td> \\r
- <td><input name="alter_dir[{1}]" type="text" maxlength="100" size="100" style="max-width:100%" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("code_to_replace_from"); ?></td> \\r
- <td><textarea name="alter_code_from[{1}]" rows="5" cols="120" style="max-width:100%"></textarea></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("code_to_replace_to"); ?></td> \\r
- <td><textarea name="alter_code_to[{1}]" rows="5" cols="120" style="max-width:100%"></textarea></td> \\r
- </tr> \\r
- </table> \\r
- <table style="display: none" width="100%"> \\r
- <tr> \\r
- <td width="150px"><?php echo _AT("file_name"); ?></td> \\r
- <td><input name="delete_filename[{1}]" type="text" maxlength="100" size="100" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("directory"); ?></td> \\r
- <td><input name="delete_dir[{1}]" type="text" maxlength="100" size="100" /></td> \\r
- </tr> \\r
- </table> \\r
- <table style="display: none" width="100%"> \\r
- <tr> \\r
- <td width="150px"><?php echo _AT("file_name"); ?></td> \\r
- <td><input name="overwrite_filename[{1}]" type="text" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("directory"); ?></td> \\r
- <td><input name="overwrite_dir[{1}]" type="text" maxlength="100" size="100" /></td> \\r
- </tr> \\r
- <tr id="overwrite_uploaded_file" style="display:none"> \\r
- <td><?php echo _AT("file"); ?></td> \\r
- <td></td> \\r
- <td><INPUT type="hidden" NAME="overwrite_uploaded_file[{1}]" SIZE="40" style="max-width:100%" /></td> \\r
- </tr> \\r
- <tr> \\r
- <td><?php echo _AT("upload_file"); ?></td> \\r
- <td><INPUT TYPE="file" NAME="overwrite_upload_file[{1}]" SIZE="40" style="max-width:100%" /></td> \\r
- </tr> \\r
- </table> \\r
- </div> \\r
- <div class="row buttons" style="float:left"> \\r
- <input type="button" value="<?php echo _AT("delete_this_file"); ?>" onClick="del_file(event)" /> \\r
- </div> \\r
- <br /><br /> \\r
-</div> \\r
-';\r
-\r
-//-->\r
-</script>\r
-\r
-\r
-<script language="JavaScript" type="text/javascript">\r
- var patch_files = <?php echo json_encode_result($result_patch_files); ?>;\r
- \r
- window.onload = function() {\r
- for(var i=0; i<patch_files.length; i++) {\r
- add_file(patch_files[i]);\r
- }\r
- }\r
-</script>\r
- \r
-<?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>\r