Subversion Repositories bacoAlunos

Rev

Rev 1860 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1860 Rev 1876
Line 54... Line 54...
54
            departmentsModule.controller('departmentsModuleController', function($scope) {
54
            departmentsModule.controller('departmentsModuleController', function($scope) {
55
                $scope.departments = ${jsonArrayDepartments};
55
                $scope.departments = ${jsonArrayDepartments};
56
                $scope.schools = ${jsonArraySchools};
56
                $scope.schools = ${jsonArraySchools};
57
                $scope.setDirty = function(department)
57
                $scope.setDirty = function(department)
58
                {
58
                {
59
                   department.dirty = "true";
59
                    department.dirty = "true";
60
                }
60
                }
61
                $scope.save = function(department)
61
                $scope.save = function(department)
62
                {
62
                {
63
                    var d = JSON.stringify(department);
63
                    var d = JSON.stringify(department);
64
 
64
 
65
                    widgetCallWithActionParameters(
65
                    widgetCallWithActionParameters(
66
                            "<%=request.getContextPath()%>/admin/adminDepartment.do",
66
                        "<%=request.getContextPath()%>/admin/adminDepartment.do",
67
                            "updateCourseDepartment",
67
                        "updateCourseDepartment",
68
                            {
68
                        {
69
                                "courseDepartmentJson" : d
69
                            "courseDepartmentJson" : d
70
                            },
70
                        },
71
                            ".form-horizontal",
71
                        ".form-horizontal",
72
                            function(departmentJson)
72
                        function(departmentJson)
73
                            {
73
                        {
74
                                department.dirty = "false";
74
                            department.dirty = "false";
75
                                $scope.$apply();
75
                            $scope.$apply();
-
 
76
                        }
-
 
77
 
-
 
78
                    );
-
 
79
                }
-
 
80
 
-
 
81
                $scope.createRoles = function(department)
-
 
82
                {
-
 
83
                    var d = JSON.stringify(department);
-
 
84
 
-
 
85
                    widgetCallWithActionParameters(
-
 
86
                        "<%=request.getContextPath()%>/admin/adminDepartment.do",
-
 
87
                        "createRolesForDeparment",
-
 
88
                        {
-
 
89
                            "courseDepartmentJson" : d
-
 
90
                        },
-
 
91
                        ".form-horizontal",
-
 
92
                        function(departmentJson)
-
 
93
                        {
-
 
94
                            window.location.reload();
76
                            }
95
                        }
77
 
96
 
78
                    );
97
                    );
79
                }
98
                }
80
                $scope.removeDepartment = function(department,$index)
99
                $scope.removeDepartment = function(department,$index)
81
                {
100
                {
82
 
101
 
83
                    var d = JSON.stringify(department);
102
                    var d = JSON.stringify(department);
84
                    widgetCallWithActionParameters(
103
                    widgetCallWithActionParameters(
85
                            "<%=request.getContextPath()%>/admin/adminDepartment.do",
104
                        "<%=request.getContextPath()%>/admin/adminDepartment.do",
86
                            "removeCourseDepartment",
105
                        "removeCourseDepartment",
87
                            {
106
                        {
88
                                "courseDepartmentJson" : d
107
                            "courseDepartmentJson" : d
89
                            },
108
                        },
90
                            ".form-horizontal",
109
                        ".form-horizontal",
91
                            function(departmentJson)
110
                        function(departmentJson)
92
                            {
111
                        {
93
                                $scope.departments.splice($index,1);
112
                            $scope.departments.splice($index,1);
94
                                $scope.$apply();
113
                            $scope.$apply();
95
                            }
114
                        }
96
 
115
 
97
                    );
116
                    );
98
                }
117
                }
99
                $scope.newDepartment = function()
118
                $scope.newDepartment = function()
100
                {
119
                {
101
 
120
 
102
                    widgetCallWithActionParameters(
121
                    widgetCallWithActionParameters(
103
                            "<%=request.getContextPath()%>/admin/adminDepartment.do",
122
                        "<%=request.getContextPath()%>/admin/adminDepartment.do",
104
                            "newCourseDepartment",{},
123
                        "newCourseDepartment",{},
105
                            ".form-horizontal",
124
                        ".form-horizontal",
106
                            function(departmentJson)
125
                        function(departmentJson)
107
                            {
126
                        {
108
                                departmentJson.dirty = "true";
127
                            departmentJson.dirty = "true";
109
                                $scope.departments.push(departmentJson);
128
                            $scope.departments.push(departmentJson);
110
                                $scope.$apply();
129
                            $scope.$apply();
111
                            }
130
                        }
112
 
131
 
113
                    );
132
                    );
114
                }
133
                }
115
 
134
 
116
            });
135
            });
