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

Changeset 10800


Ignore:
Timestamp:
Feb 19, 2009, 3:29:59 PM (11 years ago)
Author:
ebihara
Message:

#3648:added ability to set gadgets for the login page

Location:
OpenPNE3/trunk
Files:
5 added
19 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_backend/modules/design/actions/actions.class.php

    r10335 r10800  
    3535  public function executeHomeLayout(sfWebRequest $request)
    3636  {
    37     $this->form = new PickHomeLayoutForm();
     37    $option = array();
     38    $params = '';
     39    if ($request->getParameter('login'))
     40    {
     41      $option['layout_name'] = 'login_layout';
     42      $params = '?login=1';
     43    }
     44    $this->form = new PickHomeLayoutForm(array(), $option);
    3845
    3946    if ($request->isMethod(sfRequest::POST))
    4047    {
    4148      $this->form->bind($request->getParameter('pick_home_layout'));
    42       $this->redirectIf($this->form->save(), 'design/homeLayout');
     49      $this->redirectIf($this->form->save(), 'design/homeLayout'.$params);
    4350    }
    4451
     
    95102
    96103 /**
     104  * Executes login gadget plot action
     105  *
     106  * @param sfRequest $request A request object
     107  */
     108  public function executeLoginGadgetPlot(sfWebRequest $request)
     109  {
     110    $this->layoutPattern = 'layoutA';
     111    $this->topGadgets = (array)GadgetPeer::retrieveLoginTopGadgets();
     112    $this->sideMenuGadgets = (array)GadgetPeer::retrieveLoginSideMenuGadgets();
     113    $this->contentsGadgets = (array)GadgetPeer::retrieveLoginContentsGadgets();
     114    $this->bottomGadgets = (array)GadgetPeer::retrieveLoginBottomGadgets();
     115    $this->gadgetConfig = sfConfig::get('op_login_gadget_list');
     116
     117    $layout = SnsConfigPeer::retrieveByName('login_layout');
     118    if ($layout)
     119    {
     120      $this->layoutPattern = $layout->getValue();
     121    }
     122
     123    return sfView::SUCCESS;
     124  }
     125
     126 /**
    97127  * Executes add gadget action
    98128  *
     
    101131  public function executeAddGadget(sfWebRequest $request)
    102132  {
    103     $this->type = $request->getParameter('type',GadgetPeer::TOP_TYPE);
     133    $this->type = $request->getParameter('type', GadgetPeer::TOP_TYPE);
    104134    $this->config = GadgetPeer::getGadgetConfigListByType($this->type);
    105135
     
    124154    if (!empty($this->config['config']))
    125155    {
    126       $this->form = new GadgetConfigForm($this->gadget);
     156      $this->form = new GadgetConfigForm($this->gadget, array('type' => $type));
    127157
    128158      if ($request->isMethod(sfRequest::POST))
  • OpenPNE3/trunk/apps/pc_backend/modules/design/config/view.yml

    r10260 r10800  
    1717  javascripts: [%SF_PROTOTYPE_WEB_DIR%/js/prototype]
    1818
     19loginGadgetPlotSuccess:
     20  <<: *homeGadgetPlotSuccess
     21
    1922sideBannerGadgetPlotSuccess:
    2023  <<: *homeGadgetPlotSuccess
  • OpenPNE3/trunk/apps/pc_backend/modules/design/lib/PickHomeLayoutForm.class.php

    r10003 r10800  
    2323  {
    2424    $default = 0;
    25     $snsConfig = SnsConfigPeer::retrieveByName('home_layout');
     25    $snsConfig = SnsConfigPeer::retrieveByName($this->getOption('layout_name', 'home_layout'));
    2626    if ($snsConfig)
    2727    {
     
    4949    }
    5050
    51     $snsConfig = SnsConfigPeer::retrieveByName('home_layout');
     51    $snsConfig = SnsConfigPeer::retrieveByName($this->getOption('layout_name', 'home_layout'));
    5252    if (!$snsConfig)
    5353    {
    5454      $snsConfig = new SnsConfig();
    55       $snsConfig->setName('home_layout');
     55      $snsConfig->setName($this->getOption('layout_name', 'home_layout'));
    5656    }
    5757    $value = $this->choices[$this->values['layout']];
  • OpenPNE3/trunk/apps/pc_backend/modules/design/lib/WidgetAddForm.class.php

    r10260 r10800  
    5656    {
    5757      if (array_key_exists($item, sfConfig::get('op_gadget_list'))
     58        || array_key_exists($item, sfConfig::get('op_login_gadget_list'))
    5859        || array_key_exists($item, sfConfig::get('op_mobile_gadget_list'))
    5960        || array_key_exists($item, sfConfig::get('op_side_banner_gadget_list')))
  • OpenPNE3/trunk/apps/pc_backend/modules/design/lib/WidgetSortForm.class.php

    r10260 r10800  
    7171      {
    7272        if (array_key_exists($gadget->getName(), sfConfig::get('op_gadget_list'))
     73          || array_key_exists($gadget->getName(), sfConfig::get('op_login_gadget_list'))
    7374          || array_key_exists($gadget->getName(), sfConfig::get('op_mobile_gadget_list'))
    7475          || array_key_exists($gadget->getName(), sfConfig::get('op_side_banner_gadget_list')))
  • OpenPNE3/trunk/apps/pc_backend/modules/design/templates/gadgetSuccess.php

    r10260 r10800  
    55<h2>
    66<?php switch ($type): ?>
     7<?php case 'login': ?>
     8<?php echo __('ログイン画面ガジェット設定'); break; ?>
    79<?php case 'mobileHome': ?>
    810<?php echo __('携帯版ホーム画面ガジェット設定'); break; ?>
     
    1820<ul>
    1921<li><?php echo link_to(__('ホーム画面ガジェット設定'), 'design/gadget?type=home') ?></li>
     22<li><?php echo link_to(__('ログイン画面ガジェット設定'), 'design/gadget?type=login') ?></li>
    2023<li><?php echo link_to(__('サイドバナー領域ガジェット設定'), 'design/gadget?type=sideBanner') ?></li>
    2124<li><?php echo link_to(__('携帯版ホーム画面ガジェット設定'), 'design/gadget?type=mobileHome') ?></li>
  • OpenPNE3/trunk/apps/pc_backend/modules/design/templates/homeLayoutSuccess.php

    r9831 r10800  
    33<?php end_slot() ?>
    44
    5 <h2><?php echo __('ホーム画面レイアウト設定') ?></h2>
     5<h2>
     6<?php if ($sf_request->getParameter('login')) : ?>
     7<?php echo __('ログイン画面レイアウト設定'); ?>
     8<?php else: ?>
     9<?php echo __('ホーム画面レイアウト設定') ?>
     10<?php endif; ?>
     11</h2>
     12
     13<p><?php echo __('特定ページのレイアウトパターンを設定できます。ここで設定したレイアウトに従って、ガジェットを配置することができます。') ?></p>
     14
     15<ul>
     16<li><?php echo link_to(__('ホーム画面レイアウト設定'), 'design/homeLayout') ?></li>
     17<li><?php echo link_to(__('ログイン画面レイアウト設定'), 'design/homeLayout?login=1') ?></li>
     18</ul>
    619
    720<?php echo $form->renderFormTag(url_for('design/homeLayout')) ?>
     
    922<?php echo $form['layout']->render() ?>
    1023<?php echo $form->renderHiddenFields() ?>
     24<?php if ($sf_request->getParameter('login')) : ?>
     25<input type="hidden" name="login" value="1" />
     26<?php endif; ?>
    1127</form>
  • OpenPNE3/trunk/apps/pc_frontend/modules/default/actions/components.class.php

    r10444 r10800  
    5050  }
    5151
     52  public function executeFreeAreaBox()
     53  {
     54  }
     55
    5256  public function executeMemberImageBox()
    5357  {
     
    6569  {
    6670    $this->form = new opLanguageSelecterForm();
     71  }
     72
     73  public function executeLoginFormBox()
     74  {
     75    $this->forms = $this->getUser()->getAuthForms();
    6776  }
    6877
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/actions/actions.class.php

    r10777 r10800  
    4747
    4848 /**
     49  * Executes login action
     50  *
     51  * @param sfRequest $request A request object
     52  */
     53  public function executeLogin($request)
     54  {
     55    $this->gadgetConfig = sfConfig::get('op_login_gadget_list');
     56    $layout = SnsConfigPeer::retrieveByName('login_layout');
     57    if ($layout)
     58    {
     59      $this->setLayout($layout->getValue());
     60    }
     61
     62    if (!$layout || $layout->getValue() === 'layoutA')
     63    {
     64      $this->topGadgets = GadgetPeer::retrieveLoginTopGadgets();
     65    }
     66    if (!$layout || $layout->getValue() === 'layoutA' || $layout->getValue() === 'layoutB')
     67    {
     68      $this->sideMenuGadgets = GadgetPeer::retrieveLoginSideMenuGadgets();
     69    }
     70    $this->contentsGadgets = GadgetPeer::retrieveLoginContentsGadgets();
     71    $this->bottomGadgets = GadgetPeer::retrieveLoginBottomGadgets();
     72
     73    return parent::executeLogin($request);
     74  }
     75
     76 /**
    4977  * Executes search action
    5078  *
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/config/view.yml

    r10593 r10800  
    1313configSuccess:
    1414  layout: layoutB
     15
     16loginSuccess:
     17  layout: layoutA
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/loginSuccess.php

    r8759 r10800  
    1 <?php foreach ($forms as $form) : ?>
     1<?php if ($topGadgets): ?>
     2<?php slot('op_top') ?>
     3<?php foreach ($topGadgets as $gadget): ?>
     4<?php if ($gadget->isEnabled()): ?>
     5<?php include_component($gadget->getComponentModule(), $gadget->getComponentAction(), array('gadget' => $gadget)); ?>
     6<?php endif; ?>
     7<?php endforeach; ?>
     8<?php end_slot() ?>
     9<?php endif; ?>
    210
    3 <?php include_login_parts('Login', $form, 'member/login'); ?>
     11<?php if ($sideMenuGadgets): ?>
     12<?php slot('op_sidemenu') ?>
     13<?php foreach ($sideMenuGadgets as $gadget): ?>
     14<?php if ($gadget->isEnabled()): ?>
     15<?php include_component($gadget->getComponentModule(), $gadget->getComponentAction(), array('gadget' => $gadget)); ?>
     16<?php endif; ?>
     17<?php endforeach; ?>
     18<?php end_slot() ?>
     19<?php endif; ?>
    420
     21<?php if ($contentsGadgets): ?>
     22<?php foreach ($contentsGadgets as $gadget): ?>
     23<?php if ($gadget->isEnabled()): ?>
     24<?php include_component($gadget->getComponentModule(), $gadget->getComponentAction(), array('gadget' => $gadget)); ?>
     25<?php endif; ?>
    526<?php endforeach; ?>
     27<?php endif; ?>
     28
     29<?php if ($bottomGadgets): ?>
     30<?php slot('op_bottom') ?>
     31<?php foreach ($bottomGadgets as $gadget): ?>
     32<?php if ($gadget->isEnabled()): ?>
     33<?php include_component($gadget->getComponentModule(), $gadget->getComponentAction(), array('gadget' => $gadget)); ?>
     34<?php endif; ?>
     35<?php endforeach; ?>
     36<?php end_slot() ?>
     37<?php endif; ?>
  • OpenPNE3/trunk/data/fixtures/000_revision.yml

    r10799 r10800  
    22  current_revision:
    33    name:  "OpenPNE_revision"
    4     value: 1
     4    value: 2
  • OpenPNE3/trunk/data/fixtures/005_import_gadgets.yml

    r10493 r10800  
    3434    name: "informationBox"
    3535    sort_order: 10
     36
     37  login_gadget_login_form_box:
     38    type: "loginTop"
     39    name: "loginForm"
     40    sort_order: 10
  • OpenPNE3/trunk/lib/config/config/config_handlers.yml

    r10485 r10800  
    1919    prefix: mobile_
    2020
     21config/login_gadget.yml:
     22  class: opGadgetConfigHandler
     23  file:  %SF_LIB_DIR%/config/opGadgetConfigHandler.class.php
     24  param:
     25    prefix: login_
     26
    2127config/mobile_mail_domain.yml:
    2228  class: sfSimpleYamlConfigHandler
  • OpenPNE3/trunk/lib/config/config/gadget.yml

    r10260 r10800  
    66  component: [default, informationBox]
    77  config:
     8    value:
     9      Name:       "value"
     10      Caption:    "内容"
     11      FormType:   "rich_textarea"
     12      ValueType:  "text"
     13      IsRequired: false
     14
     15freeArea:
     16  caption:
     17    ja_JP: "フリーエリア"
     18  description:
     19    ja_JP: "フリーエリアを設置できます"
     20  component: [default, freeAreaBox]
     21  config:
     22    title:
     23      Name:       "title"
     24      Caption:    "タイトル"
     25      FormType:   "input"
     26      ValueType:  "text"
     27      IsRequired: false
    828    value:
    929      Name:       "value"
  • OpenPNE3/trunk/lib/config/sfOpenPNEApplicationConfiguration.class.php

    r10684 r10800  
    6464    include($this->getConfigCache()->checkConfig('config/mobile_gadget.yml'));
    6565    include($this->getConfigCache()->checkConfig('config/side_banner_gadget.yml'));
     66    include($this->getConfigCache()->checkConfig('config/login_gadget.yml'));
    6667
    6768    return $result;
  • OpenPNE3/trunk/lib/form/GadgetConfigForm.class.php

    r10260 r10800  
    2626    parent::__construct(array(), $options, $CSRFSecret);
    2727
    28     $config = sfConfig::get('op_gadget_list', array());
     28    $config = GadgetPeer::getGadgetConfigListByType($options['type']);
    2929    if (empty($config[$gadget->getName()]['config']))
    3030    {
  • OpenPNE3/trunk/lib/model/GadgetPeer.php

    r10335 r10800  
    1212{
    1313  const HOME_TYPES = 'home';
    14 
     14  const LOGIN_TYPES = 'login';
    1515  const MOBILE_HOME_TYPES = 'mobileHome';
    16 
    1716  const SIDE_BANNER_TYPES = 'sideBanner';
    1817
    1918  const TOP_TYPE = 'top';
    20 
    2119  const SIDE_MENU_TYPE = 'sideMenu';
    22 
    2320  const CONTENTS_TYPE = 'contents';
    24 
    2521  const BOTTOM_TYPE = 'bottom';
    2622
     23  const LOGIN_TOP_TYPE = 'loginTop';
     24  const LOGIN_SIDE_MENU_TYPE = 'loginSideMenu';
     25  const LOGIN_CONTENTS_TYPE = 'loginContents';
     26  const LOGIN_BOTTOM_TYPE = 'loginBottom';
     27
    2728  const MOBILE_TOP_TYPE = 'mobileTop';
    28 
    2929  const MOBILE_CONTENTS_TYPE = 'mobileContents';
    30 
    3130  const MOBILE_BOTTOM_TYPE = 'mobileBottom';
    3231
    3332  const SIDE_BANNER_CONTENTS_TYPE = 'sideBannerContents';
    3433
    35   static protected $homeTypes = array(self::TOP_TYPE, self::SIDE_MENU_TYPE, self::CONTENTS_TYPE, self::BOTTOM_TYPE);
    36 
    37   static protected $mobileHomeTypes = array(self::MOBILE_TOP_TYPE, self::MOBILE_CONTENTS_TYPE, self::MOBILE_BOTTOM_TYPE);
    38  
    39   static protected $sideBannerTypes = array(self::SIDE_BANNER_CONTENTS_TYPE);
    40 
    41   static protected $results;
     34  static protected
     35    $homeTypes = array(self::TOP_TYPE, self::SIDE_MENU_TYPE, self::CONTENTS_TYPE, self::BOTTOM_TYPE),
     36    $loginTypes = array(self::LOGIN_TOP_TYPE, self::LOGIN_SIDE_MENU_TYPE, self::LOGIN_CONTENTS_TYPE, self::LOGIN_BOTTOM_TYPE),
     37    $mobileHomeTypes = array(self::MOBILE_TOP_TYPE, self::MOBILE_CONTENTS_TYPE, self::MOBILE_BOTTOM_TYPE),
     38    $sideBannerTypes = array(self::SIDE_BANNER_CONTENTS_TYPE),
     39    $results;
    4240
    4341  static public function retrieveGadgetsByTypesName($typesName)
     
    4846      case self::MOBILE_HOME_TYPES:
    4947        $types = self::$mobileHomeTypes;
     48        break;
     49      case self::LOGIN_TYPES:
     50        $types = self::$loginTypes;
    5051        break;
    5152      case self::SIDE_BANNER_TYPES:
     
    8485  }
    8586
     87  static public function retrieveLoginTopGadgets()
     88  {
     89    return self::retrieveByType(self::LOGIN_TOP_TYPE);
     90  }
     91
     92  static public function retrieveLoginSideMenuGadgets()
     93  {
     94    return self::retrieveByType(self::LOGIN_SIDE_MENU_TYPE);
     95  }
     96
     97  static public function retrieveLoginContentsGadgets()
     98  {
     99    return self::retrieveByType(self::LOGIN_CONTENTS_TYPE);
     100  }
     101
     102  static public function retrieveLoginBottomGadgets()
     103  {
     104    return self::retrieveByType(self::LOGIN_BOTTOM_TYPE);
     105  }
     106
    86107  static public function retrieveMobileTopGadgets()
    87108  {
     
    167188      return sfConfig::get('op_gadget_list', array());
    168189    }
     190    elseif (in_array($type, self::$loginTypes))
     191    {
     192      return sfConfig::get('op_login_gadget_list', array());
     193    }
    169194    elseif (in_array($type, self::$mobileHomeTypes))
    170195    {
  • OpenPNE3/trunk/web/css/gadgetPlot.css

    r10260 r10800  
    1818}
    1919
    20 #plotTop
     20#plotTop,
     21#plotLoginTop
    2122{
    2223  width: 100%;
    2324}
    2425
    25 .layoutA #plotSideMenu
     26.layoutA #plotSideMenu,
     27.layoutA #plotLoginSideMenu
    2628{
    2729  width: 150px;
     
    3032}
    3133
    32 .layoutA #plotContents
     34.layoutA #plotContents,
     35.layoutA #plotLoginContents
    3336{
    3437  width: 380px;
     
    3841}
    3942
    40 .layoutB #plotSideMenu
     43.layoutB #plotSideMenu,
     44.layoutB #plotLoginSideMenu
    4145{
    4246  width: 100px;
     
    4448}
    4549
    46 .layoutB #plotContents
     50.layoutB #plotContents,
     51.layoutB #plotLoginContents
    4752{
    4853  width: 430px;
     
    5156}
    5257
    53 .layoutC #plotContents
     58.layoutC #plotContents,
     59.layoutC #plotLoginContents
    5460{
    5561  width: 540px;
     
    5763}
    5864
    59 #plotBottom
     65#plotBottom,
     66#plotLoginBottom
    6067{
    6168  width: 100%;
     
    6774#plotContents div,
    6875#plotBottom div,
     76#plotLoginTop div,
     77#plotLoginSideMenu div,
     78#plotLoginContents div,
     79#plotLoginBottom div,
    6980#plotSideBannerContents div,
    7081#plotMobileTop div,
     
    8596#plotContents div.emptyGadget,
    8697#plotBottom div.emptyGadget,
     98#plotLoginTop div.emptyGadget,
     99#plotLoginSideMenu div.emptyGadget,
     100#plotLoginContents div.emptyGadget,
     101#plotLoginBottom div.emptyGadget,
    87102#plotSideBannerContents div.emptyGadget,
    88103#plotMobileTop div.emptyGadget,
Note: See TracChangeset for help on using the changeset viewer.