Author: ornicar2
Date: 2010-01-29 16:07:43 +0100 (Fri, 29 Jan 2010)
New Revision: 27303

Modified:
   plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminCtrl.js
   plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminPing.js
   
plugins/diemPlugin/trunk/dmCorePlugin/lib/doctrine/loremizer/dmRecordLoremizer.php
   plugins/diemPlugin/trunk/dmCorePlugin/test/unit/dmWidgetContentImageTest.php
   
plugins/diemPlugin/trunk/dmFrontPlugin/lib/dmWidget/image/dmWidgetContentImageView.php
Log:
[Diem]
- fixed content/image widgets cache
- made ajax ping more robust
- improved record loremizer performance
- fixed widget content/image unit tests for new field link

Modified: plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminCtrl.js
===================================================================
--- plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminCtrl.js        
2010-01-29 11:13:39 UTC (rev 27302)
+++ plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminCtrl.js        
2010-01-29 15:07:43 UTC (rev 27303)
@@ -95,7 +95,7 @@
     
     listPage: function()
     {
-      self = this;
+      var self = this;
       
       if ($searchInput = $('#dm_module_search_input').orNot()) 
       {

Modified: plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminPing.js
===================================================================
--- plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminPing.js        
2010-01-29 11:13:39 UTC (rev 27302)
+++ plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminPing.js        
2010-01-29 15:07:43 UTC (rev 27303)
@@ -17,13 +17,13 @@
     {
       var self = $.dm.ping;
 
-      if(data.users != self.users)
+      if(data && data.users != self.users)
       {
         self.renderUsers(data.users.split('|'));
         self.users = data.users;
       }
 
-      if(data.locks != self.locks)
+      if(data && data.locks != self.locks)
       {
         self.renderLocks(data.locks.split('|'));
         self.locks = data.locks;

Modified: 
plugins/diemPlugin/trunk/dmCorePlugin/lib/doctrine/loremizer/dmRecordLoremizer.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmCorePlugin/lib/doctrine/loremizer/dmRecordLoremizer.php
  2010-01-29 11:13:39 UTC (rev 27302)
+++ 
plugins/diemPlugin/trunk/dmCorePlugin/lib/doctrine/loremizer/dmRecordLoremizer.php
  2010-01-29 15:07:43 UTC (rev 27303)
@@ -77,7 +77,7 @@
     }
     
     // if the field can be null, set it to null sometimes
-    if (!dmArray::get($column, 'notnull') && !dmArray::get($column, 'unique') 
&& !rand(0, 3))
+    if (!dmArray::get($column, 'notnull') && !dmArray::get($column, 'unique') 
&& !mt_rand(0, 3))
     {
       $val = null;
     }
@@ -100,12 +100,12 @@
     {
       $this->record->clearRelated($relation->getAlias());
       
-      if (rand(0, 4))
+      if (mt_rand(0, 4))
       {
         $ids = (array) dmDb::query($relation->getClass().' t')
         ->select('t.id, RANDOM() AS rand')
         ->orderBy('rand')
-        ->limit(rand(1, 6))
+        ->limit(mt_rand(1, 6))
         ->fetchFlat();
         
         $this->record->link($relation->getAlias(), array_unique($ids));
@@ -128,13 +128,13 @@
         $val = $this->getStringValForColumn($column);
         break;
       case 'boolean':
-        $val = (bool)rand(0,1);
+        $val = (bool)mt_rand(0,1);
         break;
       case 'blob':
       case 'clob':
         if ($this->table->isMarkdownColumn($columnName))
         {
-          $val = dmLorem::getMarkdownLorem(1/*rand(1, 3)*/);
+          $val = dmLorem::getMarkdownLorem(1/*mt_rand(1, 3)*/);
         }
         else
         {
@@ -143,20 +143,20 @@
         break;
       case 'time':
       case 'timestamp':
-        $val = rand(strtotime('-10 year') , time());
+        $val = mt_rand(strtotime('-10 year') , time());
         break;
       case 'date':
-        $val = date("Y-m-d", rand(strtotime('-10 year') , time()));
+        $val = date("Y-m-d", mt_rand(strtotime('-10 year') , time()));
         break;
       case 'enum':
-        $val = $column['values'][array_rand($column['values'])];
+        $val = $column['values'][array_mt_rand($column['values'])];
         break;
       case 'integer':
-        $val = rand(0,100000);
+        $val = mt_rand(0,100000);
         break;
       case 'float':
       case 'decimal':
-        $val = rand(0,1000000)/100;
+        $val = mt_rand(0,1000000)/100;
         break;
       default:
         throw new dmException(sprintf('Diem can not generate random content 
for %s column', $columnName));
@@ -169,7 +169,7 @@
   {
     if (dmArray::get($column, 'email'))
     {
-      return dmString::random(rand(4, 30)).'@localhost.com';
+      return dmString::random(mt_rand(4, 30)).'@localhost.com';
     }
     
     if ($this->table->isLinkColumn($column['name']))
@@ -177,12 +177,12 @@
       return $this->getRandomLink();
     }
 
-    $nbCarac = rand(min(4, $column['length']), max(40, $column['length']));
+    $nbCarac = mt_rand(min(4, $column['length']), max(40, $column['length']));
     $val = trim(dmLorem::getLittleLorem($nbCarac));
 
     if (dmArray::get($column, 'unique'))
     {
-      $rlen = rand(4, 10);
+      $rlen = mt_rand(4, 10);
       $val = substr($val.dmString::random($rlen), 0, $column['length']);
     }
 
@@ -196,7 +196,7 @@
 
   protected function getRandomLink()
   {
-    if(rand(0, 1))
+    if(mt_rand(0, 1))
     {
       return sprintf('http://'.dmString::random().'.random.com');
     }

Modified: 
plugins/diemPlugin/trunk/dmCorePlugin/test/unit/dmWidgetContentImageTest.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmCorePlugin/test/unit/dmWidgetContentImageTest.php    
    2010-01-29 11:13:39 UTC (rev 27302)
+++ 
plugins/diemPlugin/trunk/dmCorePlugin/test/unit/dmWidgetContentImageTest.php    
    2010-01-29 15:07:43 UTC (rev 27303)
@@ -84,7 +84,8 @@
   'height'      => '',
   'method'      => dmConfig::get('image_resize_method'),
   'background'  => 'FFFFFF',
-  'quality'     => NULL
+  'quality'     => NULL,
+  'link'        => ''
 );
 ksort($expected);
 $widgetValues = $widget->values;
@@ -109,7 +110,8 @@
   'height' => 200,
   'cssClass' => 'test css_class',
   'method' => 'fit',
-  'quality' => 50
+  'quality' => 50,
+  'link' => 'http://diem-project.org'
 )), array());
 $t->is($form->isValid(), true, 'The form is valid');
 if (!$form->isValid())
@@ -129,7 +131,8 @@
   'height'      => '200',
   'method'      => 'fit',
   'background'  => 'FFFFFF',
-  'quality'     => 50
+  'quality'     => 50,
+  'link' => 'http://diem-project.org'
 ), 'Widget values are correct');
 
 $t->comment('Recreate the form from the saved widget');
@@ -173,7 +176,8 @@
   'height'      => '200',
   'method'      => 'fit',
   'background'  => 'FFFFFF',
-  'quality'     => 50
+  'quality'     => 50,
+  'link'        => 'http://diem-project.org'
 ), 'Widget values are correct');
 
 $t->comment('Now display the widget');
@@ -196,7 +200,8 @@
     'legend'      => 'test legend',
     'method'      => 'fit',
     'background'  => 'FFFFFF',
-    'quality'     => 50
+    'quality'     => 50,
+    'link'        => 'http://diem-project.org'
   )),
   'updated_at' => $widget->updatedAt
 );

Modified: 
plugins/diemPlugin/trunk/dmFrontPlugin/lib/dmWidget/image/dmWidgetContentImageView.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmFrontPlugin/lib/dmWidget/image/dmWidgetContentImageView.php
      2010-01-29 11:13:39 UTC (rev 27302)
+++ 
plugins/diemPlugin/trunk/dmFrontPlugin/lib/dmWidget/image/dmWidgetContentImageView.php
      2010-01-29 15:07:43 UTC (rev 27303)
@@ -62,7 +62,7 @@
 
     if($link = dmArray::get($vars, 'link'))
     {
-      $html = $this->getHelper()->£link($link)->text($html);
+      $html = $this->getHelper()->£link($link)->text($html)->render();
     }
 
     if ($this->isCachable())

-- 
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