[IMP] Improved indentation.

bzr revid: jra@tinyerp.com-20110928062519-9pqd1to80a0bwoye
This commit is contained in:
Jiten (OpenERP) 2011-09-28 11:55:19 +05:30
parent 7c9a8945f4
commit 5f59f67e83
4 changed files with 225 additions and 258 deletions

View File

@ -33,20 +33,16 @@ openerp.web_mobile.MobileWebClient = openerp.web.Widget.extend({
openerp.web_mobile.Login = openerp.web.Widget.extend({
start: function() {
this.has_local_storage = typeof(localStorage) != 'undefined';
this.remember_creditentials = true;
this.selected_login = null;
this.selected_password = null;
if (this.has_local_storage && this.remember_creditentials) {
this.selected_login = localStorage.getItem('last_login_login_success');
this.selected_password = localStorage.getItem('last_password_login_success');
}
var self = this;
jQuery("#oe_header").children().remove();
this.rpc("/web/database/get_list", {}, function(result) {
self.db_list = result.db_list;
self.$element.html(QWeb.render("Login", self));
@ -66,7 +62,6 @@ openerp.web_mobile.Login = openerp.web.Widget.extend({
var db = $e.find("div select[name=database]").val();
var login = $e.find("div input[name=login]").val();
var password = $e.find("div input[name=password]").val();
//$e.hide();
// Should hide then call callback
this.session.session_login(db, login, password, function() {
@ -116,6 +111,7 @@ openerp.web_mobile.Login = openerp.web.Widget.extend({
});
}
});
openerp.web_mobile.Header = openerp.web.Widget.extend({
init: function(session, element_id) {
this._super(session, element_id);
@ -142,7 +138,6 @@ openerp.web_mobile.Shortcuts = openerp.web.Widget.extend({
var self = this;
this.rpc('/web/session/sc_list',{} ,function(res){
self.$element.html(QWeb.render("Shortcuts", {'sc' : res}))
self.$element.find("[data-role=header]").find('h1').html('Favourite');
self.$element.find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
@ -167,7 +162,6 @@ openerp.web_mobile.Shortcuts = openerp.web.Widget.extend({
$shortcut = $(ev.currentTarget);
id = $shortcut.data('menu');
res_id = $shortcut.data('res');
if(!$('[id^="oe_list_'+res_id+'"]').html()){
$('<div id="oe_list_'+res_id+'" data-role="page" data-url="oe_list_'+res_id+'"> </div>').appendTo('#moe');
this.listview = new openerp.web_mobile.ListView(self, "oe_list_"+res_id, res_id);
@ -198,7 +192,6 @@ openerp.web_mobile.Menu = openerp.web.Widget.extend({
this.header.start();
this.footer = new openerp.web_mobile.Footer(this, "oe_footer");
this.footer.start();
this.$element.html(QWeb.render("Menu", this.data));
this.$element.find("[data-role=header]").find('h1').html('Application');
this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
@ -235,7 +228,6 @@ openerp.web_mobile.Menu = openerp.web.Widget.extend({
this.$element
.removeClass("login_valid")
.addClass("secondary_menu");
if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
$('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');
this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
@ -245,6 +237,7 @@ openerp.web_mobile.Menu = openerp.web.Widget.extend({
}
}
});
openerp.web_mobile.Secondary = openerp.web.Widget.extend({
init: function(session, element_id, secondary_menu_id) {
this._super(session, element_id);
@ -287,23 +280,23 @@ openerp.web_mobile.Secondary = openerp.web.Widget.extend({
ev.stopPropagation();
var child_len = 0;
for (var i = 0; i < this.data.children.length; i++) {
for (var j=0; j < this.data.children[i].children.length; j++) {
if (this.data.children[i].children[j].id == id) {
this.children = this.data.children[i].children[j];
child_len = this.children.children.length;
}
}
for (var j=0; j < this.data.children[i].children.length; j++) {
if (this.data.children[i].children[j].id == id) {
this.children = this.data.children[i].children[j];
child_len = this.children.children.length;
}
}
}
if (child_len > 0) {
this.$element
.addClass("secondary_menu");
if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
$('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');
this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
this.secondary.start();
}else{
$.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true);
}
if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
$('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');
this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
this.secondary.start();
}else{
$.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true);
}
}
else {
if(!$('[id^="oe_list_'+id+'"]').html()){
@ -314,13 +307,6 @@ openerp.web_mobile.Secondary = openerp.web.Widget.extend({
$.mobile.changePage('#oe_list_'+id, "slide", false, true);
}
}
/* if(!$('[id^="oe_list_'+id+'"]').html()){
$('<div id="oe_list_'+id+'" data-role="page" data-url="oe_list_'+id+'"> </div>').appendTo('#moe');
this.listview = new openerp.web_mobile.ListView(this, "oe_list_"+id, id);
this.listview.start();
}else{
$.mobile.changePage('#oe_list_'+id, "slide", false, true);
}*/
jQuery("#oe_header").find("h1").html($menu.data('name'));
}
});
@ -328,7 +314,6 @@ openerp.web_mobile.Secondary = openerp.web.Widget.extend({
openerp.web_mobile.Options = openerp.web.Widget.extend({
start: function() {
var self = this;
this.$element.html(QWeb.render("Options", this));
this.$element.find("[data-role=header]").find('h1').html('Preference');
this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){

View File

@ -12,23 +12,19 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({
this.head_title = head_title;
this.resmodel = resmodel;
this.viewid = viewid;
},
start: function() {
var self = this;
var id = this.list_id;
var model = this.action.res_model || this.resmodel;
if(this.action){
var view_id = this.action.views[1][0];
}else{
var view_id = this.viewid;
}
this.dataset = new openerp.web.DataSetSearch(this, model, null, null);
var context = new openerp.web.CompoundContext(this.dataset.get_context());
this.dataset.read_slice([],{}, function (result) {
for (var i = 0; i < result.length; i++) {
if (result[i].id == id) {
var data = result[i];
@ -44,216 +40,211 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({
}
}
self.$element.html(QWeb.render("FormView", {'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : data ,'temp_flag':'1'}));
for(var i=0;i<get_fields.length;i++)
{
if(get_fields[i].attrs.widget=="progressbar")
{
$("#progress").progressbar({value:data[get_fields[i].attrs.name]})
}
}
self.$element.find("[data-role=header]").find('h1').html(self.head_title);
self.$element.find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
});
self.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
for(var i=0;i<get_fields.length;i++) {
if (get_fields[i].attrs.widget=="progressbar") {
$("#progress").progressbar({value:data[get_fields[i].attrs.name]})
}
}
self.$element.find("[data-role=header]").find('h1').html(self.head_title);
self.$element.find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
});
self.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}
else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
self.$element.find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
}
else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
self.$element.find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
var selected_id = $(this).prev().find('select').val();
var select_model = $(this).prev().find('select').attr('for');
if(selected_id!="false"){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
}
else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){
for (var k = 0; k < notebooks.children.length; k++) {
if (notebooks.children[k].attrs.string == $(this).attr('id')) {
get_fields = self.get_fields(notebooks.children[k].children);
for (var i = 0; i < get_fields.length; i++) {
if (fields[get_fields[i].attrs.name].type == 'one2many'){
self.relational_fields = get_fields[i].attrs.name;
if(fields[get_fields[i].attrs.name].views.form){
var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children);
var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields;
var notebook=fields[get_fields[i].attrs.name].views.form.arch;
}
}
}
}
});
self.$element.find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
if(notebook){
$(this).find('p').html(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields, 'values' : data,'til': notebook.attrs.string }));
}else{
$(this).find('p').html(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields, 'values' : data }));
}
else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
self.$element.find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
var selected_id = $(this).prev().find('select').val();
var select_model = $(this).prev().find('select').attr('for');
if(selected_id!="false"){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
$(this).find('p').find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
var selected_id = $(this).prev().find('select').val();
var select_model = $(this).prev().find('select').attr('for');
if(selected_id!="false"){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
}
}
});
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){
for (var k = 0; k < notebooks.children.length; k++) {
if (notebooks.children[k].attrs.string == $(this).attr('id')) {
get_fields = self.get_fields(notebooks.children[k].children);
for (var i = 0; i < get_fields.length; i++) {
if (fields[get_fields[i].attrs.name].type == 'one2many'){
self.relational_fields = get_fields[i].attrs.name;
if(fields[get_fields[i].attrs.name].views.form){
var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children);
var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields;
var notebook=fields[get_fields[i].attrs.name].views.form.arch;
}
}
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
}
}
if(notebook){
$(this).find('p').html(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields, 'values' : data,'til': notebook.attrs.string }));
}else{
$(this).find('p').html(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields, 'values' : data }));
}
$(this).find('p').find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
var selected_id = $(this).prev().find('select').val();
var select_model = $(this).prev().find('select').attr('for');
if(selected_id!="false"){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
}
}
});
}
});
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').find('p').find('[data-role=content]').find('ul').find('li').click(function(ev){
ev.preventDefault();
ev.stopPropagation();
var latid,lastid;
$(this).parents().each(function(){
latid = $(this).attr('id');
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(){
if(latid==$(this).attr('id')){
lastid = $(this).attr('id');
}
});
});
var relational = $(this).attr('for');
if(result.fields[relational]){
var head = $.trim($(this).text());
var dataset = new openerp.web.DataSetStatic(self, result.fields[relational].relation, result.fields[relational].context);
dataset.domain=[['id', 'in', data[relational]]];
dataset.name_search('', dataset.domain, 'in',false ,function(res){
for(var i=0;i<res.length;i++){
var splited_data = res[i][1].split(',');
res[i][1] = splited_data[0];
}
if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){
$('<div id="oe_list_'+relational+'_'+self.element_id+'" data-role="page" data-url="oe_list_'+relational+'_'+self.element_id+'"> </div>').appendTo('#moe');
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(QWeb.render("ListView", {'records' : res}));
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head);
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
});
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}
else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
}
else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("a#list-id").click(function(ev){
ev.preventDefault();
ev.stopPropagation();
var head_title = $(this).text();
var listid = $(ev.currentTarget).data('id');
dataset = new openerp.web.DataSetSearch(self, dataset.model, null, null);
dataset.read_slice([],{}, function (result_relational) {
for (var i = 0; i < result_relational.length; i++) {
if (result_relational[i].id == listid) {
var data_relational = result_relational[i];
}
}
});
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').find('p').find('[data-role=content]').find('ul').find('li').click(function(ev){
ev.preventDefault();
ev.stopPropagation();
var latid,lastid;
$(this).parents().each(function(){
latid = $(this).attr('id');
self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(){
if(latid==$(this).attr('id')){
lastid = $(this).attr('id');
}
});
});
var relational = $(this).attr('for');
if(result.fields[relational]){
var head = $.trim($(this).text());
var dataset = new openerp.web.DataSetStatic(self, result.fields[relational].relation, result.fields[relational].context);
dataset.domain=[['id', 'in', data[relational]]];
dataset.name_search('', dataset.domain, 'in',false ,function(res){
for(var i=0;i<res.length;i++){
var splited_data = res[i][1].split(',');
res[i][1] = splited_data[0];
}
if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){
$('<div id="oe_list_'+relational+'_'+self.element_id+'" data-role="page" data-url="oe_list_'+relational+'_'+self.element_id+'"> </div>').appendTo('#moe');
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(QWeb.render("ListView", {'records' : res}));
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head);
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
});
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}
else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
}
else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("a#list-id").click(function(ev){
ev.preventDefault();
ev.stopPropagation();
var head_title = $(this).text();
var listid = $(ev.currentTarget).data('id');
dataset = new openerp.web.DataSetSearch(self, dataset.model, null, null);
dataset.read_slice([],{}, function (result_relational) {
for (var i = 0; i < result_relational.length; i++) {
if (result_relational[i].id == listid) {
var data_relational = result_relational[i];
}
if(!$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html()){
$('<div id="oe_form_'+listid+result.fields[relational].relation+'" data-role="page" data-url="oe_form_'+listid+result.fields[relational].relation+'"> </div>').appendTo('#moe');
for (var k = 0; k < notebooks.children.length; k++) {
if (notebooks.children[k].attrs.string == lastid) {
get_fields = self.get_fields(notebooks.children[k].children);
for (var i = 0; i < get_fields.length; i++) {
if (fields[get_fields[i].attrs.name].type == 'one2many'){
self.relational_fields = get_fields[i].attrs.name;
if(fields[get_fields[i].attrs.name].views.form){
var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children);
var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields;
var notebook=fields[get_fields[i].attrs.name].views.form.arch;
}
}
if(!$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html()){
$('<div id="oe_form_'+listid+result.fields[relational].relation+'" data-role="page" data-url="oe_form_'+listid+result.fields[relational].relation+'"> </div>').appendTo('#moe');
for (var k = 0; k < notebooks.children.length; k++) {
if (notebooks.children[k].attrs.string == lastid) {
get_fields = self.get_fields(notebooks.children[k].children);
for (var i = 0; i < get_fields.length; i++) {
if (fields[get_fields[i].attrs.name].type == 'one2many'){
self.relational_fields = get_fields[i].attrs.name;
if(fields[get_fields[i].attrs.name].views.form){
var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children);
var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields;
var notebook=fields[get_fields[i].attrs.name].views.form.arch;
}
}
}
}
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(QWeb.render("FormView", {'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' }));
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('h1').html(head_title);
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}
else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
}
else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
var selected_id = $(this).prev().find('select').val();
var select_model = $(this).prev().find('select').attr('for');
if(selected_id!="false"){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
}
}
});
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
}else{
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
}
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(QWeb.render("FormView", {'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' }));
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('h1').html(head_title);
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}
else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
}
else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
var selected_id = $(this).prev().find('select').val();
var select_model = $(this).prev().find('select').attr('for');
if(selected_id!="false"){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
}
}
});
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
}else{
$.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true);
}
});
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
}else{
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
}
});
}
});
$.mobile.changePage("#"+self.element_id, "slide", false, true);
});
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
}else{
$.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true);
}
});
}
});
$.mobile.changePage("#"+self.element_id, "slide", false, true);
});
});
},
get_fields: function(view_fields, fields) {
@ -269,4 +260,5 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({
return this.fields;
}
});
};

