Statistics
| Branch: | Tag: | Revision:

root / templates / edumanage / institution_edit.html @ 0790d933

History | View | Annotate | Download (7.6 kB)

1 af9d484b Leonidas Poulopoulos
{% extends "edumanage/welcome.html"%}
2 25028c1d Leonidas Poulopoulos
{% load i18n %}
3 0f9fca26 Leonidas Poulopoulos
{% load tolocale %}
4 af9d484b Leonidas Poulopoulos
{% block crumbs %}
5 25028c1d Leonidas Poulopoulos
        <li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
6 25028c1d Leonidas Poulopoulos
        <li><a href="{% url institutions %}">{% trans "Institution" %}</a><span class="divider">/</span></li>
7 25028c1d Leonidas Poulopoulos
        <li class="active">{% tolocale institution LANGUAGE_CODE%} ({% trans "Edit" %})</li>
8 af9d484b Leonidas Poulopoulos
{% endblock %}
9 38f2278d Leonidas Poulopoulos
{% block extrahead %}
10 b9e65644 Leonidas Poulopoulos
<script type="text/javascript" src="/static/js/jquery.formset.js"></script>
11 38f2278d Leonidas Poulopoulos
<script type="text/javascript">
12 38f2278d Leonidas Poulopoulos
$(document).ready(function() {
13 38f2278d Leonidas Poulopoulos
        $("#adduserSubmit").click(function(){
14 38f2278d Leonidas Poulopoulos
                $.ajax({
15 38f2278d Leonidas Poulopoulos
                        url:"{% url adduser %}", 
16 38f2278d Leonidas Poulopoulos
                        data:$("#add_user_form").serialize(),
17 38f2278d Leonidas Poulopoulos
                        type: "POST",
18 38f2278d Leonidas Poulopoulos
                        cache: false,
19 38f2278d Leonidas Poulopoulos
                        success:function(data){
20 38f2278d Leonidas Poulopoulos
                                        try {
21 38f2278d Leonidas Poulopoulos
                                                value = data.value;
22 38f2278d Leonidas Poulopoulos
                                                text = data.text;
23 38f2278d Leonidas Poulopoulos
                                                if (typeof value === 'undefined' && typeof text === 'undefined'){
24 38f2278d Leonidas Poulopoulos
                                                        $('#mymodalbody').html(data);        
25 38f2278d Leonidas Poulopoulos
                                                }
26 38f2278d Leonidas Poulopoulos
                                                else{
27 38f2278d Leonidas Poulopoulos
                                                        $('#id_contact').append($("<option></option>").attr("value",value).text(text));
28 38f2278d Leonidas Poulopoulos
                                                        $('#myModal').modal('hide')
29 38f2278d Leonidas Poulopoulos
                                                }
30 38f2278d Leonidas Poulopoulos
                                        }
31 38f2278d Leonidas Poulopoulos
                                        catch (exception) {
32 38f2278d Leonidas Poulopoulos
                                                $('#mymodalbody').html(data);
33 38f2278d Leonidas Poulopoulos
                                        }                                        
34 38f2278d Leonidas Poulopoulos
                                }
35 38f2278d Leonidas Poulopoulos
                                });
36 38f2278d Leonidas Poulopoulos
                return false;
37 38f2278d Leonidas Poulopoulos
        });
38 38f2278d Leonidas Poulopoulos
        
39 38f2278d Leonidas Poulopoulos
        $("#add_contact").click(function(){
40 38f2278d Leonidas Poulopoulos
         $('#myModal').modal('show')
41 38f2278d Leonidas Poulopoulos
         $.ajax({
42 38f2278d Leonidas Poulopoulos
                        url:"{% url adduser %}",
43 38f2278d Leonidas Poulopoulos
                        type: "GET",
44 38f2278d Leonidas Poulopoulos
                        success: function(data){
45 38f2278d Leonidas Poulopoulos
                                $('#mymodalbody').html(data);
46 38f2278d Leonidas Poulopoulos
                                }
47 38f2278d Leonidas Poulopoulos
                        });
48 38f2278d Leonidas Poulopoulos
        
49 38f2278d Leonidas Poulopoulos
         return false;
50 38f2278d Leonidas Poulopoulos
        });
51 b9e65644 Leonidas Poulopoulos
        
52 b9e65644 Leonidas Poulopoulos
        
53 b9e65644 Leonidas Poulopoulos
         $('#urlsform tbody tr').formset({
54 b9e65644 Leonidas Poulopoulos
        prefix: '{{urls_form.prefix}}',
55 b9e65644 Leonidas Poulopoulos
        formCssClass: "dynamic-formset1",
56 b9e65644 Leonidas Poulopoulos
        added: addButton,
57 b9e65644 Leonidas Poulopoulos
    });
58 b9e65644 Leonidas Poulopoulos

59 b9e65644 Leonidas Poulopoulos
     $(".delete-row").prepend('<i class="icon-remove-sign icon-white"></i> ').addClass('btn btn-small btn-warning');
60 b9e65644 Leonidas Poulopoulos
     $(".add-row").prepend('<i class="icon-plus-sign icon-white"></i> ').addClass('btn btn-small btn-info');
61 b9e65644 Leonidas Poulopoulos
     
62 b9e65644 Leonidas Poulopoulos
     
63 38f2278d Leonidas Poulopoulos
});
64 b9e65644 Leonidas Poulopoulos
function addButton(row){
65 b9e65644 Leonidas Poulopoulos
            $(row).find(".delete-row").prepend('<i class="icon-remove-sign icon-white"></i> ').addClass('btn btn-small btn-warning');
66 b9e65644 Leonidas Poulopoulos
        }
