diff --git a/classes/client.php b/classes/client.php index df506d3..f8a4574 100644 --- a/classes/client.php +++ b/classes/client.php @@ -258,8 +258,6 @@ public function exam_data($course, $cm) { 'visibleWarnings' => $conditiondata['warnings'], 'ldb' => $conditiondata['ldb'], 'allowMultipleDisplays' => $conditiondata['allowmultipledisplays'], - 'desktopAppForbiddenProcesses' => $desktopAppForbiddenProcesses, - 'desktopAppAllowedProcesses' => $desktopAppAllowedProcesses, 'allowVirtualEnvironment' => $conditiondata['allowvirtualenvironment'], 'checkIdPhotoQuality' => $conditiondata['checkidphotoquality'], 'webCameraMainView' => $conditiondata['webcameramainview'], @@ -269,6 +267,14 @@ public function exam_data($course, $cm) { ), ]; + if($conditiondata['enabledForbiddenProcesses']) { + $data['desktopAppForbiddenProcesses'] = $desktopAppForbiddenProcesses; + } + + if($conditiondata['enabledAllowedProcesses']) { + $data['desktopAppAllowedProcesses'] = $desktopAppAllowedProcesses; + } + return $data; } diff --git a/classes/condition.php b/classes/condition.php index 382ca91..fb0a5ce 100644 --- a/classes/condition.php +++ b/classes/condition.php @@ -46,7 +46,8 @@ class condition extends \core_availability\condition { 'checkidphotoquality', 'webcameramainview', 'scoring', 'warnings', 'rules', 'customrules', 'groups', 'biometryenabled', 'biometryskipfail', 'biometryflow', 'biometrytheme', - 'desktopAppForbiddenProcesses','desktopAppAllowedProcesses', + 'desktopAppForbiddenProcesses','desktopAppAllowedProcesses','enabledForbiddenProcesses', + 'enabledAllowedProcesses' ]; /** @var array List of default values for visible warnings */ @@ -243,10 +244,18 @@ public function __construct($structure) { $this->useragreementurl = $structure->useragreementurl; } + if (!empty($structure->enabledForbiddenProcesses)) { + $this->enabledForbiddenProcesses = $structure->enabledForbiddenProcesses; + } + if (!empty($structure->desktopAppForbiddenProcesses)) { $this->desktopAppForbiddenProcesses = $structure->desktopAppForbiddenProcesses; } + if (!empty($structure->enabledAllowedProcesses)) { + $this->enabledAllowedProcesses = $structure->enabledAllowedProcesses; + } + if (!empty($structure->desktopAppAllowedProcesses)) { $this->desktopAppAllowedProcesses = $structure->desktopAppAllowedProcesses; } @@ -413,7 +422,9 @@ public function save() { 'identification' => $this->identification, 'useragreementurl' => $this->useragreementurl, 'auxiliarycamera' => (bool) $this->auxiliarycamera, + 'enabledForbiddenProcesses' => (bool)$this->enabledForbiddenProcesses, 'desktopAppForbiddenProcesses' => $this->desktopAppForbiddenProcesses, + 'enabledAllowedProcesses' => (bool)$this->enabledAllowedProcesses, 'desktopAppAllowedProcesses' => $this->desktopAppAllowedProcesses, 'customrules' => $this->customrules, ]; diff --git a/classes/frontend.php b/classes/frontend.php index 34cdb52..aec02e1 100644 --- a/classes/frontend.php +++ b/classes/frontend.php @@ -55,7 +55,7 @@ protected function get_javascript_strings() { 'scoring_params_header_desc','desktop_app_forbidden_processes', 'desktop_app_allowed_processes','desktop_app_forbidden_processes_desc', 'desktop_app_allowed_processes_desc','scoring_params_header_desc', - 'user_agreement_url_desc', + 'user_agreement_url_desc','enabledAllowedProcesses','enabledForbiddenProcesses' ]; foreach (condition::WARNINGS as $key => $value) { diff --git a/lang/en/availability_examus2.php b/lang/en/availability_examus2.php index d4ab354..484c991 100644 --- a/lang/en/availability_examus2.php +++ b/lang/en/availability_examus2.php @@ -240,3 +240,6 @@ $string['desktop_app_forbidden_processes_desc'] = 'Use line breaks to separate applications'; $string['desktop_app_allowed_processes_desc'] = 'Use line breaks to separate applications'; $string['user_agreement_url_desc'] = 'A link to the exam rules (URL) on any page. Insert a custom rules page before the exam.'; + +$string['enabledAllowedProcesses'] = 'Enable allowed processes'; +$string['enabledForbiddenProcesses'] = 'Enable forbidden processes'; diff --git a/lang/ru/availability_examus2.php b/lang/ru/availability_examus2.php index f4c2aa1..54dc556 100644 --- a/lang/ru/availability_examus2.php +++ b/lang/ru/availability_examus2.php @@ -239,4 +239,7 @@ $string['scoring_params_header_desc'] = 'Для тонкой настройки расчета скоринга и вычисления результата прокторинга для конкретного экзамена можно менять параметры скоринга.
Важно: если выбор не сделан, то будут использованы значения по умолчанию (показываются все)'; $string['desktop_app_forbidden_processes_desc'] = 'Используйте перенос строки для разделения приложений'; $string['desktop_app_allowed_processes_desc'] = 'Используйте перенос строки для разделения приложений'; -$string['user_agreement_url_desc'] = 'Ссылка на правила (URL) на любой странице. Предназначено для вставки собственной страницы с правилами перед прохождением экзамена.'; \ No newline at end of file +$string['user_agreement_url_desc'] = 'Ссылка на правила (URL) на любой странице. Предназначено для вставки собственной страницы с правилами перед прохождением экзамена.'; + +$string['enabledAllowedProcesses'] = 'Включить разрешенные процессы'; +$string['enabledForbiddenProcesses'] = 'Включить запрещенные процессы'; \ No newline at end of file diff --git a/version.php b/version.php index 7e0784b..36512e7 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'availability_examus2'; -$plugin->version = 2024021401; -$plugin->release = 'v2.0.33'; +$plugin->version = 2024031501; +$plugin->release = 'v2.0.34'; $plugin->requires = 2018111800; $plugin->maturity = MATURITY_STABLE; diff --git a/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-debug.js b/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-debug.js index 9d107db..93dff47 100644 --- a/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-debug.js +++ b/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-debug.js @@ -44,7 +44,9 @@ M.availability_examus2.form.getNode = function(json) { var biometryThemeId = id + '_biometryTheme'; var userAgreementId = id + '_userAgreement'; var webCameraMainViewId = id + '_webCameraMainView'; + var enabledForbiddenProcessesId = id + '_enabledForbiddenProcesses'; var desktopAppForbiddenProcessesId = id + '_desktopAppForbiddenProcesses'; + var enabledAllowedProcessesId = id + '_enabledAllowedProcesses'; var desktopAppAllowedProcessesId = id + '_desktopAppAllowedProcesses'; var tabButtonOne, tabButtonTwo, tabOne, tabTwo; @@ -220,6 +222,11 @@ M.availability_examus2.form.getNode = function(json) { '' ); + html += formGroup(enabledForbiddenProcessesId, getString('enabledForbiddenProcesses'), '', + ' ' + + ' ' + ); + html += formGroup( desktopAppForbiddenProcessesId, getString('desktop_app_forbidden_processes'), @@ -228,6 +235,11 @@ M.availability_examus2.form.getNode = function(json) { desktopAppForbiddenProcessesId + '" class="form-control">' ); + html += formGroup(enabledAllowedProcessesId, getString('enabledAllowedProcesses'), '', + ' ' + + ' ' + ); + html += formGroup( desktopAppAllowedProcessesId, getString('desktop_app_allowed_processes'), @@ -455,12 +467,22 @@ M.availability_examus2.form.getNode = function(json) { node.one('#' + customRulesId).set('value', json.customrules); } + if (json.enabledForbiddenProcesses !== undefined) { + node.one('#' + enabledForbiddenProcessesId).set('checked', json.enabledForbiddenProcesses ? 'checked' : null); + } + if (json.desktopAppForbiddenProcesses !== undefined) { try { node.one('#' + desktopAppForbiddenProcessesId).set('value', JSON.parse(json.desktopAppForbiddenProcesses).join('\n')); } catch (e) { node.one('#' + desktopAppForbiddenProcessesId).set('value', json.desktopAppForbiddenProcesses); } + node.one('#' + desktopAppForbiddenProcessesId) + .set('disabled', node.one('#' + enabledForbiddenProcessesId).get('checked') ? null : 'disabled'); + } + + if (json.enabledAllowedProcesses !== undefined) { + node.one('#' + enabledAllowedProcessesId).set('checked', json.enabledAllowedProcesses ? 'checked' : null); } if (json.desktopAppAllowedProcesses !== undefined) { @@ -469,6 +491,8 @@ M.availability_examus2.form.getNode = function(json) { } catch (e) { node.one('#' + desktopAppAllowedProcessesId).set('value', json.desktopAppAllowedProcesses); } + node.one('#' + desktopAppAllowedProcessesId) + .set('disabled', node.one('#' + enabledAllowedProcessesId).get('checked') ? null : 'disabled'); } if (json.useragreementurl !== undefined) { @@ -517,10 +541,12 @@ M.availability_examus2.form.fillValue = function(value, node) { value.scheduling_required = node.one('input[name=scheduling_required]').get('checked'); value.istrial = node.one('input[name=istrial]').get('checked'); value.customrules = node.one('textarea[name=customrules]').get('value').trim(); + value.enabledForbiddenProcesses = node.one('input[name=enabledForbiddenProcesses]').get('checked'); value.desktopAppForbiddenProcesses = JSON.stringify(node.one('textarea[name=desktopAppForbiddenProcesses]') .get('value').split('\n').filter(function(line) { return line.trim(); })); + value.enabledAllowedProcesses = node.one('input[name=enabledAllowedProcesses]').get('checked'); value.desktopAppAllowedProcesses = JSON.stringify(node.one('textarea[name=desktopAppAllowedProcesses]') .get('value').split('\n').filter(function(line) { return line.trim(); @@ -548,6 +574,23 @@ M.availability_examus2.form.fillValue = function(value, node) { } }); + document.addEventListener('click', function(e) { + if (e.target.name == 'enabledForbiddenProcesses') { + if (e.target.checked) { + document.querySelector('textarea[name=desktopAppForbiddenProcesses]').disabled = false; + } else { + document.querySelector('textarea[name=desktopAppForbiddenProcesses]').disabled = 'disabled'; + } + } + if (e.target.name == 'enabledAllowedProcesses') { + if (e.target.checked) { + document.querySelector('textarea[name=desktopAppAllowedProcesses]').disabled = false; + } else { + document.querySelector('textarea[name=desktopAppAllowedProcesses]').disabled = 'disabled'; + } + } + }); + value.warnings = {}; warningsInputs = node.all('.warnings input'); Y.each(warningsInputs, function(warningInput) { diff --git a/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-min.js b/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-min.js index de6cd60..38e71ce 100644 --- a/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-min.js +++ b/yui/build/moodle-availability_examus2-form/moodle-availability_examus2-form-min.js @@ -1,3 +1,3 @@ -YUI.add("moodle-availability_examus2-form",function(se,e){M.availability_examus2=M.availability_examus2||{},M.availability_examus2.form=se.Object(M.core_availability.plugin),M.availability_examus2.form.rules=null,M.availability_examus2.form.initInner=function(e,i,a,n){this.rules=e,this.warnings=i,this.scoring=a,this.defaults=n},M.availability_examus2.form.instId=0,M.availability_examus2.form.getNode=function(e){var i,t,a,n,l,o,s,r,d,c,u,m,p,b,f,v,_,h,g,y,k,w,x,A,q,C,N,P,F,T,E,S,I,L,O,R,j,J,V,D,H,$,z,B,U,Y,G,K,Q,W,X,Z,ee;function ie(e,i){return i=i||"availability_examus2",M.util.get_string(e,i)}function ae(e){var i=ie("showmore","core_form"),a=ie("showless","core_form");return''+i+'"}function ne(e,i,a,n,t){var l=t?10:5,o=t?10:7;return'
'+n+(a?' ':"")+"
"}function te(e){setTimeout(e,0)}function le(e){1==e?(q.addClass("btn-primary"),q.removeClass("btn-secondary"),C.addClass("btn-secondary"),C.removeClass("btn-primary"),N.removeClass("hidden"),P.addClass("hidden")):(C.addClass("btn-primary"),C.removeClass("btn-secondary"),q.addClass("btn-secondary"),q.removeClass("btn-primary"),N.addClass("hidden"),P.removeClass("hidden"))}for(T in M.availability_examus2.form.instId+=1,o=(n="examus2"+M.availability_examus2.form.instId)+"_mode",s=n+"_schedulingRequired",r=n+"_autoRescheduling",d=n+"_isTrial",c=n+"_identification",u=n+"_customRules",m=n+"_auxCamera",p=n+"_allowmultipledisplays",b=n+"_allowvirtualenvironment",f=n+"_checkidphotoquality",v=n+"_ldb",_=n+"_biometryEnabled",h=n+"_biometrySkipfail",g=n+"_biometryFlow",y=n+"_biometryTheme",k=n+"_userAgreement",w=n+"_webCameraMainView",x=n+"_desktopAppForbiddenProcesses",A=n+"_desktopAppAllowedProcesses",i=ne(l=n+"_duration",ie("duration"),ie("duration_desc"),''),i+=ne(o,ie("proctoring_mode"),ie("proctoring_mode_desc"),'"),i+=ne(c,ie("identification"),ie("identification_desc"),'"),i+=ne(w,ie("web_camera_main_view"),"",'"),i+=ne(s,ie("scheduling_required"),ie("scheduling_required_desc"),'  "),i+=ne(r,ie("auto_rescheduling"),ie("auto_rescheduling_desc"),'  "),i+=ne(d,ie("is_trial"),ie("is_trial_desc"),'  "),i+=ne(m,ie("auxiliary_camera"),ie("auxiliary_camera_desc"),'  "),i+=ne(v,ie("enable_ldb"),ie("enable_ldb_desc"),'  "),i+=ne(p,ie("allowmultipledisplays"),"",'  "),i+=ne(b,ie("allowvirtualenvironment"),"",'  "),i+=ne(f,ie("checkidphotoquality"),"",'  "),i+=ne(k,ie("user_agreement_url"),ie("user_agreement_url_desc"),''),i+=ne(u,ie("custom_rules"),ie("custom_rules_desc"),''),i+=ne(x,ie("desktop_app_forbidden_processes"),ie("desktop_app_forbidden_processes_desc"),''),i+=ne(A,ie("desktop_app_allowed_processes"),ie("desktop_app_allowed_processes_desc"),''),F="",this.rules)F+='
 ',F+='
";for(I in i+=ne(null,ie("rules"),ie("rules_desc"),'
'+F+"
"),S="",this.warnings -)S+='
 ',S+='
";for(R in O="",this.scoring)J='',O+=ne(j,ie("scoring_"+R),"",J);if(V="",V+=ne(_,ie("biometry_enabled"),"",'  "),V+=ne(h,ie("biometry_skipfail"),"",'  "),V+=ne(g,ie("biometry_flow"),"",''),V+=ne(y,ie("biometry_theme"),"",''),D="",D+=ne(null,ie("visible_warnings"),ie("visible_warnings_desc"),'
'+ae(S)+"
",!0),D+=ne(null,ie("scoring_params_header"),ie("scoring_params_header_desc"),ae(O),!0),D+=ne(null,ie("biometry_header"),"",ae(V),!0),(t=se.Node.create('')).setHTML("

"),H=se.Node.create('
').appendTo(t),q=se.Node.create('1').appendTo(H),C=se.Node.create('2').appendTo(H),N=se.Node.create('
'+i+"
").appendTo(t),P=se.Node.create('").appendTo(t),e.rules===undefined&&(e.rules=this.rules),e.warnings===undefined&&(e.warnings=this.warnings),e.scoring=e.scoring||{},e.creating){for($ in this.defaults)if(z=this.defaults[$],"scoring"==$)for(B in z)e.scoring[B]=z[B]?parseFloat(z[B]):null;else if("rules"==$)for(U in z)e.rules[U]=z[U];else if("warnings"==$)for(Y in z)e.warnings[Y]=!!z[Y];else e[$]=z;e.mode||(e.mode="online",e.scheduling_required=!0)}for(G in e.duration!==undefined&&t.one("input[name=duration]").set("value",e.duration),e.mode!==undefined&&t.one("select[name=mode] option[value="+e.mode+"]").set("selected","selected"),e.identification!==undefined&&t.one("select[name=identification] option[value="+e.identification+"]").set("selected","selected"),e.webcameramainview&&t.one("select[name=webcameramainview] option[value="+e.webcameramainview+"]").set("selected","selected"),e.auto_rescheduling!==undefined&&t.one("#"+r).set("checked",e.auto_rescheduling?"checked":null),e.istrial!==undefined&&(a=e.istrial?"checked":null,t.one("#"+d).set("checked",a)),e.auxiliarycamera!==undefined&&t.one("#"+m).set("checked",e.auxiliarycamera?"checked":null),e.ldb!==undefined&&t.one("#"+v).set("checked",e.ldb?"checked":null),e.scheduling_required!==undefined&&t.one("#"+s).set("checked",e.scheduling_required?"checked":null),e.allowmultipledisplays!==undefined&&t.one("#"+p).set("checked",e.allowmultipledisplays?"checked":null),e.allowvirtualenvironment!==undefined&&t.one("#"+b).set("checked",e.allowvirtualenvironment?"checked":null),e.checkidphotoquality!==undefined&&t.one("#"+f).set("checked",e.checkidphotoquality?"checked":null),e.biometryenabled!==undefined&&t.one("#"+_).set("checked",e.biometryenabled?"checked":null),e.biometryskipfail!==undefined&&t.one("#"+h).set("checked",e.biometryskipfail?"checked":null),e.biometryflow!==undefined&&t.one("#"+g).set("value",e.biometryflow),e.biometrytheme!==undefined&&t.one("#"+y).set("value",e.biometrytheme),this.warnings)e.warnings[G]===undefined&&(e.warnings[G]=this.warnings[G]);for(K in e.warnings)e.warnings[K]&&(Q=t.one(".warnings input[name="+K+"]"))&&Q.set("checked","checked");for(W in e.rules)e.rules[W]&&(X=t.one(".rules input[name="+W+"]"))&&X.set("checked","checked");for(Z in e.scoring)isNaN(e.scoring[Z])||(ee=t.one(".examus2-scoring-input[name="+Z+"]"))&&ee.set("value",e.scoring[Z]);if(e.customrules!==undefined&&t.one("#"+u).set("value",e.customrules),e.desktopAppForbiddenProcesses!==undefined)try{t.one("#"+x).set("value",JSON.parse(e.desktopAppForbiddenProcesses).join("\n"))}catch(oe){t.one("#"+x).set("value",e.desktopAppForbiddenProcesses)}if(e.desktopAppAllowedProcesses!==undefined)try{t.one("#"+A).set("value",JSON.parse(e.desktopAppAllowedProcesses).join("\n"))}catch(oe){t.one("#"+A).set("value",e.desktopAppAllowedProcesses)}return e.useragreementurl!==undefined&&t.one("#"+k).set("value",e.useragreementurl),t.delegate("valuechange",function(){te(function(){M.core_availability.form.update()})},"input,textarea,select"),t.delegate("click",function(){te(function(){M.core_availability.form.update()})},"input[type=checkbox]"),t.delegate("valuechange",function(){!function n(){var e=["online","identification"],i=t.one("select[name=mode]").get("value").trim(),a=0<=e.indexOf(i);t.one("#"+s).set("checked",a)}()},"#"+o),q.on("click",function(e){e.preventDefault(),le(1)}),C.on("click",function(e){e.preventDefault(),le(2)}),t.delegate("click",function(e){e.preventDefault(),function n(e){var i=e.next(),a=i.hasClass("hidden");a?(i.removeClass("hidden"),e.setContent(e.getAttribute("data-less"))):(i.addClass("hidden"),e.setContent(e.getAttribute("data-more")))}(e.target)},".examus2-moreless"),t},M.availability_examus2.form.fillValue=function(a,e){var i,n,t,l;a.duration=e.one("input[name=duration]").get("value").trim(),a.mode=e.one("select[name=mode]").get("value").trim(),a.identification=e.one("select[name=identification]").get("value").trim(),a.webcameramainview=e.one("select[name=webcameramainview]").get("value").trim(),a.auto_rescheduling=e.one("input[name=auto_rescheduling]").get("checked"),a.scheduling_required=e.one("input[name=scheduling_required]").get("checked"),a.istrial=e.one("input[name=istrial]" -).get("checked"),a.customrules=e.one("textarea[name=customrules]").get("value").trim(),a.desktopAppForbiddenProcesses=JSON.stringify(e.one("textarea[name=desktopAppForbiddenProcesses]").get("value").split("\n").filter(function(e){return e.trim()})),a.desktopAppAllowedProcesses=JSON.stringify(e.one("textarea[name=desktopAppAllowedProcesses]").get("value").split("\n").filter(function(e){return e.trim()})),a.useragreementurl=e.one("input[name=useragreementurl]").get("value").trim(),a.auxiliarycamera=e.one("input[name=auxiliarycamera]").get("checked"),a.ldb=e.one("input[name=ldb]").get("checked"),a.allowmultipledisplays=e.one("input[name=allowmultipledisplays]").get("checked"),a.allowvirtualenvironment=e.one("input[name=allowvirtualenvironment]").get("checked"),a.checkidphotoquality=e.one("input[name=checkidphotoquality]").get("checked"),a.biometryenabled=e.one("input[name=biometryenabled]").get("checked"),a.biometryskipfail=e.one("input[name=biometryskipfail]").get("checked"),a.biometryflow=e.one("input[name=biometryflow]").get("value").trim(),a.biometrytheme=e.one("input[name=biometrytheme]").get("value").trim(),a.rules={},i=e.all(".rules input"),se.each(i,function(e){l=e.get("value"),!0===e.get("checked")?a.rules[l]=!0:a.rules[l]=!1}),a.warnings={},n=e.all(".warnings input"),se.each(n,function(e){l=e.get("value"),!0===e.get("checked")?a.warnings[l]=!0:a.warnings[l]=!1}),a.scoring={},t=e.all(".examus2-scoring-input"),se.each(t,function(e){l=e.get("name");var i=e.get("value").trim();0'+a+'"}function le(e,a,n,i,t){var l=t?10:5,o=t?10:7;return'
'+i+(n?' ':"")+"
"}function oe(e){setTimeout(e,0)}function se(e){1==e?(F.addClass("btn-primary"),F.removeClass("btn-secondary"),C.addClass("btn-secondary"),C.removeClass("btn-primary"),N.removeClass("hidden"),S.addClass("hidden")):(C.addClass("btn-primary"),C.removeClass("btn-secondary"),F.addClass("btn-secondary"),F.removeClass("btn-primary"),N.addClass("hidden"),S.removeClass("hidden"))}for(E in M.availability_examus2.form.instId+=1,o=(i="examus2"+M.availability_examus2.form.instId)+"_mode",s=i+"_schedulingRequired",r=i+"_autoRescheduling",d=i+"_isTrial",c=i+"_identification",u=i+"_customRules",m=i+"_auxCamera",p=i+"_allowmultipledisplays",b=i+"_allowvirtualenvironment",f=i+"_checkidphotoquality",h=i+"_ldb",v=i+"_biometryEnabled",_=i+"_biometrySkipfail",g=i+"_biometryFlow",y=i+"_biometryTheme",k=i+"_userAgreement",w=i+"_webCameraMainView",x=i+"_enabledForbiddenProcesses",A=i+"_desktopAppForbiddenProcesses",P=i+"_enabledAllowedProcesses",q=i+"_desktopAppAllowedProcesses",a=le(l=i+"_duration",ie("duration"),ie("duration_desc"),''),a+=le(o,ie("proctoring_mode"),ie("proctoring_mode_desc"),'"),a+=le(c,ie("identification"),ie("identification_desc"),'"),a+=le(w,ie("web_camera_main_view"),"",'"),a+=le(s,ie("scheduling_required"),ie("scheduling_required_desc"),'  "),a+=le(r,ie("auto_rescheduling"),ie("auto_rescheduling_desc"),'  "),a+=le(d,ie("is_trial"),ie("is_trial_desc"),'  "),a+=le(m,ie("auxiliary_camera"),ie("auxiliary_camera_desc"),'  "),a+=le(h,ie("enable_ldb"),ie("enable_ldb_desc"),'  "),a+=le(p,ie("allowmultipledisplays"),"",'  "),a+=le(b,ie("allowvirtualenvironment"),"",'  "),a+=le(f,ie("checkidphotoquality"),"",'  "),a+=le(k,ie("user_agreement_url"),ie("user_agreement_url_desc"),''),a+=le(u,ie("custom_rules"),ie("custom_rules_desc"),''),a+=le(x,ie("enabledForbiddenProcesses"),"",'  "),a+=le(A,ie("desktop_app_forbidden_processes"),ie("desktop_app_forbidden_processes_desc"),''),a+=le(P,ie("enabledAllowedProcesses"),"",'  "),a+=le(q,ie("desktop_app_allowed_processes"),ie("desktop_app_allowed_processes_desc"), +''),T="",this.rules)T+='
 ',T+='
";for(O in a+=le(null,ie("rules"),ie("rules_desc"),'
'+T+"
"),I="",this.warnings)I+='
 ',I+='
";for(J in j="",this.scoring)D='',j+=le(V,ie("scoring_"+J),"",D);if(H="",H+=le(v,ie("biometry_enabled"),"",'  "),H+=le(_,ie("biometry_skipfail"),"",'  "),H+=le(g,ie("biometry_flow"),"",''),H+=le(y,ie("biometry_theme"),"",''),$="",$+=le(null,ie("visible_warnings"),ie("visible_warnings_desc"),'
'+te(I)+"
",!0),$+=le(null,ie("scoring_params_header"),ie("scoring_params_header_desc"),te(j),!0),$+=le(null,ie("biometry_header"),"",te(H),!0),(t=de.Node.create('')).setHTML("

"),z=de.Node.create('
').appendTo(t),F=de.Node.create('1').appendTo(z),C=de.Node.create('2').appendTo(z),N=de.Node.create('
'+a+"
").appendTo(t),S=de.Node.create('").appendTo(t),e.rules===undefined&&(e.rules=this.rules),e.warnings===undefined&&(e.warnings=this.warnings),e.scoring=e.scoring||{},e.creating){for(B in this.defaults)if(U=this.defaults[B],"scoring"==B)for(Y in U)e.scoring[Y]=U[Y]?parseFloat(U[Y]):null;else if("rules"==B)for(G in U)e.rules[G]=U[G];else if("warnings"==B)for(K in U)e.warnings[K]=!!U[K];else e[B]=U;e.mode||(e.mode="online",e.scheduling_required=!0)}for(Q in e.duration!==undefined&&t.one("input[name=duration]").set("value",e.duration),e.mode!==undefined&&t.one("select[name=mode] option[value="+e.mode+"]").set("selected","selected"),e.identification!==undefined&&t.one("select[name=identification] option[value="+e.identification+"]").set("selected","selected"),e.webcameramainview&&t.one("select[name=webcameramainview] option[value="+e.webcameramainview+"]").set("selected","selected"),e.auto_rescheduling!==undefined&&t.one("#"+r).set("checked",e.auto_rescheduling?"checked":null),e.istrial!==undefined&&(n=e.istrial?"checked":null,t.one("#"+d).set("checked",n)),e.auxiliarycamera!==undefined&&t.one("#"+m).set("checked",e.auxiliarycamera?"checked":null),e.ldb!==undefined&&t.one("#"+h).set("checked",e.ldb?"checked":null),e.scheduling_required!==undefined&&t.one("#"+s).set("checked",e.scheduling_required?"checked":null),e.allowmultipledisplays!==undefined&&t.one("#"+p).set("checked",e.allowmultipledisplays?"checked":null),e.allowvirtualenvironment!==undefined&&t.one("#"+b).set("checked",e.allowvirtualenvironment?"checked":null),e.checkidphotoquality!==undefined&&t.one("#"+f).set("checked",e.checkidphotoquality?"checked":null),e.biometryenabled!==undefined&&t.one("#"+v).set("checked",e.biometryenabled?"checked":null),e.biometryskipfail!==undefined&&t.one("#"+_).set("checked",e.biometryskipfail?"checked":null),e.biometryflow!==undefined&&t.one("#"+g).set("value",e.biometryflow),e.biometrytheme!==undefined&&t.one("#"+y).set("value",e.biometrytheme),this.warnings)e.warnings[Q]===undefined&&(e.warnings[Q]=this.warnings[Q]);for(W in e.warnings)e.warnings[W]&&(X=t.one(".warnings input[name="+W+"]"))&&X.set("checked","checked");for(Z in e.rules)e.rules[Z]&&(ee=t.one(".rules input[name="+Z+"]"))&&ee.set("checked","checked");for(ae in e.scoring)isNaN(e.scoring[ae])||(ne=t.one(".examus2-scoring-input[name="+ae+"]"))&&ne.set("value",e.scoring[ae]);if(e.customrules!==undefined&&t.one("#"+u).set("value",e.customrules),e.enabledForbiddenProcesses!==undefined&&t.one("#"+x).set("checked",e.enabledForbiddenProcesses?"checked":null),e.desktopAppForbiddenProcesses!==undefined){try{t.one("#"+A).set("value",JSON.parse(e.desktopAppForbiddenProcesses).join("\n"))}catch(re){t.one("#"+A).set("value",e.desktopAppForbiddenProcesses)}t.one("#"+A).set("disabled",t.one("#"+x).get("checked")?null:"disabled")}if(e.enabledAllowedProcesses!==undefined&&t.one("#"+P).set("checked",e.enabledAllowedProcesses?"checked":null),e.desktopAppAllowedProcesses!==undefined){try{t.one("#"+q).set("value",JSON.parse(e.desktopAppAllowedProcesses).join("\n"))}catch(re){t.one("#"+q).set("value",e.desktopAppAllowedProcesses)}t.one("#"+q).set("disabled",t.one("#"+P).get("checked")?null:"disabled")}return e.useragreementurl!==undefined&&t.one("#"+k).set("value",e.useragreementurl),t.delegate("valuechange",function(){oe(function(){M.core_availability.form.update()})},"input,textarea,select"),t.delegate("click",function(){oe(function(){M.core_availability.form.update()})},"input[type=checkbox]"),t.delegate("valuechange",function(){!function i(){var e=["online","identification"],a=t.one("select[name=mode]").get("value").trim(),n=0<=e.indexOf(a);t.one("#"+s).set("checked",n)}()},"#"+o),F.on("click",function(e){e.preventDefault(),se(1)}),C.on("click", +function(e){e.preventDefault(),se(2)}),t.delegate("click",function(e){e.preventDefault(),function i(e){var a=e.next(),n=a.hasClass("hidden");n?(a.removeClass("hidden"),e.setContent(e.getAttribute("data-less"))):(a.addClass("hidden"),e.setContent(e.getAttribute("data-more")))}(e.target)},".examus2-moreless"),t},M.availability_examus2.form.fillValue=function(n,e){var a,i,t,l;n.duration=e.one("input[name=duration]").get("value").trim(),n.mode=e.one("select[name=mode]").get("value").trim(),n.identification=e.one("select[name=identification]").get("value").trim(),n.webcameramainview=e.one("select[name=webcameramainview]").get("value").trim(),n.auto_rescheduling=e.one("input[name=auto_rescheduling]").get("checked"),n.scheduling_required=e.one("input[name=scheduling_required]").get("checked"),n.istrial=e.one("input[name=istrial]").get("checked"),n.customrules=e.one("textarea[name=customrules]").get("value").trim(),n.enabledForbiddenProcesses=e.one("input[name=enabledForbiddenProcesses]").get("checked"),n.desktopAppForbiddenProcesses=JSON.stringify(e.one("textarea[name=desktopAppForbiddenProcesses]").get("value").split("\n").filter(function(e){return e.trim()})),n.enabledAllowedProcesses=e.one("input[name=enabledAllowedProcesses]").get("checked"),n.desktopAppAllowedProcesses=JSON.stringify(e.one("textarea[name=desktopAppAllowedProcesses]").get("value").split("\n").filter(function(e){return e.trim()})),n.useragreementurl=e.one("input[name=useragreementurl]").get("value").trim(),n.auxiliarycamera=e.one("input[name=auxiliarycamera]").get("checked"),n.ldb=e.one("input[name=ldb]").get("checked"),n.allowmultipledisplays=e.one("input[name=allowmultipledisplays]").get("checked"),n.allowvirtualenvironment=e.one("input[name=allowvirtualenvironment]").get("checked"),n.checkidphotoquality=e.one("input[name=checkidphotoquality]").get("checked"),n.biometryenabled=e.one("input[name=biometryenabled]").get("checked"),n.biometryskipfail=e.one("input[name=biometryskipfail]").get("checked"),n.biometryflow=e.one("input[name=biometryflow]").get("value").trim(),n.biometrytheme=e.one("input[name=biometrytheme]").get("value").trim(),n.rules={},a=e.all(".rules input"),de.each(a,function(e){l=e.get("value"),!0===e.get("checked")?n.rules[l]=!0:n.rules[l]=!1}),document.addEventListener("click",function(e){"enabledForbiddenProcesses"==e.target.name&&(e.target.checked?document.querySelector("textarea[name=desktopAppForbiddenProcesses]").disabled=!1:document.querySelector("textarea[name=desktopAppForbiddenProcesses]").disabled="disabled"),"enabledAllowedProcesses"==e.target.name&&(e.target.checked?document.querySelector("textarea[name=desktopAppAllowedProcesses]").disabled=!1:document.querySelector("textarea[name=desktopAppAllowedProcesses]").disabled="disabled")}),n.warnings={},i=e.all(".warnings input"),de.each(i,function(e){l=e.get("value"),!0===e.get("checked")?n.warnings[l]=!0:n.warnings[l]=!1}),n.scoring={},t=e.all(".examus2-scoring-input"),de.each(t,function(e){l=e.get("name");var a=e.get("value").trim();0' ); + html += formGroup(enabledForbiddenProcessesId, getString('enabledForbiddenProcesses'), '', + ' ' + + ' ' + ); + html += formGroup( desktopAppForbiddenProcessesId, getString('desktop_app_forbidden_processes'), @@ -228,6 +235,11 @@ M.availability_examus2.form.getNode = function(json) { desktopAppForbiddenProcessesId + '" class="form-control">' ); + html += formGroup(enabledAllowedProcessesId, getString('enabledAllowedProcesses'), '', + ' ' + + ' ' + ); + html += formGroup( desktopAppAllowedProcessesId, getString('desktop_app_allowed_processes'), @@ -455,12 +467,22 @@ M.availability_examus2.form.getNode = function(json) { node.one('#' + customRulesId).set('value', json.customrules); } + if (json.enabledForbiddenProcesses !== undefined) { + node.one('#' + enabledForbiddenProcessesId).set('checked', json.enabledForbiddenProcesses ? 'checked' : null); + } + if (json.desktopAppForbiddenProcesses !== undefined) { try { node.one('#' + desktopAppForbiddenProcessesId).set('value', JSON.parse(json.desktopAppForbiddenProcesses).join('\n')); } catch (e) { node.one('#' + desktopAppForbiddenProcessesId).set('value', json.desktopAppForbiddenProcesses); } + node.one('#' + desktopAppForbiddenProcessesId) + .set('disabled', node.one('#' + enabledForbiddenProcessesId).get('checked') ? null : 'disabled'); + } + + if (json.enabledAllowedProcesses !== undefined) { + node.one('#' + enabledAllowedProcessesId).set('checked', json.enabledAllowedProcesses ? 'checked' : null); } if (json.desktopAppAllowedProcesses !== undefined) { @@ -469,6 +491,8 @@ M.availability_examus2.form.getNode = function(json) { } catch (e) { node.one('#' + desktopAppAllowedProcessesId).set('value', json.desktopAppAllowedProcesses); } + node.one('#' + desktopAppAllowedProcessesId) + .set('disabled', node.one('#' + enabledAllowedProcessesId).get('checked') ? null : 'disabled'); } if (json.useragreementurl !== undefined) { @@ -517,10 +541,12 @@ M.availability_examus2.form.fillValue = function(value, node) { value.scheduling_required = node.one('input[name=scheduling_required]').get('checked'); value.istrial = node.one('input[name=istrial]').get('checked'); value.customrules = node.one('textarea[name=customrules]').get('value').trim(); + value.enabledForbiddenProcesses = node.one('input[name=enabledForbiddenProcesses]').get('checked'); value.desktopAppForbiddenProcesses = JSON.stringify(node.one('textarea[name=desktopAppForbiddenProcesses]') .get('value').split('\n').filter(function(line) { return line.trim(); })); + value.enabledAllowedProcesses = node.one('input[name=enabledAllowedProcesses]').get('checked'); value.desktopAppAllowedProcesses = JSON.stringify(node.one('textarea[name=desktopAppAllowedProcesses]') .get('value').split('\n').filter(function(line) { return line.trim(); @@ -548,6 +574,23 @@ M.availability_examus2.form.fillValue = function(value, node) { } }); + document.addEventListener('click', function(e) { + if (e.target.name == 'enabledForbiddenProcesses') { + if (e.target.checked) { + document.querySelector('textarea[name=desktopAppForbiddenProcesses]').disabled = false; + } else { + document.querySelector('textarea[name=desktopAppForbiddenProcesses]').disabled = 'disabled'; + } + } + if (e.target.name == 'enabledAllowedProcesses') { + if (e.target.checked) { + document.querySelector('textarea[name=desktopAppAllowedProcesses]').disabled = false; + } else { + document.querySelector('textarea[name=desktopAppAllowedProcesses]').disabled = 'disabled'; + } + } + }); + value.warnings = {}; warningsInputs = node.all('.warnings input'); Y.each(warningsInputs, function(warningInput) { diff --git a/yui/src/form/js/form.js b/yui/src/form/js/form.js index aef045c..71d81c1 100644 --- a/yui/src/form/js/form.js +++ b/yui/src/form/js/form.js @@ -42,7 +42,9 @@ M.availability_examus2.form.getNode = function(json) { var biometryThemeId = id + '_biometryTheme'; var userAgreementId = id + '_userAgreement'; var webCameraMainViewId = id + '_webCameraMainView'; + var enabledForbiddenProcessesId = id + '_enabledForbiddenProcesses'; var desktopAppForbiddenProcessesId = id + '_desktopAppForbiddenProcesses'; + var enabledAllowedProcessesId = id + '_enabledAllowedProcesses'; var desktopAppAllowedProcessesId = id + '_desktopAppAllowedProcesses'; var tabButtonOne, tabButtonTwo, tabOne, tabTwo; @@ -218,6 +220,11 @@ M.availability_examus2.form.getNode = function(json) { '' ); + html += formGroup(enabledForbiddenProcessesId, getString('enabledForbiddenProcesses'), '', + ' ' + + ' ' + ); + html += formGroup( desktopAppForbiddenProcessesId, getString('desktop_app_forbidden_processes'), @@ -226,6 +233,11 @@ M.availability_examus2.form.getNode = function(json) { desktopAppForbiddenProcessesId + '" class="form-control">' ); + html += formGroup(enabledAllowedProcessesId, getString('enabledAllowedProcesses'), '', + ' ' + + ' ' + ); + html += formGroup( desktopAppAllowedProcessesId, getString('desktop_app_allowed_processes'), @@ -453,12 +465,22 @@ M.availability_examus2.form.getNode = function(json) { node.one('#' + customRulesId).set('value', json.customrules); } + if (json.enabledForbiddenProcesses !== undefined) { + node.one('#' + enabledForbiddenProcessesId).set('checked', json.enabledForbiddenProcesses ? 'checked' : null); + } + if (json.desktopAppForbiddenProcesses !== undefined) { try { node.one('#' + desktopAppForbiddenProcessesId).set('value', JSON.parse(json.desktopAppForbiddenProcesses).join('\n')); } catch (e) { node.one('#' + desktopAppForbiddenProcessesId).set('value', json.desktopAppForbiddenProcesses); } + node.one('#' + desktopAppForbiddenProcessesId) + .set('disabled', node.one('#' + enabledForbiddenProcessesId).get('checked') ? null : 'disabled'); + } + + if (json.enabledAllowedProcesses !== undefined) { + node.one('#' + enabledAllowedProcessesId).set('checked', json.enabledAllowedProcesses ? 'checked' : null); } if (json.desktopAppAllowedProcesses !== undefined) { @@ -467,6 +489,8 @@ M.availability_examus2.form.getNode = function(json) { } catch (e) { node.one('#' + desktopAppAllowedProcessesId).set('value', json.desktopAppAllowedProcesses); } + node.one('#' + desktopAppAllowedProcessesId) + .set('disabled', node.one('#' + enabledAllowedProcessesId).get('checked') ? null : 'disabled'); } if (json.useragreementurl !== undefined) { @@ -515,10 +539,12 @@ M.availability_examus2.form.fillValue = function(value, node) { value.scheduling_required = node.one('input[name=scheduling_required]').get('checked'); value.istrial = node.one('input[name=istrial]').get('checked'); value.customrules = node.one('textarea[name=customrules]').get('value').trim(); + value.enabledForbiddenProcesses = node.one('input[name=enabledForbiddenProcesses]').get('checked'); value.desktopAppForbiddenProcesses = JSON.stringify(node.one('textarea[name=desktopAppForbiddenProcesses]') .get('value').split('\n').filter(function(line) { return line.trim(); })); + value.enabledAllowedProcesses = node.one('input[name=enabledAllowedProcesses]').get('checked'); value.desktopAppAllowedProcesses = JSON.stringify(node.one('textarea[name=desktopAppAllowedProcesses]') .get('value').split('\n').filter(function(line) { return line.trim(); @@ -546,6 +572,21 @@ M.availability_examus2.form.fillValue = function(value, node) { } }); + document.addEventListener('click', function(e) { + if (e.target.name == 'enabledForbiddenProcesses') { + if (e.target.checked) { + document.querySelector('textarea[name=desktopAppForbiddenProcesses]').disabled = false; + } + document.querySelector('textarea[name=desktopAppForbiddenProcesses]').disabled = 'disabled'; + } + if (e.target.name == 'enabledAllowedProcesses') { + if (e.target.checked) { + document.querySelector('textarea[name=desktopAppAllowedProcesses]').disabled = false; + } + document.querySelector('textarea[name=desktopAppAllowedProcesses]').disabled = 'disabled'; + } + }); + value.warnings = {}; warningsInputs = node.all('.warnings input'); Y.each(warningsInputs, function(warningInput) {