ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 12299


Ignore:
Timestamp:
Jul 17, 2009, 10:09:11 PM (11 years ago)
Author:
ebihara
Message:

#4131:fixed configurations that displayed when the depending configuration is a disabled

Location:
OpenPNE3/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/mobile_frontend/modules/default/templates/nonMobileErrorSuccess.php

    r10300 r12299  
    11<?php echo __('Can view this page with mobile only.'); ?><br />
     2<?php if ($op_config['enable_pc']): ?>
    23<a href="<?php echo public_path('/') ?>"><?php echo __('The page for pc is here.') ?></a>
     4<?php endif; ?>
  • OpenPNE3/trunk/apps/mobile_frontend/modules/member/actions/actions.class.php

    r11895 r12299  
    3232    $this->mobileBottomGadgets = $gadgets['mobileBottom'];
    3333
    34     $this->categories = sfConfig::get('openpne_member_category');
    35     $this->categoryCaptions = array();
    36     $attributes = sfConfig::get('openpne_member_category_attribute');
    37     foreach ($this->categories as $key => $value)
    38     {
    39       $title = $key;
    40      
    41       if (isset($attributes[$key]['enable_mobile']))
    42       {
    43         if (!$attributes[$key]['enable_mobile'])
    44         {
    45           unset($this->categories[$key]);
    46           continue;
    47         }
    48       }
    49 
    50       if (!empty($attributes[$key]['caption']))
    51       {
    52         $title = $attributes[$key]['caption'];
    53       }
    54 
    55       $this->categoryCaptions[$key] = $title;
    56     }
    57    
     34    $filteredCategory = $this->filterConfigCategory();
     35    $this->categories = $filteredCategory['category'];
     36    $this->categoryCaptions = $filteredCategory['captions'];
    5837
    5938    return parent::executeHome($request);
  • OpenPNE3/trunk/lib/action/sfOpenPNEMemberAction.class.php

    r12061 r12299  
    245245  public function executeConfig($request)
    246246  {
    247     $this->categories = sfConfig::get('openpne_member_category');
    248 
    249     $this->categoryCaptions = array();
    250     $categoryAttributes = sfConfig::get('openpne_member_category_attribute');
    251 
    252     foreach ($this->categories as $key => $value)
    253     {
    254       $title = $key;
    255 
    256       $enabledKey = 'enable_pc';
    257       if (sfConfig::get('sf_app') == 'mobile_frontend')
    258       {
    259         $enabledKey = 'enable_mobile';
    260       }
    261 
    262       if (isset($categoryAttributes[$key][$enabledKey]))
    263       {
    264         if (!$categoryAttributes[$key][$enabledKey])
    265         {
    266           unset($this->categories[$key]);
    267           continue;
    268         }
    269       }
    270 
    271       if (!empty($categoryAttributes[$key]['caption']))
    272       {
    273         $title = $categoryAttributes[$key]['caption'];
    274       }
    275 
    276       $this->categoryCaptions[$key] = $title;
    277     }
     247    $filteredCategory = $this->filterConfigCategory();
     248    $this->categories = $filteredCategory['category'];
     249    $this->categoryCaptions = $filteredCategory['captions'];
    278250
    279251    $this->categoryName = $request->getParameter('category', null);
     
    406378    $this->redirect('member/configImage');
    407379  }
    408 
    409380
    410381  protected function sendDeleteAccountMail($member)
     
    418389    $mail->send(opConfig::get('admin_mail_address'), opConfig::get('admin_mail_address'));
    419390  }
     391
     392  protected function filterConfigCategory()
     393  {
     394    $categories = sfConfig::get('openpne_member_category');
     395    $categoryCaptions = array();
     396    $categoryAttributes = sfConfig::get('openpne_member_category_attribute');
     397
     398    foreach ($categories as $key => $value)
     399    {
     400      $title = $key;
     401
     402      if (isset($categoryAttributes[$key]['depending_sns_config']))
     403      {
     404        $snsConfig = $categoryAttributes[$key]['depending_sns_config'];
     405        if (!Doctrine::getTable('SnsConfig')->get($snsConfig))
     406        {
     407          unset($categories[$key]);
     408          continue;
     409        }
     410      }
     411
     412      $enabledKey = 'enable_pc';
     413      if (sfConfig::get('sf_app') == 'mobile_frontend')
     414      {
     415        $enabledKey = 'enable_mobile';
     416      }
     417
     418      if (isset($categoryAttributes[$key][$enabledKey]))
     419      {
     420        if (!$categoryAttributes[$key][$enabledKey])
     421        {
     422          unset($categories[$key]);
     423          continue;
     424        }
     425      }
     426
     427      if (!empty($categoryAttributes[$key]['caption']))
     428      {
     429        $title = $categoryAttributes[$key]['caption'];
     430      }
     431
     432      $categoryCaptions[$key] = $title;
     433    }
     434
     435    return array('category' => $categories, 'captions' => $categoryCaptions);
     436  }
    420437}
  • OpenPNE3/trunk/lib/config/config/member_config.yml

    r11151 r12299  
    2020    enable_pc:     true
    2121    enable_mobile: true
     22    depending_sns_config: enable_pc
    2223  pc_address:
    2324    Name:       "pc_address"
     
    3637    enable_pc:     true
    3738    enable_mobile: true
     39    depending_sns_config: enable_mobile
    3840  mobile_address:
    3941    Name:       "mobile_address"
Note: See TracChangeset for help on using the changeset viewer.