67 b9e65644 Leonidas Poulopoulos
        
68 38f2278d Leonidas Poulopoulos
</script>
69 38f2278d Leonidas Poulopoulos
70 38f2278d Leonidas Poulopoulos
{% endblock %}
71 b778f19c Leonidas Poulopoulos
{% block homeactive %}{% endblock %}
72 b778f19c Leonidas Poulopoulos
{% block instactive %}class="active"{% endblock %}
73 b778f19c Leonidas Poulopoulos
{% block subcontent %}
74 25028c1d Leonidas Poulopoulos
<h4>{% tolocale institution LANGUAGE_CODE%} {% trans "Edit" %}</h4>
75 af9d484b Leonidas Poulopoulos
<hr>
76 b778f19c Leonidas Poulopoulos
<form method="POST" class="form-horizontal">
77 b778f19c Leonidas Poulopoulos
        {% csrf_token %}
78 b778f19c Leonidas Poulopoulos
        {% if form.non_field_errors %}
79 b778f19c Leonidas Poulopoulos
        <p class="error">
80 b778f19c Leonidas Poulopoulos
                {{ form.non_field_errors}}
81 b778f19c Leonidas Poulopoulos
        </p>
82 b778f19c Leonidas Poulopoulos
        {% endif %}
83 b778f19c Leonidas Poulopoulos
        <div style="display: none">
84 b778f19c Leonidas Poulopoulos
                {{form.institution}}
85 b778f19c Leonidas Poulopoulos
        </div>
86 af9d484b Leonidas Poulopoulos
                <div class="control-group">
87 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_name">{% trans "Name" %}</label>
88 af9d484b Leonidas Poulopoulos
                <div class="controls">
89 25028c1d Leonidas Poulopoulos
                        <input class="input" id="disabledInput" type="text" placeholder="{% tolocale institution LANGUAGE_CODE %}" disabled
90 af9d484b Leonidas Poulopoulos
                </div
91 af9d484b Leonidas Poulopoulos
        </div
92 b778f19c Leonidas Poulopoulos
        <div ="control-group {% if  %} error {% endif %}">
93 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_ertype">{% trans "Type" %}</label>
94 b778f19c Leonidas Poulopoulos
                <div class="controls">
95 25028c1d Leonidas Poulopoulos
                        <input class="input" id="disabledInput" type="text" placeholder="{{institution.get_ertype_display}}" disabled
96 b778f19c Leonidas Poulopoulos
                </div
97 b778f19c Leonidas Poulopoulos
        </div
98 b778f19c Leonidas Poulopoulos
        <div ="control-group {% if  %} error {% endif %}">
99 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_address_street">{% trans "Address Street" %}</label>
100 b778f19c Leonidas Poulopoulos
                <div class="controls">
101 b778f19c Leonidas Poulopoulos
                        {{ form.address_street }}
102 b778f19c Leonidas Poulopoulos
                        {% if form.address_street.errors %} <span class="help-inline"> {{ form.address_street.errors|join:", " }} </span>
103 b778f19c Leonidas Poulopoulos
                        {% endif %} <span class="help-block"> {{ form.address_street.help_text }}</span>