117
        </script>
136
        </script>
118
 
137
 
119
 
138
 
120
 
139
 
121
        <p><label class="label-info">Papeis dos Departamentos:</label> Os papeis de departamento são escolhidos da lista de papeis do sistema considerando-se todos os papeis com os prefixos:</p>
140
        <p><label class="label-info">Papeis dos Departamentos:</label> Os papeis de departamento são escolhidos da lista de papeis do sistema considerando-se todos os papeis com os prefixos:</p>
122
        <ul>
141
        <ul>
123
            <li>department.board: para membros da direcção</li>
142
            <li>department.board: para membros da direcção</li>
124
            <li>department.diretor: para diretores direcção</li>
143
            <li>department.diretor: para diretores direcção</li>
125
        </ul>
144
        </ul>
126
        <p>Caso seja necessário um novo papel deverá administrar os papeis institucionais dirija-se <html:link action="/user/configurationUserRoles">Aqui</html:link></p>
145
        <p>Caso seja necessário um novo papel deverá administrar os papeis institucionais dirija-se <html:link action="/user/configurationUserRoles">Aqui</html:link></p>
127
        <button class="btn btn-default" data-toggle="collapse" data-target=".languageNames">Mostrar Campos Multinliguisticos</button>
146
        <button class="btn btn-default" data-toggle="collapse" data-target=".languageNames">Mostrar Campos Multinliguisticos</button>
128
 
147
 
129
        <button class="btn btn-success pull-right" ng-click="newDepartment()"><span class="glyphicon glyphicon-plus"/></button>
148
        <button class="btn btn-success pull-right" ng-click="newDepartment()"><span class="glyphicon glyphicon-plus"/></button>
130
        <div class="form-horizontal">
149
        <div class="form-horizontal">
131
            <div class="web-messages"></div>
150
            <div class="web-messages"></div>
132
            <table class="tablesorter-blue">
151
            <table class="tablesorter-blue">
133
                <thead>
152
                <thead>
134
                    <tr>
153
                <tr>
135
                        <th>Identificador</th>
154
                    <th>Identificador</th>
136
                        <th>Trocar Para Identificador * </th>
155
                    <th>Trocar Para Identificador * </th>
137
                        <th>Ativo</th>
156
                    <th>Ativo</th>
138
                        <th>Instituição</th>
157
                    <th>Instituição</th>
139
                        <th style="width: 30%">Nome</th>
158
                    <th style="width: 30%">Nome</th>
140
                        <th>Papel para Membro da Direcao</th>
159
                    <th>Papel para Membro da Direcao</th>
141
                        <th>Papel para Director</th>
160
                    <th>Papel para Director</th>
-
 
161
                    <th></th>
142
                        <th></th>
162
                    <th></th>
143
                        <th></th>
163
                    <th></th>
144
                    </tr>
164
                </tr>
145
                </thead>
165
                </thead>
146
                <tbody>
166
                <tbody>
147
                    <tr ng-class="{dirty: d.dirty=='true'}" ng-repeat="d in departments | orderBy:name:false">
167
                <tr ng-class="{dirty: d.dirty=='true'}" ng-repeat="d in departments | orderBy:name:false">
148
                        <td>
168
                    <td>
149
                            <div class="row">
169
                        <div class="row">
150
                                <div class="col-md-8">
170
                            <div class="col-md-8">
151
                                    <input readonly="true" class="form-control" type="text" ng-model="d.sigla" ng-keyup="setDirty(d)">
171
                                <input readonly="true" class="form-control" type="text" ng-model="d.sigla" ng-keyup="setDirty(d)">
152
                                </div>
-
 
153
                                <div class="col-md-2">*</div>
-
 
154
                            </div>
172
                            </div>
-
 
173
                            <div class="col-md-2">*</div>
-
 
174
                        </div>
155
 
175
 
156
                        </td>
176
                    </td>
157
                        <td>
177
                    <td>
158
                            <div class="row">
178
                        <div class="row">
159
                                <div class="col-md-8">
179
                            <div class="col-md-8">
160
                                    <input class="form-control" type="text" ng-model="d.siglaNova" ng-keyup="setDirty(d)">
180
                                <input class="form-control" type="text" ng-model="d.siglaNova" ng-keyup="setDirty(d)">
