Commit da41e2be0afe4244b884e6c82d3142c7669b3324

Authored by Lucas D'Avila
1 parent 00101e5d
Exists in master

Adicionado /modules/Portabilis com assets usados por outras funcionalidades e ad…

…icionado /modules/DynamicInput com assets e APIs json usados pelos helpers para inputs dinâmicos
Showing 43 changed files with 3262 additions and 0 deletions   Show diff stats
ieducar/modules/DynamicInput/Assets/Javascripts/AnoLetivo.js 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 +
  4 + var $escolaField = getElementFor('escola');
  5 + var $anoLetivoField = getElementFor('ano');
  6 +
  7 + var handleGetAnoEscolares = function(response) {
  8 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  9 + updateSelect($anoLetivoField, selectOptions, "Selecione um ano escolar");
  10 + }
  11 +
  12 + var updateAnoEscolares = function(){
  13 + resetSelect($anoLetivoField);
  14 +
  15 + if ($escolaField.val() && $escolaField.is(':enabled')) {
  16 + $anoLetivoField.children().first().html('Aguarde carregando...');
  17 +
  18 + var data = {
  19 + escola_id : $escolaField.attr('value'),
  20 + };
  21 +
  22 + $j("input[name='situacoes_ano_letivo']").each(function(index, input){
  23 + data['situacao_' + $j(input).val()] = true;
  24 + });
  25 +
  26 + var urlForGetAnosEscolares = getResourceUrlBuilder.buildUrl('/module/DynamicInput/AnoLetivo',
  27 + 'anos_letivos', data);
  28 +
  29 + var options = {
  30 + url : urlForGetAnosEscolares,
  31 + dataType : 'json',
  32 + success : handleGetAnoEscolares
  33 + };
  34 +
  35 + getResources(options);
  36 + }
  37 +
  38 + $anoLetivoField.change();
  39 + };
  40 +
  41 + // bind onchange event
  42 + $escolaField.change(updateAnoEscolares);
  43 +
  44 + }); // ready
  45 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Biblioteca.js 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $escolaField = getElementFor('escola');
  4 + var $bibliotecaField = getElementFor('biblioteca');
  5 +
  6 + var handleGetBibliotecas = function(resources) {
  7 + var selectOptions = xmlResourcesToSelectOptions(resources, 'query', 'cod_biblioteca');
  8 + updateSelect($bibliotecaField, selectOptions, "Selecione uma biblioteca");
  9 + }
  10 +
  11 + var updateBibliotecas = function(){
  12 + resetSelect($bibliotecaField);
  13 +
  14 + if ($escolaField.val() && $escolaField.is(':enabled')) {
  15 + $bibliotecaField.children().first().html('Aguarde carregando...');
  16 +
  17 + var urlForGetBibliotecas = getResourceUrlBuilder.buildUrl('educar_biblioteca_xml.php', '', {
  18 + esc : $escolaField.attr('value') });
  19 +
  20 + var options = {
  21 + url : urlForGetBibliotecas,
  22 + dataType : 'xml',
  23 + success : handleGetBibliotecas
  24 + };
  25 +
  26 + getResources(options);
  27 + }
  28 +
  29 + $bibliotecaField.change();
  30 + };
  31 +
  32 + // bind onchange event
  33 + $escolaField.change(updateBibliotecas);
  34 +
  35 + }); // ready
  36 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/BibliotecaFonte.js 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $bibliotecaField = getElementFor('biblioteca');
  4 + var $fonteField = getElementFor('fonte');
  5 +
  6 + var handleGetFontes = function(resources) {
  7 + var selectOptions = xmlResourcesToSelectOptions(resources, 'query', 'cod_fonte');
  8 + updateSelect($fonteField, selectOptions, "Selecione uma fonte");
  9 + }
  10 +
  11 + var updateFontes = function(){
  12 + resetSelect($fonteField);
  13 +
  14 + if ($bibliotecaField.val() && $bibliotecaField.is(':enabled')) {
  15 + $fonteField.children().first().html('Aguarde carregando...');
  16 +
  17 + var urlForGetFontes = getResourceUrlBuilder.buildUrl('educar_fonte_xml.php', '', {
  18 + bib : $bibliotecaField.attr('value') });
  19 +
  20 + var options = {
  21 + url : urlForGetFontes,
  22 + dataType : 'xml',
  23 + success : handleGetFontes
  24 + };
  25 +
  26 + getResources(options);
  27 + }
  28 +
  29 + $fonteField.change();
  30 + };
  31 +
  32 + // bind onchange event
  33 + $bibliotecaField.change(updateFontes);
  34 +
  35 + }); // ready
  36 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/BibliotecaSituacao.js 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $bibliotecaField = getElementFor('biblioteca');
  4 + var $situacaoField = getElementFor('situacao');
  5 +
  6 + var handleGetSituacoes = function(resources) {
  7 + var selectOptions = xmlResourcesToSelectOptions(resources, 'query', 'cod_situacao');
  8 + updateSelect($situacaoField, selectOptions, "Selecione uma situação");
  9 + }
  10 +
  11 + var updateSituacoes = function(){
  12 + resetSelect($situacaoField);
  13 +
  14 + if ($bibliotecaField.val() && $bibliotecaField.is(':enabled')) {
  15 + $situacaoField.children().first().html('Aguarde carregando...');
  16 +
  17 + var urlForGetSituacoes = getResourceUrlBuilder.buildUrl('educar_situacao_xml.php', '', {
  18 + bib : $bibliotecaField.attr('value') });
  19 +
  20 + var options = {
  21 + url : urlForGetSituacoes,
  22 + dataType : 'xml',
  23 + success : handleGetSituacoes
  24 + };
  25 +
  26 + getResources(options);
  27 + }
  28 +
  29 + $situacaoField.change();
  30 + };
  31 +
  32 + // bind onchange event
  33 + $bibliotecaField.change(updateSituacoes);
  34 +
  35 + }); // ready
  36 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/BibliotecaTipoCliente.js 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $bibliotecaField = getElementFor('biblioteca');
  4 + var $tipoClienteField = getElementFor('cliente_tipo');
  5 +
  6 + var handleGetTiposCliente = function(resources) {
  7 + var selectOptions = xmlResourcesToSelectOptions(resources, 'query', 'cod_cliente_tipo');
  8 + updateSelect($tipoClienteField, selectOptions, "Selecione um tipo de cliente");
  9 + }
  10 +
  11 + var updateTiposCliente = function(){
  12 + resetSelect($tipoClienteField);
  13 +
  14 + if ($bibliotecaField.val() && $bibliotecaField.is(':enabled')) {
  15 + $tipoClienteField.children().first().html('Aguarde carregando...');
  16 +
  17 + var path = '/intranet/educar_cliente_tipo_xml.php';
  18 + var urlForGetTipoCliente = getResourceUrlBuilder.buildUrl(path, '', {
  19 + bib : $bibliotecaField.attr('value') });
  20 +
  21 + var options = {
  22 + url : urlForGetTipoCliente,
  23 + dataType : 'xml',
  24 + success : handleGetTiposCliente
  25 + };
  26 +
  27 + getResources(options);
  28 + }
  29 +
  30 + $tipoClienteField.change();
  31 + };
  32 +
  33 + // bind onchange event
  34 + $bibliotecaField.change(updateTiposCliente);
  35 +
  36 + }); // ready
  37 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/BibliotecaTipoExemplar.js 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $bibliotecaField = getElementFor('biblioteca');
  4 + var $tipoExemplarField = getElementFor('exemplar_tipo');
  5 +
  6 + var handleGetTiposExemplar = function(response) {
  7 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  8 + updateSelect($tipoExemplarField, selectOptions, "Selecione um tipo de exemplar");
  9 + }
  10 +
  11 + var updateTiposExemplar = function(){
  12 + resetSelect($tipoExemplarField);
  13 +
  14 + if ($bibliotecaField.val() && $bibliotecaField.is(':enabled')) {
  15 + $tipoExemplarField.children().first().html('Aguarde carregando...');
  16 +
  17 + var data = {
  18 + resource : 'tipos_exemplar',
  19 + biblioteca_id : $bibliotecaField.attr('value')
  20 + };
  21 +
  22 + var urlForGetTipoExemplar = getResourceUrlBuilder.buildUrl('/module/DynamicInput/TipoExemplar',
  23 + 'tipos_exemplar', data);
  24 + var options = {
  25 + url : urlForGetTipoExemplar,
  26 + dataType : 'json',
  27 + success : handleGetTiposExemplar
  28 + };
  29 +
  30 + getResources(options);
  31 + }
  32 +
  33 + $tipoExemplarField.change();
  34 + };
  35 +
  36 + // bind onchange event
  37 + $bibliotecaField.change(updateTiposExemplar);
  38 +
  39 + }); // ready
  40 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/ComponenteCurricular.js 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 +
  4 + var $anoField = getElementFor('ano');
  5 + var $turmaField = getElementFor('turma');
  6 + var $componenteCurricularField = getElementFor('componente_curricular');
  7 +
  8 + var handleGetComponentesCurriculares = function(response) {
  9 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  10 + updateSelect($componenteCurricularField, selectOptions, "Selecione um componente curricular");
  11 + }
  12 +
  13 + var updateComponentesCurriculares = function(){
  14 + resetSelect($componenteCurricularField);
  15 +
  16 + if ($anoField.val() && $turmaField.val() && $turmaField.is(':enabled')) {
  17 + $componenteCurricularField.children().first().html('Aguarde carregando...');
  18 +
  19 + var data = {
  20 + ano : $anoField.attr('value'),
  21 + turma_id : $turmaField.attr('value')
  22 + };
  23 +
  24 + var urlForGetComponentesCurriculares = getResourceUrlBuilder.buildUrl(
  25 + '/module/DynamicInput/componenteCurricular', 'componentesCurriculares', data
  26 + );
  27 +
  28 + var options = {
  29 + url : urlForGetComponentesCurriculares,
  30 + dataType : 'json',
  31 + success : handleGetComponentesCurriculares
  32 + };
  33 +
  34 + getResources(options);
  35 + }
  36 +
  37 + $componenteCurricularField.change();
  38 + };
  39 +
  40 + // bind onchange event
  41 + $turmaField.change(updateComponentesCurriculares);
  42 +
  43 + }); // ready
  44 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Curso.js 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $instituicaoField = getElementFor('instituicao');
  4 + var $escolaField = getElementFor('escola');
  5 + var $cursoField = getElementFor('curso');
  6 +
  7 + var handleGetCursos = function(response) {
  8 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  9 + updateSelect($cursoField, selectOptions, "Selecione um curso");
  10 + }
  11 +
  12 + var updateCursos = function(){
  13 + resetSelect($cursoField);
  14 +
  15 + if ($instituicaoField.val() && $escolaField.val() && $escolaField.is(':enabled')) {
  16 + $cursoField.children().first().html('Aguarde carregando...');
  17 +
  18 + var urlForGetCursos = getResourceUrlBuilder.buildUrl('/module/DynamicInput/Curso', 'cursos', {
  19 + escola_id : $escolaField.attr('value'),
  20 + instituicao_id : $instituicaoField.attr('value'),
  21 + });
  22 +
  23 + var options = {
  24 + url : urlForGetCursos,
  25 + dataType : 'json',
  26 + success : handleGetCursos
  27 + };
  28 +
  29 + getResources(options);
  30 + }
  31 +
  32 + $cursoField.change();
  33 + };
  34 +
  35 + // bind onchange event
  36 + $escolaField.change(updateCursos);
  37 +
  38 + }); // ready
  39 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/DynamicInput.js 0 → 100644