104 b778f19c Leonidas Poulopoulos
                </div>
105 b778f19c Leonidas Poulopoulos
        </div>
106 b778f19c Leonidas Poulopoulos
        <div class="control-group {% if form.address_city.errors %} error {% endif %}">
107 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_address_city">{% trans "Address City" %}</label>
108 b778f19c Leonidas Poulopoulos
                <div class="controls">
109 b778f19c Leonidas Poulopoulos
                        {{ form.address_city }}
110 b778f19c Leonidas Poulopoulos
                        {% if form.address_city.errors %} <span class="help-inline"> {{ form.address_city.errors|join:", " }} </span>
111 b778f19c Leonidas Poulopoulos
                        {% endif %} <span class="help-block"> {{ form.address_city.help_text }}</span>
112 b778f19c Leonidas Poulopoulos
                </div>
113 b778f19c Leonidas Poulopoulos
        </div>
114 b778f19c Leonidas Poulopoulos
        <div class="control-group {% if form.contact.errors %} error {% endif %}">
115 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_contact">{% trans "Contacts" %}</label>
116 b778f19c Leonidas Poulopoulos
                <div class="controls">
117 38f2278d Leonidas Poulopoulos
                        {{ form.contact }} <button class="btn btn-small btn-info" id="add_contact"><i class="icon-plus-sign icon-white"></i>Add...</button>
118 b778f19c Leonidas Poulopoulos
                        {% if form.contact.errors %} <span class="help-inline"> {{ form.ertype.contact|join:", " }} </span>
119 b778f19c Leonidas Poulopoulos
                        {% endif %} <span class="help-block"> {{ form.contact.help_text }}</span>
120 b778f19c Leonidas Poulopoulos
                </div>
121 b778f19c Leonidas Poulopoulos
        </div>
122 b9e65644 Leonidas Poulopoulos
    <div class="control-group {% for err in urls_form.errors %}{% if err|length > 0 %}error{% endif %}{% endfor %}{% if urls_form.non_form_errors %}error{% endif %}">
123 25028c1d Leonidas Poulopoulos
        <label class="control-label" for="id_urls">{% trans "Urls" %}</label>
124 b9e65644 Leonidas Poulopoulos
        {{urls_form.management_form}}
125 b9e65644 Leonidas Poulopoulos
        <div class="controls">
126 b9e65644 Leonidas Poulopoulos
        {% if urls_form.non_form_errors %} <span class="help-inline"> {{ urls_form.non_form_errors|join:", "}}</span>{% endif %}
127 b9e65644 Leonidas Poulopoulos
            <table id="urlsform"><thead><tr><td>url</td><td>type</td><td>language</td></tr></thead><tbody>
128 b9e65644 Leonidas Poulopoulos
        {% for formset in urls_form.forms %}
129 b9e65644 Leonidas Poulopoulos
        {{ formset.id }}
130 b9e65644 Leonidas Poulopoulos
        
131 b9e65644 Leonidas Poulopoulos
        
132 b9e65644 Leonidas Poulopoulos
            <tr id="{{ formset.prefix }}-row">
133 b9e65644 Leonidas Poulopoulos
            <td> {% if formset.instance.pk %}{{ formset.DELETE }}{% endif %}{{ formset.url }}{% if formset.url.errors %}<br><div class="help-inline"> {{ formset.url.errors|join:", " }} </div>{% endif %}</td> 
134 b9e65644 Leonidas Poulopoulos
             <td>{{formset.urltype}}{% if formset.urltype.errors %}<br><p class="help-inline"> {{ formset.urltype.errors|join:", " }} </p>{% endif %}</td>
135 b9e65644 Leonidas Poulopoulos
             <td>{{formset.lang}}{% if formset.lang.errors %}<br><p class="help-inline"> {{ formset.lang.errors|join:", " }} </p>{% endif %}</td>
136 b9e65644 Leonidas Poulopoulos
             
137 b9e65644 Leonidas Poulopoulos
        </tr>
138 b9e65644 Leonidas Poulopoulos
        {% endfor %}
139 b9e65644 Leonidas Poulopoulos
        </tbody></table>
140 b9e65644 Leonidas Poulopoulos
        </div>
141 b9e65644 Leonidas Poulopoulos
    </div>
142 0384aef9 Leonidas Poulopoulos
    {% if instdets.ertype == 2 or instdets.ertype == 3 %}
