[FTR] Electronic agreement
[cds-indico.git] / indico / MaKaC / plugins / Collaboration / WebcastRequest / tpls / Main.js
blobd84ed43f615674b9070e77a313dea6af24ee5409
2     checkParams : function () {
3         return {
4             "permission": ["radio", false, function(option, values){
5                 var errors = [];
6                 if (!exists(values["permission"])) {
7                     errors.push($T("Please answer if all the speakers given permission to have their talks webcasted."));
8                 }
9                 return errors;
10             }],
11             "lectureOptions": ["text", true, function(option, values){
12                 var errors = [];
13                 if (option == 'chooseOne') {
14                     errors.push($T("Please choose if slides and/or chalkboards will be used."));
15                 }
16                 return errors;
17             }],
18             "lectureStyle": ["text", true, function(option, values){
19                 var errors = [];
20                 if (option == 'chooseOne') {
21                     errors.push($T("Please choose a type of event."));
22                 }
23                 return errors;
24             }]
25         }
26     },
28     errorHandler: function(event, error) {
29         if (error.operation == "create") {
30             CSErrorPopup($T("Could not send email to responsible"),
31                          [Html.span("", $T("There was a problem when sending the notification email to the Webcast responsible:"), Html.br(), error.inner)])
32         }
33         if (error.operation == "edit") {
34             CSErrorPopup($T("Could not send email to responsible"),
35                          [Html.span("", $T("There was a problem when sending the notification email to the Webcast responsible:"), Html.br(), error.inner)])
36         }
37         if (error.operation == "remove") {
38             CSErrorPopup($T("Could not send email to responsible"),
39                         [Html.span("", $T("There was a problem when sending the notification email to the Webcast responsible:"), Html.br(), error.inner)])
40         }
41     },
43     customText : function(booking) {
44         if (booking.acceptRejectStatus === false && trim(booking.rejectReason)) {
45             return $T("Rejection reason: ") + trim(booking.rejectReason);
46         }
47     },
49     clearForm : function () {
50         var formNodes = IndicoUtil.findFormFields($E('WebcastRequestForm'));
51         IndicoUtil.setFormValues(formNodes, {'talkSelectionComments':'', 'otherComments':''})
52         if (!isLecture) {
53             $E('allTalksRB').dom.checked = true;
54             IndicoUI.Effect.disappear($E('contributionsDiv'));
55         }
56     },
58     onLoad : function() {
60         WRUpdateContributionList();
62         IndicoUtil.enableDisableForm($E("WRForm"), WRWebcastCapable);
64         if (!isLecture) {
65             if (singleBookings['WebcastRequest'] && singleBookings['WebcastRequest'].bookingParams.talks == 'choose') {
66                 IndicoUI.Effect.appear($E('contributionsDiv'));
67             }
68         }
70         if(!singleBookings['WebcastRequest']) {
71             callFunction('WebcastRequest', 'clearForm');
72         }
73     }