diff -Nuar python-exe.orig/exe/engine/appletidevice.py python-exe/exe/engine/appletidevice.py
--- python-exe.orig/exe/engine/appletidevice.py 2011-06-02 12:23:55.641630293 +0200
+++ python-exe/exe/engine/appletidevice.py 2011-06-02 12:55:40.977630042 +0200
@@ -35,7 +35,7 @@
log = logging.getLogger(__name__)
# Constants
-GEOGEBRA_FILE_NAMES = set(["geogebra.jar", "geogebra_cas.jar", "geogebra_export.jar", "geogebra_gui.jar", "geogebra_properties.jar"])
+GEOGEBRA_FILE_NAMES = set(["geogebra_main.jar","geogebra.jar", "geogebra_cas.jar", "geogebra_export.jar", "geogebra_gui.jar", "geogebra_properties.jar"])
# ===========================================================================
diff -Nuar python-exe.orig/exe/engine/config.py python-exe/exe/engine/config.py
--- python-exe.orig/exe/engine/config.py 2011-06-02 12:23:55.641630293 +0200
+++ python-exe/exe/engine/config.py 2011-06-02 12:55:40.981630042 +0200
@@ -32,6 +32,8 @@
import os
import gettext
import tempfile
+from socket import *
+import commands
# ===========================================================================
class Config:
@@ -115,7 +117,18 @@
self.loadStyles()
self.loadLocales()
-
+
+ def isOPort(self,port):
+
+ targetIP = gethostbyname('localhost')
+ s = socket(AF_INET, SOCK_STREAM)
+ result = s.connect_ex((targetIP,int(port)))
+ s.close()
+ if(result == 0) :
+ return True
+ else :
+ return False
+
def _overrideDefaultVals(self):
"""
Override this to override the
@@ -230,6 +243,21 @@
if value == "1" or value == "yes" or value == "true" or \
value == "on":
self.assumeMediaPlugins = True;
+
+ if (os.environ['DISPLAY'] != ":0.0"):
+ proc_user=commands.getoutput("pgrep -U $USERNAME -f -c '/usr/bin/exe'")
+ if (int(proc_user) > 2): exit(0)
+ print("Searching for open port...%s" %proc_user)
+ count=0
+ max_port=255
+ while self.port < 65535 and count < max_port:
+ print("Checking if open port %s" %(self.port))
+ if (self.isOPort(self.port)):
+ self.port+=1
+ count+=1
+ else:
+ print("Found port at %s" %(self.port))
+ break
# If the dataDir points to some other dir, fix it
if not self.dataDir.isdir():
diff -Nuar python-exe.orig/exe/engine/freetextidevice.py python-exe/exe/engine/freetextidevice.py
--- python-exe.orig/exe/engine/freetextidevice.py 2011-06-02 12:23:55.645630159 +0200
+++ python-exe/exe/engine/freetextidevice.py 2011-06-02 12:55:40.981630042 +0200
@@ -34,7 +34,7 @@
"""
persistenceVersion = 7
- def __init__(self, content=""):
+ def __init__(self, content="", type=None, parent=None):
Idevice.__init__(self, x_(u"Free Text"),
x_(u"University of Auckland"),
x_(u"""The majority of a learning resource will be
@@ -50,8 +50,17 @@
self.content.idevice = self
if content:
self.edit = False
+ self.type = type
+ self.parent = parent
+ self.childs = []
+ if parent:
+ self.parent.childs.append(self)
+
+ def setContent(self, content_w_resourcePaths="", content_wo_resourcePaths=""):
+ self.content.content = content_w_resourcePaths
+ self.content.content_w_resourcePaths = content_w_resourcePaths
+ self.content.content_wo_resourcePaths = content_wo_resourcePaths
-
def getResourcesField(self, this_resource):
"""
implement the specific resource finding mechanism for this iDevice:
diff -Nuar python-exe.orig/exe/exe python-exe/exe/exe
--- python-exe.orig/exe/exe 2010-10-20 09:38:51.000000000 +0200
+++ python-exe/exe/exe 2011-06-02 13:26:52.729630048 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# ===========================================================================
# eXe
# Copyright 2004-2005, University of Auckland
diff -Nuar python-exe.orig/exe/run-exe.sh python-exe/exe/run-exe.sh
--- python-exe.orig/exe/run-exe.sh 2010-10-19 13:08:15.000000000 +0200
+++ python-exe/exe/run-exe.sh 2010-09-16 11:34:34.621560000 +0200
@@ -5,4 +5,6 @@
# Doesn't do anything but run exe now
+sleep 3s
+
python $(dirname $0)/exe
diff -Nuar python-exe.orig/exe/webui/block.py python-exe/exe/webui/block.py
--- python-exe.orig/exe/webui/block.py 2010-10-19 13:08:15.000000000 +0200
+++ python-exe/exe/webui/block.py 2011-06-02 13:11:01.493630050 +0200
@@ -341,7 +341,7 @@
"""
html = common.submitImage(u"edit", self.id,
u"/images/stock-edit.png",
- _(u"Edit"), self.package.isChanged)
+ _(u"Edit"), self.package.isChanged, True)
return html
# ===========================================================================
diff -Nuar python-exe.orig/exe/webui/common.py python-exe/exe/webui/common.py
--- python-exe.orig/exe/webui/common.py 2010-10-19 13:08:15.000000000 +0200
+++ python-exe/exe/webui/common.py 2011-06-02 12:55:40.989630042 +0200
@@ -251,7 +251,7 @@
return button(name, value, enabled, **kwparams)
-def submitImage(action, object_, imageFile, title=u"", isChanged=1):
+def submitImage(action, object_, imageFile, title=u"", isChanged=1, relative=False):
"""
Adds an image link which will trigger the javascript needed to
post a form with the action and object passed in the args
@@ -260,8 +260,11 @@
titleText = u''
if title:
titleText = u'title="%s" ' % title
+ relativeText = u''
+ if relative:
+ relativeText = u'style="position:relative;z-index:100000"'
html = u'' % onclick
+ html += u' href="#" onclick="%s" %s>' % (onclick, relativeText)
html += u'' % (title, imageFile)
html += u'\n'
return html
diff -Nuar python-exe.orig/exe/webui/element.py python-exe/exe/webui/element.py
--- python-exe.orig/exe/webui/element.py 2010-10-19 13:08:15.000000000 +0200
+++ python-exe/exe/webui/element.py 2011-06-02 12:55:40.989630042 +0200
@@ -27,6 +27,7 @@
from exe.webui import common
from exe.engine.path import Path
from exe import globals as G
+from urllib import quote
log = logging.getLogger(__name__)
@@ -198,16 +199,22 @@
return
if self.id in request.args:
+ if not hasattr(self.field_idevice,'type') or \
+ ( hasattr(self.field_idevice,'type') and self.field_idevice.type != 'frameset'):
# process any new images and other resources courtesy of tinyMCE:
- self.field.content_w_resourcePaths \
- = self.field.ProcessPreviewed(request.args[self.id][0])
- # likewise determining the paths for exports, etc.:
- self.field.content_wo_resourcePaths \
- = self.field.MassageContentForRenderView( \
- self.field.content_w_resourcePaths)
- # and begin by choosing the content for preview mode, WITH paths:
- self.field.content = self.field.content_w_resourcePaths
+ self.field.content_w_resourcePaths \
+ = self.field.ProcessPreviewed(request.args[self.id][0])
+ # likewise determining the paths for exports, etc.:
+ self.field.content_wo_resourcePaths \
+ = self.field.MassageContentForRenderView( \
+ self.field.content_w_resourcePaths)
+ # and begin by choosing the content for preview mode, WITH paths:
+ self.field.content = self.field.content_w_resourcePaths
+ if hasattr(self.field_idevice,'type') and self.field_idevice.type:
+ r = open(self.field_idevice.userResources[0].path,'w')
+ r.write(self.field.content_wo_resourcePaths.encode('utf-8'))
+ r.close()
def renderEdit(self):
@@ -237,7 +244,20 @@
# to render, choose the content with the preview-able resource paths:
self.field.content = self.field.content_w_resourcePaths
- content = re.sub(r'(?i)<\s*a[^>]+>',
+ if hasattr(self.field_idevice,'type') and self.field_idevice.type == 'frameset':
+ content ='\n'
+ content +='\n' % (quote(self.field_idevice.userResources[0].storageName))
+ else:
+ content = re.sub(r'(?i)<\s*a[^>]+>',
lambda mo: replaceLinks(mo, self.field.idevice.parentNode.package.name),
self.field.content)
return self.renderView(content=content, visible=visible, \
@@ -249,7 +269,7 @@
Returns an XHTML string for viewing or previewing this element
"""
if visible:
- visible = 'style="display:block"'
+ visible = 'style="display:block;position:relative"'
else:
visible = 'style="display:none"'
if content is None:
diff -Nuar python-exe.orig/exe/webui/freetextblock.py python-exe/exe/webui/freetextblock.py
--- python-exe.orig/exe/webui/freetextblock.py 2010-10-19 13:08:15.000000000 +0200
+++ python-exe/exe/webui/freetextblock.py 2011-06-02 12:55:40.989630042 +0200
@@ -76,7 +76,7 @@
"""
Returns an XHTML string with the form element for editing this block
"""
- html = u"