161
                                </div>
-
 
162
                                <div class="col-md-2">*</div>
-
 
163
                            </div>
-
 
164
                        </td>
-
 
165
                        <td>
-
 
166
                            <select class="chosenOff form-control" ng-model="d.active" ng-change="setDirty(d)">
-
 
167
                                <option ng-value="true" ng-selected="d.active == true">Ativo</option>
-
 
168
                                <option ng-value="false" ng-selected="d.active == false">Inativo</option>
-
 
169
                            </select>
-
 
170
                        </td>
-
 
171
                        <td>
-
 
172
                            <select class="chosenOff form-control" ng-model="d.courseSchool.id" ng-change="setDirty(d)" ng-options="s.id as s.name for s in schools">
-
 
173
                            </select>
-
 
174
                        </td>
-
 
175
                        <td>
-
 
176
                            <input class="form-control" type="text" ng-model="d.name" ng-keyup="setDirty(d)">
-
 
177
                            <div class="languageNames collapse">
-
 
178
                                EN:<input class="form-control" type="text" ng-model="d.nameEn" ng-keyup="setDirty(d)">
-
 
179
                                ES:<input class="form-control" type="text" ng-model="d.nameEs" ng-keyup="setDirty(d)">
-
 
180
                                FR:<input class="form-control" type="text" ng-model="d.nameFr" ng-keyup="setDirty(d)">
-
 
181
                            </div>
181
                            </div>
-
 
182
                            <div class="col-md-2">*</div>
182
                        </td>
183
                        </div>
-
 
184
                    </td>
-
 
185
                    <td>
-
 
186
                        <select class="chosenOff form-control" ng-model="d.active" ng-change="setDirty(d)">
-
 
187
                            <option ng-value="true" ng-selected="d.active == true">Ativo</option>
-
 
188
                            <option ng-value="false" ng-selected="d.active == false">Inativo</option>
-
 
189
                        </select>
-
 
190
                    </td>
-
 
191
                    <td>
-
 
192
                        <select class="chosenOff form-control" ng-model="d.courseSchool.id" ng-change="setDirty(d)" ng-options="s.id as s.name for s in schools">
-
 
193
                        </select>
-
 
194
                    </td>
-
 
195
                    <td>
-
 
196
                        <input class="form-control" type="text" ng-model="d.name" ng-keyup="setDirty(d)">
-
 
197
                        <div class="languageNames collapse">
-
 
198
                            EN:<input class="form-control" type="text" ng-model="d.nameEn" ng-keyup="setDirty(d)">
-
 
199
                            ES:<input class="form-control" type="text" ng-model="d.nameEs" ng-keyup="setDirty(d)">
-
 
200
                            FR:<input class="form-control" type="text" ng-model="d.nameFr" ng-keyup="setDirty(d)">
-
 
201
                        </div>
-
 
202
                    </td>
183
 
203
 
184
                        <td style="font-size: 0.7em !important">
204
                    <td style="font-size: 0.7em !important">
185
                            <select class="chosenOff form-control" ng-model="d.boardRole" ng-change="setDirty(d)">
205
                        <select class="chosenOff form-control" ng-model="d.boardRole" ng-change="setDirty(d)">
186
                                <option value="">Escolha</option>
206
                            <option value="">Escolha</option>
187
                                <logic:iterate id="role" name="rolesBoardDepartamento">
207
                            <logic:iterate id="role" name="rolesBoardDepartamento">
188
                                    <option value="${role}"><bean:message key="user.role.${role}"/></option>
208
                                <option value="${role}"><bean:message key="user.role.${role}"/></option>
189
                                </logic:iterate>
209
                            </logic:iterate>
190
                            </select>
210
                        </select>
191
                        </td>
211
                    </td>
192
                        <td style="font-size: 0.7em !important">
212
                    <td style="font-size: 0.7em !important">
193
                            <select class="chosenOff form-control" ng-model="d.directorRole" ng-change="setDirty(d)">
213
                        <select class="chosenOff form-control" ng-model="d.directorRole" ng-change="setDirty(d)">
194
                                <option value="">Escolha</option>
214
                            <option value="">Escolha</option>
195
                                <logic:iterate id="role" name="rolesDiretorDepartamento">
215
                            <logic:iterate id="role" name="rolesDiretorDepartamento">
196
                                    <option value="${role}"><bean:message key="user.role.${role}"/></option>
216
                                <option value="${role}"><bean:message key="user.role.${role}"/></option>
197
                                </logic:iterate>
