merged live

This commit is contained in:
Rushabh Mehta 2011-08-16 10:03:31 +05:30
commit d8b9bae669
11 changed files with 207 additions and 54 deletions

View File

@ -14,4 +14,49 @@ span.home-status-unread {
font-size: 11px;
color: #FFF;
background-color: RED;
}
}
div.setup-wizard {
display: none;
margin: 13px 0px;
background-color: #FED;
padding: 13px;
}
div.setup-wizard .header {
font-size: 12px;
font-weight: bold;
color: #322;
margin-bottom: 7px;
}
div.setup-wizard .percent-outer {
height: 17px;
background-color: #FFF;
border: 2px solid #322;
}
div.setup-wizard .percent-inner {
height: 17px;
background-color: GREEN;
}
div.setup-wizard .suggestion {
margin: 7px 0px;
color: #322;
}
div.setup-wizard .prev-next {
height: 13px;
}
div.setup-wizard .prev-next span {
display: none;
float: right;
margin-left: 13px;
color: #877;
font-size: 11px;
}

View File

@ -24,8 +24,8 @@ pscript.home_make_body = function() {
wrapper.head = $a(wrapper.body, 'div');
wrapper.banner_area = $a(wrapper.head, 'div');
wrapper.toolbar_area = $a(wrapper.head, 'div');
wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard')
wrapper.system_message_area = $a(wrapper.body, 'div', '',
{marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'})
@ -612,7 +612,6 @@ pscript.home_make_status = function() {
// get values
$c_page('home', 'event_updates', 'get_status_details', user,
function(r,rt) {
home_status_bar.render(r.message);
// system_messages
@ -622,6 +621,11 @@ pscript.home_make_status = function() {
// render online users
pscript.online_users_obj.render(r.message.online_users);
pscript.online_users = r.message.online_users;
// setup wizard
if(r.message.setup_status) {
new SetupWizard(r.message.setup_status)
}
}
);
}
@ -633,7 +637,7 @@ pscript.show_system_message = function(wrapper, msg) {
var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'});
txt.innerHTML = msg;
var span = $ln($a(wrapper.system_message_area, 'div'), 'Dismiss',
var span = $ln($a(wrapper.system_message_area, 'div', '', {textAlign:'right'}), 'Dismiss'.bold(),
function(me) {
me.set_working();
$c_obj('Home Control', 'dismiss_message', '', function(r,rt) {
@ -729,3 +733,53 @@ pscript.validate_fields = function(d)
if(!flag) alert(msg);
return flag;
}
SetupWizard = function(status) {
var me = this;
$.extend(this, {
make: function(status) {
me.status = status;
me.wrapper = page_body.pages['Event Updates'].setup_wizard_area;
$ds(me.wrapper);
me.make_percent(status.percent);
me.make_suggestion(status.ret);
},
make_percent: function(percent) {
$a(me.wrapper, 'div', 'header', {}, 'Your setup is '+percent+'% complete');
var o = $a(me.wrapper, 'div', 'percent-outer');
$a(o, 'div', 'percent-inner', {width:percent + '%'});
},
make_suggestion: function(ret) {
me.suggest_area = $a(me.wrapper, 'div', 'suggestion');
if(me.status.ret.length>1) {
me.prev_next = $a(me.wrapper, 'div', 'prev-next');
// next
me.next = $a(me.prev_next, 'span', 'link_type', null, 'Next Suggestion',
function() { me.show_suggestion(me.cur_sugg+1) });
// prev
me.prev = $a(me.prev_next, 'span', 'link_type', null, 'Previous Suggestion',
function() { me.show_suggestion(me.cur_sugg-1) });
}
if(me.status.ret.length) {
me.show_suggestion(0);
} else {
me.suggest_area.innerHTML = 'Congratulations: '.bold() + 'You are now on your track... Good luck';
}
},
show_suggestion: function(idx) {
me.cur_sugg = idx;
me.suggest_area.innerHTML = 'What you can do next: '.bold() + me.status.ret[idx];
// show hide prev, next
if(me.status.ret.length>1) {
$dh(me.prev); $dh(me.next);
if(idx>0) $ds(me.prev);
if(idx<me.status.ret.length-1) $ds(me.next);
}
}
})
this.make(status);
}

View File

@ -35,11 +35,51 @@ def get_status_details(arg=None):
if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']):
msg = webnotes.conn.get_global('system_message')
return {
ret = {
'user_count': len(online) or 0,
'unread_messages': get_unread_messages(),
'online_users': online or [],
'system_message':msg,
'is_trial': webnotes.conn.get_global('is_trial'),
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0')
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
'setup_status': get_setup_status()
}
return ret
def get_setup_status():
"""
Returns the setup status of the current account
"""
if cint(webnotes.conn.get_global('setup_done')):
return ''
percent = 20
ret = []
if not webnotes.conn.get_value('Personalize', None, 'header_html'):
ret.append('<a href="#!Form/Personalize/Personalize">Upload your company banner</a>')
else:
percent += 20
def check_type(doctype, ret, percent):
if not webnotes.conn.sql("select count(*) from tab%s" % doctype)[0][0]:
ret.append('''
<a href="#!Form/%(dt)s/New">
Create a new %(dt)s
</a> or
<a href="#!Import Data/%(dt)s">
Import from a spreadsheet</a>''' % {'dt':doctype})
else:
percent += 20
return ret, percent
ret, percent = check_type('Item', ret, percent)
ret, percent = check_type('Customer', ret, percent)
ret, percent = check_type('Supplier', ret, percent)
if percent==100:
webnotes.conn.set_global('setup_done', '1')
return ''
return {'ret': ret, 'percent': percent}

View File

@ -174,4 +174,4 @@ KBAnswer = function(body, data) {
}
$import(knowledge_base.kb_common);
$import(knowledge_base/page/kb_common/kb_common.js);

View File

@ -203,4 +203,4 @@ KBQuestion = function(parent, det, kb) {
this.make()
}
$import(knowledge_base.kb_common);
$import(knowledge_base/page/kb_common/kb_common.js);

View File

@ -15,7 +15,7 @@
'doctype': 'Page',
'module': 'Knowledge Base',
'name': '__common__',
'page_name': 'Questions',
'page_name': 'questions',
'standard': 'Yes'
},

View File

@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
last_patch = 337
last_patch = 338
#-------------------------------------------
@ -1373,3 +1373,7 @@ def execute(patch_no):
sp_acx[i+1] = '"'.join(sp_quot)
html = "acx=".join(sp_acx)
webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item))
elif patch_no == 338:
# update name of questions page
sql("update tabPage set name='questions' where name='Questions'")
sql("update tabPage set name='question-view' where name='Question View'")

View File

@ -28,4 +28,4 @@ class DocType:
#
def set_html_from_image(self):
file_name = self.doc.file_list.split(',')[0]
self.doc.header_html = '<div><img src="cgi-bin/getfile.cgi?name=' + file_name + '"/></div>'
self.doc.header_html = '<div><img style="max-height: 120px; max-width: 600px" src="index.cgi?cmd=get_file&fname=' + file_name + '"/></div>'

View File

@ -32,7 +32,7 @@
</tbody>
</table>
</form>
<div style="background-color: #FFE; padding: 10px; margin: 10px;">
<div style="background-color: #FFE; padding: 13px; margin: 17px;">
<h3>Data Import Guide</h3>
<ol>
<li>Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.</li>

View File

@ -1,45 +1,55 @@
pscript['onload_Import Data'] = function() {
//alert(profile.can_get_report);
//alert(profile.can_get_report);
callback = function(r,rt) {
var h = new PageHeader('di_header','Import Data','Tool to download template and upload data');
var sel = $i('import_template');
if(r.message){
add_sel_options(sel, r.message);
sel.onchange=function(){
$i('child_tab_lst').innerHTML ='';
if(sel.value != 'Select Master...'){
$c_obj('Import Data Control','get_child_lst',sel.value,
function(r,rt){
var me = this;
$y($i('child_tab_lst'),{backgroundColor:'#EEEEEE'})
var desc = $a($i('child_tab_lst'), 'div', '', {padding:'8px'});
desc.innerHTML = "<h4>Please click on following link(s) to download template.</h4>";
callback = function(r,rt) {
var h = new PageHeader('di_header','Import Data','Tool to download template and upload data');
var sel = $i('import_template');
if(r.message){
add_sel_options(sel, r.message);
// please collapse here when editing :)
sel.onchange=function(){
$i('child_tab_lst').innerHTML ='';
if(sel.value != 'Select Master...'){
$c_obj('Import Data Control','get_child_lst',sel.value,
function(r,rt){
var me = this;
$y($i('child_tab_lst'),{backgroundColor:'#EEEEEE', margin: '17px 17px', padding: '13px'})
var desc = $a($i('child_tab_lst'), 'div', '', {padding:'4px'});
desc.innerHTML = "<b>Download template(s) for importing "+sel_val(sel)+"</b>";
var parent = $a($i('child_tab_lst'), 'div');
var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'8px',fontSize:'15px',borderCollapse: 'collapse'});
for(var i=0;i<r.message.length;i++){
var dt= $a($td(tab,i,0), 'span', 'link_type');
dt.innerHTML = r.message[i];
dt.nm = r.message[i];
dt.onclick = function(){
var ovr = $('input[name="overwrite"]:checked').length;
window.location = outUrl + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
}
}
}
);
}
}
}
}
$c_obj('Import Data Control','get_master_lst','',callback);
var parent = $a($i('child_tab_lst'), 'div');
var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'3px',borderCollapse: 'collapse'});
for(var i=0;i<r.message.length;i++){
var dt= $a($td(tab,i,0), 'span', 'link_type');
dt.innerHTML = r.message[i];
dt.nm = r.message[i];
dt.onclick = function(){
var ovr = $('input[name="overwrite"]:checked').length;
window.location = outUrl + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
}
}
}
);
}
}
}
// set the default (if given in url)
if(window.location.hash) {
var to_set = window.location.hash.split('/').slice(-1)[0];
if(in_list(r.message, to_set)) {
sel.value = to_set;
sel.onchange();
}
}
}
$c_obj('Import Data Control','get_master_lst','',callback);
}

View File

@ -85,14 +85,14 @@ We will get back to you as soon as possible
[This is an automatic response]
""" + signature)
""" + (signature or ''))
from webnotes.utils.email_lib import sendmail
sendmail(\
recipients = [d.raised_by], \
sender = self.email_settings.support_email, \
subject = '['+d.name+'] ' + d.subject, \
subject = '['+d.name+'] ' + str(d.subject or ''), \
msg = response)
def auto_close_tickets(self):