View File

@ -10,8 +10,7 @@ openerp.web_mobile.ListView = openerp.web.Widget.extend({
this.list_id = list_id;
},
start: function() {
this.rpc('/web/menu/action', {'menu_id': this.list_id},
this.on_menu_action_loaded);
this.rpc('/web/menu/action', {'menu_id': this.list_id}, this.on_menu_action_loaded);
},
on_menu_action_loaded: function(data) {
var self = this;
@ -30,11 +29,10 @@ openerp.web_mobile.ListView = openerp.web.Widget.extend({
$.mobile.changePage("#oe_menu", "slide", false, true);
});
self.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
if (!$('#oe_shortcuts').html().length) {
this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}
else{
}else{
$.mobile.changePage("#oe_shortcuts", "slide", false, true);
}
});
@ -42,8 +40,7 @@ openerp.web_mobile.ListView = openerp.web.Widget.extend({
if(!$('#oe_options').html().length){
this.options = new openerp.web_mobile.Options(self, "oe_options");
this.options.start();
}
else{
}else{
$.mobile.changePage("#oe_options", "slide", false, true);
}
});
@ -58,7 +55,6 @@ openerp.web_mobile.ListView = openerp.web.Widget.extend({
ev.stopPropagation();
id = $record.data('id');
head_title = $.trim($record.text());
if(!$('[id^="oe_form_'+id+this.action.res_model+'"]').html()){
$('<div id="oe_form_'+id+this.action.res_model+'" data-role="page" data-url="oe_form_'+id+this.action.res_model+'"> </div>').appendTo('#moe');
this.formview = new openerp.web_mobile.FormView(this, "oe_form_"+id+this.action.res_model, id, this.action, head_title, '' ,'');

View File

@ -41,7 +41,6 @@
<div data-role="footer" data-theme="b" data-position="fixed">
<h1>Powered by openerp.com</h1>
</div>
</t>
<t t-name="Header">
@ -75,6 +74,7 @@
</div>
<t t-call="Footer" />
</t>
<t t-name="Menu">
<t t-call="Header" />
<div id="content" data-role="content">
@ -95,19 +95,19 @@
<t t-foreach="menu.children" t-as="menu1" >
<ul data-dividertheme="b" data-theme="c" data-inset="true" data-role="listview">
<li data-role="list-divider">
<t t-if="(menu1.children.length)">
<t t-esc="menu1.name"/>
<t t-if="(menu1.children.length)">
<t t-esc="menu1.name"/>
</t>
<t t-if="!(menu1.children.length)">
<a href="#" t-attf-id="menu_#{menu1.id}" t-att-data-menu="menu1.id" t-att-data-name="menu1.name">
<t t-esc="menu1.name"/>
</a>
</t>
<a href="#" t-attf-id="menu_#{menu1.id}" t-att-data-menu="menu1.id" t-att-data-name="menu1.name">
<t t-esc="menu1.name"/>
</a>
</t>
</li>
<t t-if="menu1.children.length">
<li data-theme="c" t-foreach="menu1.children" t-as="childmenu" >
<a href="#" t-attf-id="menu_#{childmenu.id}" t-att-data-menu="childmenu.id" t-att-data-name="childmenu.name">
<t t-esc="childmenu.name" />
<t t-esc="childmenu.name" />
</a>
</li>
</t>
@ -116,6 +116,7 @@
</div>
<t t-call="Footer" />
</t>
<t t-name="Options">
<t t-call="Header" />
<div data-role="content">
@ -141,11 +142,11 @@
</div>
<t t-call="Footer" />
</t>
<t t-name="FormView">
<t t-if="temp_flag">
<t t-call="Header" />
</t>
<div data-role="content">
<form>
<t t-foreach="get_fields" t-as="field">
@ -181,19 +182,18 @@
<t t-if="field.attrs.string" t-esc="field.attrs.string"></t>:
</label>
<t t-if="values[field.attrs.name] and field.attrs.name=='progress_rate'">
<div id="progress" value="" title="Percent of tasks closed according to total of tasks to do..."></div>
<div id="progress" value="" title="Percent of tasks closed according to total of tasks to do..."></div>
</t>
<t t-if="!(values[field.attrs.name]) and field.attrs.name=='progress_rate'">
<div id="progress" value="" title="Percent of tasks closed according to total of tasks to do..."></div>
<div id="progress" value="" title="Percent of tasks closed according to total of tasks to do..."></div>
</t>
<t t-if="values[field.attrs.name] and field.attrs.name!='progress_rate'">
<input id="" type="text" t-att-value="values[field.attrs.name]"/>
</t>
<t t-if="!values[field.attrs.name] and field.attrs.name!='progress_rate'">
<input id="" type="text" value=""/>
<input id="" type="text" value=""/>
</t>
</t>
<t t-if="fields[field.attrs.name].type == 'date'">
<label for="">
<t t-if="!(field.attrs.string)" t-esc="fields[field.attrs.name].string"></t>
@ -276,23 +276,17 @@
</t>
</div>
</t>
<t t-if="notebooks">
<t t-if="notebooks">
<div data-role="collapsible-set">
<t t-foreach="notebooks.children" t-as="page">
<t t-if="page.attrs.invisible">
<div style="display:none;" data-collapsed="true" data-role="collapsible" t-att-id="page.attrs.string">
<h3>
<t t-esc="page.attrs.string"></t>
</h3>
<p></p>
<h3><t t-esc="page.attrs.string"></t></h3>
</div>
</t>
<t t-if="!page.attrs.invisible">
<div data-collapsed="true" data-role="collapsible" t-att-id="page.attrs.string">
<h3>
<t t-esc="page.attrs.string"></t>
</h3>
<p></p>
<h3><t t-esc="page.attrs.string"></t></h3>
</div>
</t>
</t>