--- a/src/cm/media/css/base.css Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/media/css/base.css Fri Dec 11 12:03:51 2009 +0100
@@ -675,7 +675,7 @@
background:0;
}
-#text_view_frame_container { /* cf .ui-widget-content */
+#autoexpand_text_view_frame_container { /* cf .ui-widget-content */
border:1px solid #AAAAAA;
}
--- a/src/cm/media/js/client/c_layout.js Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/media/js/client/c_layout.js Fri Dec 11 12:03:51 2009 +0100
@@ -12,16 +12,19 @@
},
isInComentSite : function () {
- // TODO test with IE, test also when embeded
-
- var ret = false;
- try {
- ret = (!CY.Lang.isUndefined(parent) && !CY.Lang.isUndefined(parent.parent) && parent.parent.location != location && CY.Lang.isFunction(parent.parent.v_toggleFrameSize));
+ var ret = false;
+ try {
+ if (!CY.Lang.isUndefined(sv_site_url) && !CY.Lang.isUndefined(parent) && !CY.Lang.isUndefined(parent.parent)) {
+ var parentParentLocation = new String(parent.parent.location) ;
+ CY.log(parentParentLocation) ;
+ ret = (parentParentLocation.indexOf(sv_site_url) == 0);
+ }
}
catch (e) {
ret=false;
+ CY.log("error thrown while trying to access parent.parent.location") ;
}
-
+ CY.log("inComentSite returned : " + ret) ;
return ret ;
},
@@ -48,7 +51,6 @@
CY.get('#contentcolumn').setStyle('marginLeft', colWidth + 'px');
CY.get('#leftcolumn').setStyle('width', colWidth + 'px');
},
-
parentInterfaceUnfreeze : function() {
if (this.isInFrame())
parent.f_interfaceUnfreeze() ;
--- a/src/cm/media/js/site/c_text_view_comments.js Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/media/js/site/c_text_view_comments.js Fri Dec 11 12:03:51 2009 +0100
@@ -210,7 +210,7 @@
fn : function() {
if (gLayout.isInComentSite()) {
- top.v_toInitialSize();
+ parent.toInitialSize();
}
if (sv_withComments) {
instanciateICommentForm();
--- a/src/cm/media/js/site/f_text_view_frame.js Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/media/js/site/f_text_view_frame.js Fri Dec 11 12:03:51 2009 +0100
@@ -304,7 +304,7 @@
if (frames['text_view_comments'].gLayout.isInComentSite()) {
$("#c_fullscreen_btn").click( function() {
- top.v_toggleFrameSize();
+ toggleFrameSize();
});
} ;
@@ -737,3 +737,90 @@
f_setCookie = function(name, value) {
_setCookie(name, value) ;
}
+
+
+
+/*****************************************************************************/
+
+
+gInFullScreen = false;
+
+_setFrameSize = function() {
+ if (gInFullScreen) {
+ var headerHeight = parent.$("#header").height();
+ var windowHeight = parent.$(parent).height();
+ var frameHeight = (windowHeight - headerHeight - 2) + 'px'; // - 2 to prevent scrollbars ? --> TODO test it without -2
+
+ var windowWidth = parent.$(parent).width();
+ var frameWidth = (windowWidth - 2) + 'px'; // - 2 to prevent scrollbars ?// --> TODO test it without -2
+
+ // TODO we should be embeded ! shouldn't work otherwise anyway (frame security concerns)
+ parent.$("#text_view_frame").css( {
+ 'position' :'absolute',
+ 'left' :'0px',
+ 'top' :headerHeight,
+ 'width' :frameWidth,
+ 'height' :frameHeight
+ });
+ }
+ else {
+ var frameTop = Math.ceil(parent.$("#autoexpand_text_view_frame_container").position()["top"]);
+
+ var windowHeight = parent.$(parent).height();
+ var frameHeight = (windowHeight - frameTop - 2) + 'px'; // - 2 to prevent scrollbars // ? --> TODO test it without -2
+
+ var windowWidth = parent.$(parent).width();
+ var frameWidth = (windowWidth - 2) + 'px'; // - 2 to prevent scrollbars ? // --> TODO test it without -2
+
+ // TODO test if we're embeded ! wont work otherwise anyway (frame security)
+ parent.$("#text_view_frame").css( {
+ 'position' :'relative',
+ 'width' :'99.9%',
+ 'height' :frameHeight,
+ 'top' :'0px'
+ });
+ }
+}
+_toFullScreenSize = function() {
+ gInFullScreen = true;
+ _setFrameSize() ;
+
+ $("#c_fullscreen_btn").attr('src', sv_media_url + '/img/arrow_in.png');
+
+ f_setCookie('fullscreen', '1') ;
+};
+
+_toNormalSize = function() {
+ gInFullScreen = false;
+ _setFrameSize() ;
+
+ $("#c_fullscreen_btn").attr('src', sv_media_url + 'img/arrow_out.png');
+
+ f_setCookie('fullscreen', '0') ;
+};
+
+_toInitialSize = function() {
+ //console.info('_toInitialSize') ;
+ var fullscreen = ($.cookie('fullscreen') == '1');
+ if (fullscreen)
+ _toFullScreenSize() ;
+ else
+ _toNormalSize() ;
+};
+
+toInitialSize = function() {
+ _toInitialSize() ;
+ parent.$(parent).resize(function(){
+// console.log('before setFramesize in top resize winwidth' + frames['text_view_comments'].CY.DOM.winWidth()) ;
+ _setFrameSize();
+// console.log('after setFramesize in top resize winwidth' + frames['text_view_frame'].frames['text_view_comments'].CY.DOM.winWidth()) ;
+ });
+}
+
+toggleFrameSize = function() {
+ if (gInFullScreen)
+ _toNormalSize() ;
+ else
+ _toFullScreenSize() ;
+}
+
--- a/src/cm/templates/site/macros/text_tabs.html Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/templates/site/macros/text_tabs.html Fri Dec 11 12:03:51 2009 +0100
@@ -7,7 +7,7 @@
<div id="text-tabs">
<ul>
- <li><a id="view_tab_link" class="cust_behav" href="#text_view_frame_container">{% blocktrans %}Text{% endblocktrans %}</a></li>
+ <li><a id="view_tab_link" class="cust_behav" href="#autoexpand_text_view_frame_container">{% blocktrans %}Text{% endblocktrans %}</a></li>
{% if can_edit_text %}
<li><a id="edit_tab_link" class="cust_behav" href="#text_edit">{% blocktrans %}Edit{% endblocktrans %}</a></li>
{% endif %}
--- a/src/cm/templates/site/text_history.html Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/templates/site/text_history.html Fri Dec 11 12:03:51 2009 +0100
@@ -96,7 +96,9 @@
{% endif %}
{{ content }}
+<div id="autoexpand_text_view_frame_container">
{{ embed_code }}
+</div>
{% endautoescape %}
</div>
--- a/src/cm/templates/site/text_view.html Fri Dec 11 12:02:39 2009 +0100
+++ b/src/cm/templates/site/text_view.html Fri Dec 11 12:03:51 2009 +0100
@@ -2,8 +2,6 @@
{% load com %}
{% block head %}
-<script type="text/javascript" src="{{ MEDIA_URL }}js/site/text_view_to_frame.js"></script>
-<script type="text/javascript" src="{{ MEDIA_URL }}js/site/text_view.js"></script>
{% endblock %}
{% block main %}
@@ -19,7 +17,7 @@
<!-- <div style="clear:right;">-->
<!-- border-width: 0pt; frameborder="0" -->
-<div id="text_view_frame_container">
+<div id="autoexpand_text_view_frame_container">
<center>
{% autoescape off %}
{{ embed_code }}