PHP Classes

File: js/user.js

Recommend this page to a friend!
  Classes of giuseppe lucarelli   dbuser   js/user.js   Download  
File: js/user.js
Role: Auxiliary data
Content type: text/plain
Description: javascript code
Class: dbuser
Manage MySQL or PostgreSQL users using reconfig
Author: By
Last change:
Date: 10 years ago
Size: 2,823 bytes
 

Contents

Class file image Download
$(document).ready(function() { var request = {}; $.each(document.location.search.substr(1).split('&'),function(c,q){ if(q.length > 0) { var i = q.split('='); request[i[0]] = i[1]; } }); var driver=''; if(typeof request.driver != 'undefined') { driver=request.driver; } $reconfig.init(driver); /* change 'exec' with 'login' for authentication */ $('#building').reconfig({action: ['exec','build']}); }); var $reconfig = { init: function (driver) { this.settings.driver=(driver==''?'mysql':driver); $.reconfig.defaults = $.extend($.reconfig.defaults,this.settings); }, selectuser: function(controller,_this) { $('#'+_this.id+' option:selected').each(function () { $reconfig.user=$(this).attr('value'); $reconfig.userdes=$(this).html(); $reconfig.db=$('#dblist option:selected').text(); $reconfig.dbvalue=$('#dblist option:selected').attr('value'); $('#building').reconfig({action:['exec','fill'], controller:controller,user: $reconfig.user, userdes:escape($reconfig.userdes), do_after_build: function(data) { if(typeof data !== 'undefined') { $('#dblist option[value='+$reconfig.dbvalue+']').prop('selected',true); if($reconfig.settings.driver=='pgsql') $('.chkbox').prop('checked', false); } } }); }); }, save: function(controller,op) { if(typeof op == 'undefined') op = 'save'; var user=''; var userdes=''; if(op != 'insert') { user=$reconfig.user; userdes=escape($reconfig.userdes); } $('#building').reconfig({action:(op == 'save' ? op : ['save',op]), target: null, //detail_data, //null, controller:controller,'json_data': $reconfig.settings.json_data,user: user, all_data:true,'items':['building'], do_after_save: function(data) { if(typeof data !== 'undefined') { if(data.building.validation.match(/success/gi)) { $('#building').reconfig({action:['exec','fill'], controller:controller,user: $('#User').val(), userdes:$('#User').val()+'@'+$('#Host').val() }); } alert(unescape(data.building.validation)); } } }); }, settings: { display_plain_text: true, all_data: true, /* true>save all data, false>save only changed values */ controller: 'user.php' } };