Development

Changeset 27286

You must first sign up to be able to contribute.

Changeset 27286

Show
Ignore:
Timestamp:
01/28/10 20:52:10 (3 years ago)
Author:
ornicar2
Message:

[Diem]
- implemented real-time resource locks [NEED DOCTRINE MIGRATION]
- fixed editing style for webkit based browsers
- updated french translations
- cleaned init filters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/diemPlugin/trunk/dmAdminPlugin/config/dm/assets.yml

    r27114 r27286  
    2222    sitemap:          dmAdminSitemap 
    2323    diagram:          dmAdminDiagram 
     24    ping:             dmAdminPing 
    2425 
    2526css: 
  • plugins/diemPlugin/trunk/dmAdminPlugin/data/generator/dmAdminDoctrineModule/dmAdmin/template/templates/_form.php

    r23658 r27286  
    33 
    44<div class="sf_admin_form"> 
     5 
     6  <div class="dm_active_locks"></div> 
    57 
    68  [?php $formActions = get_partial('<?php echo $this->getModuleName() ?>/form_action_bar', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper, 'nearRecords' => $nearRecords)); ?] 
  • plugins/diemPlugin/trunk/dmAdminPlugin/lib/filter/dmAdminInitFilter.php

    r26905 r27286  
    1717    $this->loadAssetConfig(); 
    1818 
     19    $this->updateLock(); 
     20 
    1921    $filterChain->execute(); 
    20      
    21     $response = $this->context->getResponse(); 
    2222 
    2323    // If response has no title, generate one with the H1 
    24     if ($response->isHtmlForHuman() && !$response->getTitle()) 
     24    if ($this->response->isHtmlForHuman() && !$this->response->getTitle()) 
    2525    { 
    26       preg_match('|<h1[^>]*>(.*)</h1>|iuUx', $response->getContent(), $matches); 
     26      preg_match('|<h1[^>]*>(.*)</h1>|iuUx', $this->response->getContent(), $matches); 
    2727         
    2828      if (isset($matches[1])) 
     
    3030        $title = 'Admin : '.strip_tags($matches[1]).' - '.dmConfig::get('site_name'); 
    3131       
    32         $response->setContent(str_replace('<title></title>', '<title>'.$title.'</title>', $response->getContent())); 
     32        $this->response->setContent(str_replace('<title></title>', '<title>'.$title.'</title>', $this->response->getContent())); 
    3333      } 
    3434    } 
  • plugins/diemPlugin/trunk/dmAdminPlugin/lib/response/asset/dmAdminAssetConfig.php

    r26729 r27286  
    5050      'core.pageBar', 
    5151      'core.mediaBar', 
     52      'core.ping', 
    5253      'admin.ctrl', 
    5354      'admin.toolBar', 
    5455      'admin.pageBar', 
    55       'admin.mediaBar' 
     56      'admin.mediaBar', 
     57      'admin.ping' 
    5658    ); 
    5759  } 
  • plugins/diemPlugin/trunk/dmAdminPlugin/lib/view/html/layout/dmAdminLayoutHelper.php

    r25028 r27286  
    4949  } 
    5050 
     51  protected function getJavascriptConfig() 
     52  { 
     53    $config = parent::getJavascriptConfig(); 
     54     
     55    $config['record_id'] = $this->serviceContainer->getService('request')->getParameter('pk', 0); 
     56 
     57    return $config; 
     58  } 
    5159 
    5260} 
  • plugins/diemPlugin/trunk/dmAdminPlugin/modules/dmInterface/templates/_toolBar.php

    r26137 r27286  
    55  echo £link('dmAuth/signout')->textTitle($sf_user->getUsername().' : '.__('Logout'))->set('.widget16.s16block.s16_signout'); 
    66 
    7 //  echo £link()->textTitle(__('Home'))->set('.widget16.s16block.s16_home'); 
    8  
    97  if ($sf_user->can('clear_cache')) 
    108  { 
     
    1210  } 
    1311   
    14 //  echo £link('dmCodeEditor/index')->textTitle(__('Code Editor'))->set('.widget16.s16block.s16_code_editor'); 
    15  
    1612  echo £('div.dm_menu.widget16', $menu->render()); 
    1713 
     
    3127 
    3228  echo £link('app:front')->textTitle(__('Go to site'))->set('.widget16.ml10'); 
     29 
     30  echo £('div.dm_active_users'); 
    3331   
    3432  if (sfConfig::get('sf_web_debug')) 
  • plugins/diemPlugin/trunk/dmAdminPlugin/web/css/bars.css

    r24212 r27286  
    22  top: 0; 
    33  -moz-box-shadow: 0 4px 4px #888; 
     4  -webkit-box-shadow: 0 4px 4px #888; 
    45} 
    56 
     
    6667  background: #fff; 
    6768  -moz-box-shadow: 4px 4px 4px #888; 
     69  -webkit-box-shadow: 4px 4px 4px #888; 
    6870} 
    6971 
     
    134136  width: 100%; 
    135137} 
     138 
     139#dm_tool_bar div.dm_active_users { 
     140  margin-left: 5px; 
     141} 
     142 
     143#dm_tool_bar div.dm_active_users span { 
     144  -moz-border-radius: 4px; 
     145  -webkit-border-radius: 4px; 
     146  background: #FFFFFF; 
     147  color: #000000; 
     148  float: left; 
     149  margin-top: 5px; 
     150  margin-left: 5px; 
     151  opacity: 0.7; 
     152  padding: 2px 5px; 
     153} 
  • plugins/diemPlugin/trunk/dmAdminPlugin/web/css/flash.css

    r22786 r27286  
    1 #flash
     1#flash, div.dm_active_locks
    22  margin-bottom: 5px; 
    33  cursor: pointer; 
    44} 
    55 
    6 #flash li.flash { 
     6#flash li.flash, 
     7div.dm_active_locks span { 
    78  border: 1px solid; 
    89  padding: 5px; 
    910  margin-top: 5px; 
    1011  color: #333; 
     12  -moz-border-radius: 4px; 
     13  -webkit-border-radius: 4px; 
     14  display: block; 
    1115} 
    1216 
     
    1620} 
    1721 
    18 #flash li.alert { 
     22#flash li.alert, 
     23div.dm_active_locks span { 
    1924  background: #F8F2B7 url(../images/flash/yellow.gif) repeat-x top left; 
    2025  border-color: #DBD6A1; 
  • plugins/diemPlugin/trunk/dmAdminPlugin/web/js/dmAdminCtrl.js

    r27081 r27286  
    3131 
    3232      this.checkVersion(); 
     33 
     34      this.launchPing(); 
    3335    }, 
    3436 
  • plugins/diemPlugin/trunk/dmCorePlugin/config/dm/assets.yml

    r27247 r27286  
    1515    auth:             dmCoreAuth 
    1616    codeArea:         dmCoreCodeArea 
     17    ping:             dmCorePing 
    1718     
    1819  lib: 
  • plugins/diemPlugin/trunk/dmCorePlugin/config/dm/config.yml

    r27253 r27286  
    5151    remember_cookie_name:               # defaults to "dm_remember_%project_name%" 
    5252    remember_key_expiration_age:        # defaults to 15 days 
     53    active_user_timeout:  10            # time in seconds to consider a user is no more active 
    5354  
    5455###### dm internal config ###### 
  • plugins/diemPlugin/trunk/dmCorePlugin/config/doctrine/schema.yml

    r26078 r27286  
    169169    description:            { type: string(60000) } 
    170170 
     171DmLock: 
     172  columns: 
     173    user_id:                { type: integer, notnull: true } 
     174    user_name:              { type: string(255), notnull: true } 
     175    module:                 { type: string(127), notnull: true } 
     176    action:                 { type: string(127), notnull: true } 
     177    record_id:              { type: integer, unsigned: true, notnull: true, default: 0 } 
     178    time:                   { type: integer, notnull: true } 
     179    app:                    { type: string(127), notnull: true } 
     180    url:                    { type: string(255), notnull: true } 
     181    culture:                { type: string(15), notnull: true } 
     182  indexes: 
     183    dmLockIndex: 
     184      fields:               [ user_id, module, action, record_id ] 
     185      type:                 unique 
     186  relations: 
     187    User: 
     188      class:                DmUser 
     189      local:                user_id 
     190      onDelete:             CASCADE 
     191 
    171192# SEO SCHEMA 
    172193 
  • plugins/diemPlugin/trunk/dmCorePlugin/data/dm/i18n/en_fr.yml

    r27269 r27286  
    402402"Click to edit": "Cliquer pour modifier" 
    403403"Code generation": "Génération du code" 
     404"%user% is browsing this page, you should not modify it now.": "%user% est déjà sur cette page, vous ne devriez pas la modifier maintenant." 
  • plugins/diemPlugin/trunk/dmCorePlugin/lib/filter/dmFilter.php

    r26906 r27286  
    44{ 
    55  protected 
    6   $request; 
     6  $request, 
     7  $response, 
     8  $user; 
    79 
    810  /** 
     
    1719  { 
    1820    $this->request = $context->getRequest(); 
     21    $this->response = $context->getResponse(); 
     22    $this->user = $context->getUser(); 
    1923 
    2024    return parent::initialize($context, $parameters); 
  • plugins/diemPlugin/trunk/dmCorePlugin/lib/filter/dmInitFilter.php

    r27135 r27286  
    44{ 
    55 
     6  protected function updateLock() 
     7  { 
     8    if(class_exists('DmLock') && $this->user->can('admin') && $this->response->isHtmlForHuman()) 
     9    { 
     10      dmDb::table('DmLock')->update(array( 
     11        'user_id'   => $this->user->getUserId(), 
     12        'user_name' => $this->user->getUser()->get('username'), 
     13        'time'      => $_SERVER['REQUEST_TIME'], 
     14        'app'       => sfConfig::get('sf_app'), 
     15        'module'    => $this->request->getParameter('module'), 
     16        'action'    => $this->request->getParameter('action'), 
     17        'record_id' => $this->request->getParameter('pk', 0), 
     18        'culture'   => $this->user->getCulture(), 
     19        'url'       => str_replace($this->request->getAbsoluteUrlRoot(), '', $this->request->getUri()) 
     20      )); 
     21    } 
     22  } 
     23 
    624  protected function loadAssetConfig() 
    725  { 
    8     if ($this->context->getResponse()->isHtmlForHuman()) 
     26    if ($this->response->isHtmlForHuman()) 
    927    { 
    10       $this->context->getResponse()->setAssetConfig($this->context->get('asset_config')); 
     28      $this->response->setAssetConfig($this->context->get('asset_config')); 
    1129    } 
    1230  } 
     
    2846    $appUrlKey = implode('-', array(sfConfig::get('sf_app'), sfConfig::get('sf_environment'))); 
    2947     
    30     $appUrl    = $this->request->getUriPrefix().$this->context->getRequest()->getScriptName(); 
     48    $appUrl    = $this->request->getUriPrefix().$this->request->getScriptName(); 
    3149       
    3250    if (!isset($knownBaseUrls[$appUrlKey]) || $knownBaseUrls[$appUrlKey] !== $appUrl) 
  • plugins/diemPlugin/trunk/dmCorePlugin/lib/view/html/layout/dmCoreLayoutHelper.php

    r26363 r27286  
    218218      'debug'              => sfConfig::get('sf_debug') ? true : false, 
    219219      'culture'            => $this->serviceContainer->getParameter('user.culture'), 
    220       'module'             => $this->serviceContainer->getParameter('controller.module') 
     220      'module'             => $this->serviceContainer->getParameter('controller.module'), 
     221      'action'             => $this->serviceContainer->getParameter('controller.action') 
    221222    )); 
    222223  } 
  • plugins/diemPlugin/trunk/dmCorePlugin/modules/dmCore/config/security.yml

    r24510 r27286  
    1414  is_secure:    true 
    1515  credential:   admin 
     16 
     17ping: 
     18  is_secure:    true 
     19  credential:   admin 
  • plugins/diemPlugin/trunk/dmCorePlugin/modules/dmCore/lib/BasedmCoreActions.class.php

    r27269 r27286  
    33class BasedmCoreActions extends dmBaseActions 
    44{ 
     5   
     6  public function executePing(dmWebRequest $request) 
     7  { 
     8    $recordId = $this->request->getParameter('record_id', 0); 
     9     
     10    $data = array( 
     11      'user_id'   => $this->getUser()->getUserId(), 
     12      'time'      => $_SERVER['REQUEST_TIME'], 
     13      'app'       => sfConfig::get('sf_app'), 
     14      'module'    => $this->request->getParameter('sf_module'), 
     15      'action'    => $this->request->getParameter('sf_action'), 
     16      'record_id' => $recordId, 
     17      'culture'   => $this->getUser()->getCulture() 
     18    ); 
     19     
     20    dmDb::table('DmLock')->ping($data); 
     21 
     22    $users = dmDb::table('DmLock')->getUserNames(); 
     23    $locks = $recordId ? dmDb::table('DmLock')->getLocks($data) : array(); 
     24 
     25    if(!empty($locks)) 
     26    { 
     27      foreach($locks as $index => $lock) 
     28      { 
     29        $locks[$index] = $this->getService('i18n')->__('%user% is browsing this page, you should not modify it now.', array( 
     30          '%user%' => '<strong>'.$lock.'</strong>' 
     31          )); 
     32      } 
     33    } 
     34 
     35    return $this->renderJson(array( 
     36      'users' => implode('|', $users), 
     37      'locks' => implode('|', $locks) 
     38    )); 
     39  } 
     40   
    541  public function executeThumbnail(dmWebRequest $request) 
    642  { 
  • plugins/diemPlugin/trunk/dmCorePlugin/web/css/mediaBar.css

    r25429 r27286  
    2222  font-size: 11px; 
    2323  -moz-box-shadow: -3px 0 4px #888; 
     24  -webkit-box-shadow: -3px 0 4px #888; 
    2425} 
    2526 
  • plugins/diemPlugin/trunk/dmCorePlugin/web/css/pageBar.css

    r24212 r27286  
    2222  font-size: 11px; 
    2323  -moz-box-shadow: 3px 0 4px #888; 
     24  -webkit-box-shadow: 3px 0 4px #888; 
    2425} 
    2526 
  • plugins/diemPlugin/trunk/dmCorePlugin/web/js/dmCoreEditCtrl.js

    r27114 r27286  
    33 
    44  $.dm.coreEditCtrl = $.extend($.dm.coreCtrl, { 
     5 
     6    launchPing: function() 
     7    { 
     8      $.dm.ping.init(this.options); 
     9    }, 
    510   
    611    liveEvents: function() 
     
    1318          return false; 
    1419        } 
     20         
     21        return true; 
    1522      }); 
    1623       
  • plugins/diemPlugin/trunk/dmFrontPlugin/lib/filter/dmFrontInitFilter.php

    r26905 r27286  
    3838    if (($page = $this->context->getPage()) && ($h1 = $page->_getI18n('h1'))) 
    3939    { 
    40       $this->context->getResponse()->setContent(preg_replace( 
     40      $this->response->setContent(preg_replace( 
    4141        '|<h1(.*)>.*</h1>|iuU', 
    4242        '<h1$1>'.$h1.'</h1>', 
    43         $this->context->getResponse()->getContent() 
     43        $this->response->getContent() 
    4444      )); 
    4545    } 
  • plugins/diemPlugin/trunk/dmFrontPlugin/web/css/toolBar.css

    r27125 r27286  
    8181  background: #fff; 
    8282  -moz-box-shadow: 4px -4px 4px #888; 
     83  -webkit-box-shadow: 4px -4px 4px #888; 
    8384} 
    8485