... ... @@ -0,0 +1,92 @@
  1 +function updateSelect($targetElement, options, emptyOptionHtml) {
  2 + $targetElement.children().not('[value=""]').remove();
  3 +
  4 + $j.each(options, function(index, value){
  5 + $j(value).appendTo($targetElement);
  6 + });
  7 +
  8 + if (options.length > 0) {
  9 + $targetElement.removeAttr('disabled');
  10 + $targetElement.children('[value=""]').first().html(emptyOptionHtml || "Selecione uma opção");
  11 + }
  12 + else
  13 + $targetElement.children(':first').html('Sem opções');
  14 +}
  15 +
  16 +
  17 +function resetSelect($targetElement) {
  18 + $targetElement.children().not('[value=""]').remove();
  19 + $targetElement.children().first().attr('checked', 'checked');
  20 + //$targetElement.attr('disabled', 'disabled');
  21 +}
  22 +
  23 +
  24 +function xmlResourcesToSelectOptions(resources, parentNodeName, nodeIdAttrName, nodeValueAttrName) {
  25 + var options = [];
  26 +
  27 + $j.each($j(resources).find(parentNodeName).children(), function(index, value){
  28 + var $value = $j(value);
  29 + var text;
  30 +
  31 + var $option = $j('<option />');
  32 + $option.attr('value', $value.attr(nodeIdAttrName));
  33 +
  34 + if (typeof nodeValueAttrName != 'undefined')
  35 + text = safeCapitalize($value.attr(nodeValueAttrName));
  36 + else
  37 + text = safeCapitalize($value.text());
  38 +
  39 + $option.html(text);
  40 + options.push($option);
  41 + });
  42 +
  43 + return options;
  44 +}
  45 +
  46 +
  47 +function jsonResourcesToSelectOptions(resources) {
  48 + var options = [];
  49 +
  50 + $j.each(resources, function(id, value) {
  51 +
  52 + // como arrays com chave numerica são ordenados pela chave pode-se enviar
  53 + // arrays como { __123 : 'value a', __111 : 'value b'} com a chave iniciando com '__'
  54 + // para que seja respeitado a posição dos elementos da lista e não pela chave
  55 + // assim o '__' do inicio do id será removido antes de usa-lo.
  56 +
  57 + if (id.indexOf && id.substr && id.indexOf('__') == 0)
  58 + id = id.substr(2);
  59 +
  60 + options.push($j('<option />').attr('value', id).html(safeCapitalize(value)));
  61 + });
  62 +
  63 + return options;
  64 +}
  65 +
  66 +
  67 +function getFirstDefined(attrIdNames) {
  68 + if (! $j.isArray(attrIdNames))
  69 + attrIdNames = [attrIdNames];
  70 +
  71 + var $element = undefined;
  72 +
  73 + $j.each(attrIdNames, function(index, attIdName){
  74 + $element = $j(buildId(attIdName));
  75 +
  76 + if ($element.length > 0)
  77 + return false;
  78 + });
  79 +
  80 + return $element;
  81 +}
  82 +
  83 +function getElementFor(entityName) {
  84 + var $element = getFirstDefined([entityName + "_id" ,
  85 + "ref_cod_" + entityName,
  86 + "ref_ref_cod_" + entityName,
  87 + entityName]);
  88 + if ($element == undefined)
  89 + safeLog("Elemento não definido para '" + entityName + "'");
  90 +
  91 + return $element;
  92 +}
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Escola.js 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 + var $instituicaoField = getElementFor('instituicao');
  4 + var $escolaField = getElementFor('escola');
  5 +
  6 + var handleGetEscolas = function(resources) {
  7 + var selectOptions = xmlResourcesToSelectOptions(resources, 'query', 'cod_escola');
  8 + updateSelect($escolaField, selectOptions, "Selecione uma escola");
  9 + }
  10 +
  11 + var updateEscolas = function(){
  12 + resetSelect($escolaField);
  13 +
  14 + if ($instituicaoField.val() && $instituicaoField.is(':enabled')) {
  15 + $escolaField.children().first().html('Aguarde carregando...');
  16 +
  17 + var urlForGetEscolas = getResourceUrlBuilder.buildUrl('educar_escola_xml2.php', '', {
  18 + ins : $instituicaoField.attr('value') });
  19 +
  20 + var options = {
  21 + url : urlForGetEscolas,
  22 + dataType : 'xml',
  23 + success : handleGetEscolas
  24 + };
  25 +
  26 + getResources(options);
  27 + }
  28 +
  29 + $escolaField.change();
  30 + };
  31 +
  32 + // bind onchange event
  33 + $instituicaoField.change(updateEscolas);
  34 +
  35 + }); // ready
  36 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Etapa.js 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 +
  4 + var $anoField = getElementFor('ano');
  5 + var $escolaField = getElementFor('escola');
  6 + var $cursoField = getElementFor('curso');
  7 + var $turmaField = getElementFor('turma');
  8 + var $etapaField = getElementFor('etapa');
  9 +
  10 + var handleGetEtapas = function(response) {
  11 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  12 + updateSelect($etapaField, selectOptions, "Selecione uma etapa");
  13 + }
  14 +
  15 + var updateEtapas = function(){
  16 + resetSelect($etapaField);
  17 +
  18 + if ($anoField.val() && $escolaField.val() && $cursoField.val() && $turmaField.val() && $turmaField.is(':enabled')) {
  19 + $etapaField.children().first().html('Aguarde carregando...');
  20 +
  21 + var data = {
  22 + ano : $anoField.attr('value'),
  23 + escola_id : $escolaField.attr('value'),
  24 + curso_id : $cursoField.attr('value'),
  25 + turma_id : $turmaField.attr('value')
  26 + };
  27 +
  28 + var urlForGetEtapas = getResourceUrlBuilder.buildUrl('/module/DynamicInput/Etapa',
  29 + 'etapas', data);
  30 +
  31 + var options = {
  32 + url : urlForGetEtapas,
  33 + dataType : 'json',
  34 + success : handleGetEtapas
  35 + };
  36 +
  37 + getResources(options);
  38 + }
  39 +
  40 + $etapaField.change();
  41 + };
  42 +
  43 + // bind onchange event
  44 + $turmaField.change(updateEtapas);
  45 +
  46 + }); // ready
  47 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Matricula.js 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 +
  4 + var $anoField = getElementFor('ano');
  5 + var $turmaField = getElementFor('turma');
  6 + var $matriculaField = getElementFor('matricula');
  7 +
  8 + var handleGetMatriculas = function(response) {
  9 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  10 + updateSelect($matriculaField, selectOptions, "Selecione uma matricula");
  11 + }
  12 +
  13 + var updateMatriculas = function(){
  14 + resetSelect($matriculaField);
  15 +
  16 + if ($anoField.val() && $turmaField.val() && $turmaField.is(':enabled')) {
  17 + $matriculaField.children().first().html('Aguarde carregando...');
  18 +
  19 + var data = {
  20 + ano : $anoField.attr('value'),
  21 + turma_id : $turmaField.attr('value')
  22 + };
  23 +
  24 + var urlForGetMatriculas = getResourceUrlBuilder.buildUrl('/module/DynamicInput/Matricula',
  25 + 'matriculas', data);
  26 +
  27 + var options = {
  28 + url : urlForGetMatriculas,
  29 + dataType : 'json',
  30 + success : handleGetMatriculas
  31 + };
  32 +
  33 + getResources(options);
  34 + }
  35 +
  36 + $matriculaField.change();
  37 + };
  38 +
  39 + // bind onchange event
  40 + $turmaField.change(updateMatriculas);
  41 +
  42 + }); // ready
  43 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Serie.js 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 +
  4 + // serie search expect an id for escola
  5 + var $escolaField = getElementFor('escola');
  6 +
  7 + var $cursoField = getElementFor('curso');
  8 + var $serieField = getElementFor('serie');
  9 +
  10 + var handleGetSeries = function(resources) {
  11 + var selectOptions = xmlResourcesToSelectOptions(resources, 'query', 'cod_serie');
  12 + updateSelect($serieField, selectOptions, "Selecione uma s&eacute;rie");
  13 + }
  14 +
  15 + var updateSeries = function(){
  16 + resetSelect($serieField);
  17 +
  18 + if ($escolaField.val() && $cursoField.val() && $cursoField.is(':enabled')) {
  19 + $serieField.children().first().html('Aguarde carregando...');
  20 +
  21 + var urlForGetSeries = getResourceUrlBuilder.buildUrl('educar_escola_curso_serie_xml.php', '', {
  22 + esc : $escolaField.attr('value'),
  23 + cur : $cursoField.attr('value') });
  24 +
  25 + var options = {
  26 + url : urlForGetSeries,
  27 + dataType : 'xml',
  28 + success : handleGetSeries
  29 + };
  30 +
  31 + getResources(options);
  32 + }
  33 +
  34 + $serieField.change();
  35 + };
  36 +
  37 + // bind onchange event
  38 + $cursoField.change(updateSeries);
  39 +
  40 + }); // ready
  41 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Assets/Javascripts/Turma.js 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +(function($){
  2 + $(document).ready(function(){
  3 +
  4 + // turma search expect an id for escola
  5 + var $instituicaoField = getElementFor('instituicao');
  6 + var $escolaField = getElementFor('escola');
  7 +
  8 + var $serieField = getElementFor('serie');
  9 + var $turmaField = getElementFor('turma');
  10 +
  11 + var handleGetTurmas = function(response) {
  12 + var selectOptions = jsonResourcesToSelectOptions(response['options']);
  13 + updateSelect($turmaField, selectOptions, "Selecione uma turma");
  14 + }
  15 +
  16 + var updateTurmas = function(){
  17 + resetSelect($turmaField);
  18 +
  19 + if ($instituicaoField.val() && $escolaField.val() && $serieField.val() && $serieField.is(':enabled')) {
  20 + $turmaField.children().first().html('Aguarde carregando...');
  21 +
  22 + var urlForGetTurmas = getResourceUrlBuilder.buildUrl('/module/DynamicInput/turma', 'turmas', {
  23 + instituicao_id : $instituicaoField.attr('value'),
  24 + escola_id : $escolaField.attr('value'),
  25 + serie_id : $serieField.attr('value')
  26 + });
  27 +
  28 + var options = {
  29 + url : urlForGetTurmas,
  30 + dataType : 'json',
  31 + success : handleGetTurmas
  32 + };
  33 +
  34 + getResources(options);
  35 + }
  36 +
  37 + $turmaField.change();
  38 + };
  39 +
  40 + // bind onchange event
  41 + $serieField.change(updateTurmas);
  42 +
  43 + }); // ready
  44 +})(jQuery);
... ...
ieducar/modules/DynamicInput/Views/AnoLetivoController.php 0 → 100644
... ... @@ -0,0 +1,89 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +
  37 +/**
  38 + * AnoLetivoController class.
  39 + *
  40 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  41 + * @category i-Educar
  42 + * @license @@license@@
  43 + * @package Avaliacao
  44 + * @subpackage Modules
  45 + * @since Classe disponível desde a versão 1.1.0
  46 + * @version @@package_version@@
  47 + */
  48 +class AnoLetivoController extends ApiCoreController
  49 +{
  50 +
  51 + protected function canGetAnosLetivos() {
  52 + return $this->validatesId('escola');
  53 + }
  54 +
  55 + protected function filtroSituacao() {
  56 + $tiposSituacao = array('nao_iniciado' => 0, 'em_andamento' => 1, 'finalizado' => 2);
  57 + $situacaoIn = array();
  58 +
  59 + foreach ($tiposSituacao as $nome => $flag) {
  60 + if ($this->getRequest()->{"situacao_$nome"} == true)
  61 + $situacaoIn[] = $flag;
  62 + }
  63 +
  64 + return (empty($situacaoIn) ? '' : 'and andamento in ('. implode(',', $situacaoIn) . ')');
  65 + }
  66 +
  67 + protected function getAnosLetivos() {
  68 + if ($this->canGetAnosLetivos()) {
  69 + $params = array($this->getRequest()->escola_id);
  70 + $sql = "select ano from pmieducar.escola_ano_letivo as al where ref_cod_escola = $1
  71 + and ativo = 1 {$this->filtroSituacao()} order by ano desc";
  72 +
  73 + $records = $this->fetchPreparedQuery($sql, $params);
  74 + $options = array();
  75 +
  76 + foreach ($records as $record)
  77 + $options[$record['ano']] = $record['ano'];
  78 +
  79 + return array('options' => $options);
  80 + }
  81 + }
  82 +
  83 + public function Gerar() {
  84 + if ($this->isRequestFor('get', 'anos_letivos'))
  85 + $this->appendResponse($this->getAnosLetivos());
  86 + else
  87 + $this->notImplementedOperationError();
  88 + }
  89 +}
... ...
ieducar/modules/DynamicInput/Views/ComponenteCurricularController.php 0 → 100644
... ... @@ -0,0 +1,109 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +require_once 'Portabilis/Business/Professor.php';
  37 +
  38 +/**
  39 + * ComponenteCurricularController class.
  40 + *
  41 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  42 + * @category i-Educar
  43 + * @license @@license@@
  44 + * @package Avaliacao
  45 + * @subpackage Modules
  46 + * @since Classe disponível desde a versão 1.1.0
  47 + * @version @@package_version@@
  48 + */
  49 +class ComponenteCurricularController extends ApiCoreController
  50 +{
  51 +
  52 + protected function canGetComponentesCurriculares() {
  53 + return $this->validatesId('escola') &&
  54 + $this->validatesId('turma') &&
  55 + $this->validatesPresenceOf('ano');
  56 + }
  57 +
  58 + protected function getComponentesCurriculares() {
  59 + if ($this->canGetComponentesCurriculares()) {
  60 +
  61 + $userId = $this->getSession()->id_pessoa;
  62 + $instituicaoId = $this->getRequest()->instituicao_id;
  63 + $turmaId = $this->getRequest()->turma_id;
  64 + $ano = $this->getRequest()->ano;
  65 +
  66 + $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId);
  67 +
  68 + if ($isProfessor) {
  69 + $componentesCurriculares = Portabilis_Business_Professor::componentesCurricularesAlocado(
  70 + $turmaId, $ano, $userId
  71 + );
  72 + }
  73 +
  74 + else {
  75 + $sql = "select cc.id, cc.nome
  76 + from pmieducar.turma, modules.componente_curricular_turma as cct, modules.componente_curricular as cc,
  77 + pmieducar.escola_ano_letivo as al where turma.cod_turma = $1 and cct.turma_id = turma.cod_turma and
  78 + cct.escola_id = turma.ref_ref_cod_escola and cct.componente_curricular_id = cc.id and al.ano = $2
  79 + and cct.escola_id = al.ref_cod_escola";
  80 +
  81 + $componentesCurriculares = $this->fetchPreparedQuery($sql, array($turmaId, $ano));
  82 +
  83 + if (count($ComponentesCurriculares) < 1) {
  84 + $sql = "select cc.id, cc.nome from
  85 + pmieducar.turma as t, pmieducar.escola_serie_disciplina as esd, modules.componente_curricular
  86 + as cc, pmieducar.escola_ano_letivo as al where t.cod_turma = $1 and esd.ref_ref_cod_escola =
  87 + t.ref_ref_cod_escola and esd.ref_ref_cod_serie = t.ref_ref_cod_serie and esd.ref_cod_disciplina =
  88 + cc.id and al.ano = $2 and esd.ref_ref_cod_escola = al.ref_cod_escola and t.ativo = 1 and
  89 + esd.ativo = 1 and al.ativo = 1";
  90 +
  91 + $componentesCurriculares = $this->fetchPreparedQuery($sql, array($turmaId, $ano));
  92 + }
  93 + }
  94 +
  95 + $options = array();
  96 + foreach ($componentesCurriculares as $componenteCurricular)
  97 + $options['__' . $componenteCurricular['id']] = $this->toUtf8($componenteCurricular['nome']);
  98 +
  99 + return array('options' => $options);
  100 + }
  101 + }
  102 +
  103 + public function Gerar() {
  104 + if ($this->isRequestFor('get', 'componentesCurriculares'))
  105 + $this->appendResponse($this->getComponentesCurriculares());
  106 + else
  107 + $this->notImplementedOperationError();
  108 + }
  109 +}
... ...
ieducar/modules/DynamicInput/Views/CursoController.php 0 → 100644
... ... @@ -0,0 +1,90 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +require_once 'Portabilis/Business/Professor.php';
  37 +
  38 +/**
  39 + * CursoController class.
  40 + *
  41 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  42 + * @category i-Educar
  43 + * @license @@license@@
  44 + * @package Avaliacao
  45 + * @subpackage Modules
  46 + * @since Classe disponível desde a versão 1.1.0
  47 + * @version @@package_version@@
  48 + */
  49 +class CursoController extends ApiCoreController
  50 +{
  51 +
  52 + protected function canGetCursos() {
  53 + return $this->validatesId('instituicao') &&
  54 + $this->validatesId('escola');
  55 + }
  56 +
  57 + protected function getCursos() {
  58 + if ($this->canGetCursos()) {
  59 + $userId = $this->getSession()->id_pessoa;
  60 + $instituicaoId = $this->getRequest()->instituicao_id;
  61 + $escolaId = $this->getRequest()->escola_id;
  62 +
  63 + $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId);
  64 +
  65 + if ($isProfessor)
  66 + $cursos = Portabilis_Business_Professor::cursosAlocado($instituicaoId, $escolaId, $userId);
  67 +
  68 + else {
  69 + $sql = "select c.cod_curso as id, c.nm_curso as nome FROM pmieducar.curso c,
  70 + pmieducar.escola_curso ec WHERE ec.ref_cod_escola = $1 AND ec.ref_cod_curso =
  71 + c.cod_curso AND ec.ativo = 1 AND c.ativo = 1 ORDER BY c.nm_curso ASC";
  72 +
  73 + $cursos = $this->fetchPreparedQuery($sql, $escolaId);
  74 + }
  75 +
  76 + $options = array();
  77 + foreach ($cursos as $curso)
  78 + $options['__' . $curso['id']] = $this->toUtf8($curso['nome']);
  79 +
  80 + return array('options' => $options);
  81 + }
  82 + }
  83 +
  84 + public function Gerar() {
  85 + if ($this->isRequestFor('get', 'cursos'))
  86 + $this->appendResponse($this->getCursos());
  87 + else
  88 + $this->notImplementedOperationError();
  89 + }
  90 +}
