View | Details | Raw Unified | Return to bug 10409
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt (-169 / +175 lines)
Lines 2-72 Link Here
2
<title>Koha &rsaquo; Course reserves &rsaquo; [% IF course_name %] Edit [% course_name %] [% ELSE %] New course [% END %]</title>
2
<title>Koha &rsaquo; Course reserves &rsaquo; [% IF course_name %] Edit [% course_name %] [% ELSE %] New course [% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
4
5
<script type="text/javascript">
5
[% IF ( departments ) %]
6
//<![CDATA[
7
6
8
    function Check(f) {
7
    <script type="text/javascript">
9
        var _alertString = "";
8
    //<![CDATA[
10
9
11
        if( ! $("#department").val() ) {
10
        function Check(f) {
12
            _alertString += _("- You must choose a department") + "\n";
11
            var _alertString = "";
13
        }
14
12
15
        if( ! $("#course_number").val() ) {
13
            if( ! $("#department").val() ) {
16
            _alertString += _("- You must choose a course number") + "\n";
14
                _alertString += _("- You must choose a department") + "\n";
17
        }
15
            }
18
16
19
        if( ! $("#course_name").val() ) {
17
            if( ! $("#course_number").val() ) {
20
            _alertString += _("- You must add a course name") + "\n";
18
                _alertString += _("- You must choose a course number") + "\n";
21
        }
19
            }
22
20
23
        if ( _alertString.length ) {
21
            if( ! $("#course_name").val() ) {
24
            var alertHeader;
22
                _alertString += _("- You must add a course name") + "\n";
25
            alertHeader = _("Form not submitted because of the following problem(s)");
23
            }
26
            alertHeader += "\n------------------------------------------------------------------------------------\n\n";
27
24
28
            alert( alertHeader + _alertString );
25
            if ( _alertString.length ) {
29
        } else {
26
                var alertHeader;
30
            f.submit();
27
                alertHeader = _("Form not submitted because of the following problem(s)");
31
        }
28
                alertHeader += "\n------------------------------------------------------------------------------------\n\n";
32
    }
33
29
34
//]]>
30
                alert( alertHeader + _alertString );
35
</script>
31
            } else {
36
32
                f.submit();
37
<script type="text/javascript">
33
            }
38
//<![CDATA[
39
$(document).ready(function(){
40
    $( "#find_instructor" ).autocomplete({
41
        source: "/cgi-bin/koha/circ/ysearch.pl",
42
        minLength: 3,
43
        select: function( event, ui ) {
44
            AddInstructor( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber );
45
            return false;
46
        }
34
        }
47
    })
48
    .data( "autocomplete" )._renderItem = function( ul, item ) {
49
        return $( "<li></li>" )
50
        .data( "item.autocomplete", item )
51
        .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
52
        .appendTo( ul );
53
    };
54
55
});
56
35
57
function AddInstructor( name, cardnumber ) {
36
    //]]>
58
    div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' onclick='RemoveInstructor(" + cardnumber + ");return false;'> Remove </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>";
37
    </script>
59
    $('#instructors').append( div );
38
39
    <script type="text/javascript">
40
    //<![CDATA[
41
    $(document).ready(function(){
42
        $( "#find_instructor" ).autocomplete({
43
            source: "/cgi-bin/koha/circ/ysearch.pl",
44
            minLength: 3,
45
            select: function( event, ui ) {
46
                AddInstructor( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber );
47
                return false;
48
            }
49
        })
50
        .data( "autocomplete" )._renderItem = function( ul, item ) {
51
            return $( "<li></li>" )
52
            .data( "item.autocomplete", item )
53
            .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
54
            .appendTo( ul );
55
        };
56
57
    });
58
59
    function AddInstructor( name, cardnumber ) {
60
        div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' onclick='RemoveInstructor(" + cardnumber + ");return false;'> Remove </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>";
61
        $('#instructors').append( div );
62
63
        $('#find_instructor').val('').focus();
64
    }
60
65
61
    $('#find_instructor').val('').focus();
66
    function RemoveInstructor( cardnumber ) {
62
}
67
        $( '#borrower_' + cardnumber ).remove();
68
    }
63
69
64
function RemoveInstructor( cardnumber ) {
70
    //]]>
65
    $( '#borrower_' + cardnumber ).remove();
71
    </script>
66
}
67
72
68
//]]>
73
[% END %]
69
</script>
70
74
71
</head>
75
</head>
72
76
Lines 77-204 function RemoveInstructor( cardnumber ) { Link Here
77
81
78
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; [% IF course_name %] Edit <i>[% course_name %]</i> [% ELSE %] New course [% END %]</div>
82
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; [% IF course_name %] Edit <i>[% course_name %]</i> [% ELSE %] New course [% END %]</div>
79
83
80
<div id="doc2" class="yui-t7">
84
[% IF ( departments ) %]
81
    <div id="bd">
85
82
        <div id="yui-main">
86
    <div id="doc" class="yui-t7">
83
            <div class="yui-b">
87
        <div id="bd">
84
                <div class="yui-g">
88
            <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl">
85
                    <div class="yui-u first">
89
                [% IF course_id %]<input type="hidden" name="course_id" value="[% course_id %]" />[% END %]
86
                        <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl">
90
                <fieldset class="rows">
87
                            [% IF course_id %]<input type="hidden" name="course_id" value="[% course_id %]" />[% END %]
91
                    <legend>[% IF course_id %] Edit [% ELSE %] Create [% END %] course</legend>
88
                            <fieldset class="rows">
92
                    <ol>
89
                                <legend>[% IF course_id %] Edit [% ELSE %] Create [% END %] course</legend>
93
                        <li>
90
                                <ol>
94
                            <label class="required" for="department">Department:</label>
91
                                    <li>
95
                            <select id="department" name="department">
92
                                        <label class="required" for="department">Department:</label>
96
                                <option value="">Select a department</option>
93
                                        [% IF departments %]
97
94
                                            <select id="department" name="department">
98
                                [% FOREACH d IN departments %]
95
                                                <option value="">Select A Department</option>
99
                                    [% IF d.authorised_value == department %]
96
100
                                        <option value="[% d.authorised_value %]" selected="selected">[% d.lib %]</option>
97
                                                [% FOREACH d IN departments %]
101
                                    [% ELSE %]
98
                                                    [% IF d.authorised_value == department %]
102
                                        <option value="[% d.authorised_value %]">[% d.lib %]</option>
99
                                                        <option value="[% d.authorised_value %]" selected="selected">[% d.lib %]</option>
103
                                    [% END %]
100
                                                    [% ELSE %]
104
                                [% END %]
101
                                                        <option value="[% d.authorised_value %]">[% d.lib %]</option>
105
                            </select>
102
                                                    [% END %]
106
                        </li>
103
                                                [% END %]
107
104
                                            </select>
108
                        <li>
109
                            <label class="required" for="course_number">Course number:</label>
110
                            <input id="course_number" name="course_number" type="text" value="[% course_number %]" />
111
                        </li>
112
113
                        <li>
114
                            <label for="section">Section:</label>
115
                            <input id="section" name="section" type="text" value="[% section %]"/>
116
                        </li>
117
118
                        <li>
119
                            <label class="required" for="course_name">Course name:</label>
120
                            <input id="course_name" name="course_name" type="text" value="[% course_name %]" />
121
                        </li>
122
123
                        <li>
124
                            [% IF terms %]
125
                                <label for="term">Term:</label>
126
                                <select id="term" name="term">
127
                                    <option value=""></option>
128
129
                                    [% FOREACH t IN terms %]
130
                                        [% IF t.authorised_value == term %]
131
                                            <option value="[% t.authorised_value %]" selected="selected">[% t.lib %]</option>
105
                                        [% ELSE %]
132
                                        [% ELSE %]
106
                                            <span id="department">No DEPARTMENT authorised values found! Please create one or more authorised values with the category DEPARTMENT.</span>
133
                                            <option value="[% t.authorised_value %]">[% t.lib %]</option>
107
                                        [% END %]
134
                                        [% END %]
108
                                    </li>
135
                                    [% END %]
109
136
                                </select>
110
                                    <li>
137
                            [% ELSE %]
111
                                        <label class="required" for="course_number">Course number:</label>
138
                                <span class="label">Term: </span>
112
                                        <input id="course_number" name="course_number" type="text" value="[% course_number %]" />
139
                                <span id="term">No TERM authorised values found! Please create one or more authorised values with the category TERM.</span>
113
                                    </li>
140
                            [% END %]
114
141
                        </li>
115
                                    <li>
142
116
                                        <label for="section">Section:</label>
143
                        <li>
117
                                        <input id="section" name="section" type="text" value="[% section %]"/>
144
                            <span class="label">Instructors:</span>
118
                                    </li>
145
119
146
                            <fieldset>
120
                                    <li>
147
                                 <div id="instructors">
121
                                        <label class="required" for="course_name">Course name:</label>
148
                                     [% FOREACH i IN instructors %]
122
                                        <input id="course_name" name="course_name" type="text" value="[% course_name %]" />
149
                                         <div id="borrower_[% i.cardnumber %]">
123
                                    </li>
150
                                             [% i.surname %], [% i.firstname %] ( <a href='#' onclick='RemoveInstructor( [% i.cardnumber %] );'> Remove </a> )
124
151
                                             <input type='hidden' name='instructors' value='[% i.cardnumber %]' />
125
                                    <li>
152
                                         </div>
126
                                        <label for="term">Term:</label>
153
                                     [% END %]
127
                                        [% IF terms %]
154
                                 </div>
128
                                            <select id="term" name="term">
129
                                                <option value=""></option>
130
131
                                                [% FOREACH t IN terms %]
132
                                                    [% IF t.authorised_value == term %]
133
                                                        <option value="[% t.authorised_value %]" selected="selected">[% t.lib %]</option>
134
                                                    [% ELSE %]
135
                                                        <option value="[% t.authorised_value %]">[% t.lib %]</option>
136
                                                    [% END %]
137
                                                [% END %]
138
                                            </select>
139
                                        [% ELSE %]
140
                                            <span id="term">No TERM authorised values found! Please create one or more authorised values with the category TERM.</span>
141
                                        [% END %]
142
                                    </li>
143
144
                                    <li>
145
                                        <label for="instructors">Instructors:</label>
146
147
                                        <fieldset>
148
                                             <div id="instructors">
149
                                                 [% FOREACH i IN instructors %]
150
                                                     <div id="borrower_[% i.cardnumber %]">
151
                                                         [% i.surname %], [% i.firstname %] ( <a href='#' onclick='RemoveInstructor( [% i.cardnumber %] );'> Remove </a> )
152
                                                         <input type='hidden' name='instructors' value='[% i.cardnumber %]' />
153
                                                     </div>
154
                                                 [% END %]
155
                                             </div>
156
157
                                        </fieldset>
158
159
                                        <fieldset>
160
                                            <label for="find_instructor">Instructor search:</label>
161
                                            <input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
162
                                            <div id="find_instructor_container"></div>
163
                                        </fieldset>
164
                                    <li>
165
                                        <label for="staff_note">Staff note:</label>
166
                                        <textarea name="staff_note" id="staff_note">[% staff_note %]</textarea>
167
                                    </li>
168
169
                                    <li>
170
                                        <label for="public_note">Public note:</label>
171
                                        <textarea name="public_note" id="public_note">[% public_note %]</textarea>
172
                                    </li>
173
174
                                    <li>
175
                                        <label for="students_count">Number of students:</label>
176
                                        <input id="students_count" name="students_count" type="text" value="[% students_count %]" />
177
                                    </li>
178
179
                                    <li>
180
                                        <label for="enabled">Enabled?</label>
181
                                        [% IF enabled == 'no' %]
182
                                            <input type="checkbox" name="enabled" id="enabled" />
183
                                        [% ELSE %]
184
                                            <input type="checkbox" name="enabled" id="enabled" checked="checked" />
185
                                        [% END %]
186
                                    </li>
187
                                </ol>
188
                            </fieldset>
155
                            </fieldset>
189
156
190
                            <fieldset class="action">
157
                            <fieldset>
191
                                <input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" />
158
                                <label for="find_instructor">Instructor search:</label>
192
159
                                <input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
193
                                <a href="/cgi-bin/koha/course_reserves/course-reserves.pl" class="cancel">Cancel</a>
160
                                <div id="find_instructor_container"></div>
194
                            </fieldset>
161
                            </fieldset>
195
162
                        <li>
196
                    </div>
163
                            <label for="staff_note">Staff note:</label>
197
                </div>
164
                            <textarea name="staff_note" id="staff_note">[% staff_note %]</textarea>
198
            </div>
165
                        </li>
166
167
                        <li>
168
                            <label for="public_note">Public note:</label>
169
                            <textarea name="public_note" id="public_note">[% public_note %]</textarea>
170
                        </li>
171
172
                        <li>
173
                            <label for="students_count">Number of students:</label>
174
                            <input id="students_count" name="students_count" type="text" value="[% students_count %]" />
175
                        </li>
176
177
                        <li>
178
                            <label for="enabled">Enabled?</label>
179
                            [% IF enabled == 'no' %]
180
                                <input type="checkbox" name="enabled" id="enabled" />
181
                            [% ELSE %]
182
                                <input type="checkbox" name="enabled" id="enabled" checked="checked" />
183
                            [% END %]
184
                        </li>
185
                    </ol>
186
                </fieldset>
187
188
                <fieldset class="action">
189
                    <input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" />
190
191
                    <a href="/cgi-bin/koha/course_reserves/course-reserves.pl" class="cancel">Cancel</a>
192
                </fieldset>
193
            </form>
199
        </div>
194
        </div>
200
    </div>
195
196
[% ELSE %]
197
198
<div class="dialog alert">
199
    <p>
200
        No DEPARTMENT authorised values found!
201
        [% IF ( CAN_user_parameters ) %]
202
            Please <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=DEPARTMENT">create one or more authorised values</a> with the category DEPARTMENT.
203
        [% ELSE %]
204
            An administrator must create one or more authorised values with the category DEPARTMENT.
205
        [% END %]
206
    </p>
201
</div>
207
</div>
202
208
209
[% END %]
203
210
204
[% INCLUDE 'intranet-bottom.inc' %]
211
[% INCLUDE 'intranet-bottom.inc' %]
205
- 

Return to bug 10409