Browse Source

display status messages when saved successfully and hide the texture forms for murmur 1.2.2

Natenom/support-murmur-13-1446181288462
Michael Ziegler 14 years ago
parent
commit
4180ea8ca2
  1. 17
      pyweb/djextdirect/formprovider.py
  2. 56
      pyweb/mumble/templates/mumble/mumble.html

17
pyweb/djextdirect/formprovider.py

@ -50,6 +50,18 @@ Ext.ux.%(clsname)s = function( config ){
if( typeof config.pk != "undefined" ){ if( typeof config.pk != "undefined" ){
this.load(); this.load();
} }
this.form.addEvents({
'submitSuccess': true,
'submitFailure': true
});
if( typeof config.listeners != "undefined" ){
if( typeof config.listeners.submitSuccess != "undefined" )
this.form.on("submitSuccess", config.listeners.submitSuccess);
if( typeof config.listeners.submitFailure != "undefined" )
this.form.on("submitFailure", config.listeners.submitFailure);
}
} }
Ext.extend( Ext.ux.%(clsname)s, Ext.form.FormPanel, { Ext.extend( Ext.ux.%(clsname)s, Ext.form.FormPanel, {
@ -64,6 +76,10 @@ Ext.extend( Ext.ux.%(clsname)s, Ext.form.FormPanel, {
typeof action.result.errors['__all__'] != 'undefined' ){ typeof action.result.errors['__all__'] != 'undefined' ){
Ext.Msg.alert( "Error", action.result.errors['__all__'] ); Ext.Msg.alert( "Error", action.result.errors['__all__'] );
} }
form.fireEvent("submitFailure", form, action);
},
success: function( form, action ){
form.fireEvent("submitSuccess", form, action);
} }
}); });
}, },
@ -267,6 +283,7 @@ class FormProvider(Provider):
"""buttons: [{ """buttons: [{
text: "Submit", text: "Submit",
handler: this.submit, handler: this.submit,
id: '"""+clsname+"""_submit',
scope: this scope: this
}]""" }]"""
'}', '}',

56
pyweb/mumble/templates/mumble/mumble.html

@ -119,19 +119,70 @@
xtype: "{{ RegForm|lower }}", xtype: "{{ RegForm|lower }}",
pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %}, pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %},
labelWidth: 150, labelWidth: 150,
baseParams: {serverid: {{MumbleServer.id}} }
baseParams: {serverid: {{MumbleServer.id}} },
{% if not MumbleAccount %}
listeners: {
submitSuccess: function( form, action ){
window.location.reload();
}
}
{% else %}
listeners: {
submitSuccess: function( form, action ){
form.savetip = new Ext.ToolTip({
id: 'content-anchor-tip',
target: '{{ RegForm }}_submit',
anchor: 'right',
html: gettext("Saved successfully."),
width: 150,
autoHide: true,
listeners: {
hide: function( ttip ){
form.savetip.destroy();
form.savetip = null;
}
}
});
form.savetip.show();
}
}
{% endif %}
}, },
{% if IsAdmin %} {% if IsAdmin %}
{ {
title: gettext("Administration"), title: gettext("Administration"),
pk: {{ MumbleServer.id }}, pk: {{ MumbleServer.id }},
labelWidth: 150, labelWidth: 150,
xtype: 'mumbleform'
xtype: 'mumbleform',
listeners: {
submitSuccess: function( form, action ){
form.savetip = new Ext.ToolTip({
id: 'content-anchor-tip',
target: 'MumbleForm_submit',
anchor: 'right',
html: gettext("Saved successfully."),
width: 150,
autoHide: true,
listeners: {
hide: function( ttip ){
form.savetip.destroy();
form.savetip = null;
}
}
});
form.savetip.show();
}
}
}, },
{% endif %} {% endif %}
{% if MumbleAccount %} {% if MumbleAccount %}
{ {
title: gettext("User texture"), title: gettext("User texture"),
{% if MumbleServer|mmversion_eq:"1.2.2" %}
html: gettext(
'Sorry, due to a bug in Murmur 1.2.2, displaying and setting the Texture is disabled.'
)
{% else %}
layout: "border", layout: "border",
items: [{ items: [{
region: "north", region: "north",
@ -181,6 +232,7 @@
} }
}] }]
}] }]
{% endif %}
}, },
{% endif %} {% endif %}
{% if IsAdmin %} {% if IsAdmin %}

Loading…
Cancel
Save