0 91 \ No newline at end of file
... ...
ieducar/modules/DynamicInput/Views/EtapaController.php 0 → 100644
... ... @@ -0,0 +1,99 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +#require_once 'intranet/include/pmieducar/clsPmieducarEtapa.inc.php';
  37 +
  38 +/**
  39 + * EtapaController class.
  40 + *
  41 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  42 + * @category i-Educar
  43 + * @license @@license@@
  44 + * @package Avaliacao
  45 + * @subpackage Modules
  46 + * @since Classe disponível desde a versão 1.1.0
  47 + * @version @@package_version@@
  48 + */
  49 +class EtapaController extends ApiCoreController
  50 +{
  51 +
  52 + protected function canGetEtapas() {
  53 + return $this->validatesId('escola') &&
  54 + $this->validatesId('curso') &&
  55 + $this->validatesId('turma') &&
  56 + $this->validatesPresenceOf('ano');
  57 + }
  58 +
  59 + protected function getEtapas() {
  60 + if ($this->canGetEtapas()) {
  61 + $cursoId = $this->getRequest()->curso_id;
  62 +
  63 + $sql = "select padrao_ano_escolar from pmieducar.curso where cod_curso = $1 and ativo = 1";
  64 + $padraoAnoLetivo = $this->fetchPreparedQuery($sql, array($cursoId), true, 'first-field');
  65 +
  66 + if ($padraoAnoLetivo == 1) {
  67 + $escolaId = $this->getRequest()->escola_id;
  68 + $ano = $this->getRequest()->ano;
  69 +
  70 + $sql = "select padrao.sequencial as etapa, modulo.nm_tipo as nome from pmieducar.ano_letivo_modulo
  71 + as padrao, pmieducar.modulo where padrao.ref_ano = $1 and padrao.ref_ref_cod_escola = $2
  72 + and padrao.ref_cod_modulo = modulo.cod_modulo and modulo.ativo = 1 order by padrao.sequencial";
  73 +
  74 + $etapas = $this->fetchPreparedQuery($sql, array($ano, $escolaId));
  75 + }
  76 +
  77 + else {
  78 + $sql = "select turma.sequencial as etapa, modulo.nm_tipo as nome from pmieducar.turma_modulo as turma,
  79 + pmieducar.modulo where turma.ref_cod_turma = $1 and turma.ref_cod_modulo = modulo.cod_modulo
  80 + and modulo.ativo = 1 order by turma.sequencial";
  81 +
  82 + $etapas = $this->fetchPreparedQuery($sql, $this->getRequest()->turma_id);
  83 + }
  84 +
  85 + $options = array();
  86 + foreach ($etapas as $etapa)
  87 + $options['__' . $etapa['etapa']] = $etapa['etapa'] . 'º ' . $this->toUtf8($etapa['nome']);
  88 +
  89 + return array('options' => $options);
  90 + }
  91 + }
  92 +
  93 + public function Gerar() {
  94 + if ($this->isRequestFor('get', 'etapas'))
  95 + $this->appendResponse($this->getEtapas());
  96 + else
  97 + $this->notImplementedOperationError();
  98 + }
  99 +}
... ...
ieducar/modules/DynamicInput/Views/MatriculaController.php 0 → 100644
... ... @@ -0,0 +1,109 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +require_once 'intranet/include/pmieducar/clsPmieducarMatricula.inc.php';
  37 +
  38 +/**
  39 + * MatriculaController class.
  40 + *
  41 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  42 + * @category i-Educar
  43 + * @license @@license@@
  44 + * @package Avaliacao
  45 + * @subpackage Modules
  46 + * @since Classe disponível desde a versão 1.1.0
  47 + * @version @@package_version@@
  48 + */
  49 +class MatriculaController extends ApiCoreController
  50 +{
  51 +
  52 + protected function canGetMatriculas() {
  53 + return $this->validatesId('turma') &&
  54 + $this->validatesPresenceOf('ano');
  55 + }
  56 +
  57 + protected function getMatriculas() {
  58 + if ($this->canGetMatriculas()) {
  59 + $matriculas = new clsPmieducarMatricula();
  60 + $matriculas->setOrderby('nome ASC, cod_matricula');
  61 + $matriculas = $matriculas->lista(NULL,
  62 + NULL,
  63 + $this->getRequest()->escola_id,
  64 + $this->getRequest()->serie_id,
  65 + NULL,
  66 + NULL,
  67 + $this->getRequest()->aluno_id,
  68 + NULL,
  69 + NULL,
  70 + NULL,
  71 + NULL,
  72 + NULL,
  73 + $ativo = 1,
  74 + $this->getRequest()->ano,
  75 + NULL,
  76 + $this->getRequest()->instituicao_id,
  77 + NULL,
  78 + NULL,
  79 + NULL,
  80 + NULL,
  81 + NULL,
  82 + NULL,
  83 + NULL,
  84 + NULL,
  85 + $this->getRequest()->curso_id,
  86 + NULL,
  87 + $this->getRequest()->matricula_id,
  88 + NULL,
  89 + NULL,
  90 + NULL,
  91 + NULL,
  92 + $this->getRequest()->turma_id);
  93 +
  94 + $options = array();
  95 +
  96 + foreach ($matriculas as $matricula)
  97 + $options['__' . $matricula['cod_matricula']] = $this->toUtf8($matricula['nome']);
  98 +
  99 + return array('options' => $options);
  100 + }
  101 + }
  102 +
  103 + public function Gerar() {
  104 + if ($this->isRequestFor('get', 'matriculas'))
  105 + $this->appendResponse($this->getMatriculas());
  106 + else
  107 + $this->notImplementedOperationError();
  108 + }
  109 +}
... ...
ieducar/modules/DynamicInput/Views/TipoExemplarController.php 0 → 100644
... ... @@ -0,0 +1,84 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +require_once 'Biblioteca/Model/TipoExemplarDataMapper.php';
  37 +
  38 +/**
  39 + * TipoExemplarController class.
  40 + *
  41 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  42 + * @category i-Educar
  43 + * @license @@license@@
  44 + * @package Avaliacao
  45 + * @subpackage Modules
  46 + * @since Classe disponível desde a versão 1.1.0
  47 + * @version @@package_version@@
  48 + */
  49 +class TipoExemplarController extends ApiCoreController
  50 +{
  51 + protected $_dataMapper = 'Biblioteca_Model_TipoExemplarDataMapper';
  52 +
  53 + protected function canGetTiposExemplar() {
  54 + return $this->validatesId('biblioteca');
  55 + }
  56 +
  57 + protected function getTiposExemplar() {
  58 + if ($this->canGetTiposExemplar()) {
  59 + $columns = array('cod_exemplar_tipo', 'nm_tipo');
  60 +
  61 + $where = array('ref_cod_biblioteca' => $this->getRequest()->biblioteca_id,
  62 + 'ativo' => '1');
  63 +
  64 + $records = $this->getDataMapper()->findAll($columns,
  65 + $where,
  66 + $orderBy = array('nm_tipo' => 'ASC'),
  67 + $addColumnIdIfNotSet = false);
  68 +
  69 + $options = array();
  70 +
  71 + foreach ($records as $record)
  72 + $options[$record->cod_exemplar_tipo] = $record->nm_tipo;
  73 +
  74 + return array('options' => $options);
  75 + }
  76 + }
  77 +
  78 + public function Gerar() {
  79 + if ($this->isRequestFor('get', 'tipos_exemplar'))
  80 + $this->appendResponse($this->getTiposExemplar());
  81 + else
  82 + $this->notImplementedOperationError();
  83 + }
  84 +}
... ...
ieducar/modules/DynamicInput/Views/TurmaController.php 0 → 100644
... ... @@ -0,0 +1,92 @@
  1 +<?php
  2 +
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
  5 +
  6 +/**
  7 + * i-Educar - Sistema de gestão escolar
  8 + *
  9 + * Copyright (C) 2006 Prefeitura Municipal de Itajaí
  10 + * <ctima@itajai.sc.gov.br>
  11 + *
  12 + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
  13 + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
  14 + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
  15 + * qualquer versão posterior.
  16 + *
  17 + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
  18 + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
  19 + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
  20 + * do GNU para mais detalhes.
  21 + *
  22 + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
  23 + * com este programa; se não, escreva para a Free Software Foundation, Inc., no
  24 + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  25 + *
  26 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  27 + * @category i-Educar
  28 + * @license @@license@@
  29 + * @package Avaliacao
  30 + * @subpackage Modules
  31 + * @since Arquivo disponível desde a versão ?
  32 + * @version $Id$
  33 + */
  34 +
  35 +require_once 'lib/Portabilis/Controller/ApiCoreController.php';
  36 +require_once 'Portabilis/Business/Professor.php';
  37 +
  38 +/**
  39 + * CursoController class.
  40 + *
  41 + * @author Lucas D'Avila <lucasdavila@portabilis.com.br>
  42 + * @category i-Educar
  43 + * @license @@license@@
  44 + * @package Avaliacao
  45 + * @subpackage Modules
  46 + * @since Classe disponível desde a versão 1.1.0
  47 + * @version @@package_version@@
  48 + */
  49 +class TurmaController extends ApiCoreController
  50 +{
  51 +
  52 + protected function canGetTurmas() {
  53 + return $this->validatesId('instituicao') &&
  54 + $this->validatesId('escola') &&
  55 + $this->validatesId('serie');
  56 + }
  57 +
  58 + protected function getTurmas() {
  59 + if ($this->canGetTurmas()) {
  60 + $userId = $this->getSession()->id_pessoa;
  61 + $instituicaoId = $this->getRequest()->instituicao_id;
  62 + $escolaId = $this->getRequest()->escola_id;
  63 + $serieId = $this->getRequest()->serie_id;
  64 +
  65 + $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId);
  66 +
  67 + if ($isProfessor)
  68 + $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId);
  69 +
  70 + else {
  71 + $sql = "select cod_turma as id, nm_turma as nome from pmieducar.turma where ref_ref_cod_escola = $1
  72 + and (ref_ref_cod_serie = $2 or ref_ref_cod_serie_mult = $2) and ativo = 1 and
  73 + visivel != 'f' order by nm_turma asc";
  74 +
  75 + $turmas = $this->fetchPreparedQuery($sql, array($escolaId, $serieId));
  76 + }
  77 +
  78 + $options = array();
  79 + foreach ($turmas as $turma)
  80 + $options['__' . $turma['id']] = $this->toUtf8($turma['nome']);
  81 +
  82 + return array('options' => $options);
  83 + }
  84 + }
  85 +
  86 + public function Gerar() {
  87 + if ($this->isRequestFor('get', 'turmas'))
  88 + $this->appendResponse($this->getTurmas());
  89 + else
  90 + $this->notImplementedOperationError();
  91 + }
  92 +}
0 93 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Images/loading.gif 0 → 100644

2.58 KB

ieducar/modules/Portabilis/Assets/Javascripts/ClientApi.js 0 → 100644
... ... @@ -0,0 +1,117 @@
  1 +var resourceUrlBuilder = {
  2 + buildUrl : function(urlBase, vars){
  3 +
  4 + _vars = '';
  5 + for(varName in vars){
  6 + _vars += '&'+varName+'='+vars[varName];
  7 + }
  8 + return urlBase + '?' + _vars;
  9 + }
  10 +};
  11 +
  12 +var getResourceUrlBuilder = {
  13 + buildUrl : function(urlBase, resourceName, additionalVars){
  14 + var vars = {
  15 + oper : 'get'
  16 + };
  17 +
  18 + if (resourceName)
  19 + vars.resource = resourceName;
  20 +
  21 + if (additionalVars)
  22 + vars = $j.extend(vars, additionalVars);
  23 +
  24 + return resourceUrlBuilder.buildUrl(urlBase, vars);
  25 + }
  26 +};
  27 +
  28 +var postResourceUrlBuilder = {
  29 + buildUrl : function(urlBase, resourceName, additionalVars){
  30 +
  31 + var vars = {
  32 + oper : 'post'
  33 + };
  34 +
  35 + if (resourceName)
  36 + vars.resource = resourceName;
  37 +
  38 + if (additionalVars)
  39 + vars = $j.extend(vars, additionalVars);
  40 +
  41 + return resourceUrlBuilder.buildUrl(urlBase, vars);
  42 + }
  43 +};
  44 +
  45 +var putResourceUrlBuilder = {
  46 + buildUrl : function(urlBase, resourceName, additionalVars){
  47 +
  48 + var vars = {
  49 + oper : 'put'
  50 + };
  51 +
  52 + if (resourceName)
  53 + vars.resource = resourceName;
  54 +
  55 + if (additionalVars)
  56 + vars = $j.extend(vars, additionalVars);
  57 +
  58 + return resourceUrlBuilder.buildUrl(urlBase, vars);
  59 + }
  60 +};
  61 +
  62 +var deleteResourceUrlBuilder = {
  63 + buildUrl : function(urlBase, resourceName, additionalVars){
  64 +
  65 + var vars = {
  66 + oper : 'delete'
  67 + };
  68 +
  69 + if (resourceName)
  70 + vars.resource = resourceName;
  71 +
  72 + if (additionalVars)
  73 + vars = $j.extend(vars, additionalVars);
  74 +
  75 + return resourceUrlBuilder.buildUrl(urlBase, vars);
  76 + }
  77 +};
  78 +
  79 +var handleErrorOnGetResource = function(response){
  80 + alert('Erro ao obter recurso, detalhes:' + response.responseText);
  81 + safeLog(response);
  82 +};
  83 +
  84 +var handleErrorOnPostResource = function(response){
  85 + handleMessages([{type : 'error', msg : 'Erro ao alterar recurso, detalhes:' + response.responseText}], '');
  86 + safeLog(response);
  87 +};
  88 +
  89 +var handleErrorOnPutResource = function(response){
  90 + handleMessages([{type : 'error', msg : 'Erro ao alterar recurso, detalhes:' + response.responseText}], '');
  91 + safeLog(response);
  92 +};
  93 +
  94 +function handleErrorOnDeleteResource(response){
  95 + handleMessages([{type : 'error', msg : 'Erro ao remover recurso, detalhes:' + response.responseText}], '');
  96 + safeLog(response);
  97 +}
  98 +
  99 +var getResource = function(options, errorCallback) {
  100 + $j.ajax(options).error(errorCallback || handleErrorOnGetResource);
  101 +};
  102 +
  103 +var getResources = function(options, errorCallback) {
  104 + getResource(options, errorCallback);
  105 +};
  106 +
  107 +var postResource = function(options, errorCallback){
  108 + $j.ajax(options).error(errorCallback || handleErrorOnPostResource);
  109 +};
  110 +
  111 +var putResource = function(options, errorCallback){
  112 + $j.ajax(options).error(errorCallback || handleErrorOnPutResource);
  113 +};
  114 +
  115 +function deleteResource(options, errorCallback){
  116 + $j.ajax(options).error(errorCallback || handleErrorOnDeleteResource);
  117 +}
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearch.js 0 → 100644
... ... @@ -0,0 +1,60 @@
  1 +// multiple search input
  2 +
  3 +var defaultChosenOptions = {
  4 + no_results_text: "Sem resultados"
  5 +};
  6 +
  7 +var defaultMultipleSearchOptions = {
  8 + // options that cannot be overwritten
  9 +
  10 + get : function(optionName) { return optionsUtils.get(this, optionName) },
  11 + mergeWith : function(options) {
  12 + options = optionsUtils.merge(this, options);
  13 + options.chosenOptions = optionsUtils.merge(defaultChosenOptions, options.chosenOptions);
  14 +
  15 + return options;
  16 + },
  17 +
  18 + // options that must be overwritten
  19 + objectName : undefined,
  20 + attrName : undefined,
  21 + searchPath : undefined,
  22 +
  23 + // options that can be overwritten
  24 + placeholder : safeUtf8Decode('Selecione as opções')
  25 +};
  26 +
  27 +var multipleSearch = {
  28 + setup : function(options) {
  29 + options = defaultMultipleSearchOptions.mergeWith(options);
  30 + options.chosenOptions.url = options.get('searchPath');
  31 +
  32 + var attrName = options.get('attrName');
  33 + if (attrName) { attrName = '_' + attrName; }
  34 +
  35 + var $input = $j(buildId(options.get('objectName') + attrName));
  36 +
  37 + // fixups for chosen
  38 + $input.attr('multiple', '');
  39 + $input.attr('data-placeholder', options.get('placeholder'));
  40 +
  41 + // jquery scope
  42 + $input.chosen(options.get('chosenOptions'), multipleSearch.handleSearch);
  43 +
  44 + // fixup to API receive all ids
  45 + $j("#deficiencias").attr('name', $j("#deficiencias").attr('name') + '[]');
  46 + }
  47 +};
  48 +
  49 +var multipleSearchHelper = {
  50 + setup : function(objectName, attrName, searchPath, searchResourceOptions) {
  51 + var defaultOptions = {
  52 + searchPath : searchPath,
  53 + objectName : objectName,
  54 + attrName : attrName
  55 + };
  56 +
  57 + var options = optionsUtils.merge(defaultOptions, searchResourceOptions);
  58 + multipleSearch.setup(options);
  59 + }
  60 +};
