Author: ornicar2
Date: 2010-02-03 23:13:47 +0100 (Wed, 03 Feb 2010)
New Revision: 27518

Added:
   plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/config/view.yml
   plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/
   
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.js
   
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.min.js
Modified:
   
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
   
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/templates/indexSuccess.php
   plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminDiagram.js
   plugins/diemPlugin/trunk/dmCorePlugin/config/dm/assets.yml
Log:
[Diem]
- admin diagrams are now movable by holding the mouse button
- added jQuery panview to available core libs
- dependency injection diagrams are bigger and more readable
- made all diagrams downloadable

Modified: 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
  2010-02-03 21:45:04 UTC (rev 27517)
+++ 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/actions/actions.class.php
  2010-02-03 22:13:47 UTC (rev 27518)
@@ -12,7 +12,7 @@
     
     try
     {
-      foreach(array('admin', 'front') as $appName)
+      foreach(array('front', 'admin') as $appName)
       {
         $this->dicImages[$appName] = $this->getDiagramImage($appName);
       }
@@ -26,14 +26,16 @@
     
     try
     {
-//      $this->mldUserImage = $doctrineGraphviz->getMldImage(array('type' => 
'user'));
-//      $this->mldCoreImage = $doctrineGraphviz->getMldImage(array('type' => 
'core'));
-//      $this->mldProjectImage = $doctrineGraphviz->getMldImage(array('type' 
=> 'project'));
+      $this->mldUserImage = $doctrineGraphviz->getMldImage(array('type' => 
'user'));
+      $this->mldCoreImage = $doctrineGraphviz->getMldImage(array('type' => 
'core'));
+      $this->mldProjectImage = $doctrineGraphviz->getMldImage(array('type' => 
'project'));
     }
     catch(dmException $e)
     {
       $this->getUser()->logError($e->getMessage());
     }
+
+    $this->getUser()->logInfo('Hold down your mouse button to move the 
images');
   }
   
   protected function loadServiceContainerDumper()
@@ -91,12 +93,12 @@
       'graph' => array(
         'overlap' => 'false',
         'splines' => 'true',
-        'epsilon' => '1.5',
+        'epsilon' => '0.5',
         'maxiter' => '30000',
         'concentrate' => 'false',
         'bgcolor' => 'transparent',
         'ratio' => 'fill',
-        'size' => '20,8'
+        'size' => '25,12'
       ),
       'node'  => array('fontsize' => 20, 'fontname' => 'Arial', 'shape' => 
'Mrecord'),
       'edge'  => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => 
'grey', 'arrowhead' => 'open', 'arrowsize' => 1),

Added: plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/config/view.yml
===================================================================
--- plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/config/view.yml    
                        (rev 0)
+++ plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/config/view.yml    
2010-02-03 22:13:47 UTC (rev 27518)
@@ -0,0 +1,3 @@
+indexSuccess:
+
+  javascripts:  [ lib.panView, admin.diagram ]
\ No newline at end of file

Modified: 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/templates/indexSuccess.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/templates/indexSuccess.php
 2010-02-03 21:45:04 UTC (rev 27517)
+++ 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmDiagram/templates/indexSuccess.php
 2010-02-03 22:13:47 UTC (rev 27518)
@@ -1,46 +1,63 @@
 <style type="text/css">