217
                            </logic:iterate>
198
                            </select>
218
                        </select>
199
                        </td>
219
                    </td>
200
                        <td>
220
                    <td>
201
                            <button type="button" class="btn btn-success btn-xs" ng-click="save(d)">
221
                        <button type="button" class="btn btn-success btn-xs" ng-click="save(d)">
202
                                <span class="glyphicon glyphicon-ok"/>
222
                            <span class="glyphicon glyphicon-ok"/>
203
                            </button>
223
                        </button>
204
                        </td>
224
                    </td>
-
 
225
                    <td>
205
                        <td>
226
                        <bacoTags:confirm  msg="Tem a certeza que deseja remover o departamento {{d.name}}" targetFunction="angular.element($('#departmentsModule')).scope().removeDepartment({{d}},{{$index}});angular.element($('#departmentsModule')).scope().$apply();" btnClass="btn btn-danger btn-xs" icon="glyphicon glyphicon-remove"/>
-
 
227
                    </td>
-
 
228
                    <td>
-
 
229
                        <button ng-if="!d.directorRole && !d.boardRole" data-toggle="tooltip" data-title="Criar Roles para este departamento" type="button" class="btn btn-success btn-xs" ng-click="createRoles(d)">
-
 
230
                            <span class="glyphicon glyphicon-user"/>
206
                            <bacoTags:confirm  msg="Tem a certeza que deseja remover o departamento {{d.name}}" targetFunction="angular.element($('#departmentsModule')).scope().removeDepartment({{d}},{{$index}});angular.element($('#departmentsModule')).scope().$apply();" btnClass="btn btn-danger btn-xs" icon="glyphicon glyphicon-remove"/>
231
                        </button>
207
                        </td>
232
                    </td>
208
 
233
 
209
 
234
 
210
 
235
 
211
                    </tr>
236
                </tr>
212
                </tbody>
237
                </tbody>
213
            </table>
238
            </table>
214
            <p class="label label-warning">* - A sigla é o identificador do departamento, altere a sigla apenas se perceber as suas implicações. Existem Classes no sistema que dependem da sigla do departamento, a sigla tem de ser unica</p>
239
            <h2 class="label label-warning">* - A sigla é o identificador do departamento, altere a sigla apenas se perceber as suas implicações. Existem Classes no sistema que dependem da sigla do departamento, a sigla tem de ser unica</h2>
-
 
240
            <h2 class="label label-warning">* - A sigla apenas pode ser alterada se não houver docentes nem cursos a apontar para o departamento que pretende alterar</h2>
215
            <%--
241
            <%--
216
            <model:id name="department" property="id"/>
242
            <model:id name="department" property="id"/>
217
            <model:field name="department" property="name"/>
243
            <model:field name="department" property="name"/>
218
            <model:field name="department" property="nameEn"/>
244
            <model:field name="department" property="nameEn"/>
219
            <model:field name="department" property="nameEs"/>
245
            <model:field name="department" property="nameEs"/>
220
            <model:field name="department" property="nameFr"/>
246
            <model:field name="department" property="nameFr"/>
221
            <model:remove name="department"/>
247
            <model:remove name="department"/>
222
    --%>
248
        --%>
223
        </div>
249
        </div>
224
 
250
 
225
        <pre>
251
        <!--<pre>
226
            {{departments | json}}
252
            {{departments | json}}
227
        </pre>
253
        </pre>-->
228
        <%-- DEBUG
254
        <%-- DEBUG
229
        <pre>
255
        <pre>
230
            {{departments | json}}
256
            {{departments | json}}
231
        </pre>
257
        </pre>
232
        <pre>
258
        <pre>
Line 236... Line 262...
236
    </div>
262
    </div>
237
 
263
 
238
 
264
 
239
</div>
265
</div>
240
 
266
 
241
<p>* Atenção o identificador é a base dos papeis, deverá trocar também as chaves dos papeis na administração de papeis institucionais, procurando pelos papeis respectivos e alterando a sua chave para a nova sigla ou criando novos papeis</p>
267
<p>* Atenção o identificador é a base dos papeis, deverá trocar também as chaves dos papeis na administração de papeis institucionais, procurando pelos papeis respectivos e alterando a sua chave para a nova sigla ou criando novos papeis</p>
242
 
268
 
243
 
269
 
244
<%
270
<%
245
    AbstractDao.getCurrentSession().getTransaction().commit();
271
    AbstractDao.getCurrentSession().getTransaction().commit();
246
%>
272
%>
247
 
273