0 61 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearchAjax.js 0 → 100644
... ... @@ -0,0 +1,71 @@
  1 +// multiple search ajax input
  2 +
  3 +var defaultAjaxChosenOptions = {
  4 + minTermLength : 1,
  5 + type: 'GET',
  6 + dataType: 'json',
  7 + url: '',
  8 + jsonTermKey: 'query'
  9 +};
  10 +
  11 +
  12 +var defaultMultipleSearchAjaxOptions = {
  13 + // options that cannot be overwritten
  14 +
  15 + get : function(optionName) { return optionsUtils.get(this, optionName) },
  16 + mergeWith : function(options) {
  17 + options = optionsUtils.merge(this, options);
  18 + options.ajaxChosenOptions = optionsUtils.merge(defaultAjaxChosenOptions, options.ajaxChosenOptions);
  19 +
  20 + return options;
  21 + },
  22 +
  23 + // options that must be overwritten
  24 + objectName : undefined,
  25 + attrName : undefined,
  26 + searchPath : undefined
  27 +};
  28 +
  29 +
  30 +var multipleSearchAjax = {
  31 + handleSearch : function(dataResponse) {
  32 + var results = [];
  33 +
  34 + $j.each(dataResponse.result, function (value, label) {
  35 + results.push({ value: value, text: label });
  36 + });
  37 +
  38 + return results;
  39 + },
  40 +
  41 + setup : function(options) {
  42 + options = defaultMultipleSearchAjaxOptions.mergeWith(options);
  43 + options.ajaxChosenOptions.url = options.get('searchPath');
  44 +
  45 + var attrName = options.get('attrName');
  46 + if (attrName) { attrName = '_' + attrName; }
  47 +
  48 + var $input = $j(buildId(options.get('objectName') + attrName));
  49 +
  50 + // fixups for chosen
  51 + //$input.css('width', '430px');
  52 + $input.attr('multiple', '');
  53 +
  54 + $input.ajaxChosen(options.get('ajaxChosenOptions'), multipleSearchAjax.handleSearch);
  55 + }
  56 +};
  57 +
  58 +var multipleSearchAjaxHelper = {
  59 + setup : function(objectName, attrName, searchPath, searchResourceOptions) {
  60 + var defaultOptions = {
  61 + searchPath : searchPath,
  62 + objectName : objectName,
  63 + attrName : attrName
  64 + };
  65 +
  66 + var options = optionsUtils.merge(defaultOptions, searchResourceOptions);
  67 + multipleSearchAjax.setup(options);
  68 + }
  69 +};
  70 +
  71 +// # TODO implementar 'load' options
