Browse files

Bugfixes, workarounds, etc.

  • Loading branch information...
1 parent 9a3ea7f commit 3c3332c8846eac05b6f6608dd691d68ff3e80614 @p2k p2k committed Sep 1, 2009
View
4 media/css/pygowave-client-style.css
@@ -263,7 +263,7 @@
height: auto;
cursor: text;
overflow: visible;
- font-size: 1.2em;
+ font-size: 1.1em;
outline: none;
padding-top: 2px;
border-bottom: 1px solid #B8C6D9;
@@ -294,7 +294,7 @@
.blip_editor_widget .gadget_element iframe
{
width: 100%;
- height: 200px;
+ height: 300px;
border: 0;
}
View
2 media/js/gadget-wrapper.js
@@ -21,7 +21,7 @@
// Cut to minimum to allow cross-subdomain access
try {
- document.domain = document.domain.split('.').slice(1).join('.');
+ document.domain = document.domain.split('.').slice(-2).join('.');
}
catch (e){
document.domain = document.domain;
View
9 pygowave_client/src/controller/controller.js
@@ -113,6 +113,7 @@ pygowave.controller = $defined(pygowave.controller) ? pygowave.controller : new
this._cachedGadgetList = null;
this._deferredMessageBundles = new Array();
this._processingDeferred = false;
+ this._pendingTimer = null;
// The connection object must be stored in this.conn and must have a sendJson and subscribeWavelet method (defined below).
this.conn = new STOMPClient(); // STOMP is used as communication protocol
@@ -407,6 +408,9 @@ pygowave.controller = $defined(pygowave.controller) ? pygowave.controller : new
if (!this.isBlocked(wavelet_id)) {
this.wavelets[wavelet_id].pending = true;
+ if ($defined(this._pendingTimer))
+ $clear(this._pendingTimer);
+ this._pendingTimer = this._serverAckTimeout.delay(10000, this);
this.conn.sendJson(wavelet_id, {
type: "OPERATION_MESSAGE_BUNDLE",
@@ -417,6 +421,9 @@ pygowave.controller = $defined(pygowave.controller) ? pygowave.controller : new
});
}
},
+ _serverAckTimeout: function () {
+ this._iview.showControllerError(gettext("The server did not acknowledge the last operation within 10 seconds. This could be a bug in the client or a server crash. Try to reload."));
+ },
/**
* Queue a message bundle if the view is busy. Process it, if it is or
* goes ready.
@@ -478,6 +485,8 @@ pygowave.controller = $defined(pygowave.controller) ? pygowave.controller : new
wavelet.checkSync(blipsums);
}
else { // ACK message
+ $clear(this._pendingTimer);
+ this._pendingTimer = null;
wavelet.options.version = version;
mpending.fetch(); // Clear
if (!mcached.isEmpty())
View
27 pygowave_client/src/view/blip_editor.js
@@ -551,6 +551,20 @@ pygowave.view = $defined(pygowave.view) ? pygowave.view : new Hash();
);
}
},
+ /**
+ * Check if the parent paragraph is empty and has no trailing <br>
+ *
+ * @function {private} _fixPara
+ * @param {Node} elt
+ */
+ _fixPara: function (elt) {
+ if (!$defined(elt) || Browser.Engine.trident)
+ return;
+ while ($type(elt) != 'element' || elt.get('tag') != "p")
+ elt = elt.parentNode;
+ if (!$defined(elt.lastChild) || $type(elt.lastChild) != "element" || elt.lastChild.get('tag') != "br")
+ new Element("br").inject(elt);
+ },
/**
* Callback from model on text insertion
@@ -657,12 +671,14 @@ pygowave.view = $defined(pygowave.view) ? pygowave.view : new Hash();
elt = elt.parentElement;
while (rlength > 0 && $defined(elt)) {
next = this._nextTextOrPara(elt);
+
if ($type(elt) == "textnode") {
dellength = elt.data.length-offset;
if (dellength > rlength)
dellength = rlength;
if (dellength > 0)
elt.deleteData(offset, dellength);
+ this._fixPara(elt);
rlength -= dellength;
if (rlength > 0 && $type(next) == "element" && next.get('tag') == "p") {
// Merge, then next is empty and will be deleted
@@ -830,9 +846,16 @@ pygowave.view = $defined(pygowave.view) ? pygowave.view : new Hash();
* @param {int} offset Absolute offset to walk down
*/
_walkDown: function (body, offset) {
- var elt = body.firstChild;
+ var elt = body.firstChild, next;
- var next = this._nextTextOrPara(elt, true, true); // Try to descend to first text node
+ while ($type(elt) == "element" && elt.get('tag') != "p") { // gadget_element at start
+ elt = this._nextTextOrPara(elt, true, true);
+ offset--;
+ }
+ if (offset < 0 || elt == null)
+ return [new Element("p"), 0]; // Panic
+
+ next = this._nextTextOrPara(elt, true, true); // Try to descend to first text node
if ($type(next) == "textnode")
elt = next;
View
8 pygowave_server/context_processors.py
@@ -23,14 +23,18 @@ def server(request):
Puts IS_LOCAL setting, the VERSION and the Orbited configuration into context.
"""
+ if settings.ORBITED_PORT == "auto":
+ oport = request.META["SERVER_PORT"]
+ else:
+ oport = settings.ORBITED_PORT
return {'IS_LOCAL': settings.IS_LOCAL,
'ORBITED_SERVER': settings.ORBITED_SERVER,
- 'ORBITED_PORT': settings.ORBITED_PORT,
+ 'ORBITED_PORT': oport,
'VERSION': settings.VERSION}
def storage_urls(request):
"""
Puts AVATAR_URL and GADGET_URL into context.
"""
- return {'AVATAR_URL': settings.AVATAR_URL, 'GADGET_URL': settings.GADGET_URL}
+ return {'AVATAR_URL': settings.AVATAR_URL, 'GADGET_URL': settings.GADGET_URL}
View
7 pygowave_server/models.py
@@ -543,7 +543,10 @@ def get_data(self):
if self.properties == "":
return {}
else:
- return simplejson.loads(self.properties)
+ try:
+ return simplejson.loads(self.properties)
+ except:
+ return {}
def set_data(self, data):
"""
@@ -795,4 +798,4 @@ def instantiate(self):
def __unicode__(self):
return u"Gadget '%s' by '%s'" % (self.title, self.by_user.username)
-
+
View
2 templates/pygowave_server/waves/on_the_wave.html
@@ -10,7 +10,7 @@
<script type="text/javascript">
// Cut to minimum to allow cross-subdomain access
try {
- document.domain = document.domain.split('.').slice(1).join('.');
+ document.domain = document.domain.split('.').slice(-2).join('.');
}
catch (e){
document.domain = document.domain;

0 comments on commit 3c3332c

Please sign in to comment.