Revisión 152
Añadido por jredrejo hace alrededor de 14 años
controlies/branches/web2py/applications/admin/views | ||
---|---|---|
link /usr/share/web2py/applications/admin/views
|
||
controlies/branches/web2py/applications/admin/cron/cron.master | ||
---|---|---|
(F1299086640.057498
|
||
F1299086640.0583701
|
||
t.
|
controlies/branches/web2py/applications/admin/models | ||
---|---|---|
link /usr/share/web2py/applications/admin/models
|
||
controlies/branches/web2py/applications/admin/controllers | ||
---|---|---|
link /usr/share/web2py/applications/admin/controllers
|
||
controlies/branches/web2py/applications/admin/languages | ||
---|---|---|
link /usr/share/web2py/applications/admin/languages
|
||
controlies/branches/web2py/applications/admin/static | ||
---|---|---|
link /usr/share/web2py/applications/admin/static
|
||
controlies/branches/web2py/applications/controlies/views/web2py_ajax.html | ||
---|---|---|
{{
|
||
response.files.insert(0,URL('static','js/jquery/jquery.js'))
|
||
response.files.insert(1,URL('static','js/jquery/jquery-ui.custom.min.js'))
|
||
response.files.insert(2,URL('static','css/calendar.css'))
|
||
response.files.insert(3,URL('static','js/calendar.js'))
|
||
for _item in response.meta or []:}}
|
||
<meta name="{{=_item}}" content="{{=response.meta[_item]}}" />{{
|
||
pass
|
||
for _k,_file in enumerate(response.files or []):
|
||
if _file in response.files[:_k]:
|
||
continue
|
||
_file0=_file.lower().split('?')[0]
|
||
if _file0.endswith('.css'):}}
|
||
<link href="{{=_file}}" rel="stylesheet" type="text/css" />{{
|
||
elif _file0.endswith('.js'):}}
|
||
<script src="{{=_file}}" type="text/javascript"></script>{{
|
||
pass
|
||
pass
|
||
}}
|
||
|
||
<script type="text/javascript"><!--
|
||
function popup(url) {
|
||
newwindow=window.open(url,'name','height=400,width=600');
|
||
if (window.focus) newwindow.focus();
|
||
return false;
|
||
}
|
||
function collapse(id) { jQuery('#'+id).slideToggle(); }
|
||
function fade(id,value) { if(value>0) jQuery('#'+id).hide().fadeIn('slow'); else jQuery('#'+id).show().fadeOut('slow'); }
|
||
function ajax(u,s,t) {
|
||
query = '';
|
||
if (typeof s == "string") {
|
||
d = jQuery(s).serialize();
|
||
if(d){ query = d; }
|
||
} else {
|
||
pcs = [];
|
||
for(i=0; i<s.length; i++) {
|
||
q = jQuery("[name="+s[i]+"]").serialize();
|
||
if(q){pcs.push(q);}
|
||
}
|
||
if (pcs.length>0){query = pcs.join("&");}
|
||
}
|
||
jQuery.ajax({type: "POST", url: u, data: query, success: function(msg) { if(t) { if(t==':eval') eval(msg); else jQuery("#" + t).html(msg); } } });
|
||
}
|
||
|
||
String.prototype.reverse = function () { return this.split('').reverse().join('');};
|
||
function web2py_ajax_init() {
|
||
jQuery('.hidden').hide();
|
||
jQuery('.error').hide().slideDown('slow');
|
||
jQuery('.flash').click(function() { jQuery(this).fadeOut('slow'); return false; });
|
||
// jQuery('input[type=submit]').click(function(){var t=jQuery(this);t.hide();t.after('<input class="submit_disabled" disabled="disabled" type="submit" name="'+t.attr("name")+'_dummy" value="'+t.val()+'">')});
|
||
jQuery('input.integer').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
|
||
jQuery('input.double,input.decimal').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
|
||
jQuery("input[type='checkbox'].delete").live('click', function(){ if(this.checked) if(!confirm("{{=T('Sure you want to delete this object?')}}")) this.checked=false; });
|
||
try {jQuery("input.date").live('focus',function() {Calendar.setup({
|
||
inputField:this, ifFormat:"{{=T('%Y-%m-%d')}}", showsTime:false
|
||
}); }); } catch(e) {};
|
||
try { jQuery("input.datetime").live('focus', function() {Calendar.setup({
|
||
inputField:this, ifFormat:"{{=T('%Y-%m-%d %H:%M:%S')}}", showsTime: true,timeFormat: "24"
|
||
}); }); } catch(e) {};
|
||
|
||
jQuery("input.time").live('focus', function() { var el = jQuery(this);
|
||
if (!el.hasClass('hasTimeEntry')) try { el.timeEntry(); } catch(e) {};
|
||
});
|
||
};
|
||
|
||
jQuery(document).ready(function() {
|
||
var flash = jQuery('.flash');
|
||
flash.hide();
|
||
if(flash.html()) flash.slideDown();
|
||
web2py_ajax_init();
|
||
});
|
||
function web2py_trap_form(action,target) {
|
||
jQuery('#'+target+' form').each(function(i){
|
||
var form=jQuery(this);
|
||
if(!form.hasClass('no_trap'))
|
||
form.submit(function(obj){
|
||
jQuery('.flash').hide().html('');
|
||
web2py_ajax_page('post',action,form.serialize(),target);
|
||
return false;
|
||
});
|
||
});
|
||
}
|
||
function web2py_ajax_page(method,action,data,target) {
|
||
jQuery.ajax({'type':method,'url':action,'data':data,
|
||
'beforeSend':function(xhr) {
|
||
xhr.setRequestHeader('web2py-component-location',document.location);
|
||
xhr.setRequestHeader('web2py-component-element',target);},
|
||
'complete':function(xhr,text){
|
||
var html=xhr.responseText;
|
||
var content=xhr.getResponseHeader('web2py-component-content');
|
||
var command=xhr.getResponseHeader('web2py-component-command');
|
||
var flash=xhr.getResponseHeader('web2py-component-flash');
|
||
var t = jQuery('#'+target);
|
||
if(content=='prepend') t.prepend(html);
|
||
else if(content=='append') t.append(html);
|
||
else if(content!='hide') t.html(html);
|
||
web2py_trap_form(action,target);
|
||
web2py_ajax_init();
|
||
if(command) eval(command);
|
||
if(flash) jQuery('.flash').html(flash).slideDown();
|
||
}
|
||
});
|
||
}
|
||
function web2py_component(action,target) {
|
||
jQuery(document).ready(function(){ web2py_ajax_page('get',action,null,target); });
|
||
}
|
||
function web2py_comet(url,onmessage,onopen,onclose) {
|
||
if ("WebSocket" in window) {
|
||
var ws = new WebSocket(url);
|
||
ws.onopen = onopen?onopen:(function(){});
|
||
ws.onmessage = onmessage;
|
||
ws.onclose = onclose?onclose:(function(){});
|
||
return true; // supported
|
||
} else return false; // not supported
|
||
}
|
||
//--></script>
|
controlies/branches/web2py/applications/controlies/views/generic.html | ||
---|---|---|
{{extend 'layout.html'}}
|
||
{{"""
|
||
|
||
You should not modify this file.
|
||
It is used as default when a view is not provided for your controllers
|
||
|
||
"""}}
|
||
<h2>{{=' '.join(x.capitalize() for x in request.function.split('_'))}}</h2>
|
||
{{if len(response._vars)==1:}}
|
||
{{=response._vars.values()[0]}}
|
||
{{elif len(response._vars)>1:}}
|
||
{{=BEAUTIFY(response._vars)}}
|
||
|
||
<button onclick="document.location='{{=URL("admin","default","design",args=request.application)}}'">admin</button>
|
||
<button onclick="jQuery('#request').slideToggle()">request</button>
|
||
<div class="hidden" id="request"><h2>request</h2>{{=BEAUTIFY(request)}}</div>
|
||
<button onclick="jQuery('#session').slideToggle()">session</button>
|
||
<div class="hidden" id="session"><h2>session</h2>{{=BEAUTIFY(session)}}</div>
|
||
<button onclick="jQuery('#response').slideToggle()">response</button>
|
||
<div class="hidden" id="response"><h2>response</h2>{{=BEAUTIFY(response)}}</div>
|
||
<script>jQuery('.hidden').hide();</script>
|
||
{{pass}}
|
controlies/branches/web2py/applications/controlies/views/grupos/form.html | ||
---|---|---|
<script language="javascript">
|
||
|
||
$(function() {
|
||
$("#name").focus();
|
||
$("#saveButton").button({ icons: { primary: "ui-icon-disk"}});
|
||
$("#cancelButton")
|
||
.button({ icons: { primary: "ui-icon-close"}})
|
||
.click( function(){ $('#dialog-form').dialog('close'); });
|
||
});
|
||
|
||
function restartStyle(){
|
||
$("#form_data p span").css("color","black");
|
||
$('#message').html("");
|
||
}
|
||
|
||
|
||
function send(){
|
||
|
||
restartStyle();
|
||
|
||
jQuery.post('call/json/modify', jQuery("#form_data").serialize(), function(result) {
|
||
//var result = $.parseJSON(data);
|
||
switch(result.response){
|
||
case "OK":{
|
||
jQuery('#message').html("Operación realizada correctamente").css("color","green").effect("highlight", {"color":"yellow"}, 1000);
|
||
setTimeout("$('#dialog-form').dialog('close')",1000);
|
||
jQuery("#list").trigger("reloadGrid");
|
||
break;
|
||
}
|
||
case "fail":{
|
||
jQuery('#message').html("Se produjo un error").effect("highlight", {"color":"yellow"}, 1000);
|
||
break;
|
||
}
|
||
case "distinctPassword":{
|
||
jQuery('#password2Tag').css("color","red");
|
||
jQuery('#password2').effect("highlight", {"color":"yellow"}, 1000).focus();
|
||
jQuery('#message').html("La repetición no coincide").effect("highlight", {"color":"yellow"}, 1000);
|
||
break;
|
||
}
|
||
case "userAlreadyExists":{
|
||
jQuery('#userTag').css("color","red");
|
||
jQuery('#user').effect("highlight", {"color":"yellow"}, 1000).focus();
|
||
jQuery('#message').html("Ya existe ese nombre de usuario").effect("slide");
|
||
break;
|
||
}
|
||
default:{
|
||
jQuery('#'+result.response+"Tag").css("color","red");
|
||
jQuery('#'+result.response).effect("highlight", {"color":"yellow"}, 1000).focus();
|
||
jQuery('#message').html("Hay campos vacíos o incorrectos").effect("slide");
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
|
||
return false;
|
||
}
|
||
|
||
</script>
|
||
|
||
<form id="form_data" onsubmit="return send();">
|
||
<input type="hidden" id="action" name="action"/>
|
||
<p><span id="typeTag">Tipo Grupo</span><br>
|
||
<select id="type" name="type">
|
||
<option value="none">Seleccione...</option>
|
||
<option value="school_department">Departamento</option>
|
||
<option value="school_class">Curso</option>
|
||
</select>
|
||
</p>
|
||
<p><span id="nameTag">Nombre </span><br><input type="text" id="name" name="name"/></p>
|
||
|
||
<p><span id="usersTag">Usuarios</span>
|
||
<div class="form_users"><input type="text" name="users" value="" id="users" /></div>
|
||
</p>
|
||
<p style="margin-bottom:300px;"></p>
|
||
<div id="message" style="text-align:center; font-weight:bold; color:red; padding:3px; "></div>
|
||
<div style="text-align:center;"><button id="saveButton" type="submit" style="width:100px;">Guardar</button> <button type="button" id="cancelButton" style="width:100px;">Cancelar</button></div>
|
||
</form>
|
controlies/branches/web2py/applications/controlies/views/grupos/index.html | ||
---|---|---|
<!-- Libreria Multiselect -->
|
||
{{response.files.append(URL('static','js/multiselect/jquery.multiselect.css'))}}
|
||
{{response.files.append(URL('static','js/multiselect/jquery.multiselect.min.js'))}}
|
||
{{response.files.append(URL('static','js/multiselect/jquery.multiselect.es.js'))}}
|
||
|
||
{{response.files.append(URL('static','js/autocomplete/TextboxList.css'))}}
|
||
{{response.files.append(URL('static','js/autocomplete/TextboxList.Autocomplete.css'))}}
|
||
{{response.files.append(URL('static','js/autocomplete/GrowingInput.js'))}}
|
||
{{response.files.append(URL('static','js/autocomplete/TextboxList.js'))}}
|
||
{{response.files.append(URL('static','js/autocomplete/TextboxList.Autocomplete.js'))}}
|
||
{{response.files.append(URL('static','js/autocomplete/TextboxList.Autocomplete.Binary.js'))}}
|
||
|
||
|
||
|
||
{{response.files.append(URL('static','js/jdgrid/css/ui.jqgrid.css'))}}
|
||
{{response.files.append(URL('static','js/jquery/jquery.dropdown.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/grid.locale-sp.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/jquery.jqGrid.min.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/src/grid.common.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/src/grid.formedit.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/src/grid.custom.js'))}}
|
||
|
||
|
||
|
||
|
||
{{extend 'layout.html'}}
|
||
|
||
<div id="tabla_clientes" class="centerGrid">
|
||
<table width="100%">
|
||
<tr>
|
||
<td style="width:2%"></td>
|
||
<td><table id="list" width="100%"></table></td>
|
||
<td style="width:2%"></td>
|
||
</tr>
|
||
</table>
|
||
<div id="pager" style=""></div>
|
||
<div id="filter" style="margin-left:30%;display:none">Search Invoices</div>
|
||
</div>
|
||
|
||
<div id="dialog-form"></div>
|
||
|
||
<div id="dialog-confirm" title="¿Borrar el registro seleccionado?" style="display:none;">
|
||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Este elemento quedará permanentemente eliminado. ¿Está seguro?</p>
|
||
</div>
|
||
|
||
<div id="dialog-alert" title="Atención" style="display:none;">
|
||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Para operar sobre un registro debe seleccionarlo previamente.</p>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
|
||
jQuery(function() {
|
||
jQuery("#dialog-confirm").dialog({ autoOpen: false });
|
||
jQuery("#dialog-alert").dialog({ autoOpen: false });
|
||
});
|
||
|
||
|
||
function print_grid(){
|
||
jQuery("#list").jqGrid({
|
||
url:"{{=URL(c='grupos',f='call',args=['json','list'])}}",
|
||
data: "{}",
|
||
mtype: 'GET',
|
||
datatype: "json",
|
||
colNames:['Tipo Grupo','Nombre','ID Grupo','Nº Usuarios'],
|
||
colModel:[
|
||
{name:'type',index:'type', width:60, align:"center", stype:'select', editoptions:{value:":Todo;Departamento:Departamentos;Curso:Cursos"}},
|
||
{name:'cn',index:'cn', width:80, align:"center"},
|
||
{name:'gidNumber',index:'gidNumber', width:60, align:"center"},
|
||
{name:'usersNumber',index:'usersNumber', width:60, align:"center"}
|
||
],
|
||
rowNum:25,
|
||
height:335,
|
||
width: 900,
|
||
rowList:[25,50,75],
|
||
pager: '#pager',
|
||
sortname: 'cn',
|
||
autowidth: false,
|
||
viewrecords: true,
|
||
sortorder: "desc",
|
||
caption:"Grupos"
|
||
|
||
});
|
||
jQuery("#list").jqGrid('navGrid','#pager',{add:false,edit:false,del:false,search:false,refresh:false});
|
||
|
||
jQuery("#list").jqGrid('navButtonAdd','#pager',{
|
||
caption: "Insertar",
|
||
buttonicon :'ui-icon-plus',
|
||
onClickButton : function (){
|
||
addRecord();
|
||
}
|
||
});
|
||
jQuery("#list").jqGrid('navButtonAdd','#pager',{
|
||
caption: "Modificar",
|
||
buttonicon :'ui-icon-pencil',
|
||
onClickButton : function (){
|
||
modifyRecord();
|
||
}
|
||
});
|
||
jQuery("#list").jqGrid('navButtonAdd','#pager',{
|
||
caption: "Borrar",
|
||
buttonicon :'ui-icon-trash',
|
||
onClickButton : function (){
|
||
deleteRecord();
|
||
}
|
||
});
|
||
|
||
|
||
jQuery("#list").jqGrid('filterToolbar');
|
||
|
||
}
|
||
|
||
|
||
function rowSelected(){
|
||
var uid = jQuery("#list").jqGrid('getGridParam','selrow');
|
||
|
||
if( uid == null ){
|
||
jQuery( "#dialog-alert" ).dialog({
|
||
resizable: false,
|
||
height:150,
|
||
width:290,
|
||
modal: true,
|
||
buttons: { "Aceptar": function() { $( this ).dialog( "close" ); }}
|
||
}).dialog('open');
|
||
return false;
|
||
}
|
||
return uid;
|
||
}
|
||
|
||
function addRecord(){
|
||
|
||
jQuery("#messageLoading").show();
|
||
|
||
jQuery("#dialog-form").html("");
|
||
jQuery("#dialog-form").load("form.html", function() {
|
||
jQuery("#form_data #action").val("add");
|
||
jQuery("#form_data #messageForm").html("Todos los campos son obligatorios");
|
||
|
||
x = (jQuery(window).width()-500)/2;
|
||
y = (jQuery(window).height()-500)/2;
|
||
|
||
jQuery("#messageLoading").hide();
|
||
|
||
jQuery("#dialog-form").dialog({
|
||
resizable: false,
|
||
position: top,
|
||
modal: true,
|
||
width: 500,
|
||
title: "Añadir Grupo"
|
||
}).dialog('option', 'position', [x, y]);
|
||
|
||
var autoComplete = new jQuery.TextboxList('#users', {unique: true, plugins: {autocomplete: {
|
||
minLength: 2,
|
||
queryRemote: true,
|
||
remote: {url: "{{=URL(c='usuarios',f='call',args=['json','getAllUsers'])}}" }
|
||
}}});
|
||
|
||
});
|
||
}
|
||
|
||
|
||
|
||
var autoComplete;
|
||
|
||
function modifyRecord(){
|
||
var uid;
|
||
|
||
jQuery("#messageLoading").show();
|
||
|
||
var uid = rowSelected();
|
||
if(uid==false)
|
||
return false;
|
||
|
||
jQuery("#dialog-form").html("").css("display","none");
|
||
jQuery("#dialog-form").load("form.html", function() {
|
||
|
||
jQuery("#form_data #action").val("modify");
|
||
|
||
jQuery.post('call/json/getGroupData',{ name: uid }, function(result) {
|
||
|
||
if(result.response['type']=="school_department")
|
||
var textType = "Departamento";
|
||
else
|
||
var textType = "Curso";
|
||
|
||
jQuery("#form_data #type").replaceWith(textType+"<input type='hidden' id='type' name='type' value='"+result.response['type']+"'/>");
|
||
jQuery("#form_data #name").replaceWith(result.response['name']+"<input type='hidden' id='name' name='name' value='"+result.response['name']+"'/>");
|
||
|
||
x = (jQuery(window).width()-500)/2;
|
||
y = (jQuery(window).height()-500)/2;
|
||
|
||
jQuery("#messageLoading").hide();
|
||
|
||
jQuery("#dialog-form").dialog({
|
||
resizable: false,
|
||
modal: true,
|
||
width: 500,
|
||
title: "Modificar Grupo"
|
||
}).dialog('option', 'position', [x, y]);
|
||
|
||
// Autocomplete with poll the server as you type
|
||
autoComplete = new jQuery.TextboxList('#users', {unique: true, plugins: {autocomplete: {
|
||
minLength: 2,
|
||
queryRemote: true,
|
||
remote: {url: "{{=URL(c='usuarios',f='call',args=['json','getAllUsers'])}}" }
|
||
}}});
|
||
|
||
$.each(result.response['memberuid'], function(i, l){
|
||
autoComplete.add(l);
|
||
});
|
||
});
|
||
});
|
||
}
|
||
|
||
function deleteRecord(){
|
||
|
||
var id = rowSelected();
|
||
if(id==false)
|
||
return false;
|
||
|
||
jQuery( "#dialog-confirm" ).dialog({
|
||
resizable: false,
|
||
height:160,
|
||
width:350,
|
||
modal: true,
|
||
buttons: {
|
||
"Borrar": function() {
|
||
jQuery.post("call/json/delete","name="+id, function(data){
|
||
jQuery("#dialog-confirm").dialog( "close" );
|
||
jQuery("#list").trigger("reloadGrid");
|
||
});
|
||
},
|
||
"Cancelar": function() {
|
||
$(this).dialog( "close" );
|
||
}
|
||
}
|
||
}).dialog('open');
|
||
}
|
||
|
||
|
||
|
||
function getAllUsers(){
|
||
$.post("{{=URL(c='usuarios',f='call',args=['json','getAllUsers'])}}", function(users) {
|
||
|
||
|
||
|
||
});
|
||
}
|
||
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
jQuery(document).ready(function(){ print_grid();});
|
||
</script>
|
controlies/branches/web2py/applications/controlies/views/layout.html | ||
---|---|---|
<!DOCTYPE html>
|
||
<html lang="{{=T.accepted_language or 'en'}}" class="no-js"><!-- no-js need it for modernzr -->
|
||
<head>
|
||
|
||
<meta charset="utf-8" />
|
||
<!-- www.phpied.com/conditional-comments-block-downloads/ -->
|
||
<!--[if IE]><![endif]-->
|
||
<!-- Always force latest IE rendering engine
|
||
(even in intranet) & Chrome Frame
|
||
Remove this if you use the .htaccess -->
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
|
||
<title>{{=response.title or request.application}}</title>
|
||
|
||
<!-- http://dev.w3.org/html5/markup/meta.name.html -->
|
||
<meta name="application-name" content="{{=request.application}}" />
|
||
|
||
<!-- Speaking of Google, don't forget to set your site up:
|
||
http://google.com/webmasters -->
|
||
<meta name="google-site-verification" content="" />
|
||
|
||
<!-- Mobile Viewport Fix
|
||
j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
|
||
device-width: Occupy full width of the screen in its current orientation
|
||
initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
|
||
maximum-scale = 1.0 retains dimensions instead of zooming in if page width < device width
|
||
-->
|
||
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
|
||
|
||
<!-- Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references -->
|
||
<link rel="shortcut icon" href="{{=URL('static','favicon.ico')}}" type="image/x-icon">
|
||
<link rel="apple-touch-icon" href="{{=URL('static','favicon.png')}}">
|
||
|
||
<!-- For the less-enabled mobile browsers like Opera Mini -->
|
||
<link rel="stylesheet" media="handheld" href="{{=URL('static','css/handheld.css')}}">
|
||
|
||
<!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
|
||
<script src="{{=URL('static','js/modernizr-1.7.min.js')}}"></script>
|
||
|
||
{{#------ require CSS and JS files for this page (read info in base.css) ------}}
|
||
{{response.files.append(URL('static','css/base.css'))}}
|
||
{{response.files.append(URL('static','css/superfish.css'))}}
|
||
{{response.files.append(URL('static','js/superfish.js'))}}
|
||
|
||
{{response.files.append(URL('static','ui/css/ui-lightness/jquery-ui-1.8.9.custom.css'))}}
|
||
|
||
|
||
|
||
|
||
|
||
{{#------ include web2py specific js code (jquery, calendar, form stuff) ------}}
|
||
{{include 'web2py_ajax.html'}}
|
||
|
||
{{
|
||
#using sidebars need to know what sidebar you want to use
|
||
#prior of using it, because of static width size of content, you can use
|
||
#left_sidebar, right_sidebar, both or none (False left and right)
|
||
left_sidebar_enabled = globals().get('left_sidebar_enabled',False)
|
||
right_sidebar_enabled = globals().get('right_sidebar_enabled',False)
|
||
if left_sidebar_enabled and right_sidebar_enabled: width_content='63%'
|
||
elif left_sidebar_enabled != right_sidebar_enabled: width_content='740px'
|
||
else: width_content='100%'
|
||
if left_sidebar_enabled: left_sidebar_style = 'style="display: block;"'
|
||
else: left_sidebar_style = 'style="display: none;"'
|
||
if right_sidebar_enabled: right_sidebar_style = 'style="display: block;"'
|
||
else: right_sidebar_style = 'style="display: none;"'
|
||
style_content = 'style="width: %s"' % width_content
|
||
}}
|
||
</head>
|
||
|
||
<body>
|
||
|
||
<div class="flash">{{=response.flash or ''}}</div> <!-- notification div -->
|
||
|
||
<div id="container">
|
||
|
||
<div id="wrapper">
|
||
|
||
<div id="header"> <!-- header and login nav -->
|
||
{{block header}} <!-- this is default header -->
|
||
{{try:}}{{=auth.navbar(action=URL('default','user'))}}{{except:pass}}
|
||
<h1> Control<span class="fontTitle">IES</span> <span class="subTitle">Centros Educativos de Extremadura</span></h1>
|
||
|
||
<div style="clear: both;"></div><!-- Clear the divs -->
|
||
{{end}}
|
||
</div><!-- header -->
|
||
|
||
<div id="statusbar"><!-- statusbar is menu zone -->
|
||
{{block statusbar}} <!-- this is default statusbar -->
|
||
{{#------ superfish menu ------}}
|
||
{{if auth.user is not None:
|
||
=MENU(response.menu,_class='sf-menu') }}
|
||
|
||
<script type="text/javascript">
|
||
jQuery(document).ready(function(){
|
||
jQuery('ul.sf-menu').superfish();});
|
||
</script>
|
||
{{pass}}
|
||
<div style="clear: both;"></div><!-- Clear the divs -->
|
||
{{end}}
|
||
</div><!-- statusbar -->
|
||
|
||
<div id="page"> <!-- Here my central body -->
|
||
|
||
{{if left_sidebar_enabled:}}
|
||
<div id="left_sidebar" {{=XML(left_sidebar_style)}} >
|
||
<div style="padding: 4px;">
|
||
{{block left_sidebar}}Content Left Sidebar{{end}}
|
||
</div>
|
||
</div><!-- left_sidebar -->
|
||
{{pass}}
|
||
|
||
<!-- content -->
|
||
<div id="content" {{=XML(style_content)}} >
|
||
|
||
|
||
{{include}}
|
||
|
||
|
||
|
||
|
||
</div>
|
||
<!-- content -->
|
||
|
||
{{if right_sidebar_enabled:}}
|
||
<div id="right_sidebar" {{=XML(right_sidebar_style)}} >
|
||
<div style="padding: 4px;">
|
||
{{block right_sidebar}}Content Right Sidebar{{end}}
|
||
</div>
|
||
</div><!-- right_sidebar -->
|
||
{{pass}}
|
||
|
||
|
||
<div style="clear: both;"></div><!-- Clear the divs -->
|
||
|
||
</div><!-- page -->
|
||
|
||
|
||
</div><!-- wrapper -->
|
||
</div><!-- container -->
|
||
|
||
|
||
</body>
|
||
</html>
|
controlies/branches/web2py/applications/controlies/views/generic.rss | ||
---|---|---|
{{
|
||
###
|
||
# response._vars contains the dictionary returned by the controller action
|
||
# for this to work the action must return something like
|
||
#
|
||
# dict(title=...,link=...,description=...,created_on='...',items=...)
|
||
#
|
||
# items is a list of dictionaries each with title, link, description, pub_date.
|
||
###
|
||
try:
|
||
from gluon.serializers import rss
|
||
response.write(rss(response._vars), escape=False)
|
||
response.headers['Content-Type'] = 'application/rss+xml'
|
||
except (TypeError, ValueError):
|
||
raise HTTP(405, 'RSS serialization error')
|
||
except ImportError:
|
||
raise HTTP(405, 'RSS not available')
|
||
except:
|
||
raise HTTP(405, 'RSS error')
|
||
}}
|
controlies/branches/web2py/applications/controlies/views/default/index.html | ||
---|---|---|
{{response.files.append(URL('static','js/jquery.tzineClock/jquery.tzineClock.css'))}}
|
||
{{response.files.append(URL('static','js/jquery.tzineClock/jquery.tzineClock.js'))}}
|
||
|
||
|
||
{{left_sidebar_enabled=right_sidebar_enabled=False}}
|
||
{{extend 'layout.html'}}
|
||
|
||
{{if auth.user is not None:}}
|
||
|
||
|
||
<script type="text/javascript">
|
||
jQuery(document).ready(function(){
|
||
jQuery('#fancyClock').tzineClock();
|
||
});
|
||
</script>
|
||
{{pass}}
|
||
|
||
|
||
|
||
{{if 'message' in globals():}}
|
||
|
||
<h1>{{=message}}</h1>
|
||
|
||
<hr />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
{{else:}}
|
||
{{=BEAUTIFY(response._vars)}}
|
||
{{pass}}
|
||
|
||
<div id="fancyClock" style="margin-left:190px;"></div>
|
||
|
||
{{block left_sidebar}}New Left Sidebar Content{{end}}
|
||
{{block right_sidebar}}New Right Sidebar Content{{end}}
|
controlies/branches/web2py/applications/controlies/views/default/user.html | ||
---|---|---|
{{extend 'layout.html'}}
|
||
|
||
<script type="text/javascript">
|
||
$(function() {
|
||
$( "#tabs" ).tabs();
|
||
$( "#authButton" ).button({ icons: { primary: "ui-icon-locked"}});
|
||
});
|
||
</script>
|
||
|
||
|
||
|
||
<h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
|
||
<div id="web2py_user_form">
|
||
|
||
|
||
<div id="tabs" class="centerAuth">
|
||
<ul>
|
||
<li><a href="#tabs-1">Autenticación</a></li>
|
||
</ul>
|
||
<div id="tabs-1">
|
||
|
||
{{=IMG(_src=URL(r=request,c='static',f='images/unlock.png'),_style="float:right;")}}
|
||
|
||
|
||
{{=form.custom.begin}}
|
||
|
||
|
||
<p><span>LDAP</span><br><input type="text" id="host" name="host" value="localhost"></p>
|
||
<p><span>{{=form.custom.label.username}}</span><br> {{=form.custom.widget.username}}</p>
|
||
<p><span>{{=form.custom.label.password}}</span><br>{{=form.custom.widget.password}}</p><br>
|
||
<p style="text-align:center;">
|
||
{{form.custom.submit
|
||
submit = form.element("input",_type="submit")
|
||
submit["_value"] = "Autenticar"
|
||
submit["_id"] = "authButton"
|
||
=submit
|
||
}}
|
||
</p>
|
||
|
||
|
||
{{=form.custom.end}}
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
{{if request.args(0)=='login':}}
|
||
{{if not 'register' in auth.settings.actions_disabled:}}
|
||
<br/><a href="{{=URL(r=request,args='register')}}">register</a>
|
||
{{pass}}
|
||
{{if not 'request_reset_password' in auth.settings.actions_disabled:}}
|
||
<br/><a href="{{=URL(r=request,args='request_reset_password')}}">lost password</a>
|
||
{{pass}}
|
||
{{pass}}
|
||
</div>
|
||
|
||
<script language="javascript">
|
||
<!--
|
||
jQuery("#web2py_user_form input:visible:enabled:first").focus();
|
||
//-->
|
||
</script>
|
controlies/branches/web2py/applications/controlies/views/generic.json | ||
---|---|---|
{{
|
||
###
|
||
# response._vars contains the dictionary returned by the controller action
|
||
###
|
||
try:
|
||
from gluon.serializers import json
|
||
response.write(json(response._vars), escape=False)
|
||
response.headers['Content-Type'] = 'application/json'
|
||
except (TypeError, ValueError):
|
||
raise HTTP(405, 'JSON serialization error')
|
||
except ImportError:
|
||
raise HTTP(405, 'JSON not available')
|
||
except:
|
||
raise HTTP(405, 'JSON error')
|
||
}}
|
controlies/branches/web2py/applications/controlies/views/generic.pdf | ||
---|---|---|
{{
|
||
import re
|
||
from gluon.contrib.markmin.markmin2pdf import markmin2pdf
|
||
def markmin_serializer(text,tag=None,attr={}):
|
||
if tag==None: return re.sub('\s+',' ',text)
|
||
if tag=='br': return '\n\n'
|
||
if tag=='h1': return '# '+text+'\n\n'
|
||
if tag=='h2': return '#'*2+' '+text+'\n\n'
|
||
if tag=='h3': return '#'*3+' '+text+'\n\n'
|
||
if tag=='h4': return '#'*4+' '+text+'\n\n'
|
||
if tag=='p': return text+'\n\n'
|
||
if tag=='li': return '\n- '+text.replace('\n',' ')
|
||
if tag=='tr': return text[3:].replace('\n',' ')+'\n'
|
||
if tag in ['table','blockquote']: return '\n-----\n'+text+'\n------\n'
|
||
if tag in ['td','th']: return ' | '+text
|
||
if tag in ['b','strong','label']: return '**%s**' % text
|
||
if tag in ['em','i']: return "''%s''" % text
|
||
if tag in ['tt','code']: return '``%s``' % text
|
||
if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
|
||
return text
|
||
html=response.render('%s/%s.html' % (request.controller,request.function))
|
||
markmin=TAG(html).element('#content').flatten(markmin_serializer)
|
||
pdf,warnings,errors=markmin2pdf(markmin)
|
||
if errors:
|
||
response.headers['Content-Type']='text'
|
||
response.write(HTML(BODY(H1('errors'),LU(*errors),H1('warnings'),LU(*warnings))))
|
||
else:
|
||
response.headers['Content-Type']='application/pdf'
|
||
response.write(pdf,escape=False)
|
||
pass
|
||
}}
|
controlies/branches/web2py/applications/controlies/views/generic.load | ||
---|---|---|
{{'''
|
||
# License: Public Domain
|
||
# Author: Iceberg at 21cn dot com
|
||
|
||
With this generic.load file, you can use same function to serve two purposes.
|
||
|
||
= regular action
|
||
- ajax callback (when called with .load)
|
||
|
||
Example modified from http://www.web2py.com/AlterEgo/default/show/252:
|
||
|
||
def index():
|
||
return dict(
|
||
part1='hello world',
|
||
part2=LOAD(url=URL(r=request,f='auxiliary.load'),ajax=True))
|
||
|
||
def auxiliary():
|
||
form=SQLFORM.factory(Field('name'))
|
||
if form.accepts(request.vars):
|
||
response.flash = 'ok'
|
||
return dict(message="Hello %s" % form.vars.name)
|
||
return dict(form=form)
|
||
|
||
Notice:
|
||
|
||
- no need to set response.headers['web2py-response-flash']
|
||
- no need to return a string
|
||
even if the function is called via ajax.
|
||
|
||
'''}}{{if len(response._vars)==1:}}{{=response._vars.values()[0]}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}
|
controlies/branches/web2py/applications/controlies/views/usuarios/form.html | ||
---|---|---|
<script language="javascript">
|
||
|
||
$(function() {
|
||
$("#name").focus();
|
||
$("#saveButton").button({ icons: { primary: "ui-icon-disk"}});
|
||
$("#cancelButton")
|
||
.button({ icons: { primary: "ui-icon-close"}})
|
||
.click( function(){ $('#dialog-form').dialog('close'); });
|
||
});
|
||
|
||
function restartStyle(){
|
||
$("#form_data p span").css("color","black");
|
||
$('#message').html("");
|
||
}
|
||
|
||
function send(){
|
||
|
||
restartStyle();
|
||
|
||
jQuery.post('call/json/modify_user', jQuery("#form_data").serialize(), function(result) {
|
||
//var result = $.parseJSON(data);
|
||
switch(result.response){
|
||
case "OK":{
|
||
jQuery('#message').html("Operación realizada correctamente").css("color","green").effect("highlight", {"color":"yellow"}, 1000);
|
||
setTimeout("$('#dialog-form').dialog('close')",1000);
|
||
jQuery("#list").trigger("reloadGrid");
|
||
break;
|
||
}
|
||
case "fail":{
|
||
jQuery('#message').html("Se produjo un error").effect("highlight", {"color":"yellow"}, 1000);
|
||
break;
|
||
}
|
||
case "distinctPassword":{
|
||
jQuery('#password2Tag').css("color","red");
|
||
jQuery('#password2').effect("highlight", {"color":"yellow"}, 1000).focus();
|
||
jQuery('#message').html("La repetición no coincide").effect("highlight", {"color":"yellow"}, 1000);
|
||
break;
|
||
}
|
||
case "userAlreadyExists":{
|
||
jQuery('#userTag').css("color","red");
|
||
jQuery('#user').effect("highlight", {"color":"yellow"}, 1000).focus();
|
||
jQuery('#message').html("Ya existe ese nombre de usuario").effect("slide");
|
||
break;
|
||
}
|
||
default:{
|
||
jQuery('#'+result.response+"Tag").css("color","red");
|
||
jQuery('#'+result.response).effect("highlight", {"color":"yellow"}, 1000).focus();
|
||
jQuery('#message').html("Hay campos vacíos o incorrectos").effect("slide");
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
|
||
return false;
|
||
}
|
||
|
||
function searchUsername(){
|
||
if(jQuery("#form_data #action").val()=="add")
|
||
jQuery.post('call/json/searchUsername','name='+jQuery("#form_data #name").val()+'&surname='+jQuery("#form_data #surname").val(), function(data) {
|
||
//var result = $.parseJSON(data);
|
||
jQuery("#form_data #user").val(result.response);
|
||
});
|
||
}
|
||
</script>
|
||
|
||
<form id="form_data" onsubmit="return send();">
|
||
<input type="hidden" id="action" name="action"/>
|
||
<div>
|
||
<div style="float:right;">
|
||
<p> {{=IMG(_src=URL('static','images/nobody.png'),_id='photo',_name='photo', _style='border:1px solid #BBB;')}} </p>
|
||
</div>
|
||
<div>
|
||
<p><span id="typeTag">Tipo Usuario</span><br>
|
||
<select type="text" id="type" name="type">
|
||
<option value="none">Seleccione...</option>
|
||
<option value="teacher">Profesor</option>
|
||
<option value="student">Alumno</option>
|
||
</select>
|
||
</p>
|
||
<p><span id="nameTag">Nombre y Apellidos</span><br><input type="text" id="name" name="name" onChange="searchUsername();"/></p>
|
||
<p><span id="surnameTag">Primer Apellido</span><br><input type="text" id="surname" name="surname"/></p>
|
||
<p><span id="nifTag">NIF</span><br><input type="text" id="nif" name="nif"/></p>
|
||
|
||
<p><span id="departmentsTag">Departamentos</span><br><select type="text" id="departments" name="departments[]" multiple style="width:250px;"></select>
|
||
<p><span id="classroomsTag">Cursos</span><br><select type="text" id="classrooms" name="classrooms[]" multiple style="width:250px;"></select>
|
||
|
||
<p><span id="userTag">Usuario</span><br><input type="text" id="user" name="user"/></p>
|
||
<p><span id="passwordTag">Contraseña</span><br><input type="text" id="password" name="password"/></p>
|
||
<p><span id="password2Tag">Repita Contraseña</span><br><input type="text" id="password2" name="password2"/></p>
|
||
</div>
|
||
</div>
|
||
<div id="message" style="text-align:center; font-weight:bold; color:red; padding:3px; "></div>
|
||
<div style="text-align:center;"><button id="saveButton" type="submit" style="width:100px;">Guardar</button> <button type="button" id="cancelButton" style="width:100px;">Cancelar</button></div>
|
||
<p style="padding-top:10px; text-align:center; font-size:10px;" id="messageForm"></p>
|
||
</form>
|
controlies/branches/web2py/applications/controlies/views/usuarios/index.html | ||
---|---|---|
<!-- Libreria Multiselect -->
|
||
{{response.files.append(URL('static','js/multiselect/jquery.multiselect.css'))}}
|
||
{{response.files.append(URL('static','js/multiselect/jquery.multiselect.min.js'))}}
|
||
{{response.files.append(URL('static','js/multiselect/jquery.multiselect.es.js'))}}
|
||
{{#response.files.append(URL('static','css/helper.css'))}}
|
||
{{#response.files.append(URL('static','css/dropdown.css'))}}
|
||
{{#response.files.append(URL('static','css/default.advanced.css'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/css/ui.jqgrid.css'))}}
|
||
{{response.files.append(URL('static','js/jquery/jquery.dropdown.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/grid.locale-sp.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/jquery.jqGrid.min.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/src/grid.common.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/src/grid.formedit.js'))}}
|
||
{{response.files.append(URL('static','js/jdgrid/src/grid.custom.js'))}}
|
||
|
||
|
||
|
||
|
||
{{extend 'layout.html'}}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div id="tabla_clientes" class="centerGrid">
|
||
<table width="100%" align="center">
|
||
<tr>
|
||
<td style="width:2%"></td>
|
||
<td style="text-align:center;"><table id="list" width="100%"></table></td>
|
||
<td style="width:2%"></td>
|
||
</tr>
|
||
</table>
|
||
<div id="pager" style=""></div>
|
||
<div id="filter" style="margin-left:30%;display:none">Buscar nada</div>
|
||
</div>
|
||
|
||
<div id="dialog-form"></div>
|
||
|
||
<div id="dialog-confirm" title="¿Borrar el registro seleccionado?" style="display:none;">
|
||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Este elemento quedará permanentemente eliminado. ¿Está seguro?</p>
|
||
</div>
|
||
|
||
<div id="dialog-alert" title="Atención" style="display:none;">
|
||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Para operar sobre un registro debe seleccionarlo previamente.</p>
|
||
</div>
|
||
|
||
|
||
<script type="text/javascript">
|
||
|
||
jQuery(function() {
|
||
jQuery("#dialog-confirm").dialog({ autoOpen: false });
|
||
jQuery("#dialog-alert").dialog({ autoOpen: false });
|
||
});
|
||
|
||
|
||
function print_grid(){
|
||
jQuery("#list").jqGrid({
|
||
url:"{{=URL(c='usuarios',f='call',args=['json','list'])}}",
|
||
data: "{}",
|
||
datatype: 'json',
|
||
mtype: 'GET',
|
||
contentType: "application/json; charset=utf-8",
|
||
complete: function(jsondata, stat) {
|
||
if (stat == "success") {
|
||
var thegrid = jQuery("#list")[0];
|
||
thegrid.addJSONData(JSON.parse(jsondata.responseText).d);
|
||
}
|
||
},
|
||
|
||
colNames:['Tipo Usuario','Nombre','Usuario','ID usuario','ID Grupo','Identificación'],
|
||
colModel:[
|
||
{name:'type',index:'type', width:60, align:"center", stype:'select', editoptions:{value:":Todo;Profesor:Profesores;Alumno:Alumnos"}},
|
||
{name:'cn',index:'cn', width:140, align:"left"},
|
||
{name:'uid',index:'uid', width:90, align:"center"},
|
||
{name:'uidNumber',index:'uidNumber', width:70, align:"center"},
|
||
{name:'gidNumber',index:'gidNumber', width:70, align:"center"},
|
||
{name:'employeeNumber',index:'employeeNumber', width:80, align:"center"}
|
||
],
|
||
rowNum:25,
|
||
height:335,
|
||
width: 900,
|
||
rowList:[25,50,75],
|
||
pager: '#pager',
|
||
sortname: 'cn',
|
||
autowidth: false,
|
||
viewrecords: true,
|
||
sortorder: "desc",
|
||
caption:"Usuarios"
|
||
|
||
});
|
||
jQuery("#list").jqGrid('navGrid','#pager',{add:false,edit:false,del:false,search:false,refresh:false});
|
||
|
||
jQuery("#list").jqGrid('navButtonAdd','#pager',{
|
||
caption: "Insertar",
|
||
buttonicon :'ui-icon-plus',
|
||
onClickButton : function (){
|
||
addRecord();
|
||
}
|
||
});
|
||
jQuery("#list").jqGrid('navButtonAdd','#pager',{
|
||
caption: "Modificar",
|
||
buttonicon :'ui-icon-pencil',
|
||
onClickButton : function (){
|
||
modifyRecord();
|
||
}
|
||
});
|
||
jQuery("#list").jqGrid('navButtonAdd','#pager',{
|
||
caption: "Borrar",
|
||
buttonicon :'ui-icon-trash',
|
||
onClickButton : function (){
|
||
deleteRecord();
|
||
}
|
||
});
|
||
|
||
|
||
jQuery("#list").jqGrid('filterToolbar');
|
||
|
||
}
|
||
|
||
|
||
function rowSelected(){
|
||
var uid = jQuery("#list").jqGrid('getGridParam','selrow');
|
||
|
||
if( uid == null ){
|
||
jQuery( "#dialog-alert" ).dialog({
|
||
resizable: false,
|
||
height:150,
|
||
width:290,
|
||
modal: true,
|
||
buttons: { "Aceptar": function() { $( this ).dialog( "close" ); }}
|
||
}).dialog('open');
|
||
return false;
|
||
}
|
||
return uid;
|
||
}
|
||
|
||
function addRecord(){
|
||
|
||
jQuery("#messageLoading").show();
|
||
|
||
jQuery("#dialog-form").html("").css("display","none");;
|
||
jQuery("#dialog-form").load("form.html", function() {
|
||
getAllGroups();
|
||
jQuery("#form_data #action").val("add");
|
||
jQuery("#form_data #messageForm").html("Todos los campos son obligatorios");
|
||
|
||
x = (jQuery(window).width()-300)/2;
|
||
y = (jQuery(window).height()-500)/2;
|
||
|
||
jQuery("#messageLoading").hide();
|
||
|
||
jQuery("#dialog-form").dialog({
|
||
resizable: false,
|
||
position: top,
|
||
modal: true,
|
||
width: 300,
|
||
title: "Añadir Usuario"
|
||
}).dialog('option', 'position', [x, y]);
|
||
});
|
||
}
|
||
|
||
function modifyRecord(){
|
||
var uid;
|
||
|
||
jQuery("#messageLoading").show();
|
||
|
||
var uid = rowSelected();
|
||
if(uid==false)
|
||
return false;
|
||
|
||
jQuery("#dialog-form").html("").css("display","none");
|
||
jQuery("#dialog-form").load("form.html", function() {
|
||
|
||
getAllGroups();
|
||
|
||
jQuery("#form_data #action").val("modify");
|
||
jQuery("#form_data #user").attr("readonly","true");
|
||
jQuery("#form_data #user").css("background-color","#DDD");
|
||
jQuery("#form_data #messageForm").html("Si deja la contraseña en blanco no se modificará<br>El resto de campos son obligatorios");
|
||
|
||
jQuery.post('call/json/getUserData',{ username: uid }, function(result) {
|
||
//var result = jQuery.parseJSON(data);
|
||
|
||
if(result.response['type']=="teacher")
|
||
var textType = "Profesor";
|
||
else
|
||
var textType = "Alumno";
|
||
|
||
var dep = Array(result.response['groups']['departments']);
|
||
|
||
jQuery("#form_data #type").replaceWith(textType+"<input type='hidden' id='type' name='type' value='"+result.response['type']+"'/>");
|
||
jQuery("#form_data #name").val(result.response['name']);
|
||
jQuery("#form_data #nif").val(result.response['nif']);
|
||
jQuery("#form_data #user").val(result.response['user']);
|
||
jQuery("#form_data #surname").val(result.response['surname']);
|
||
|
||
jQuery("#form_data #photo").attr("src","data:image/png;base64,"+result.response['photo']);
|
||
|
||
$.each(result.response['groups']['departments'], function(i, l){
|
||
jQuery('#form_data input:checkbox[value='+l+']').attr('checked', true);
|
||
});
|
||
|
||
$.each(result.response['groups']['classrooms'], function(i, l){
|
||
jQuery('#form_data input:checkbox[value='+l+']').attr('checked', true);
|
||
});
|
||
|
||
x = (jQuery(window).width()-300)/2;
|
||
y = (jQuery(window).height()-500)/2;
|
||
|
||
jQuery("#messageLoading").hide();
|
||
|
||
jQuery("#dialog-form").dialog({
|
||
resizable: false,
|
||
modal: true,
|
||
width: 300,
|
||
title: "Modificar Usuario"
|
||
}).dialog('option', 'position', [x, y]);
|
||
});
|
||
});
|
||
}
|
||
|
||
function deleteRecord(){
|
||
|
||
var uid = rowSelected();
|
||
if(uid==false)
|
||
return false;
|
||
|
||
jQuery( "#dialog-confirm" ).dialog({
|
||
resizable: false,
|
||
height:160,
|
||
width:350,
|
||
modal: true,
|
||
buttons: {
|
||
"Borrar": function() {
|
||
jQuery.post("call/json/delete","user="+uid, function(data){
|
||
jQuery("#dialog-confirm").dialog( "close" );
|
||
jQuery("#list").trigger("reloadGrid");
|
||
});
|
||
},
|
||
"Cancelar": function() {
|
||
$(this).dialog( "close" );
|
||
}
|
||
}
|
||
}).dialog('open');
|
||
}
|
||
|
||
function getAllGroups(){
|
||
$.post("{{=URL(c='grupos',f='call',args=['json','getAllGroups'])}}", function(groups) {
|
||
//var groups = $.parseJSON(data);
|
||
|
||
$.each( groups.departments, function(i, l){
|
||
jQuery("#form_data #departments").append("<option value='"+l+"'>"+l+"</option>");
|
||
});
|
||
$.each( groups.classrooms, function(i, l){
|
||
jQuery("#form_data #classrooms").append("<option value='"+l+"'>"+l+"</option>");
|
||
});
|
||
jQuery("#form_data #departments").multiselect();
|
||
jQuery("#form_data #classrooms").multiselect();
|
||
});
|
||
}
|
||
|
||
</script>
|
||
|
||
|
||
<script type="text/javascript">
|
||
jQuery(document).ready(function(){ print_grid();});
|
||
</script>
|
controlies/branches/web2py/applications/controlies/views/generic.xml | ||
---|---|---|
{{
|
||
###
|
||
# response._vars contains the dictionary returned by thecontroller action
|
||
###
|
||
try:
|
||
from gluon.serializers import xml
|
||
response.write(xml(response._vars), escape=False)
|
||
response.headers['Content-Type'] = 'text/xml'
|
||
except (TypeError, ValueError):
|
||
raise HTTP(405, 'XML serialization error')
|
||
except ImportError:
|
||
raise HTTP(405, 'XML not available')
|
||
except:
|
||
raise HTTP(405, 'XML error')
|
||
}}
|
controlies/branches/web2py/applications/controlies/views/appadmin.html | ||
---|---|---|
{{extend 'layout.html'}}
|
||
<script><!--
|
||
jQuery(document).ready(function(){
|
||
jQuery("table.sortable tbody tr").mouseover( function() {
|
||
jQuery(this).addClass("highlight"); }).mouseout( function() {
|
||
jQuery(this).removeClass("highlight"); });
|
||
jQuery('table.sortable tbody tr:odd').addClass('odd');
|
||
jQuery('table.sortable tbody tr:even').addClass('even');
|
||
});
|
||
//--></script>
|
||
|
||
{{if request.function=='index':}}
|
||
<h1>{{=T("Available databases and tables")}}</h1>
|
||
{{if not databases:}}{{=T("No databases in this application")}}{{pass}}
|
||
{{for db in sorted(databases):}}
|
||
{{for table in databases[db].tables:}}
|
||
{{qry='%s.%s.id>0'%(db,table)}}
|
||
{{tbl=databases[db][table]}}
|
||
{{if hasattr(tbl,'_primarykey'):}}
|
||
{{if tbl._primarykey:}}
|
||
{{firstkey=tbl[tbl._primarykey[0]]}}
|
||
{{if firstkey.type in ['string','text']:}}
|
||
{{qry='%s.%s.%s!=""'%(db,table,firstkey.name)}}
|
||
{{else:}}
|
||
{{qry='%s.%s.%s>0'%(db,table,firstkey.name)}}
|
||
{{pass}}
|
||
{{else:}}
|
||
{{qry=''}}
|
||
{{pass}}
|
||
{{pass}}
|
||
<h2>{{=A("%s.%s" % (db,table),_href=URL('select',args=[db],vars=dict(query=qry)))}}
|
||
</h2>
|
||
[ {{=A(str(T('insert new'))+' '+table,_href=URL('insert',args=[db,table]))}} ]
|
||
<br /><br />
|
||
{{pass}}
|
||
{{pass}}
|
||
|
||
{{elif request.function=='select':}}
|
||
<h1>{{=XML(str(T("database %s select"))%A(request.args[0],_href=URL('index'))) }}
|
||
</h1>
|
||
{{if table:}}
|
||
[ {{=A(str(T('insert new %s'))%table,_href=URL('insert',args=[request.args[0],table]))}} ]<br/><br/>
|
||
<h2>{{=T("Rows in table")}}</h2><br/>
|
||
{{else:}}
|
||
<h2>{{=T("Rows selected")}}</h2><br/>
|
||
{{pass}}
|
||
{{=form}}
|
||
<p>{{=T('The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.')}}<br/>
|
||
{{=T('Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.')}}<br/>
|
||
{{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}</p>
|
||
<br/><br/>
|
||
<h3>{{=nrows}} {{=T("selected")}}</h3>
|
||
{{if start>0:}}[ {{=A(T('previous 100 rows'),_href=URL('select',args=request.args[0],vars=dict(start=start-100)))}} ]{{pass}}
|
||
{{if stop<nrows:}}[ {{=A(T('next 100 rows'),_href=URL('select',args=request.args[0],vars=dict(start=start+100)))}} ]{{pass}}
|
||
{{if rows:}}
|
||
<div style="overflow: auto;" width="80%">
|
||
{{linkto=URL('update',args=request.args[0])}}
|
||
{{upload=URL('download',args=request.args[0])}}
|
||
{{=SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable')}}
|
||
</div>
|
||
{{pass}}
|
||
<br/><br/><h2>{{=T("Import/Export")}}</h2><br/>
|
||
[ <a href="{{=URL('csv',args=request.args[0],vars=dict(query=query))}}">{{=T("export as csv file")}}</a> ]
|
||
{{if table:}}
|
||
{{=FORM(str(T('or import from csv file'))+" ",INPUT(_type='file',_name='csvfile'),INPUT(_type='hidden',_value=table,_name='table'),INPUT(_type='submit',_value='import'))}}
|
||
{{pass}}
|
||
|
||
|
||
{{elif request.function=='insert':}}
|
||
<h1>{{=T("database")}} {{=A(request.args[0],_href=URL('index'))}}
|
||
{{if hasattr(table,'_primarykey'):}}
|
||
{{fieldname=table._primarykey[0]}}
|
||
{{dbname=request.args[0]}}
|
||
{{tablename=request.args[1]}}
|
||
{{cond = table[fieldname].type in ['string','text'] and '!=""' or '>0'}}
|
||
{{=T("table")}} {{=A(tablename,_href=URL('select',args=dbname,vars=dict(query='%s.%s.%s%s'%(dbname,tablename,fieldname,cond))))}}
|
||
{{else:}}
|
||
{{=T("table")}} {{=A(request.args[1],_href=URL('select',args=request.args[0],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))}}
|
||
{{pass}}
|
||
</h1>
|
||
<h2>{{=T("New Record")}}</h2><br/>
|
||
{{=form}}
|
||
|
||
|
||
|
||
{{elif request.function=='update':}}
|
||
<h1>{{=T("database")}} {{=A(request.args[0],_href=URL('index'))}}
|
||
{{if hasattr(table,'_primarykey'):}}
|
||
{{fieldname=request.vars.keys()[0]}}
|
||
{{dbname=request.args[0]}}
|
||
{{tablename=request.args[1]}}
|
||
{{cond = table[fieldname].type in ['string','text'] and '!=""' or '>0'}}
|
||
{{=T("table")}} {{=A(tablename,_href=URL('select',args=dbname,vars=dict(query='%s.%s.%s%s'%(dbname,tablename,fieldname,cond))))}}
|
||
{{=T("record")}} {{=A('%s=%s'%request.vars.items()[0],_href=URL('update',args=request.args[:2],vars=request.vars))}}
|
||
{{else:}}
|
||
{{=T("table")}} {{=A(request.args[1],_href=URL('select',args=request.args[0],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))}}
|
||
{{=T("record id")}} {{=A(request.args[2],_href=URL('update',args=request.args[:3]))}}
|
||
{{pass}}
|
||
</h1>
|
||
<h2>{{=T("Edit current record")}}</h2><br/><br/>{{=form}}
|
||
|
||
|
||
|
||
{{elif request.function=='state':}}
|
||
<h1>{{=T("Internal State")}}</h1>
|
||
<h2>{{=T("Current request")}}</h2>
|
||
{{=BEAUTIFY(request)}}
|
||
<br/><h2>{{=T("Current response")}}</h2>
|
||
{{=BEAUTIFY(response)}}
|
||
<br/><h2>{{=T("Current session")}}</h2>
|
||
{{=BEAUTIFY(session)}}
|
||
|
||
|
||
{{elif request.function == 'ccache':}}
|
||
<h2>Cache</h2>
|
Exportar a: Unified diff
controlies con web2py