0 72 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/Resource/SimpleSearchAluno.js 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +var simpleSearchAlunoOptions = {
  2 +
  3 + params : {
  4 + escola_id : function() {
  5 + return $j('#ref_cod_escola').val()
  6 + },
  7 +
  8 + },
  9 +
  10 + canSearch : function() {
  11 +
  12 + if (! $j('#ref_cod_escola').val()) {
  13 + alert('Selecione uma escola.');
  14 + return false;
  15 + }
  16 +
  17 + return true;
  18 + }
  19 +};
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/Resource/SimpleSearchMatricula.js 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +var simpleSearchMatriculaOptions = {
  2 +
  3 + params : {
  4 + escola_id : function() {
  5 + return $j('#ref_cod_escola').val()
  6 + },
  7 +
  8 + ano : function() {
  9 + return $j('#ano').val()
  10 + }
  11 + },
  12 +
  13 + canSearch : function() {
  14 +
  15 + if (! $j('#ano').val()) {
  16 + alert('Informe o ano.');
  17 + return false;
  18 + }
  19 +
  20 + if (! $j('#ref_cod_escola').val()) {
  21 + alert('Selecione uma escola.');
  22 + return false;
  23 + }
  24 +
  25 + return true;
  26 + }
  27 +};
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/SimpleSearch.js 0 → 100644
... ... @@ -0,0 +1,151 @@
  1 +// simple search input
  2 +
  3 +var defaultJQueryAutocompleteOptions = {
  4 + minLength : 1,
  5 + autoFocus : true,
  6 + source : function(request, response) { return simpleSearch.search(this.element, request, response) },
  7 + select : function(event, ui) { return simpleSearch.handleSelect(event, ui) }
  8 +
  9 + // options that can be overwritten
  10 + // change : function (event, ui) {},
  11 + // close : function (event, ui) {},
  12 +};
  13 +
  14 +
  15 +var defaultSimpleSearchOptions = {
  16 + // options that cannot be overwritten
  17 +
  18 + get : function(optionName) { return optionsUtils.get(this, optionName) },
  19 + mergeWith : function(options) {
  20 + options = optionsUtils.merge(this, options);
  21 + options.autocompleteOptions = optionsUtils.merge(defaultJQueryAutocompleteOptions, options.autocompleteOptions);
  22 +
  23 + return options;
  24 + },
  25 +
  26 + // options that must be overwritten
  27 + objectName : undefined,
  28 + attrName : undefined,
  29 + searchPath : undefined,
  30 +
  31 + // options that can be overwritten
  32 + placeholder : 'Informe um valor',
  33 +
  34 + // additional search params to send to api
  35 + params : {},
  36 +
  37 + // #TODO implementar validacao dependencia
  38 + // elements that presence is required to do the search
  39 + // requiresPresenceOf : [ /* $j('#someElement') */ ],
  40 +
  41 + canSearch : function() { return true; }
  42 +};
  43 +
  44 +
  45 +var simpleSearch = {
  46 +
  47 + /* API returns result as {value : label, value2, label2}
  48 + but jquery autocomplete, expects [{value : label}, {value : label}]
  49 + */
  50 + fixResult : function(result) {
  51 + var fixed = [];
  52 +
  53 + $j.each(result, function(value, label) {
  54 + fixed.push({ value : value, label : label})
  55 + });
  56 +
  57 + return fixed;
  58 + },
  59 +
  60 + search : function(element, request, response) {
  61 + var $element = $j(element);
  62 +
  63 + if ($element.data('simple-search-options').canSearch()) {
  64 + var hiddenInputId = $element.data('hidden-input-id');
  65 + var searchPath = $element.data('simple-search-options').searchPath;
  66 + var params = { query : request.term };
  67 +
  68 + // inject additional params
  69 + $j.each($element.data('simple-search-options').params, function(name, value) {
  70 + params[name] = typeof value == 'function' ? value() : value;
  71 + });
  72 +
  73 + // clear the hidden id, because it will be set when the user select another result.
  74 + $j(hiddenInputId).val('');
  75 +
  76 + $j.get(searchPath, params, function(dataResponse) {
  77 + simpleSearch.handleSearch(dataResponse, response);
  78 + });
  79 + }
  80 + },
  81 +
  82 + handleSearch : function(dataResponse, response) {
  83 + handleMessages(dataResponse['msgs']);
  84 +
  85 + if (dataResponse.result) {
  86 + response(simpleSearch.fixResult(dataResponse.result));
  87 + }
  88 + },
  89 +
  90 + handleSelect : function(event, ui) {
  91 + var $element = $j(event.target);
  92 + var hiddenInputId = $element.data('hidden-input-id');
  93 +
  94 + $element.val(ui.item.label);
  95 + $j(hiddenInputId).val(ui.item.value);
  96 +
  97 + return false;
  98 + },
  99 +
  100 + /* limpa o texto dos inputs simple search, cujo hidden id é obrigatorio porem está vazio,
  101 + para que ao tentar gravar o formulário o campo de texto obrigatório (e vazio) seja validado
  102 + isto ocorre quando é informado qualquer valor, sem selecionar um resultado. */
  103 + fixupRequiredFieldsValidation : function() {
  104 + $j('input[type=hidden].simple-search-id.obrigatorio').each(function(index, element){
  105 + var $element = $j(element);
  106 +
  107 + if (! $element.val())
  108 + $j(buildId($element.data('for'))).val('');
  109 + });
  110 + },
  111 +
  112 + setup : function(options) {
  113 + options = defaultSimpleSearchOptions.mergeWith(options);
  114 +
  115 + var attrName = options.get('attrName');
  116 + if (attrName) { attrName = '_' + attrName; }
  117 +
  118 + var inputId = buildId(options.get('objectName') + attrName);
  119 + var hiddenInputId = buildId(options.get('objectName') + '_id');
  120 +
  121 + var $input = $j(inputId);
  122 + var $hiddenInput = $j(hiddenInputId);
  123 +
  124 + $input.data('simple-search-options', options);
  125 + $input.data('hidden-input-id', $hiddenInput);
  126 +
  127 + $input.attr('placeholder', options.get('placeholder'));
  128 +
  129 + $hiddenInput.addClass('simple-search-id');
  130 + $hiddenInput.attr('data-for', $input.attr('id'));
  131 +
  132 + if ($input.hasClass('obrigatorio'))
  133 + $hiddenInput.addClass('obrigatorio required');
  134 +
  135 + $input.autocomplete(options.get('autocompleteOptions'));
  136 + }
  137 +};
  138 +
  139 +
  140 +var simpleSearchHelper = {
  141 + setup : function(objectName, attrName, searchPath, searchResourceOptions) {
  142 + var defaultOptions = {
  143 + searchPath : searchPath,
  144 + objectName : objectName,
  145 + attrName : attrName
  146 + };
  147 +
  148 + var options = optionsUtils.merge(defaultOptions, searchResourceOptions);
  149 + simpleSearch.setup(options);
  150 + }
  151 +};
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Process.js 0 → 100644
... ... @@ -0,0 +1,262 @@
  1 +// metodos e variaveis acessiveis por outros modulos
  2 +
  3 +
  4 +// #TODO migrar para opcoes todas variaveis / funcoes subescritas nos scripts de cada controlador/action.
  5 +var processOptions = {
  6 +
  7 + // options that can be overwritten in child
  8 +
  9 + validatesResourcesAfterSearch : true,
  10 +};
  11 +
  12 +function removeImgLoadingFor($targetElement) {
  13 + $targetElement.siblings('img').remove();
  14 +}
  15 +
  16 +
  17 +function appendImgLoadingTo($targetElement) {
  18 + if ($targetElement.siblings('img').length < 1);
  19 + $j('<img alt="loading..." src="/modules/Portabilis/Assets/Images/loading.gif" />').appendTo($targetElement.parent());
  20 +}
  21 +
  22 +
  23 +function beforeChangeResource($resourceElement) {
  24 + if ($resourceElement.is(':checkbox'))
  25 + $j('.disable-on-apply-changes').attr('disabled', 'disabled');
  26 +
  27 + appendImgLoadingTo($resourceElement);
  28 +}
  29 +
  30 +function afterChangeResource($resourceElement) {
  31 + if ($resourceElement.is(':checkbox'))
  32 + $resourceElement.attr('checked', false);
  33 +
  34 + removeImgLoadingFor($resourceElement);
  35 + $j('.disable-on-apply-changes').removeAttr('disabled');
  36 +
  37 + // change value of execute action button
  38 + $j('input.execute-action').val(POST_LABEL);
  39 + $j('input.delete').val(DELETE_LABEL);
  40 +}
  41 +
  42 +function getFirstCheckboxChecked($targetElement) {
  43 + var $firstChecked = $j('input.'+RESOURCE_NAME+':checked:first');
  44 +
  45 + if ($firstChecked.length < 1) {
  46 + handleMessages([{type : 'error', msg : 'Selecione algum '+RESOURCE_NAME+'.'}], $targetElement, true);
  47 + $firstChecked = undefined;
  48 + }
  49 +
  50 + return $firstChecked;
  51 +}
  52 +
  53 +function clearSearchResult() {
  54 + $navActions.html('');
  55 + $tableSearchDetails.children().remove();
  56 + $resultTable.children().fadeOut('fast').remove();
  57 +
  58 + $j('.disable-on-search').attr('disabled', 'disabled');
  59 + $j('.hide-on-search').hide();
  60 + $j('.disable-on-apply-changes').removeAttr('disabled');
  61 +}
  62 +
  63 +
  64 +function showSearchForm(event) {
  65 + clearSearchResult()
  66 +
  67 + $formFilter.fadeIn('fast', function() {
  68 + $(this).show()
  69 + });
  70 +
  71 + //$actionButton.val(POST_LABEL);
  72 +}
  73 +
  74 +// called before search resources
  75 +function canSearch(){
  76 + return true;
  77 +}
  78 +
  79 +
  80 +function showNextSelectionButton() {
  81 +}
  82 +
  83 +
  84 +// vars
  85 +
  86 +var $formFilter = $j('#formcadastro');
  87 +var $submitButton = $j('#botao_busca');
  88 +
  89 +var $tableSearchDetails = $j('<table />').attr('id', 'search-details')
  90 + .addClass('styled')
  91 + .addClass('horizontal-expand')
  92 + .addClass('center')
  93 + .hide()
  94 + .prependTo($formFilter.parent());
  95 +
  96 +var $navActions = $j('<p />').attr('id', 'nav-actions');
  97 +$navActions.insertAfter($tableSearchDetails);
  98 +
  99 +var $resultTable = $j('#form_resultado .tablelistagem').addClass('horizontal-expand');
  100 +
  101 +
  102 +// metodos e variaveis não acessiveis por outros modulos
  103 +
  104 +(function($) {
  105 + $(document).ready(function() {
  106 + // prepare result table
  107 + $resultTable.children().remove();
  108 +
  109 +
  110 + // add action bars
  111 + $('<div />').attr('id', 'first-bar-action')
  112 + .attr('class', 'bar-action hide-on-search')
  113 + .prependTo($resultTable.parent());
  114 +
  115 + $('<div />').attr('id', 'second-bar-action')
  116 + .attr('class', 'bar-action hide-on-search')
  117 + .appendTo($resultTable.parent());
  118 +
  119 + var $barActions = $('.bar-action').hide();
  120 +
  121 + $('<input class="select-all disable-on-apply-changes" type="button" value="Selecionar todos" />').appendTo($barActions);
  122 +
  123 + $('<input class="execute-action disable-on-apply-changes" type="button" />').val(POST_LABEL).appendTo($barActions);
  124 +
  125 + $('<input class="delete disable-on-apply-changes" type="button" />').val(DELETE_LABEL).appendTo($barActions);
  126 +
  127 + var $selectAllButton = $barActions.find('input.select-all');
  128 + var $actionButton = $barActions.find('input.execute-action');
  129 + var $deleteButton = $barActions.find('input.delete');
  130 +
  131 + // add resource options table
  132 + var $resourceOptionsTable = $('#resource-options');
  133 + $resourceOptionsTable.find('tr:even').addClass('even');
  134 + $resourceOptionsTable.hide().prependTo($formFilter.parent());
  135 +
  136 + // add orientations about search
  137 + $('<p />').html(SEARCH_ORIENTATION)
  138 + .addClass('center')
  139 + .attr('id', 'orientation-search')
  140 + .appendTo($resultTable.parent());
  141 +
  142 + // before search changes
  143 + $('.disable-on-search').attr('disabled', 'disabled');
  144 + $('.hide-on-search').hide();
  145 +
  146 +
  147 + // functions, callbacks
  148 +
  149 + function showNewSearchButton() {
  150 + $navActions.html(
  151 + $("<a href='#'><strong>Nova consulta</strong></a>")
  152 + .bind('click', showSearchForm)
  153 + .attr('style', 'text-decoration: underline')
  154 + );
  155 + }
  156 +
  157 + function showNewSearchActions() {
  158 + showNewSearchButton();
  159 + showNextSelectionButton();
  160 +
  161 + $('.disable-on-search').removeAttr('disabled');
  162 + $('.hide-on-search').show();
  163 + }
  164 +
  165 + // config search form
  166 + var searchOptions = {
  167 + url : '',
  168 + dataType : 'json',
  169 + success : _handleSearch,
  170 + error : handleSearchError
  171 + };
  172 +
  173 + $formFilter.ajaxForm(searchOptions);
  174 +
  175 +
  176 + // submit button callbacks
  177 + var onClickSearchEvent = function(event) {
  178 + if (validatesPresenseOfValueInRequiredFields() && canSearch()) {
  179 + searchOptions.url = getResourceUrlBuilder.buildUrl(API_URL_BASE, RESOURCES_NAME, {});
  180 +
  181 + if (window.history && window.history.pushState)
  182 + window.history.pushState('', '', getResourceUrlBuilder.buildUrl(PAGE_URL_BASE, RESOURCES_NAME));
  183 +
  184 + $resultTable.children().fadeOut('fast').remove();
  185 +
  186 + $formFilter.submit();
  187 + $formFilter.fadeOut('fast');
  188 + $navActions
  189 + .html('Aguarde, carregando...')
  190 + .attr('style', 'text-align:center;')
  191 + .unbind('click');
  192 + }
  193 + };
  194 +
  195 +
  196 + function _setTableSearchDetails(dataDetails) {
  197 + setTableSearchDetails($tableSearchDetails, dataDetails);
  198 + }
  199 +
  200 +
  201 + function _handleSearch(dataResponse) {
  202 + showNewSearchActions();
  203 +
  204 + try{
  205 + handleMessages(dataResponse.msgs);
  206 + var resources = dataResponse[RESOURCES_NAME];
  207 +
  208 + if(processOptions.validatesResourcesAfterSearch && ! $.isArray(resources)) {
  209 + $('<td />')
  210 + .html('O(a)s '+ RESOURCES_NAME +' n&#227;o poderam ser recuperado(a)s, verifique as mensagens de erro ou tente <a alt="Recarregar página" href="/" style="text-decoration:underline">recarregar</a>.')
  211 + .addClass('center')
  212 + .appendTo($('<tr />').appendTo($resultTable));
  213 + }
  214 + else if (processOptions.validatesResourcesAfterSearch && resources.length < 1) {
  215 + $('<td />')
  216 + .html('Busca de '+ RESOURCES_NAME +' sem resultados.')
  217 + .addClass('center')
  218 + .appendTo($('<tr />').appendTo($resultTable));
  219 + }
  220 + else {
  221 + _setTableSearchDetails(dataResponse['details']);
  222 + handleSearch($resultTable, dataResponse);
  223 + }
  224 + }
  225 + catch(error) {
  226 + showNewSearchActions();
  227 +
  228 + handleMessages([{type : 'error', msg : 'Ocorreu um erro ao exibir o recurso '+ RESOURCES_NAME +', por favor tente novamente, detalhes: ' + error}], '');
  229 +
  230 + safeLog('Error details:');
  231 + safeLog(error);
  232 +
  233 + safeLog('dataResponse details:');
  234 + safeLog(dataResponse);
  235 +
  236 + throw error;
  237 + }
  238 + }
  239 +
  240 +
  241 + function handleSearchError(response) {
  242 + showNewSearchButton();
  243 +
  244 + handleMessages([{type : 'error', msg : 'Ocorreu um erro ao carregar o recurso '+ RESOURCES_NAME +', por favor tente novamente, detalhes:' + response.responseText}], '');
  245 +
  246 + safeLog('response details:');
  247 + safeLog(response);
  248 + }
  249 +
  250 + $submitButton.val('Carregar');
  251 + $submitButton.attr('onclick', '');
  252 +
  253 + // bind events
  254 + $submitButton.click(onClickSearchEvent);
  255 +
  256 + onClickSelectAllEvent ? $selectAllButton.click(onClickSelectAllEvent) : $selectAllButton.hide();
  257 + onClickActionEvent ? $actionButton.click(onClickActionEvent) : $actionButton.hide();
  258 + onClickDeleteEvent ? $deleteButton.click(onClickDeleteEvent) : $deleteButton.hide();
  259 +
  260 + fixupFieldsWidth();
  261 + }); // ready
  262 +})(jQuery);
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js 0 → 100644
... ... @@ -0,0 +1,223 @@
  1 +// metodos e variaveis acessiveis por outros modulos
  2 +
  3 +var $submitButton = $j('#btn_enviar');
  4 +var $deleteButton = $j('.botaolistagem[value=" Excluir "]');
  5 +
  6 +var resource = {
  7 + // options that cannot be overwritten
  8 +
  9 + get : function(optionName) { return optionsUtils.get(this, optionName) },
  10 +
  11 + url : function(id) {
  12 + var url = window.location.href.split("?")[0]
  13 +
  14 + if (id != undefined)
  15 + url += '?id=' + id;
  16 +
  17 + return url;
  18 + },
  19 +
  20 + isNew : function() { return this.id() == undefined },
  21 +
  22 + id : function(){
  23 + var id;
  24 +
  25 + if (window.location.search.indexOf('id=') > -1) {
  26 + id = window.location.search.split('id=');
  27 + id = id[id.length - 1];
  28 + }
  29 +
  30 + return id;
  31 + }
  32 +};
  33 +
  34 +var resourceOptions = {
  35 + // options that cannot be overwritten in child
  36 +
  37 + get : function(optionName) { return optionsUtils.get(this, optionName) },
  38 +
  39 + // options that can be overwritten in child
  40 +
  41 + form : $j('#formcadastro'),
  42 +
  43 + apiUrlBase : function() { return '/module/Api/' + resourceOptions.get('name')() },
  44 +
  45 + name : function() {
  46 + var name = window.location.pathname.split('/');
  47 + name = name[name.length - 1];
  48 +
  49 + return name.toLowerCase();
  50 + },
  51 +
  52 + handlePost : function(dataResponse) {
  53 + },
  54 +
  55 + _handlePost : function(dataResponse) {
  56 + if (dataResponse.id) {
  57 + if (window.history && window.history.pushState)
  58 + window.history.pushState('', '', window.location.href.split("?")[0] + "?id=" + dataResponse.id);
  59 + }
  60 +
  61 + resourceOptions.handlePost(dataResponse);
  62 + },
  63 +
  64 + handlePut : function(dataResponse) {
  65 + },
  66 +
  67 +
  68 + handleGet : function(dataResponse) {
  69 + throw new Error('The function resourceOptions.handleGet must be overwritten!');
  70 + },
  71 +
  72 +
  73 + handleEnable : function(dataResponse) {
  74 + handleMessages(dataResponse.msgs);
  75 + $resourceNotice.slideUp('fast');
  76 + $submitButton.removeAttr('disabled').show();
  77 + $deleteButton.removeAttr('disabled').show();
  78 + },
  79 +
  80 +
  81 + handleDelete : function(dataResponse) {
  82 + handleMessages(dataResponse.msgs);
  83 + // reload resource
  84 + resourceOptions.getResource(resource.id());
  85 + },
  86 +
  87 + getResource : function(id) {
  88 + var additionalVars = {
  89 + id : id
  90 + };
  91 +
  92 + var options = {
  93 + url : getResourceUrlBuilder.buildUrl(resourceOptions.apiUrlBase(), resourceOptions.get('name')(), additionalVars),
  94 + dataType : 'json',
  95 + success : this.handleGet
  96 + };
  97 +
  98 + getResource(options);
  99 + },
  100 +
  101 + deleteResource : function() {
  102 + if (confirm(stringUtils.toUtf8('Confirma remoção do cadastro?'))) {
  103 + var additionalVars = {
  104 + id : resource.id()
  105 + };
  106 +
  107 + var options = {
  108 + url : deleteResourceUrlBuilder.buildUrl(resourceOptions.apiUrlBase(), resourceOptions.get('name')(), additionalVars),
  109 + dataType : 'json',
  110 + success : resourceOptions.handleDelete
  111 + };
  112 +
  113 + deleteResource(options);
  114 + }
  115 + },
  116 +
  117 + enable : function() {
  118 + if (confirm(stringUtils.toUtf8('Confirma reativação do cadastro?'))) {
  119 + var additionalVars = {
  120 + id : resource.id(),
  121 + oper : 'enable'
  122 + };
  123 +
  124 + var options = {
  125 + url : postResourceUrlBuilder.buildUrl(resourceOptions.apiUrlBase(), resourceOptions.get('name')(), additionalVars),
  126 + dataType : 'json',
  127 + success : resourceOptions.handleEnable
  128 + };
  129 +
  130 + postResource(options);
  131 + }
  132 + }
  133 +};
  134 +
  135 +
  136 +// metodos e variaveis não acessiveis por outros modulos
  137 +
  138 +(function($) {
  139 + $(document).ready(function() {
  140 +
  141 + // config resource form
  142 + var submitOptions = {
  143 + url : '',
  144 + dataType : 'json',
  145 + success : handleSuccess,
  146 + error : handleError
  147 + };
  148 +
  149 + resourceOptions.form.ajaxForm(submitOptions);
  150 +
  151 +
  152 + // submit button callbacks
  153 + var submitForm = function(event) {
  154 + if (validationUtils.validatesFields()) {
  155 + var urlBuilder;
  156 + var additionalVars = {};
  157 +
  158 + if (resource.isNew())
  159 + urlBuilder = postResourceUrlBuilder;
  160 + else {
  161 + urlBuilder = putResourceUrlBuilder;
  162 + additionalVars.id = resource.id();
  163 + }
  164 +
  165 + submitOptions.url = urlBuilder.buildUrl(resourceOptions.get('apiUrlBase')(),
  166 + resourceOptions.get('name')(),
  167 + additionalVars);
  168 +
  169 + resourceOptions.form.submit();
  170 + }
  171 + };
  172 +
  173 +
  174 + function handleSuccess(dataResponse) {
  175 + try {
  176 + handleMessages(dataResponse.msgs, 'btn_enviar');
  177 +
  178 + if(! dataResponse.any_error_msg && ! dataResponse[resourceOptions.get('name')()] && ! dataResponse.id)
  179 + throw new Error('A API não retornou o recurso nem seu id.');
  180 +
  181 + if (resource.isNew())
  182 + resourceOptions.get('_handlePost')(dataResponse);
  183 + else
  184 + resourceOptions.get('handlePut')(dataResponse);
  185 + }
  186 + catch(error) {
  187 + handleMessages([{type : 'error', msg : 'Erro ao realizar operação, por favor tente novamente, detalhes: ' + error}], '');
  188 +
  189 + safeLog('Error details:');
  190 + safeLog(error);
  191 +
  192 + safeLog('dataResponse details:');
  193 + safeLog(dataResponse);
  194 +
  195 + throw error;
  196 + }
  197 + }
  198 +
  199 +
  200 + function handleError(response) {
  201 + handleMessages([{type : 'error', msg : 'Erro ao realizar operação, por favor tente novamente, detalhes:' + response.responseText}], '');
  202 +
  203 + safeLog('response details:');
  204 + safeLog(response);
  205 + }
  206 +
  207 + $submitButton.val('Gravar');
  208 + $deleteButton.hide().attr('disabled', 'disabled');
  209 +
  210 + // unbind events
  211 + $submitButton.removeAttr('onclick');
  212 + $deleteButton.removeAttr('onclick');
  213 + resourceOptions.form.removeAttr('onsubmit');
  214 +
  215 + // bind events
  216 + $submitButton.click(submitForm);
  217 + $deleteButton.click(resourceOptions.deleteResource);
  218 +
  219 + if (! resource.isNew())
  220 + resourceOptions.getResource(resource.id());
  221 +
  222 + }); // ready
  223 +})(jQuery);
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Utils.js 0 → 100644
... ... @@ -0,0 +1,291 @@
  1 +
  2 +// jquery utils
  3 +
  4 +function buildId(id) {
  5 + return typeof(id) == 'string' && id.length > 0 && id[0] != '#' ? '#' + id : id;
  6 +}
  7 +
  8 +
  9 +// console utils
  10 +
  11 +function safeLog(value) {
  12 + if(typeof(console) != 'undefined' && typeof(console.log) == 'function')
  13 + console.log(value);
  14 +}
  15 +
  16 +
  17 +// form utils
  18 +
  19 +var formUtils = {
  20 + submit : function(form) {
  21 +
  22 + if (form == undefined)
  23 + form = $j('form:first');
  24 +
  25 + form.removeAttr('onsubmit');
  26 +
  27 + if (validationUtils.validatesFields())
  28 + form.submit();
  29 + }
  30 +};
  31 +
  32 +function fixupFieldsWidth(additionalFields, force){
  33 + if (! $j(document).data('fixed-fields-width') || force) {
  34 + var maxWidth = 0;
  35 + var $fields = $j('form select');
  36 +
  37 + if (additionalFields)
  38 + $j.merge($fields, additionalFields);
  39 +
  40 + //get maxWidh
  41 + $j.each($fields, function(index, field){
  42 + $field = $j(field);
  43 + if ($field.outerWidth() > maxWidth)
  44 + maxWidth = $field.outerWidth();
  45 + });
  46 +
  47 + //set maxWidth
  48 + $j.each($fields, function(index, field){
  49 + $j(field).width(maxWidth);
  50 + });
  51 +
  52 + $j(document).data('fixed-fields-width', true);
  53 + }
  54 + else
  55 + safeLog('fixupFieldsWidth already called, skipping!');
  56 +};
  57 +
  58 +
  59 +// options (hash) utils
  60 +
  61 +var optionsUtils = {
  62 + get : function(options, optionName) {
  63 + var value = options[optionName];
  64 +
  65 + if (typeof value == 'undefined')
  66 + throw new Error("Option '" + optionName + "' not defined in simpleSearchOptions.");
  67 +
  68 + return value;
  69 + },
  70 +
  71 + merge : function(defaultOptions, options) {
  72 + if (typeof options == 'undefined')
  73 + options = {};
  74 +
  75 + return $j.extend({}, defaultOptions, options);
  76 + }
  77 +};
  78 +
  79 +// key-value object (hash) utils
  80 +
  81 +var objectUtils = {
  82 + length : function(hash) {
  83 + return Object.getOwnPropertyNames(hash).length;
  84 + },
  85 +
  86 + join : function(object, glue, separator) {
  87 + if (glue == undefined)
  88 + glue = '=';
  89 +
  90 + if (separator == undefined)
  91 + separator = ' ';
  92 +
  93 + return $j.map(Object.getOwnPropertyNames(object), function(k) { return [k, object[k]].join(glue) }).join(separator)
  94 + }
  95 +};
  96 +
  97 +// window utils
  98 +
  99 +var windowUtils = {
  100 +
  101 + // open a new window, for more information see developer.mozilla.org/en-US/docs/DOM/window.open
  102 + open : function(url, name, options) {
  103 + var defaultOptions = {
  104 + name : 'new_window',
  105 + options : {}
  106 + };
  107 +
  108 + var defaultWindowOptions = {
  109 + top : 0,
  110 + left : 0,
  111 + height : $j(window).height(),
  112 + width : $j(window).width(),
  113 +
  114 + resizable : 'yes',
  115 + scrollbars : 'yes',
  116 +
  117 + menubar : 'no',
  118 + toolbar : 'no',
  119 + location : 'no',
  120 + personalbar : 'no',
  121 + status : 'no'
  122 + };
  123 +
  124 + options = optionsUtils.merge(defaultOptions, options);
  125 + options.options = optionsUtils.merge(defaultWindowOptions, options.options);
  126 +
  127 + window.open(url, options.name, objectUtils.join(options.options)).focus();
  128 + }
  129 +};
  130 +
  131 +// string utils
  132 +
  133 +var stringUtils = {
  134 + toUtf8 : function(s) {
  135 + try {
  136 + s = decodeURIComponent(escape(s));
  137 + }
  138 + catch(e) {
  139 + safeLog('Erro ao decodificar string utf8: ' + s);
  140 + }
  141 +
  142 + return s;
  143 + }
  144 +};
  145 +
  146 +// #TODO migrar restante funcoes string utils para hash stringUtils / migrar referencias a estas.
  147 +
  148 +function safeToUpperCase(value) {
  149 + if (typeof(value) == 'string')
  150 + value = value.toUpperCase();
  151 +
  152 + return value;
  153 +}
  154 +
  155 +
  156 +function safeToLowerCase(value) {
  157 + if (typeof(value) == 'string')
  158 + value = value.toLowerCase();
  159 +
  160 + return value;
  161 +}
  162 +
  163 +
  164 +function safeCapitalize(value) {
  165 + if (typeof(value) == 'string') {
  166 + value = value.toLowerCase();
  167 + var words = value.split(' ');
  168 +
  169 + $j.each(words, function(index, word){
  170 + words[index] = word.substr(0, 1).toUpperCase() + word.substr(1);
  171 + });
  172 +
  173 + value = words.join(' ');
  174 + }
  175 +
  176 + return value;
  177 +}
  178 +
  179 +
  180 +function safeSort(values) {
  181 + try{
  182 + var sortedValues = values.sort(function(a, b) {
  183 + if (typeof(a) == 'string' && typeof(b) == 'string')
  184 + var isGreaterThan = a.toLowerCase() > b.toLowerCase();
  185 + else
  186 + var isGreaterThan = a > b;
  187 +
  188 + return isGreaterThan ? 1 : -1;
  189 + });
  190 + return sortedValues;
  191 + }
  192 + catch(e) {
  193 + safeLog('Erro ao ordenar valores: ' + e);
  194 + safeLog(values);
  195 + return values;
  196 + }
  197 +}
  198 +
  199 +
  200 +function safeUtf8Decode(s) {
  201 + return stringUtils.toUtf8(s);
  202 +}
  203 +
  204 +// feedback messages
  205 +
  206 +// #TODO migrar todas referencias de "handleMessages([{type*" para "messageUtils.<type>"
  207 +
  208 +var messageUtils = {
  209 + error : function(msg, targetId) {
  210 + handleMessages([{type : 'error', msg : safeUtf8Decode(msg)}], targetId);
  211 + },
  212 +
  213 + success : function(msg, targetId) {
  214 + handleMessages([{type : 'success', msg : safeUtf8Decode(msg)}], targetId);
  215 + },
  216 +
  217 + notice : function(msg, targetId) {
  218 + handleMessages([{type : 'notice', msg : safeUtf8Decode(msg)}], targetId);
  219 + }
  220 +};
  221 +
  222 +function handleMessages(messages, targetId, useDelayClassRemoval) {
  223 +
  224 + var $feedbackMessages = $j('#feedback-messages');
  225 + var hasErrorMessages = false;
  226 + var hasSuccessMessages = false;
  227 + var hasNoticeMessages = false;
  228 + var delayClassRemoval = 20000;
  229 +
  230 + var $targetElement = buildId(targetId);
  231 + var $targetElement = $j($targetElement);
  232 +
  233 + for (var i = 0; i < messages.length; i++) {
  234 + if (messages[i].type == 'success')
  235 + var delay = 5000;
  236 + else if (messages[i].type != 'error')
  237 + var delay = 10000;
  238 + else
  239 + var delay = 20000;
  240 +
  241 + $j('<p />').hide()
  242 + .addClass(messages[i].type)
  243 + .html(safeUtf8Decode(messages[i].msg))
  244 + .appendTo($feedbackMessages)
  245 + .fadeIn()
  246 + .delay(delay)
  247 + .fadeOut(function() { $j(this).remove() })
  248 + .data('target_id', targetId);
  249 +
  250 + if (! hasErrorMessages && messages[i].type == 'error')
  251 + hasErrorMessages = true;
  252 + else if(! hasSuccessMessages && messages[i].type == 'success')
  253 + hasSuccessMessages = true;
  254 + else if(! hasNoticeMessages && messages[i].type == 'notice')
  255 + hasNoticeMessages = true;
  256 + }
  257 +
  258 + if($targetElement) {
  259 + if (hasErrorMessages) {
  260 + $targetElement.addClass('error').removeClass('success').removeClass('notice');
  261 + $targetElement.first().focus();
  262 + }
  263 +
  264 + else if (hasSuccessMessages)
  265 + $targetElement.addClass('success').removeClass('error').removeClass('notice');
  266 +
  267 + else if (hasNoticeMessages)
  268 + $targetElement.addClass('notice').removeClass('error').removeClass('sucess');
  269 +
  270 + else
  271 + $targetElement.removeClass('success').removeClass('error').removeClass('notice');
  272 +
  273 + if (useDelayClassRemoval) {
  274 + window.setTimeout(function() {
  275 + $targetElement.removeClass('success').removeClass('error').removeClass('notice');
  276 + }, delayClassRemoval);
  277 + }
  278 + }
  279 +}
  280 +
  281 +
  282 +// when page is ready
  283 +
  284 +(function($) {
  285 + $(document).ready(function() {
  286 +
  287 + // add div for feedback messages
  288 + $j('<div />').attr('id', 'feedback-messages').appendTo($j('form').last().parent());
  289 +
  290 + }); // ready
  291 +})(jQuery);
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Validator.js 0 → 100644
... ... @@ -0,0 +1,102 @@
  1 +
  2 +// #TODO rename this file to Validation.js and move functions validates* to object validationUtils
  3 +
  4 +var validationUtils = {
  5 + validatesDate : function(date) {
  6 + return /(((0[1-9]|[12][0-9])\/(02))|((0[1-9]|[12][0-9]|(30))\/(0[4689]|(11)))|((0[1-9]|[12][0-9]|3[01])\/(0[13578]|(10)|(12))))\/[1-2][0-9]{3}/.test(date);
  7 + },
  8 +
  9 + validatesDateFields : function() {
  10 + var allValid = true;
  11 + var fields = $j("input[id^='data_'][value!=''], input[id^='dt_'][value!='']");
  12 +
  13 + $j.each(fields, function(index, field) {
  14 + allValid = validationUtils.validatesDate(field.value);
  15 + });
  16 +
  17 + if (! allValid)
  18 + messageUtils.error('Informe a data corretamente.', fields.first());
  19 +
  20 + return allValid;
  21 + },
  22 +
  23 + validatesFields : function (){
  24 + return validatesPresenseOfValueInRequiredFields() &&
  25 + validationUtils.validatesDateFields();
  26 + }
  27 +};
  28 +
  29 +function validatesPresenseOfValueInRequiredFields(additionalFields, exceptFields) {
  30 + var $emptyFields = [];
  31 + requiredFields = document.getElementsByClassName('obrigatorio');
  32 +
  33 + if (additionalFields)
  34 + requiredFields = $j.merge(requiredFields, additionalFields);
  35 +
  36 + if (typeof(simpleSearch) != 'undefined' && typeof(simpleSearch.fixupRequiredFieldsValidation) == 'function')
  37 + simpleSearch.fixupRequiredFieldsValidation();
  38 +
  39 + for (var i = 0; i < requiredFields.length; i++) {
  40 + var $requiredField = $j(requiredFields[i]);
  41 +
  42 + if ($requiredField.length > 0 &&
  43 + /*$requiredField.css('display') != 'none' &&*/
  44 + $requiredField.is(':visible') &&
  45 + $requiredField.is(':enabled') &&
  46 + $requiredField.val() == '' &&
  47 + $j.inArray($requiredField[0], exceptFields) < 0) {
  48 +
  49 + $emptyFields.push($requiredField);
  50 +
  51 + if (! $requiredField.hasClass('error'))
  52 + $requiredField.addClass('error');
  53 + }
  54 + else if ($requiredField.length > 0)
  55 + $requiredField.removeClass('error');
  56 + }
  57 +
  58 + if ($emptyFields.length == 0)
  59 + return true;
  60 +
  61 + alert('Preencha os campos obrigat\u00F3rios, antes de continuar.');
  62 + $emptyFields.first().focus();
  63 + return false;
  64 +}
  65 +
  66 +
  67 +function validatesIfValueIsInSet(value, targetId, set) {
  68 + if (objectUtils.length(set) > 0 && set[value] == undefined) {
  69 + var s = [];
  70 +
  71 + $j.each(set, function(index, value) {
  72 + s.push(value);
  73 + });
  74 +
  75 + s = safeSort(s);
  76 + messageUtils.error('Informe um valor que pertença ao conjunto: ' + s.join(', '), targetId);
  77 +
  78 + return false;
  79 + }
  80 +
  81 + return true;
  82 +}
  83 +
  84 +
  85 +function validatesIfValueIsNumeric(value, targetId) {
  86 + if (! $j.isNumeric(value)) {
  87 + messageUtils.error('Informe um numero válido.', targetId);
  88 + return false;
  89 + }
  90 +
  91 + return true;
  92 +}
  93 +
  94 +
  95 +function validatesIfNumericValueIsInRange(value, targetId, initialRange, finalRange) {
  96 + if (! $j.isNumeric(value) || value < initialRange || value > finalRange) {
  97 + messageUtils.error('Informe um valor entre ' + initialRange + ' e ' + finalRange, targetId);
  98 + return false;
  99 + }
  100 +
  101 + return true;
  102 +}
