2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Course reserves › [% IF course_name %] Edit [% course_name | html %] [% ELSE %] New course [% END %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
7 <body id="courses_course" class="course">
9 [% INCLUDE 'header.inc' %]
10 [% INCLUDE 'cat-search.inc' %]
12 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> › [% IF course_name %] Edit <i>[% course_name | html %]</i> [% ELSE %] New course [% END %]</div>
14 [% IF ( departments ) %]
16 <div class="main container-fluid">
18 <div class="col-md-8 col-md-offset-2">
20 <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl" class="validated">
21 [% IF course_id %]<input type="hidden" name="course_id" value="[% course_id | html %]" />[% END %]
22 <fieldset class="rows">
23 <legend>[% IF course_id %]Edit course[% ELSE %]Create course[% END %]</legend>
26 <label class="required" for="department">Department:</label>
27 <select id="department" name="department" required="required" class="required">
28 <option value="">Select a department</option>
30 [% FOREACH d IN departments %]
31 [% IF d.authorised_value == department %]
32 <option value="[% d.authorised_value | html %]" selected="selected">[% d.lib | html %]</option>
34 <option value="[% d.authorised_value | html %]">[% d.lib | html %]</option>
38 <span class="required">Required</span>
42 <label class="required" for="course_number">Course number:</label>
43 <input id="course_number" name="course_number" type="text" value="[% course_number | html %]" required="required" class="required" />
44 <span class="required">Required</span>
48 <label for="section">Section:</label>
49 <input id="section" name="section" type="text" value="[% section | html %]"/>
53 <label class="required" for="course_name">Course name:</label>
54 <input id="course_name" name="course_name" type="text" value="[% course_name | html %]" required="required" class="required" />
55 <span class="required">Required</span>
60 <label for="term">Term:</label>
61 <select id="term" name="term">
62 <option value=""></option>
64 [% FOREACH t IN terms %]
65 [% IF t.authorised_value == term %]
66 <option value="[% t.authorised_value | html %]" selected="selected">[% t.lib | html %]</option>
68 <option value="[% t.authorised_value | html %]">[% t.lib | html %]</option>
73 <span class="label">Term: </span>
74 <span id="term">No TERM authorised values found! Please create one or more authorised values with the category TERM.</span>
79 <span class="label">Instructors:</span>
81 <fieldset id="course_instructors">
82 <div id="instructors">[% FOREACH i IN instructors %]<div id="borrower_[% i.cardnumber | html %]">[% i.surname | html %], [% i.firstname | html %] ( <a href="#" class="removeInstructor"> Remove </a> )
83 <input type='hidden' name='instructors' value='[% i.cardnumber | html %]' /></div>[% END %]</div>
87 <label for="find_instructor">Instructor search:</label>
88 <input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
89 <div id="find_instructor_container"></div>
92 <label for="staff_note">Staff note:</label>
93 <textarea name="staff_note" id="staff_note">[% staff_note | html %]</textarea>
97 <label for="public_note">Public note:</label>
98 <textarea name="public_note" id="public_note">[% public_note | html %]</textarea>
102 <label for="students_count">Number of students:</label>
103 <input id="students_count" name="students_count" type="text" value="[% students_count | html %]" />
107 <label for="enabled">Enabled?</label>
108 [% IF enabled == 'no' %]
109 <input type="checkbox" name="enabled" id="enabled" />
111 <input type="checkbox" name="enabled" id="enabled" checked="checked" />
117 <fieldset class="action">
118 <input type="submit" value="Save" class="submit" />
121 <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course_id | html %]" class="cancel">Cancel</a>
123 <a href="/cgi-bin/koha/course_reserves/course-reserves.pl" class="cancel">Cancel</a>
132 <div class="dialog alert">
134 No DEPARTMENT authorized values found!
135 [% IF ( CAN_user_parameters ) %]
136 Please <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=DEPARTMENT">create one or more authorized values</a> with the category DEPARTMENT.
138 An administrator must create one or more authorized values with the category DEPARTMENT.
145 [% IF ( departments ) %]
146 [% MACRO jsinclude BLOCK %]
147 <script type="text/javascript">
148 $(document).ready(function(){
149 $( "#find_instructor" ).autocomplete({
150 source: "/cgi-bin/koha/circ/ysearch.pl",
152 select: function( event, ui ) {
153 AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber );
157 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
158 return $( "<li></li>" )
159 .data( "ui-autocomplete-item", item )
160 .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
164 if ( ! $('#instructors').html() ) {
165 $('#course_instructors').hide();
168 $("body").on("click",".removeInstructor",function(e){
170 var divid = $(this).parent().attr("id");
171 var cardnumber = divid.replace("borrower_","");
172 RemoveInstructor(cardnumber);
176 function AddInstructor( name, cardnumber ) {
177 div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' class='removeInstructor'> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>";
178 $('#instructors').append( div );
180 $('#find_instructor').val('').focus();
181 $('#course_instructors').show();
184 function RemoveInstructor( cardnumber ) {
185 $( '#borrower_' + cardnumber ).remove();
187 if ( ! $('#instructors').html() ) {
188 $('#course_instructors').hide( 800 );
195 [% INCLUDE 'intranet-bottom.inc' %]