143 b778f19c Leonidas Poulopoulos
        <div class="control-group {% if form.oper_name.errors %} error {% endif %}">
144 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_oper_name">{% trans "Oper Name" %}</label>
145 b778f19c Leonidas Poulopoulos
                <div class="controls">
146 b778f19c Leonidas Poulopoulos
                        {{ form.oper_name }}
147 b778f19c Leonidas Poulopoulos
                        {% if form.oper_name.errors %} <span class="help-inline"> {{ form.oper_name.errors|join:", " }} </span>
148 b778f19c Leonidas Poulopoulos
                        {% endif %} <span class="help-block"> {{ form.oper_name.help_text }}</span>
149 b778f19c Leonidas Poulopoulos
                </div>
150 b778f19c Leonidas Poulopoulos
        </div>
151 0384aef9 Leonidas Poulopoulos
        {% endif %}
152 0384aef9 Leonidas Poulopoulos
        {% if instdets.ertype == 1 or instdets.ertype == 3 %}
153 b778f19c Leonidas Poulopoulos
        <div class="control-group {% if form.number_user.errors %} error {% endif %}">
154 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_number_user">{% trans "Number of Users" %}</label>
155 b778f19c Leonidas Poulopoulos
                <div class="controls">
156 b778f19c Leonidas Poulopoulos
                        {{ form.number_user }}
157 b778f19c Leonidas Poulopoulos
                        {% if form.number_user.errors %} <span class="help-inline"> {{ form.number_user.errors|join:", " }} </span>
158 b778f19c Leonidas Poulopoulos
                        {% endif %} <span class="help-block"> {{ form.number_user.help_text }}</span>
159 b778f19c Leonidas Poulopoulos
                </div>
160 b778f19c Leonidas Poulopoulos
        </div>
161 0384aef9 Leonidas Poulopoulos
        {% endif %}
162 b778f19c Leonidas Poulopoulos
        <div class="control-group {% if form.number_id.errors %} error {% endif %}">
163 25028c1d Leonidas Poulopoulos
                <label class="control-label" for="id_number_id">{% trans "Number Id" %}</label>
164 b778f19c Leonidas Poulopoulos
                <div class="controls">
165 b778f19c Leonidas Poulopoulos
                        {{ form.number_id }}
166 b778f19c Leonidas Poulopoulos
                        {% if form.number_id.errors %} <span class="help-inline"> {{ form.number_id.errors|join:", " }} </span>
167 b778f19c Leonidas Poulopoulos
                        {% endif %} <span class="help-block"> {{ form.number_id.help_text }}</span>
168 b778f19c Leonidas Poulopoulos
                </div>
169 b778f19c Leonidas Poulopoulos
        </div>
170 b778f19c Leonidas Poulopoulos
        <div class="control-group">
171 b778f19c Leonidas Poulopoulos
                <div class="controls">
172 25028c1d Leonidas Poulopoulos
                        <button type="submit" id="applybutton" value="Apply" class="btn btn-large btn-primary"/>{% trans "Apply" %}</button>
173 b778f19c Leonidas Poulopoulos
                </div>
174 b778f19c Leonidas Poulopoulos
        </div>
175 b778f19c Leonidas Poulopoulos
</form>
176 38f2278d Leonidas Poulopoulos
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
177 38f2278d Leonidas Poulopoulos
<div class="modal-header">
178 38f2278d Leonidas Poulopoulos
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
179 25028c1d Leonidas Poulopoulos
<h3 id="myModalLabel">{% trans "Add User" %}</h3>
180 38f2278d Leonidas Poulopoulos
</div>
181 38f2278d Leonidas Poulopoulos
<div class="modal-body" id="mymodalbody">
182 fa8b2f7d Leonidas Poulopoulos
183 38f2278d Leonidas Poulopoulos
</div>
184 38f2278d Leonidas Poulopoulos
<div class="modal-footer">
185 25028c1d Leonidas Poulopoulos
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Close" %}</button>
186 25028c1d Leonidas Poulopoulos
<a class="btn btn-primary" id="adduserSubmit" href="#">{% trans "Save changes" %}</a>
187 38f2278d Leonidas Poulopoulos
</div>
188 38f2278d Leonidas Poulopoulos
</div>
189 b778f19c Leonidas Poulopoulos
{% endblock %}
190 fa8b2f7d Leonidas Poulopoulos