... ...
ieducar/modules/Portabilis/Assets/Plugins/AjaxChosen/ajax-chosen.js 0 → 100644
... ... @@ -0,0 +1,125 @@
  1 +// Generated by CoffeeScript 1.4.0
  2 +
  3 +(function($) {
  4 + return $.fn.ajaxChosen = function(settings, callback, chosenOptions) {
  5 + var chosenXhr, defaultOptions, options, select;
  6 + if (settings == null) {
  7 + settings = {};
  8 + }
  9 + if (callback == null) {
  10 + callback = {};
  11 + }
  12 + if (chosenOptions == null) {
  13 + chosenOptions = function() {};
  14 + }
  15 + defaultOptions = {
  16 + minTermLength: 3,
  17 + afterTypeDelay: 500,
  18 + jsonTermKey: "term",
  19 + keepTypingMsg: "Keep typing...",
  20 + lookingForMsg: "Looking for"
  21 + };
  22 + select = this;
  23 + chosenXhr = null;
  24 + options = $.extend({}, defaultOptions, $(select).data(), settings);
  25 + this.chosen(chosenOptions ? chosenOptions : {});
  26 + return this.each(function() {
  27 + return $(this).next('.chzn-container').find(".search-field > input, .chzn-search > input").bind('keyup', function() {
  28 + var field, msg, success, untrimmed_val, val;
  29 + untrimmed_val = $(this).attr('value');
  30 + val = $.trim($(this).attr('value'));
  31 + msg = val.length < options.minTermLength ? options.keepTypingMsg : options.lookingForMsg + (" '" + val + "'");
  32 + select.next('.chzn-container').find('.no-results').text(msg);
  33 + if (val === $(this).data('prevVal')) {
  34 + return false;
  35 + }
  36 + $(this).data('prevVal', val);
  37 + if (this.timer) {
  38 + clearTimeout(this.timer);
  39 + }
  40 + if (val.length < options.minTermLength) {
  41 + return false;
  42 + }
  43 + field = $(this);
  44 + if (!(options.data != null)) {
  45 + options.data = {};
  46 + }
  47 + options.data[options.jsonTermKey] = val;
  48 + if (options.dataCallback != null) {
  49 + options.data = options.dataCallback(options.data);
  50 + }
  51 + success = options.success;
  52 + options.success = function(data) {
  53 + var items, nbItems, selected_values;
  54 + if (!(data != null)) {
  55 + return;
  56 + }
  57 + selected_values = [];
  58 + select.find('option').each(function() {
  59 + if (!$(this).is(":selected")) {
  60 + return $(this).remove();
  61 + } else {
  62 + return selected_values.push($(this).val() + "-" + $(this).text());
  63 + }
  64 + });
  65 + select.find('optgroup:empty').each(function() {
  66 + return $(this).remove();
  67 + });
  68 + items = callback(data);
  69 + nbItems = 0;
  70 + $.each(items, function(i, element) {
  71 + var group, text, value;
  72 + nbItems++;
  73 + if (element.group) {
  74 + group = select.find("optgroup[label='" + element.text + "']");
  75 + if (!group.size()) {
  76 + group = $("<optgroup />");
  77 + }
  78 + group.attr('label', element.text).appendTo(select);
  79 + return $.each(element.items, function(i, element) {
  80 + var text, value;
  81 + if (typeof element === "string") {
  82 + value = i;
  83 + text = element;
  84 + } else {
  85 + value = element.value;
  86 + text = element.text;
  87 + }
  88 + if ($.inArray(value + "-" + text, selected_values) === -1) {
  89 + return $("<option />").attr('value', value).html(text).appendTo(group);
  90 + }
  91 + });
  92 + } else {
  93 + if (typeof element === "string") {
  94 + value = i;
  95 + text = element;
  96 + } else {
  97 + value = element.value;
  98 + text = element.text;
  99 + }
  100 + if ($.inArray(value + "-" + text, selected_values) === -1) {
  101 + return $("<option />").attr('value', value).html(text).appendTo(select);
  102 + }
  103 + }
  104 + });
  105 + if (nbItems) {
  106 + select.trigger("liszt:updated");
  107 + } else {
  108 + select.data().chosen.no_results_clear();
  109 + select.data().chosen.no_results(field.attr('value'));
  110 + }
  111 + if (success != null) {
  112 + success(data);
  113 + }
  114 + return field.attr('value', untrimmed_val);
  115 + };
  116 + return this.timer = setTimeout(function() {
  117 + if (chosenXhr) {
  118 + chosenXhr.abort();
  119 + }
  120 + return chosenXhr = $.ajax(options);
  121 + }, options.afterTypeDelay);
  122 + });
  123 + });
  124 + };
  125 +})(jQuery);
