Author: ornicar2
Date: 2010-02-02 01:39:07 +0100 (Tue, 02 Feb 2010)
New Revision: 27406

Modified:
   
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmInterface/templates/_toolBar.php
   plugins/diemPlugin/trunk/dmAdminPlugin/web/css/bars.css
   
plugins/diemPlugin/trunk/dmCorePlugin/lib/model/doctrine/PluginDmLockTable.class.php
   
plugins/diemPlugin/trunk/dmCorePlugin/modules/dmCore/lib/BasedmCoreActions.class.php
   plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCorePing.js
Log:
[Diem]
- fix previous commit

Modified: 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmInterface/templates/_toolBar.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmInterface/templates/_toolBar.php
   2010-02-02 00:22:35 UTC (rev 27405)
+++ 
plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmInterface/templates/_toolBar.php
   2010-02-02 00:39:07 UTC (rev 27406)
@@ -8,30 +8,30 @@
   {
     echo _link('dmCore/refresh')->textTitle(__('Update 
project'))->set('.dm_refresh_link.widget16.s16block.s16_clear');
   }
-  
+
   echo _tag('div.dm_menu.widget16', $menu->render());
 
   if (isset($cultureSelect))
   {
     echo _tag('div.widget16.mt3', $cultureSelect->render('dm_select_culture', 
$sf_user->getCulture()));
   }
-  
+
   if (dmAPCCache::isEnabled() && $sf_user->can('systeme'))
   {
     $apcLoad = dmAPCCache::getLoad();
     echo _link('dmServer/apc')
     ->set('.dm_load_monitor.fleft')
     ->title(sprintf('APC load : %s / %s', $apcLoad['usage'], 
$apcLoad['limit']))
-    ->text(sprintf('<span style="height: %dpx;"></span>', 
round($apcLoad['percent'] * 0.21))); 
+    ->text(sprintf('<span style="height: %dpx;"></span>', 
round($apcLoad['percent'] * 0.21)));
   }
 
   echo _link('app:front')->textTitle(__('Go to site'))->set('.widget16.ml10');
 
   if(sfConfig::get('dm_locks_enabled'))
   {
-    echo _tag('div.dm_active_users', _tag('span', 
$sf_user->getUser()->get('username')));
+    echo _tag('div.dm_active_users', '');
   }
-  
+
   if (sfConfig::get('sf_web_debug'))
   {
     echo '__SF_WEB_DEBUG__';

Modified: plugins/diemPlugin/trunk/dmAdminPlugin/web/css/bars.css
===================================================================
--- plugins/diemPlugin/trunk/dmAdminPlugin/web/css/bars.css     2010-02-02 
00:22:35 UTC (rev 27405)
+++ plugins/diemPlugin/trunk/dmAdminPlugin/web/css/bars.css     2010-02-02 
00:39:07 UTC (rev 27406)
@@ -61,7 +61,7 @@
   -webkit-border-radius:  0 0 4px 4px;
 
   left: -4000px;
-  
+
   max-height: 300px;
   overflow: auto;
   background: #fff;
@@ -138,16 +138,16 @@
 
 #dm_tool_bar div.dm_active_users {
   margin-left: 5px;
+  opacity: 0.6;
 }
 
 #dm_tool_bar div.dm_active_users span {
   -moz-border-radius: 4px;
   -webkit-border-radius: 4px;
   background: #FFFFFF;
-  color: #000000;
+  color: #222;
   float: left;
   margin-top: 4px;
   margin-left: 5px;
-  opacity: 0.7;
   padding: 2px 5px;
 }
\ No newline at end of file

Modified: 
plugins/diemPlugin/trunk/dmCorePlugin/lib/model/doctrine/PluginDmLockTable.class.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmCorePlugin/lib/model/doctrine/PluginDmLockTable.class.php
        2010-02-02 00:22:35 UTC (rev 27405)
+++ 
plugins/diemPlugin/trunk/dmCorePlugin/lib/model/doctrine/PluginDmLockTable.class.php
        2010-02-02 00:39:07 UTC (rev 27406)
@@ -11,10 +11,10 @@
   {
     $locks = dmDb::pdo(
       sprintf(
-        'SELECT DISTINCT a.user_name FROM %s a WHERE a.user_id != ? AND 
a.module = ? AND a.action = ? AND a.record_id = ? ORDER BY a.user_name ASC',
+        'SELECT DISTINCT a.user_name FROM %s a WHERE a.user_id != ? AND 
a.module = ? AND a.action = ? AND a.record_id = ? AND a.time > ? ORDER BY 
a.user_name ASC',
         $this->getTableName()
       ),
-      array($data['user_id'], $data['module'], $data['action'], 
$data['record_id'])
+      array($data['user_id'], $data['module'], $data['action'], 
$data['record_id'], $_SERVER['REQUEST_TIME'] - 
sfConfig::get('dm_locks_timeout', 10))
     )->fetchAll(PDO::FETCH_NUM);
 
     return $this->toUsernames($locks);
@@ -26,8 +26,8 @@
   public function getUserNames()
   {
     $locks = dmDb::pdo(
-      sprintf('SELECT DISTINCT a.user_name FROM %s a ORDER BY a.user_name 
ASC', $this->getTableName()),
-      array()
+      sprintf('SELECT DISTINCT a.user_name FROM %s a WHERE a.time > ? ORDER BY 
a.user_name ASC', $this->getTableName()),
+      array($_SERVER['REQUEST_TIME'] - sfConfig::get('dm_locks_timeout', 10))
     )->fetchAll(PDO::FETCH_NUM);
 
     return $this->toUsernames($locks);
@@ -82,7 +82,7 @@
   {
     dmDb::pdo(
       sprintf('DELETE FROM %s WHERE time < ?', $this->getTableName()),
-      array($_SERVER['REQUEST_TIME'] - sfConfig::get('dm_locks_timeout', 10))
+      array($_SERVER['REQUEST_TIME'] - 10*sfConfig::get('dm_locks_timeout', 
10))
     );
   }
 

Modified: 
plugins/diemPlugin/trunk/dmCorePlugin/modules/dmCore/lib/BasedmCoreActions.class.php
===================================================================
--- 
plugins/diemPlugin/trunk/dmCorePlugin/modules/dmCore/lib/BasedmCoreActions.class.php
        2010-02-02 00:22:35 UTC (rev 27405)
+++ 
plugins/diemPlugin/trunk/dmCorePlugin/modules/dmCore/lib/BasedmCoreActions.class.php
        2010-02-02 00:39:07 UTC (rev 27406)
@@ -2,11 +2,11 @@
 
 class BasedmCoreActions extends dmBaseActions
 {
-  
+
   public function executePing(dmWebRequest $request)
   {
     $recordId = $this->request->getParameter('record_id', 0);
-    
+
     $data = array(
       'user_id'   => $this->getUser()->getUserId(),
       'time'      => $_SERVER['REQUEST_TIME'],
@@ -16,23 +16,18 @@
       'record_id' => $recordId,
       'culture'   => $this->getUser()->getCulture()
     );
-    
+
     dmDb::table('DmLock')->ping($data);
 
     $users = dmDb::table('DmLock')->getUserNames();
 
-    if($recordId && count($users) > 1)
+    if($recordId && count($users) > 1 && count($locks = 
dmDb::table('DmLock')->getLocks($data)))
     {
-      $locks = $recordId ? dmDb::table('DmLock')->getLocks($data) : array();
-
-      if(!empty($locks))
+      foreach($locks as $index => $lock)
       {
-        foreach($locks as $index => $lock)
-        {
-          $locks[$index] = $this->getI18n()->__('%user% is browsing this page, 
you should not modify it now.', array(
-            '%user%' => '<strong>'.$lock.'</strong>'
-            ));
-        }
+        $locks[$index] = $this->getI18n()->__('%user% is browsing this page, 
you should not modify it now.', array(
+          '%user%' => '<strong>'.$lock.'</strong>'
+        ));
       }
     }
     else
@@ -45,11 +40,11 @@
       'locks' => implode('|', $locks)
     ));
   }
-  
+
   public function executeThumbnail(dmWebRequest $request)
   {
     $tag = $this->getHelper()->media($request->getParameter('source'));
-  
+
     foreach(array('width', 'height', 'method', 'quality') as $key)
     {
       if ($request->hasParameter($key))
@@ -57,7 +52,7 @@
         $tag->set($key, $request->getParameter($key));
       }
     }
-    
+
     return $this->renderText($tag->render());
   }
 
@@ -87,10 +82,10 @@
     );
 
     $this->setLayout(false);
