浏览代码

Update 'ilm_manager_form.php'

Synchronizing iAssign Git with the current iAssign stable version (until Moodle 5.0).
Small changes in: ilm_manager.php, lang/*/iassign.php
Bigger changes in: ilm_manager_form.php, lib.php, settings_form.php, settings.php, version.php, backup/moodle2/*.php, ilm_debug/escreva.php, ilm_handlers/java.php
New iLM versions: iassign/ilm/iFractions/, iassign/ilm/iHanoi/, iassign/ilm/iVProg/
New file (was missing): settings_activities.php
leo 2 周之前
父节点
当前提交
2741adf7b7
共有 1 个文件被更改,包括 41 次插入20 次删除
  1. 41 20
      ilm_manager_form.php

+ 41 - 20
ilm_manager_form.php

@@ -2,25 +2,26 @@
 
 /**
  * Form to manager ilm installed into iAssign.
+ * This uses 'locallib.php:view_files_ilm($iassign_ilm_class, $extension)' to construct HTML/JavaScript to manage iLM content files.
  *
  * Release Notes:
  * - v 1.7 2013/10/24
- * 		+ View extension when iassign view is active.
+ *   + View extension when iassign view is active.
  * - v 1.6 2013/08/22
- * 		+ Merge for import zip files and iassign files.
+ *   + Merge for import zip files and iassign files.
  * - v 1.5 2013/08/21
- * 		+ Insert functions for import files.
+ *   + Insert functions for import files.
  * - v 1.4 2013/07/23
- * 		+ Fix filter iLM from select of iLMs only iassign mode and not block mode..
- * 		+ Fix change form message with function 'disable_form_change_checker()'.
+ *   + Fix filter iLM from select of iLMs only iassign mode and not block mode..
+ *   + Fix change form message with function 'disable_form_change_checker()'.
  * - v 1.3 2013/07/12
- * 		+ Fix filter iLM from select of iLMs.
- * 		+ Fix error messages of 'setType' in debug mode for hidden fields.
+ *   + Fix filter iLM from select of iLMs.
+ *   + Fix error messages of 'setType' in debug mode for hidden fields.
  * - v 1.1 2013/06/26
- * 		+ Remove the button of choose iLM (ID of iLM send of parent page).
+ *   + Remove the button of choose iLM (ID of iLM send of parent page).
  *
  * @author Patricia Alves Rodrigues
- * @author Leônidas O. Brandão
+ * @author Leo^nidas de Oliveira Branda~o
  * @version v 1.7 2013/10/24
  * @package mod_iassign_ilm
  * @since 2010/09/27
@@ -51,16 +52,36 @@ class ilm_manager_form extends moodleform {
     $mform = & $this->_form;
     //TODO Javascript code: verify alternatives...
     $code_javascript_open_online_ilm = "
-  <script type='text/javascript'>
-  //<![CDATA[
-    function open_online_ilm(ilmid) {
-      if (ilmid == null || ilmid == '')
-	ilmid = document.getElementById('id_iassign_ilmid').value;
-	dirid = document.forms[0].dirid.value;
-	window.location='$CFG->wwwroot/mod/iassign/ilm_manager.php?from=" . $from . "&id=" . $id . "&action=new&ilmid='+ilmid+'&dirid='+dirid;
-        }
-  //]]>
-  </script>\n";
+<script type='text/javascript'>
+//<![CDATA[
+function clear_action (action) { // Auxiliary to identify correct iAssign form 'http://.../moodle/mod/iassign/ilm_manager.php'
+  if (action) {
+    var items = action.split('/');
+    var sizeI = items.length;
+    return items[sizeI-1];
+    }
+  return '';
+  }
+function open_online_ilm (ilmid) {
+  var dirid, ilmid;
+  if (ilmid == null || ilmid == '')
+    ilmid = document.getElementById('id_iassign_ilmid').value;
+  var document_forms = document.getElementsByTagName('form'); // instead of document.forms
+  //TOODO: Nowadays, there are lots of 'form' in view of Moodle! Use: id='mform1_k2DTt9FBTfCoWkC'
+  console.log('ilm_manager_form.php: open_online_ilm(.): #document_forms = ' + document_forms.length);
+  for (var i=0; i<document_forms.length; i++) {
+    var strAction = clear_action(document_forms[i].action);
+    if (strAction == 'ilm_manager.php') {
+      dirid = document_forms[i].dirid.value;
+      break;
+      }
+    }
+  console.log('ilm_manager_form.php: open_online_ilm(.): dirid=' + dirid);
+  // change window content with iLM online editor
+  window.location='" . $CFG->wwwroot . "/mod/iassign/ilm_manager.php?from=" . $from . "&id=" . $id . "&action=new&ilmid='+ilmid+'&dirid='+dirid;
+  }
+//]]>
+</script>\n";
 
     /// Adding new iLM
     $mform->addElement('header', 'new_ilm', get_string('new_ilm', 'iassign'));
@@ -109,4 +130,4 @@ class ilm_manager_form extends moodleform {
     $mform->disable_form_change_checker();
     }
 
-  } // class ilm_manager_form extends moodleform
+  } // class ilm_manager_form extends moodleform