... ...
ieducar/modules/Portabilis/Assets/Plugins/AjaxChosen/ajax-chosen.min.js 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +
  2 +(function($){return $.fn.ajaxChosen=function(settings,callback,chosenOptions){var chosenXhr,defaultOptions,options,select;if(settings==null){settings={};}
  3 +if(callback==null){callback={};}
  4 +if(chosenOptions==null){chosenOptions=function(){};}
  5 +defaultOptions={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term",keepTypingMsg:"Keep typing...",lookingForMsg:"Looking for"};select=this;chosenXhr=null;options=$.extend({},defaultOptions,$(select).data(),settings);this.chosen(chosenOptions?chosenOptions:{});return this.each(function(){return $(this).next('.chzn-container').find(".search-field > input, .chzn-search > input").bind('keyup',function(){var field,msg,success,untrimmed_val,val;untrimmed_val=$(this).attr('value');val=$.trim($(this).attr('value'));msg=val.length<options.minTermLength?options.keepTypingMsg:options.lookingForMsg+(" '"+val+"'");select.next('.chzn-container').find('.no-results').text(msg);if(val===$(this).data('prevVal')){return false;}
  6 +$(this).data('prevVal',val);if(this.timer){clearTimeout(this.timer);}
  7 +if(val.length<options.minTermLength){return false;}
  8 +field=$(this);if(!(options.data!=null)){options.data={};}
  9 +options.data[options.jsonTermKey]=val;if(options.dataCallback!=null){options.data=options.dataCallback(options.data);}
  10 +success=options.success;options.success=function(data){var items,nbItems,selected_values;if(!(data!=null)){return;}
  11 +selected_values=[];select.find('option').each(function(){if(!$(this).is(":selected")){return $(this).remove();}else{return selected_values.push($(this).val()+"-"+$(this).text());}});select.find('optgroup:empty').each(function(){return $(this).remove();});items=callback(data);nbItems=0;$.each(items,function(i,element){var group,text,value;nbItems++;if(element.group){group=select.find("optgroup[label='"+element.text+"']");if(!group.size()){group=$("<optgroup />");}
  12 +group.attr('label',element.text).appendTo(select);return $.each(element.items,function(i,element){var text,value;if(typeof element==="string"){value=i;text=element;}else{value=element.value;text=element.text;}
  13 +if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(group);}});}else{if(typeof element==="string"){value=i;text=element;}else{value=element.value;text=element.text;}
  14 +if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(select);}}});if(nbItems){select.trigger("liszt:updated");}else{select.data().chosen.no_results_clear();select.data().chosen.no_results(field.attr('value'));}
  15 +if(success!=null){success(data);}
  16 +return field.attr('value',untrimmed_val);};return this.timer=setTimeout(function(){if(chosenXhr){chosenXhr.abort();}
  17 +return chosenXhr=$.ajax(options);},options.afterTypeDelay);});});};})(jQuery);
0 18 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Plugins/Chosen/LICENSE.md 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +# Chosen, a Select Box Enhancer for jQuery and Protoype
  2 +## by Patrick Filler for [Harvest](http://getharvest.com)
  3 +
  4 +Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
  5 +
  6 +Copyright (c) 2011 by Harvest
  7 +
  8 +Permission is hereby granted, free of charge, to any person obtaining a copy
  9 +of this software and associated documentation files (the "Software"), to deal
  10 +in the Software without restriction, including without limitation the rights
  11 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12 +copies of the Software, and to permit persons to whom the Software is
  13 +furnished to do so, subject to the following conditions:
  14 +
  15 +The above copyright notice and this permission notice shall be included in
  16 +all copies or substantial portions of the Software.
  17 +
  18 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24 +THE SOFTWARE.
0 25 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Plugins/Chosen/chosen-sprite.png 0 → 100644

646 Bytes

ieducar/modules/Portabilis/Assets/Plugins/Chosen/chosen-sprite@2x.png 0 → 100644

872 Bytes