-    
+
     $this->getUser()->setAttribute('dm_refresh_back_url', $this->getBackUrl());
   }
-  
+
   public function executeRefreshStep(dmWebRequest $request)
   {
     if ($request->hasParameter('dm_use_thread'))
@@ -99,54 +94,54 @@
       ->mergeParameter('page_tree_watcher.options', array('use_thread' => 
$request->getParameter('use_thread')))
       ->reload('page_tree_watcher');
     }
-    
+
     $this->step = $request->getParameter('step');
-    
+
     try
     {
       switch($this->step)
       {
         case 1:
           @$this->getService('cache_manager')->clearAll();
-       
+
           if ($this->getUser()->can('system'))
           {
             @$this->getService('filesystem')->sf('dmFront:generate');
-      
+
             @dmFileCache::clearAll();
           }
-          
+
           $data = array(
             'msg'  => $this->getI18n()->__('Page synchronization'),
             'type' => 'ajax',
             'url'  => 
$this->getHelper()->link('+/dmCore/refreshStep')->param('step', 2)->getHref()
           );
           break;
-          
+
         case 2:
           $this->getService('page_tree_watcher')->synchronizePages();
-          
+
           $data = array(
             'msg'  => $this->getI18n()->__('SEO synchronization'),
             'type' => 'ajax',
             'url'  => 
$this->getHelper()->link('+/dmCore/refreshStep')->param('step', 3)->getHref()
           );
           break;
-          
+
         case 3:
           $this->getService('page_tree_watcher')->synchronizeSeo();
-          
+
           if (count($this->getI18n()->getCultures()) > 1)
           {
             
$this->getService('page_i18n_builder')->createAllPagesTranslations();
           }
-          
+
           $data = array(
             'msg'  => $this->getI18n()->__('Interface regeneration'),
             'type' => 'redirect',
             'url'  => $this->getUser()->getAttribute('dm_refresh_back_url')
           );
-          
+
           $this->context->getEventDispatcher()->notify(new sfEvent($this, 
'dm.refresh', array()));
           
$this->getUser()->getAttributeHolder()->remove('dm_refresh_back_url');
           $this->getUser()->logInfo('Project successfully updated');
@@ -156,13 +151,13 @@
     catch(Exception $e)
     {
       $this->getUser()->logError($this->getI18n()->__('Something went wrong 
when updating project'));
-      
+
       $data = array(
         'msg'  => $this->getI18n()->__('Something went wrong when updating 
project'),
         'type' => 'redirect',
         'url'  => $this->getUser()->getAttribute('dm_refresh_back_url')
       );
-    
+
       if (sfConfig::get('sf_debug'))
       {
         if ($request->isXmlHttpRequest())
@@ -175,13 +170,13 @@
         }
       }
     }
-    
+
     return $this->renderJson($data);
   }
-  
+
   public function executeMarkdown(dmWebRequest $request)
   {
     return 
$this->renderText($this->getService('markdown')->toHtml($request->getParameter('text')));
   }
-  
+
 }
\ No newline at end of file

Modified: plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCorePing.js
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCorePing.js  2010-02-02 
00:22:35 UTC (rev 27405)
+++ plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCorePing.js  2010-02-02 
00:39:07 UTC (rev 27406)
@@ -10,7 +10,7 @@
       var self = $.dm.ping;
 
       self.options = $.extend({
-        delay:    3000,
+        delay:    4000,
         url:      $.dm.ctrl.getHref('+/dmCore/ping')
       }, options || {});
 

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