Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <gonzalo@nautilus.localdomain>2009-12-16 01:16:02 (GMT)
committer Gonzalo Odiard <gonzalo@nautilus.localdomain>2009-12-16 01:16:02 (GMT)
commitdbab1f8887a7dbedfd1eadb90458018a18dcb73a (patch)
treef7112ce84ce103a966a446e2b8b0ceaeb9a71867
parentd470ef28f65cd5c5bceb8338ab1e6d7a2cc473ac (diff)
correciones esteticas para que entre bien en la pantalla de la xoHEADmaster
grabacion correcta de las notas en la xo
-rw-r--r--ElementsActivity.py15
-rw-r--r--activity/activity.info2
-rw-r--r--web/tabla_elem.xsl39
-rw-r--r--web/utiles.js74
4 files changed, 119 insertions, 11 deletions
diff --git a/ElementsActivity.py b/ElementsActivity.py
index 62bee1d..36f6f21 100644
--- a/ElementsActivity.py
+++ b/ElementsActivity.py
@@ -12,6 +12,9 @@ class ElementsActivity (activity.Activity):
activity.Activity.__init__(self, handle)
self.set_title('Elements')
+ act_root = self.get_activity_root()
+ path_data = os.path.join(act_root, "data")
+ self.file_name = os.path.join(path_data,"datos.js")
# The XOCom object helps us communicate with the browser
# This uses web/index.html as the default page to load
self.xocom = XOCom("file://"+os.path.join(os.path.dirname(os.path.abspath(__file__)),"web/allelements.xml"))
@@ -22,11 +25,11 @@ class ElementsActivity (activity.Activity):
self.set_canvas( self.xocom.create_webview() )
- #self.read_file(os.path.join(os.path.dirname(os.path.abspath(__file__)),"datos.txt"))
+ self.read_file(self.file_name)
def write_file(self, filename):
- filename = os.path.join(os.path.dirname(os.path.abspath(__file__)),"web/datos.js")
+ print "Grabando", filename
content = self.xocom.send_to_browser('write')
if content:
@@ -35,8 +38,12 @@ class ElementsActivity (activity.Activity):
fh.close()
def read_file(self, filename):
- fh = open(filename, 'r')
- content = fh.read()
+ print "Leyendo", filename
+ content = "textos = new Array();"
+ if os.path.exists(filename):
+ fh = open(filename, 'r')
+ content = fh.read()
+ print content
def send_delayed_read():
self.xocom.send_to_browser('read', content)
return False
diff --git a/activity/activity.info b/activity/activity.info
index d9b6750..37449f6 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -3,5 +3,5 @@ name = ElementsActivity
service_name = com.Eq.Elements
class = ElementsActivity.ElementsActivity
icon = activity-elements
-activity_version = 1
+activity_version = 2
show_launcher = yes
diff --git a/web/tabla_elem.xsl b/web/tabla_elem.xsl
index d95be35..9c04d72 100644
--- a/web/tabla_elem.xsl
+++ b/web/tabla_elem.xsl
@@ -13,7 +13,6 @@
<script language="javascript" type="text/javascript" src="jquery.js"></script>
<script language="javascript" type="text/javascript" src="xocom.js"></script>
-<script language="javascript" type="text/javascript" src="datos.js"></script>
<script language="javascript" type="text/javascript" src="utiles.js"></script>
<script language="javascript" type="text/javascript">
@@ -153,7 +152,33 @@
color:black;
}
-
+ #loading {
+ z-index:2;
+ position:absolute;
+ border: 2px solid black;
+ text-align:center;
+ background:#bbbbbb;
+ left:300px;
+ top:150px;
+ -moz-border-radius:5px;
+ color:black;
+ padding:50px;
+ }
+
+
+ #dhtmltooltip{
+ text-align:center;
+ position: absolute;
+ width: 120px;
+ border: 1px solid black;
+ padding: 2px;
+ background-color: lightyellow;
+ visibility: hidden;
+ z-index: 100;
+ -moz-border-radius:3px;
+ }
+
+
</style>
@@ -173,6 +198,10 @@
<textarea cols="80" rows="5" name="editedText" id="editedText"></textarea>
</div>
+ <div id="dhtmltooltip"></div>
+
+ <p id="loading">Cargando</p>
+
<div id="wiki" style="display:none">
<div id="cerrar" onclick="cerrarWiki()">X</div>
<iframe id="wikiBody">
@@ -288,7 +317,11 @@
</xsl:choose>
- <xsl:attribute name="onclick">javascript:mostrar('<xsl:value-of select="SYMBOL"/>','<xsl:value-of select="NOMBRE"/>','<xsl:value-of select="NAME"/>','<xsl:value-of select="ATOMIC_WEIGHT"/>','<xsl:value-of select="ATOMIC_NUMBER"/>','<xsl:value-of select="WIKIPEDIA"/>')</xsl:attribute>
+ <xsl:attribute name="onclick">mostrar('<xsl:value-of select="SYMBOL"/>','<xsl:value-of select="NOMBRE"/>','<xsl:value-of select="NAME"/>','<xsl:value-of select="ATOMIC_WEIGHT"/>','<xsl:value-of select="ATOMIC_NUMBER"/>','<xsl:value-of select="WIKIPEDIA"/>')</xsl:attribute>
+
+ <xsl:attribute name="onMouseover">ddrivetip('<xsl:value-of select="NOMBRE"/>')</xsl:attribute>
+ <xsl:attribute name="onMouseout">hideddrivetip()</xsl:attribute>
+
<div align="center">
<xsl:value-of select="SYMBOL"/>
</div>
diff --git a/web/utiles.js b/web/utiles.js
index 7d88de3..221be4a 100644
--- a/web/utiles.js
+++ b/web/utiles.js
@@ -96,17 +96,16 @@
XO.register('read', function(content) {
// Your code to consume the supplied content
- /*
if (content != '') {
try {
- eval("textos = "+content);
+ //$("#loading").html(content);
+ eval(content);
} catch(err) {
textos = new Array();
}
}
$("#loading").fadeOut('slow');
mostrado = false;
- */
})
@@ -126,5 +125,74 @@
return persistent;
})
+// Tooltip (basado en http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm)
+
+ var offsetxpoint=-60; //Customize x offset of tooltip
+ var offsetypoint=20; //Customize y offset of tooltip
+ var ie=document.all;
+ var ns6=document.getElementById && !document.all;
+ var enabletip=false;
+
+ if (ie||ns6)
+ var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
+
+ function ietruebody() {
+ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
+ }
+
+ function ddrivetip(thetext, thecolor, thewidth) {
+ if (ns6||ie){
+ if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
+ if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
+ tipobj.innerHTML=thetext;
+ enabletip=true;
+ return false;
+ }
+ }
+
+ function positiontip(e) {
+ if (enabletip) {
+ var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
+ var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
+ //Find out how close the mouse is to the corner of the window
+ var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
+ var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
+
+ var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;
+
+ //if the horizontal distance isn't enough to accomodate the width of the context menu
+ if (rightedge<tipobj.offsetWidth)
+ //move the horizontal position of the menu to the left by it's width
+ tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
+ else if (curX<leftedge)
+ tipobj.style.left="5px";
+ else
+ //position the horizontal position of the menu where the mouse is positioned
+ tipobj.style.left=curX+offsetxpoint+"px";
+
+ //same concept with the vertical position
+ if (bottomedge<tipobj.offsetHeight)
+ tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
+ else
+ tipobj.style.top=curY+offsetypoint+"px";
+ tipobj.style.visibility="visible";
+ }
+ }
+
+ function hideddrivetip() {
+ if (ns6||ie) {
+ enabletip=false;
+ tipobj.style.visibility="hidden";
+ tipobj.style.left="-1000px";
+ tipobj.style.backgroundColor='';
+ tipobj.style.width='';
+ }
+ }
+
+ document.onmousemove=positiontip;
+
+
+
+