ieducar/modules/Portabilis/Assets/Plugins/Chosen/chosen.css 0 → 100644
... ... @@ -0,0 +1,413 @@
  1 +/* @group Base */
  2 +.chzn-container {
  3 + font-size: 13px;
  4 + position: relative;
  5 + display: inline-block;
  6 + zoom: 1;
  7 + *display: inline;
  8 +}
  9 +.chzn-container .chzn-drop {
  10 + background: #fff;
  11 + border: 1px solid #aaa;
  12 + border-top: 0;
  13 + position: absolute;
  14 + top: 29px;
  15 + left: 0;
  16 + -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
  17 + -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
  18 + box-shadow : 0 4px 5px rgba(0,0,0,.15);
  19 + z-index: 1010;
  20 +}
  21 +/* @end */
  22 +
  23 +/* @group Single Chosen */
  24 +.chzn-container-single .chzn-single {
  25 + background-color: #ffffff;
  26 + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
  27 + background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
  28 + background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
  29 + background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
  30 + background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
  31 + background-image: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
  32 + -webkit-border-radius: 5px;
  33 + -moz-border-radius : 5px;
  34 + border-radius : 5px;
  35 + -moz-background-clip : padding;
  36 + -webkit-background-clip: padding-box;
  37 + background-clip : padding-box;
  38 + border: 1px solid #aaaaaa;
  39 + -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
  40 + -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
  41 + box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
  42 + display: block;
  43 + overflow: hidden;
  44 + white-space: nowrap;
  45 + position: relative;
  46 + height: 23px;
  47 + line-height: 24px;
  48 + padding: 0 0 0 8px;
  49 + color: #444444;
  50 + text-decoration: none;
  51 +}
  52 +.chzn-container-single .chzn-default {
  53 + color: #999;
  54 +}
  55 +.chzn-container-single .chzn-single span {
  56 + margin-right: 26px;
  57 + display: block;
  58 + overflow: hidden;
  59 + white-space: nowrap;
  60 + -o-text-overflow: ellipsis;
  61 + -ms-text-overflow: ellipsis;
  62 + text-overflow: ellipsis;
  63 +}
  64 +.chzn-container-single .chzn-single abbr {
  65 + display: block;
  66 + position: absolute;
  67 + right: 26px;
  68 + top: 6px;
  69 + width: 12px;
  70 + height: 12px;
  71 + font-size: 1px;
  72 + background: url('chosen-sprite.png') -42px 1px no-repeat;
  73 +}
  74 +.chzn-container-single .chzn-single abbr:hover {
  75 + background-position: -42px -10px;
  76 +}
  77 +.chzn-container-single.chzn-disabled .chzn-single abbr:hover {
  78 + background-position: -42px -10px;
  79 +}
  80 +.chzn-container-single .chzn-single div {
  81 + position: absolute;
  82 + right: 0;
  83 + top: 0;
  84 + display: block;
  85 + height: 100%;
  86 + width: 18px;
  87 +}
  88 +.chzn-container-single .chzn-single div b {
  89 + background: url('chosen-sprite.png') no-repeat 0px 2px;
  90 + display: block;
  91 + width: 100%;
  92 + height: 100%;
  93 +}
  94 +.chzn-container-single .chzn-search {
  95 + padding: 3px 4px;
  96 + position: relative;
  97 + margin: 0;
  98 + white-space: nowrap;
  99 + z-index: 1010;
  100 +}
  101 +.chzn-container-single .chzn-search input {
  102 + background: #fff url('chosen-sprite.png') no-repeat 100% -20px;
  103 + background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
  104 + background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  105 + background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  106 + background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  107 + background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
  108 + margin: 1px 0;
  109 + padding: 4px 20px 4px 5px;
  110 + outline: 0;
  111 + border: 1px solid #aaa;
  112 + font-family: sans-serif;
  113 + font-size: 1em;
  114 +}
  115 +.chzn-container-single .chzn-drop {
  116 + -webkit-border-radius: 0 0 4px 4px;
  117 + -moz-border-radius : 0 0 4px 4px;
  118 + border-radius : 0 0 4px 4px;
  119 + -moz-background-clip : padding;
  120 + -webkit-background-clip: padding-box;
  121 + background-clip : padding-box;
  122 +}
  123 +/* @end */
  124 +
  125 +.chzn-container-single-nosearch .chzn-search input {
  126 + position: absolute;
  127 + left: -9000px;
  128 +}
  129 +
  130 +/* @group Multi Chosen */
  131 +.chzn-container-multi .chzn-choices {
  132 + background-color: #fff;
  133 + background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
  134 + background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  135 + background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  136 + background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  137 + background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
  138 + border: 1px solid #aaa;
  139 + margin: 0;
  140 + padding: 0;
  141 + cursor: text;
  142 + overflow: hidden;
  143 + height: auto !important;
  144 + height: 1%;
  145 + position: relative;
  146 +}
  147 +.chzn-container-multi .chzn-choices li {
  148 + float: left;
  149 + list-style: none;
  150 +}
  151 +.chzn-container-multi .chzn-choices .search-field {
  152 + white-space: nowrap;
  153 + margin: 0;
  154 + padding: 0;
  155 +}
  156 +.chzn-container-multi .chzn-choices .search-field input {
  157 + color: #666;
  158 + background: transparent !important;
  159 + border: 0 !important;
  160 + font-family: sans-serif;
  161 + font-size: 100%;
  162 + height: 15px;
  163 + padding: 5px;
  164 + margin: 1px 0;
  165 + outline: 0;
  166 + -webkit-box-shadow: none;
  167 + -moz-box-shadow : none;
  168 + box-shadow : none;
  169 +}
  170 +.chzn-container-multi .chzn-choices .search-field .default {
  171 + color: #999;
  172 +}
  173 +.chzn-container-multi .chzn-choices .search-choice {
  174 + -webkit-border-radius: 3px;
  175 + -moz-border-radius : 3px;
  176 + border-radius : 3px;
  177 + -moz-background-clip : padding;
  178 + -webkit-background-clip: padding-box;
  179 + background-clip : padding-box;
  180 + background-color: #e4e4e4;
  181 + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
  182 + background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
  183 + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  184 + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  185 + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  186 + background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  187 + -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
  188 + -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
  189 + box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
  190 + color: #333;
  191 + border: 1px solid #aaaaaa;
  192 + line-height: 13px;
  193 + padding: 3px 20px 3px 5px;
  194 + margin: 3px 0 3px 5px;
  195 + position: relative;
  196 + cursor: default;
  197 +}
  198 +.chzn-container-multi .chzn-choices .search-choice.search-choice-disabled {
  199 + background-color: #e4e4e4;
  200 + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
  201 + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
  202 + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  203 + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  204 + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  205 + background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  206 + background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
  207 + color: #666;
  208 + border: 1px solid #cccccc;
  209 + padding-right: 5px;
  210 +}
  211 +.chzn-container-multi .chzn-choices .search-choice-focus {
  212 + background: #d4d4d4;
  213 +}
  214 +.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
  215 + display: block;
  216 + position: absolute;
  217 + right: 3px;
  218 + top: 4px;
  219 + width: 12px;
  220 + height: 12px;
  221 + font-size: 1px;
  222 + background: url('chosen-sprite.png') -42px 1px no-repeat;
  223 +}
  224 +.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
  225 + background-position: -42px -10px;
  226 +}
  227 +.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
  228 + background-position: -42px -10px;
  229 +}
  230 +/* @end */
  231 +
  232 +/* @group Results */
  233 +.chzn-container .chzn-results {
  234 + margin: 0 4px 4px 0;
  235 + max-height: 240px;
  236 + padding: 0 0 0 4px;
  237 + position: relative;
  238 + overflow-x: hidden;
  239 + overflow-y: auto;
  240 + -webkit-overflow-scrolling: touch;
  241 +}
  242 +.chzn-container-multi .chzn-results {
  243 + margin: -1px 0 0;
  244 + padding: 0;
  245 +}
  246 +.chzn-container .chzn-results li {
  247 + display: none;
  248 + line-height: 15px;
  249 + padding: 5px 6px;
  250 + margin: 0;
  251 + list-style: none;
  252 +}
  253 +.chzn-container .chzn-results .active-result {
  254 + cursor: pointer;
  255 + display: list-item;
  256 +}
  257 +.chzn-container .chzn-results .highlighted {
  258 + background-color: #3875d7;
  259 + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
  260 + background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
  261 + background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
  262 + background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
  263 + background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
  264 + background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
  265 + color: #fff;
  266 +}
  267 +.chzn-container .chzn-results li em {
  268 + background: #feffde;
  269 + font-style: normal;
  270 +}
  271 +.chzn-container .chzn-results .highlighted em {
  272 + background: transparent;
  273 +}
  274 +.chzn-container .chzn-results .no-results {
  275 + background: #f4f4f4;
  276 + display: list-item;
  277 +}
  278 +.chzn-container .chzn-results .group-result {
  279 + cursor: default;
  280 + color: #999;
  281 + font-weight: bold;
  282 +}
  283 +.chzn-container .chzn-results .group-option {
  284 + padding-left: 15px;
  285 +}
  286 +.chzn-container-multi .chzn-drop .result-selected {
  287 + display: none;
  288 +}
  289 +.chzn-container .chzn-results-scroll {
  290 + background: white;
  291 + margin: 0 4px;
  292 + position: absolute;
  293 + text-align: center;
  294 + width: 321px; /* This should by dynamic with js */
  295 + z-index: 1;
  296 +}
  297 +.chzn-container .chzn-results-scroll span {
  298 + display: inline-block;
  299 + height: 17px;
  300 + text-indent: -5000px;
  301 + width: 9px;
  302 +}
  303 +.chzn-container .chzn-results-scroll-down {
  304 + bottom: 0;
  305 +}
  306 +.chzn-container .chzn-results-scroll-down span {
  307 + background: url('chosen-sprite.png') no-repeat -4px -3px;
  308 +}
  309 +.chzn-container .chzn-results-scroll-up span {
  310 + background: url('chosen-sprite.png') no-repeat -22px -3px;
  311 +}
  312 +/* @end */
  313 +
  314 +/* @group Active */
  315 +.chzn-container-active .chzn-single {
  316 + -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
  317 + -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
  318 + box-shadow : 0 0 5px rgba(0,0,0,.3);
  319 + border: 1px solid #5897fb;
  320 +}
  321 +.chzn-container-active .chzn-single-with-drop {
  322 + border: 1px solid #aaa;
  323 + -webkit-box-shadow: 0 1px 0 #fff inset;
  324 + -moz-box-shadow : 0 1px 0 #fff inset;
  325 + box-shadow : 0 1px 0 #fff inset;
  326 + background-color: #eee;
  327 + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
  328 + background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
  329 + background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
  330 + background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
  331 + background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
  332 + background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
  333 + -webkit-border-bottom-left-radius : 0;
  334 + -webkit-border-bottom-right-radius: 0;
  335 + -moz-border-radius-bottomleft : 0;
  336 + -moz-border-radius-bottomright: 0;
  337 + border-bottom-left-radius : 0;
  338 + border-bottom-right-radius: 0;
  339 +}
  340 +.chzn-container-active .chzn-single-with-drop div {
  341 + background: transparent;
  342 + border-left: none;
  343 +}
  344 +.chzn-container-active .chzn-single-with-drop div b {
  345 + background-position: -18px 2px;
  346 +}
  347 +.chzn-container-active .chzn-choices {
  348 + -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
  349 + -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
  350 + box-shadow : 0 0 5px rgba(0,0,0,.3);
  351 + border: 1px solid #5897fb;
  352 +}
  353 +.chzn-container-active .chzn-choices .search-field input {
  354 + color: #111 !important;
  355 +}
  356 +/* @end */
  357 +
  358 +/* @group Disabled Support */
  359 +.chzn-disabled {
  360 + cursor: default;
  361 + opacity:0.5 !important;
  362 +}
  363 +.chzn-disabled .chzn-single {
  364 + cursor: default;
  365 +}
  366 +.chzn-disabled .chzn-choices .search-choice .search-choice-close {
  367 + cursor: default;
  368 +}
  369 +
  370 +/* @group Right to Left */
  371 +.chzn-rtl { text-align: right; }
  372 +.chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
  373 +.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
  374 +
  375 +.chzn-rtl .chzn-single div { left: 3px; right: auto; }
  376 +.chzn-rtl .chzn-single abbr {
  377 + left: 26px;
  378 + right: auto;
  379 +}
  380 +.chzn-rtl .chzn-choices .search-field input { direction: rtl; }
  381 +.chzn-rtl .chzn-choices li { float: right; }
  382 +.chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
  383 +.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; }
  384 +.chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
  385 +.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
  386 +.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
  387 +.chzn-rtl .chzn-search input {
  388 + background: #fff url('chosen-sprite.png') no-repeat -30px -20px;
  389 + background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
  390 + background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  391 + background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  392 + background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
  393 + background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
  394 + padding: 4px 5px 4px 20px;
  395 + direction: rtl;
  396 +}
  397 +.chzn-container-single.chzn-rtl .chzn-single div b {
  398 + background-position: 6px 2px;
  399 +}
  400 +.chzn-container-single.chzn-rtl .chzn-single-with-drop div b {
  401 + background-position: -12px 2px;
  402 +}
  403 +/* @end */
  404 +
  405 +/* @group Retina compatibility */
  406 +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
  407 + .chzn-rtl .chzn-search input, .chzn-container-single .chzn-single abbr, .chzn-container-single .chzn-single div b, .chzn-container-single .chzn-search input, .chzn-container-multi .chzn-choices .search-choice .search-choice-close, .chzn-container .chzn-results-scroll-down span, .chzn-container .chzn-results-scroll-up span {
  408 + background-image: url('chosen-sprite@2x.png') !important;
  409 + background-repeat: no-repeat !important;
  410 + background-size: 52px 37px !important;
  411 + }
  412 +}
  413 +/* @end */
... ...
ieducar/modules/Portabilis/Assets/Plugins/Chosen/chosen.jquery.min.js 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +// Chosen, a Select Box Enhancer for jQuery and Protoype
  2 +// by Patrick Filler for Harvest, http://getharvest.com
  3 +//
  4 +// Version 0.9.11
  5 +// Full source at https://github.com/harvesthq/chosen
  6 +// Copyright (c) 2011 Harvest http://getharvest.com
  7 +
  8 +// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
  9 +// This file is generated by `cake build`, do not edit it by hand.
  10 +(function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=this,e=jQuery,e.fn.extend({chosen:function(n){return e.browser.msie&&(e.browser.version==="6.0"||e.browser.version==="7.0"&&document.documentMode===7)?this:this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))})}}),t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return s(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},i.prototype.set_up_html=function(){var t,r,i,s,o,u;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",t=["chzn-container"],t.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chzn-rtl"),this.f_width=this.form_field_jq.outerWidth(),i={id:this.container_id,"class":t.join(" "),style:"width: "+this.f_width+"px;",title:this.form_field.title},r=e("<div />",i),this.is_multiple?r.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):r.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(r),this.container=e("#"+this.container_id),this.dropdown=this.container.find("div.chzn-drop").first(),s=this.container.height(),o=this.f_width-n(this.dropdown),this.dropdown.css({width:o+"px",top:s+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),u=o-n(this.search_container)-n(this.search_field),this.search_field.css({width:u+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){return e.container_mousedown(t)}),this.container.mouseup(function(t){return e.container_mouseup(t)}),this.container.mouseenter(function(t){return e.mouse_enter(t)}),this.container.mouseleave(function(t){return e.mouse_leave(t)}),this.search_results.mouseup(function(t){return e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){return e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){return e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){return e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate",function(t){return e.activate_field(t)}),this.form_field_jq.bind("liszt:open",function(t){return e.container_mousedown(t)}),this.search_field.blur(function(t){return e.input_blur(t)}),this.search_field.keyup(function(t){return e.keyup_checker(t)}),this.search_field.keydown(function(t){return e.keydown_checker(t)}),this.search_field.focus(function(t){return e.input_focus(t)}),this.is_multiple?this.search_choices.click(function(t){return e.choices_click(t)}):this.container.click(function(e){return e.preventDefault()})},i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled)return n=t!=null?e(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault(),!this.pending_destroy_click&&!n?(this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.results_data;for(n=0,i=s.length;n<i;n++)t=s[n],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},i.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){var e;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return e=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},i.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.search_field.attr("tabindex",t)},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t),this.search_field.focus()},i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},i.prototype.choice_build=function(t){var n,r,i,s=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(n=this.container_id+"_c_"+t.array_index,this.choices+=1,t.disabled?r='<li class="search-choice search-choice-disabled" id="'+n+'"><span>'+t.html+"</span></li>":r='<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>',this.search_container.before(r),i=e("#"+n).find("a").first(),i.click(function(e){return s.choice_destroy_link_click(e)}))},i.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},i.prototype.choice_destroy=function(e){if(this.result_deselect(e.attr("rel")))return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},i.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},i.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight)return t=this.result_highlight,n=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),i=n.substr(n.lastIndexOf("_")+1),r=this.results_data[i],r.selected=!0,this.form_field.options[r.options_index].selected=!0,this.is_multiple?this.choice_build(r):(this.selected_item.find("span").first().text(r.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[r.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},i.prototype.result_activate=function(e){return e.addClass("active-result")},i.prototype.result_deactivate=function(e){return e.removeClass("active-result")},i.prototype.result_deselect=function(t){var n,r;return r=this.results_data[t],this.form_field.options[r.options_index].disabled?!1:(r.selected=!1,this.form_field.options[r.options_index].selected=!1,n=e("#"+this.container_id+"_o_"+t),n.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[r.options_index].value}),this.search_field_scale(),!0)},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear(),f=0,l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),o=this.search_contains?"":"^",s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1,a=n.dom_id,u=e("#"+a);if(s.test(n.html))t=!0,f+=1;else if(this.enable_split_word_search&&(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0)){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++)r=i[v],s.test(r)&&(t=!0,f+=1)}t?(l.length?(c=n.html.search(p),h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length),h=h.substr(0,c)+"<em>"+h.substr(c)):h=n.html,u.html(h),this.result_activate(u),n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(u))}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()},i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val(""),n=this.search_results.find("li"),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t=e(t),t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0);return s},i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}},i.prototype.no_results=function(t){var n;return n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),n.find("span").first().html(t),this.search_results.append(n)},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var t,n;this.result_highlight?this.results_showing&&(n=this.result_highlight.nextAll("li.active-result").first(),n&&this.result_do_highlight(n)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t)));if(!this.results_showing)return this.results_show()},i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},i.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled"))return this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0,u=0,s="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++)i=o[a],s+=i+":"+this.search_field.css(i)+";";return n=e("<div />",{style:s}),n.text(this.search_field.val()),e("body").append(n),u=n.width()+25,n.remove(),u>this.f_width-10&&(u=this.f_width-10),this.search_field.css({width:u+"px"}),t=this.container.height(),this.dropdown.css({top:t+"px"})}},i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t},i}(AbstractChosen),r.Chosen=t,n=function(e){var t;return t=e.outerWidth()-e.width()},r.get_side_border_padding=n}.call(this);
0 11 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Stylesheets/Frontend.css 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +/* portabilis style */
  2 +
  3 +#nav-actions a {
  4 + margin-right: 10px;
  5 +}
  6 +
  7 +/* feedback messages utils */
  8 +
  9 +#feedback-messages {
  10 + position: fixed;
  11 + bottom: 0px;
  12 + background-color: #fff;
  13 +}
  14 +
  15 +#feedback-messages p {
  16 + margin: 2px 2px 0px 2px;
  17 + padding: 4px;
  18 +}
0 19 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Stylesheets/Frontend/Process.css 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +/* fixups ieducar */
  2 +table#tablenum1 {
  3 + border: 0px;
  4 +}
  5 +
  6 +td.formdktd {
  7 + background-color: #fff;
  8 +}
  9 +
  10 +#form_resultado {
  11 + margin-bottom: 70px;
  12 +}
  13 +
  14 +tr.rodape {
  15 + display: none;
  16 +}
  17 +
  18 +#corpo {
  19 + margin: 0
  20 +}
0 21 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Stylesheets/Frontend/Resource.css 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +.resource-notice {
  2 + display: block;
  3 + padding: 5px;
  4 + margin: 2px;
  5 +}
  6 +
  7 +.right-top-notice {
  8 + float: right;
  9 + padding: 5px;
  10 + position: absolute;
  11 + right: 0;
  12 + top: 24px;
  13 + margin-right: 10px;
  14 +}
0 15 \ No newline at end of file
... ...
ieducar/modules/Portabilis/Assets/Version.php 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<?php
  2 +
  3 +/* mantem a versão dos assets (js, css), a qual pode ser alterada para resetar o cache.
  4 + usado pelo metodos loadJavascript e loadStylesheet do helper Portabilis_View_Helper_Application */
  5 +
  6 +class Portabilis_Assets_Version {
  7 + const VERSION = "0_0_0_1003";
  8 +}
  9 +
  10 +?>
... ...