-div.viewport {
+div.full_width_image {
   width: 100%;
-  height: 300px;
+  height: 450px;
+}
+div.full_width_image img.panview {
   cursor: move;
 }
 </style>
 <?php
 
-foreach($dicImages as $appName => $image)
+if (!empty($mldProjectImage))
 {
-  if (!$image) continue;
-
   echo _tag('div.dm_box.big.diagram',
     _tag('div.title',
-    _tag('h2', dmString::camelize($appName).' : Dependency Injection 
Container'._link($image)->text('Download'))).
+      _tag('h2', 'Project 
Database'._link($mldProjectImage)->text(__('Download'))->target('blank'))
+    ).
     _tag('div.dm_box_inner',
-      ($withDispatcherLinks
-      ? _tag('p.s16.s16_info', 
_link('+/dmDiagram/index?with_dispatcher_links=0')->text('Hide dispatcher 
dependencies'))
-      : _tag('p.s16.s16_info', 'As nearly all modules have a reference to 
dispatcher, these dependencies are hidden. 
'._link('+/dmDiagram/index?with_dispatcher_links=1')->text('Click here to see 
them'))
-      ).
-      _media($image)
+      _tag('div.full_width_image', 
_media($mldProjectImage)->set('.panview#mld_project'))
     )
   );
 }
 
-if (!empty($mldProjectImage))
+if (!empty($mldUserImage))
 {
-  echo _tag('div.dm_box.big.diagram', _tag('div.title', _tag('h2', 'Project 
Database'))._tag('div.dm_box_inner',
-    _tag('div.full_width_image', 
_link($mldProjectImage)->text(_media($mldProjectImage)))
-  ));
+  echo _tag('div.dm_box.big.diagram',
+    _tag('div.title',
+      _tag('h2', 'Diem User 
Database'._link($mldUserImage)->text(__('Download'))->target('blank'))
+    ).
+    _tag('div.dm_box_inner',
+      _tag('div.full_width_image', _media($mldUserImage))
+    )
+  );
 }
 
-if (!empty($mldUserImage))
+if (!empty($mldCoreImage))
 {
-  echo _tag('div.dm_box.big.diagram', _tag('div.title', _tag('h2', 'Diem User 
Database'))._tag('div.dm_box_inner',
-    _tag('div.full_width_image', 
_link($mldUserImage)->text(_media($mldUserImage)))
-  ));
+  echo _tag('div.dm_box.big.diagram',
+    _tag('div.title',
+      _tag('h2', 'Diem Core 
Database'._link($mldCoreImage)->text(__('Download'))->target('blank'))
+    ).
+    _tag('div.dm_box_inner',
+      _tag('div.full_width_image', 
_media($mldCoreImage)->set('.panview#mld_core'))
+    )
+  );
 }
 
-if (!empty($mldCoreImage))
+foreach($dicImages as $appName => $image)
 {
-  echo _tag('div.dm_box.big.diagram', _tag('div.title', _tag('h2', 'Diem Core 
Database'))._tag('div.dm_box_inner',
-    _tag('div.full_width_image', 
_link($mldCoreImage)->text(_media($mldCoreImage)))
-  ));
+  if (!$image) continue;
+
+  echo _tag('div.dm_box.big.diagram',
+    _tag('div.title',
+    _tag('h2', dmString::camelize($appName).' : Dependency Injection 
Container'._link($image)->text(__('Download'))->target('blank'))).
+    _tag('div.dm_box_inner',
+      ($withDispatcherLinks
+      ? _tag('p.s16.s16_info', 
_link('+/dmDiagram/index?with_dispatcher_links=0')->text('Hide dispatcher 
dependencies'))
+      : _tag('p.s16.s16_info', 'As nearly all modules have a reference to 
dispatcher, these dependencies are hidden. 
'._link('+/dmDiagram/index?with_dispatcher_links=1')->text('Click here to see 
them'))
+      ).
+      _tag('div.full_width_image', 
_media($image)->set('.panview#panview'.$appName))
+    )
+  );
 }
\ No newline at end of file

Modified: plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminDiagram.js
===================================================================
--- plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminDiagram.js     
2010-02-03 21:45:04 UTC (rev 27517)
+++ plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminDiagram.js     
2010-02-03 22:13:47 UTC (rev 27518)
@@ -1,15 +1,10 @@
 (function($)
 {
 
-$('div.viewport').each(function() {
+$('#dm_admin_content img.panview').each(function() {
 
-  $(this)
-  .find('div.toplevel').width($(this).width()).end()
-  .mapbox({
-    mousewheel: true,
-    layerSplit: 20
-  })
-  .mapbox("zoomTo", 1);
+  var $img = $(this);
+  $img.panView($img.parent().width(), $img.parent().height());
 
 });
   

Modified: plugins/diemPlugin/trunk/dmCorePlugin/config/dm/assets.yml
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/config/dm/assets.yml  2010-02-03 
21:45:04 UTC (rev 27517)
+++ plugins/diemPlugin/trunk/dmCorePlugin/config/dm/assets.yml  2010-02-03 
22:13:47 UTC (rev 27518)
@@ -49,6 +49,7 @@
     tree-component:   jsTree/source/tree_component.min
     tree-css:         jsTree/source/css
     fieldSelection:   jquery-fieldselection/jquery-fieldselection
+    panView:          panview/jquery-plugin-panview.min
 
 css:
 

Added: 
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.js
===================================================================
--- 
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.js  
                            (rev 0)
+++ 
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.js  
    2010-02-03 22:13:47 UTC (rev 27518)
@@ -0,0 +1,144 @@
+$.fn.panView = function(width,height) {
+       return this.each(function(){
+               
+               var panViewWidthType = 'static';
+               var panViewHeightType = 'static';
+               var panId = this.id + "Pan";
+               var panMaskId = this.id + "PanMask";
+               var mouseState = 'up';
+               var mouseStartX = 0;
+               var mouseStartY = 0;
+               var mouseDropX = 0;
+               var mouseDropY = 0;
+               var cssWidth;
+               var cssHeight;
+               var eThis = this; 
+               // show image
+               $(this).css('display','block');
+
+               // check arguments
+               if(width == 'auto') {           
+                       width = (this.clientWidth < document.body.clientWidth) 
? this.clientWidth : document.body.clientWidth;
+                       panViewWidthType = 'dynamic';
+               }
+               if(height == 'auto') {
+                       height = (this.clientHeight < 
document.body.clientHeight) ? this.clientHeight : document.body.clientHeight;
+                       panViewHeightType = 'dynamic';
+               }
+       
+               var bounds = new GetElementBounds(eThis);
+
+               function MouseEvent(e) {
+                       this.e = e ? e : window.event; 
+                       this.source = e.target ? e.target : e.srcElement;
+                       this.x = this.e.pageX ? this.e.pageX : this.e.clientX;
+                       this.y = this.e.pageY ? this.e.pageY : this.e.clientY;
+                       if(window.event) {
+                               this.x = (document.body.scrollLeft) ? this.x + 
document.body.scrollLeft : this.x;
+                               this.y = (document.body.scrollTop) ? this.y + 
document.body.scrollTop : this.y;
+                       }
+               }
+
+               function GetElementBounds(o) {
+                       this.width = o.clientWidth;
+                       this.height = o.clientHeight;
+                       this.minX = (width - this.width);
+                       this.minY = (height - this.height);
+                       this.maxX = 0;
+                       this.maxY = 0;
+               }
+               
+               $(this).wrap('<div id="' + panId + '" style="width:' + width + 
'px; height:' + height + 'px; overflow:hidden; position: relative;"><div id="' 
+ panMaskId + '" style="left:0px;top:0px;position:relative;"></div></div>');
+               
+               $(document).resize(function(e) {
+                       if(panViewWidthType == 'dynamic') {
+                               width = (this.clientWidth < 
document.body.clientWidth) ? this.clientWidth : document.body.clientWidth;
+                               $('div#' + panId).css('width',width + 'px');
+                       }
+                       if(panViewHeightType == 'dynamic') {
+                               height = (this.clientHeight < 
document.body.clientHeight) ? this.clientHeight : document.body.clientHeight;
+                               $('div#' + panId).css('height',height + 'px');
+                       }
+                       if(panViewWidthType == 'dynamic' || panViewHeightType 
== 'dynamic') {
+                               bounds = null;
+                               bounds = new GetElementBounds(eThis);
+                               
+                               mouseStartX = 0;
+                               mouseStartY = 0;
+                               mouseDropX = 0;
+                               mouseDropY = 0;
+                               
+                               $('div#' + panMaskId).css('left', 0 + 
'px').css('top',0 + 'px');
+
+                       }
+
+               });
+
+               $('div#' + panId).mousedown(function(e) {
+                       
+                       mouseState = 'down';
+                       
+                       var me = new MouseEvent(e);
+                       
+                       mouseStartX = me.x;
+                       mouseStartY = me.y;     
+               
+                       me = null;
+                       
+                       $(this).css('cursor','move');
+
+                       return false
+               });
+
+               $('div#' + panId).mouseup(function(e) {
+
+                       mouseState = 'up';
+                       
+                       mouseDropX = parseInt($('div#' + 
panMaskId).get(0).style.left);
+                       mouseDropY = parseInt($('div#' + 
panMaskId).get(0).style.top);
+
+                       $(this).css('cursor','default');
+
+               });
+
+               $(document.body).mousemove(function(e) {
+
+                       var me = new MouseEvent(e);
+                       
+                       var ePan = $('div#' + panId).get(0);
+               
+
+                       // simple bound check.
+                       if(me.x < ePan.offsetLeft || me.x > (ePan.offsetLeft + 
width) || me.y < ePan.offsetTop || me.y > (ePan.offsetTop + height)) {
+                               mouseState = 'up';
+                       }
+                       
+                       if(mouseState == 'down') {
+                       
+                               
+                               
+                               var iLeft = mouseDropX - (mouseStartX - me.x);
+                               var iTop = mouseDropY - (mouseStartY - me.y);
+
+                               if(iLeft < bounds.minX) {
+                                       iLeft = bounds.minX;
+                               } else if(iLeft > bounds.maxX) {
+                                       iLeft = bounds.maxX;
+                               }
+                               
+                               if(iTop < bounds.minY) {
+                                       iTop = bounds.minY;
+                               } else if(iTop > bounds.maxY) {
+                                       iTop = bounds.maxY;
+                               }
+
+                               $('div#' + panMaskId).css('left', iLeft + 
'px').css('top',iTop + 'px'); 
+                       }
+                       
+                       me = null;
+
+                       return false
+               });
+
+       });
+};
\ No newline at end of file

Added: 
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.min.js
===================================================================
--- 
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.min.js
                          (rev 0)
+++ 
plugins/diemPlugin/trunk/dmCorePlugin/web/lib/panview/jquery-plugin-panview.min.js
  2010-02-03 22:13:47 UTC (rev 27518)
@@ -0,0 +1 @@
+$.fn.panView=function(d,e){return this.each(function(){function 
o(a){this.e=a?a:window.event;this.source=a.target?a.target:a.srcElement;this.x=this.e.pageX?this.e.pageX:this.e.clientX;this.y=this.e.pageY?this.e.pageY:this.e.clientY;if(window.event){this.x=document.body.scrollLeft?this.x+document.body.scrollLeft:this.x;this.y=document.body.scrollTop?this.y+document.body.scrollTop:this.y}}function
 
p(a){this.width=a.clientWidth;this.height=a.clientHeight;this.minX=d-this.width;this.minY=e-this.height;
 this.maxY=this.maxX=0}var 
i="static",j="static",f=this.id+"Pan",g=this.id+"PanMask",h="up",k=0,l=0,m=0,n=0,q=this;$(this).css("display","block");if(d=="auto"){d=this.clientWidth<document.body.clientWidth?this.clientWidth:document.body.clientWidth;i="dynamic"}if(e=="auto"){e=this.clientHeight<document.body.clientHeight?this.clientHeight:document.body.clientHeight;j="dynamic"}var
 b=new p(q);$(this).wrap('<div id="'+f+'" style="width:'+d+"px; height:"+e+'px; 
overflow:hidden; position: relative;"><div id="'+ g+'" 
style="left:0px;top:0px;position:relative;"></div></div>');$(document).resize(function(){if(i=="dynamic"){d=this.clientWidth<document.body.clientWidth?this.clientWidth:document.body.clientWidth;$("div#"+f).css("width",d+"px")}if(j=="dynamic"){e=this.clientHeight<document.body.clientHeight?this.clientHeight:document.body.clientHeight;$("div#"+f).css("height",e+"px")}if(i=="dynamic"||j=="dynamic"){b=null;b=new
 
p(q);n=m=l=k=0;$("div#"+g).css("left","0px").css("top","0px")}});$("div#"+f).mousedown(function(a){h=
 "down";a=new o(a);k=a.x;l=a.y;$(this).css("cursor","move");return 
false});$("div#"+f).mouseup(function(){h="up";m=parseInt($("div#"+g).get(0).style.left);n=parseInt($("div#"+g).get(0).style.top);$(this).css("cursor","default")});$(document.body).mousemove(function(a){a=new
 o(a);var 
c=$("div#"+f).get(0);if(a.x<c.offsetLeft||a.x>c.offsetLeft+d||a.y<c.offsetTop||a.y>c.offsetTop+e)h="up";if(h=="down"){c=m-(k-a.x);a=n-(l-a.y);if(c<b.minX)c=b.minX;else
 if(c>b.maxX)c=b.maxX;if(a<b.minY)a=b.minY;else if(a> 
b.maxY)a=b.maxY;$("div#"+g).css("left",c+"px").css("top",a+"px")}return 
false})})};
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to