[pLog-svn] r6066 - in plog/trunk: js/ui/pages templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Wed Nov 21 12:17:17 EST 2007


Author: mark
Date: 2007-11-21 12:17:17 -0500 (Wed, 21 Nov 2007)
New Revision: 6066

Modified:
   plog/trunk/js/ui/pages/resourcealbums.js
   plog/trunk/templates/admin/resources.template
   plog/trunk/templates/admin/resources_table.template
Log:
Finally, I fixed the imageloader bug...

Although, it only a small change, but also take me over several hours to to make it work .. :(

I hate javascript, why it is so hard to debug, even I use firefox and firebug ...

Modified: plog/trunk/js/ui/pages/resourcealbums.js
===================================================================
--- plog/trunk/js/ui/pages/resourcealbums.js	2007-11-21 10:23:44 UTC (rev 6065)
+++ plog/trunk/js/ui/pages/resourcealbums.js	2007-11-21 17:17:17 UTC (rev 6066)
@@ -10,12 +10,29 @@
 	Lifetype.Forms.AjaxFormProcessor(form.id,'?op=addResourceAlbum&output=json', {} );
 }
 
+Lifetype.UI.Pages.Resources.loadImages = function() {
+    var foldGroup = new YAHOO.util.ImageLoader.group(window, 'scroll');
+    var imgObjs = document.getElementsByTagName( 'img' );
+    for( var j = 0 ; j < imgObjs.length; j++ ) {
+	    if( imgObjs[j].id.substr(0,13) == 'resource_img_' ) {
+    		foldGroup.registerSrcImage( imgObjs[j].id, imgObjs[j].attributes['url'].value );
+        }
+    }
+    foldGroup.foldConditional = true;
+    foldGroup.addTrigger(window, 'resize');
+    foldGroup._foldCheck();
+}
+
 YAHOO.util.Event.addListener( window, "load", function() {
 	var t = new Lifetype.Effects.Table( "list" );
 	t.stripe();
 	t.highlightRows();
 
+    // We need to load the images after page loaded
+    Lifetype.UI.Pages.Resources.loadImages();
+
 	// reload the list when successfully deleting an item and processing one of the forms
 	Lifetype.Forms.Events.performRequestSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
 	Lifetype.Forms.Events.formProcessorSuccessEvent.subscribe( Lifetype.UI.AjaxPager.reload );
+    Lifetype.UI.AjaxPager.Events.dataLoaded.subscribe(  Lifetype.UI.Pages.Resources.loadImages );
 });
\ No newline at end of file

Modified: plog/trunk/templates/admin/resources.template
===================================================================
--- plog/trunk/templates/admin/resources.template	2007-11-21 10:23:44 UTC (rev 6065)
+++ plog/trunk/templates/admin/resources.template	2007-11-21 17:17:17 UTC (rev 6066)
@@ -111,16 +111,6 @@
   </div>
 </div>
 </form>
-<script type="text/javascript">
-var foldGroup = new YAHOO.util.ImageLoader.group(window, 'scroll');
-{foreach from=$resources item=resource}
-	{if $resource->hasPreview()}
-		foldGroup.registerSrcImage( 'resource_img_{$resource->getId()}', '{$url->resourcePreviewLink($resource)}');
-	{/if}
-{/foreach}
-foldGroup.foldConditional = true;
-foldGroup.name = 'fold_group';
-foldGroup.addTrigger(window, 'resize');
-</script>
+
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Modified: plog/trunk/templates/admin/resources_table.template
===================================================================
--- plog/trunk/templates/admin/resources_table.template	2007-11-21 10:23:44 UTC (rev 6065)
+++ plog/trunk/templates/admin/resources_table.template	2007-11-21 17:17:17 UTC (rev 6066)
@@ -39,7 +39,7 @@
 	<div class="pictureFrame">
 	 <div class="picture">
    	  <a href="?op=resourceInfo&amp;resourceId={$resource->getId()}">
-    	<img alt="{$resource->getDescription()}" id="resource_img_{$resource->getId()}" />
+    	<img alt="{$resource->getDescription()}" id="resource_img_{$resource->getId()}" url="{$url->resourcePreviewLink($resource)}" />
       </a>
      </div>
     </div>



More information about the pLog-svn mailing list