form style and module fixes

This commit is contained in:
Rushabh Mehta 2011-06-28 21:10:05 +05:30
parent 3dcb2cfd52
commit 3ee3a7ef4d
4 changed files with 27 additions and 27 deletions

View file

@ -62,4 +62,28 @@ def get_module_path(module):
# get module path by importing the module
modules_path = os.path.join(webnotes.defs.modules_path, scrub(module))
return modules_path
return modules_path
def switch_module(dt, dn, to, frm=None, export=None):
"""
Change the module of the given doctype, if export is true, then also export txt and copy
code files from src
"""
import os
webnotes.conn.sql("update `tab"+dt+"` set module=%s where name=%s", (to, dn))
if export:
export_doc(dt, dn)
# copy code files
if dt in ('DocType', 'Page', 'Search Criteria'):
from_path = os.path.join(get_module_path(frm), scrub(dt), scrub(dn), scrub(dn))
to_path = os.path.join(get_module_path(to), scrub(dt), scrub(dn), scrub(dn))
# make dire if exists
os.system('mkdir -p %s' % os.path.join(get_module_path(to), scrub(dt), scrub(dn)))
for ext in ('py','js','html','css'):
os.system('cp %s %s')

View file

@ -1,27 +1,3 @@
#==============================================================================
# script to change the module name in the database & update svn
#==============================================================================
def change_module(dt, dn, from_module, to_module):
import os, webnotes.defs
from webnotes.modules import scrub
# change in db
webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % (dt, '%s', '%s'), (to_module, dn))
# export files
from webnotes.modules.export_module import export_to_files
export_to_files(record_list = [[dt, dn]])
if dt in ['DocType','Page','Search Criteria']:
dt, dn = scrub(dt), scrub(dn)
# svn add
webnotes.msgprint(os.popen("svn add %s" % os.path.join(webnotes.defs.modules_path, scrub(to_module), dt, dn)).read())
# svn remove
webnotes.msgprint(os.popen("svn remove %s" % os.path.join(webnotes.defs.modules_path, scrub(from_module), dt, dn)).read())
#==============================================================================

View file

@ -1,5 +1,5 @@
_f.FrmContainer=function(){this.wrapper=page_body.add_page("Forms",function(){},function(){});this.last_displayed=null;$dh(this.wrapper);this.body=$a(this.wrapper,'div');_f.frm_dialog=new _f.FrmDialog();}
_f.FrmContainer=function(){this.wrapper=page_body.add_page("Forms",function(){},function(){});this.last_displayed=null;$dh(this.wrapper);this.body=$a(this.wrapper,'div','frm_container');_f.frm_dialog=new _f.FrmDialog();}
_f.frm_dialog=null;_f.calling_doc_stack=[];_f.temp_access={};_f.FrmDialog=function(){var me=this;this.last_displayed=null;var d=new Dialog(640,null,'Edit Row');this.body=$a(d.body,'div','dialog_frm');$y(d.body,{backgroundColor:'#EEE'});d.done_btn_area=$a(d.body,'div','',{margin:'8px'});me.on_complete=function(){if(me.table_form){me.dialog.hide();}else{var callback=function(r){var dn=cur_frm.docname;if(!r.exc){me.dialog.hide();}
if(me.on_save_callback)
me.on_save_callback(dn);}

View file

@ -5,7 +5,7 @@ _f.FrmContainer = function() {
// create hidden
$dh(this.wrapper);
this.body = $a(this.wrapper,'div');
this.body = $a(this.wrapper,'div','frm_container');
// make by twin
_f.frm_dialog = new _f.FrmDialog();