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

Changeset 9562


Ignore:
Timestamp:
Dec 15, 2008, 5:53:34 PM (12 years ago)
Author:
ShogoKawahara
Message:

#3119:added some actions for the OpenSocial application configuration

Location:
OpenPNE3/plugins/opOpenSocialPlugin/trunk
Files:
7 added
7 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/application/actions/actions.class.php

    r9526 r9562  
    1818  public function executeIndex($request)
    1919  {
     20    return $this->redirect('application/applicationConfig');
     21  }
     22
     23 /**
     24  * Executes applicationConfig action
     25  *
     26  * @param sfRequest $request A request object
     27  */
     28  public function executeApplicationConfig($request)
     29  {
     30    $this->applicationConfigForm = new ApplicationConfigForm();
     31
     32    if (!$request->isMethod('post'))
     33    {
     34      return sfView::SUCCESS;
     35    }
     36
     37    $this->applicationConfigForm->bind($request->getParameter('application_config'));
     38    if ($this->applicationConfigForm->isValid())
     39    {
     40      $this->applicationConfigForm->save();
     41    }
    2042    return sfView::SUCCESS;
    2143  }
     
    5072    try
    5173    {
    52       $app = ApplicationPeer::addApplication($contact['application_url'], $this->getUser()->getCulture());     
     74      $application = ApplicationPeer::addApplication($contact['application_url'], $this->getUser()->getCulture(),true);     
    5375    }
    5476    catch (Exception $e)
    5577    {
    56       //TODO : add error action
    57       return sfView::SUCCESS;
     78      return sfView::ERROR;
    5879    }
     80    return $this->redirect('application/info?id='.$application->getId());
    5981  }
    6082
     
    89111  public function executeProfileSetting($request)
    90112  {
    91 
     113    $this->profileConfigForm = new OpenSocialPersonFieldConfigForm();
    92114    return sfView::SUCCESS;
    93115  }
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/application/templates/_submenu.php

    r9526 r9562  
    1 <li><?php echo link_to(__('アプリケーション管理'),'application/list') ?></li>
    2 <li><?php echo link_to(__('OpenSocialAPIプロフィール連動設定'),'application/profileSetting') ?></li>
     1<li><?php echo link_to(__('アプリケーションの設定'), 'application/applicationConfig') ?></li>
     2<li><?php echo link_to(__('アプリケーション管理'), 'application/list') ?></li>
     3<li><?php echo link_to(__('OpenSocialAPIプロフィール連動設定'), 'application/profileSetting') ?></li>
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/application/templates/profileSettingSuccess.php

    r9526 r9562  
    33<?php end_slot() ?>
    44
    5 <h2></h2>
    6 
     5<h2>OpenSocialAPIプロフィール連動設定</h2>
     6<table>
     7<th>識別名</th><th>対応先</th>
     8<?php echo $profileConfigForm ?>
     9<tr><td colspan="2"><input type="submit" value="設定変更"></td></tr>
     10</table>
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_frontend/modules/application/actions/actions.class.php

    r9541 r9562  
    106106    }
    107107
    108     if (!$request->isMethod('post'))
     108    $this->is_add_application = false;
     109    $snsConfig = SnsConfigPeer::retrieveByName('is_add_application');
     110    if ($snsConfig && $snsConfig->getValue())
     111    {
     112      $this->is_add_application = true;
     113    }
     114
     115    if (!$request->isMethod('post') || !$this->is_add_application)
    109116    {
    110117      return sfView::SUCCESS;
     
    142149    }
    143150
     151    $modId = $request->getParameter('mid');
     152    $member_app = MemberApplicationPeer::retrieveByPK($modId);
     153    $this->appName = $member_app->getApplication()->getTitle();
     154
    144155    $this->applicationSettingForm = new ApplicationSettingForm();
    145156    $member_id = $this->getUser()->getMember()->getId();
    146     $modId = $request->getParameter('mid');
    147157    $this->applicationSettingForm->setConfigWidgets($member_id, $modId);
    148158
    149     $member_app = MemberApplicationPeer::retrieveByPK($modId);
    150     $this->appName = $member_app->getApplication()->getTitle();
    151 
    152     $this->memberApplicationSettingForm = new MemberApplicationSettingForm();
    153     $isDispOther = $member_app->getIsDispOther();
    154     $isDispHome  = $member_app->getIsDispHome();
    155         $this->memberApplicationSettingForm->setDefaults(array(
    156       'is_disp_other' => $isDispOther,
    157       'is_disp_home'  => $isDispHome,
    158     ));
     159    $this->memberApplicationSettingForm = new MemberApplicationSettingForm($member_app);
    159160
    160161    if (!$request->isMethod('post'))
     
    162163      return sfView::SUCCESS;
    163164    }
    164    
     165
    165166    $this->memberApplicationSettingForm->bind($request->getParameter('member_app_setting'));
    166167    $this->applicationSettingForm->bind($request->getParameter('setting'));
     
    169170    {
    170171      $this->applicationSettingForm->save($modId);
    171       $this->memberApplicationSettingForm->save($modId);
     172      $this->memberApplicationSettingForm->save();
    172173      $this->redirect('application/canvas?mid='.$modId);
    173174    }
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_frontend/modules/application/templates/listSuccess.php

    r9541 r9562  
    33<?php if ($is_owner) : ?>
    44<?php echo link_to(__('Application Gallery'), 'application/gallery') ?>
     5<?php if ($is_add_application) : ?>
    56<?php include_box('form','アプリケーション追加','',array(
    67  'form' => array($form),
     
    89  'button' => 'add'
    910)) ?>
     11<?php endif ?>
    1012<?php endif ?>
    1113<?php if (isset($member_apps) && count($member_apps)) : ?>
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/lib/form/MemberApplicationSettingForm.class.php

    r9507 r9562  
    2222    $this->widgetSchema->setNameFormat('member_app_setting[%s]');
    2323  }
    24 
    25   public function save($moduleId)
    26   {
    27     $values = $this->getValues();
    28     $memberApplication = MemberApplicationPeer::retrieveByPk($moduleId);
    29     if (!$memberApplication)
    30     {
    31       return false;
    32     }
    33 
    34     $memberApplication->setIsDispOther($values['is_disp_other']);
    35     $memberApplication->setIsDispHome($values['is_disp_home']);
    36     $memberApplication->save();
    37     return true;
    38   }
    3924}
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/lib/user/opJsonDbOpensocialService.class.php

    r9464 r9562  
    2929  public function getPeople($userId, $groupId, CollectionOptions $options, $fields, SecurityToken $token)
    3030  {
     31    sfLoader::loadHelpers("Asset");
     32    sfLoader::loadHelpers("sfImage");
    3133    $ids = $this->getIdSet($userId, $groupId, $token);
    3234    $first = $options->getStartIndex();
     
    4951      $p['isOwner']    =  (!$token->isAnonymous() && $member->getId() == $token->getOwnerId()) ? true : false;
    5052      $p['isViewer']   =  (!$token->isAnonymous() && $member->getId() == $token->getViewerId()) ? true : false;
    51       $p['displayName'] = $member->getName();
     53      $p['id']           = $member->getId();
     54      $p['displayName']  = $member->getName();
     55      $p['thumbnailUrl'] = "";
     56      if ($member->getImage())
     57      {
     58        $p['thumbnailUrl'] = sf_image_path($member->getImage()->getFile()->getName(),
     59          array('size' => '180x180'), true);
     60      }
     61      $p['profileUrl']   = sfContext::getInstance()->getController()->genUrl("@member_profile?id=".$member->getId(),true);
     62      $memberProfiles = MemberProfilePeer::getProfileListByMemberId($member->getId());
     63      foreach ($memberProfiles as $memberProfile)
     64      {
     65        $osPersonField = $memberProfile->getProfile()->getOpensocialPersonField();
     66        if ($osPersonField)
     67        {
     68          $fieldName = $osPersonField->getFieldName();
     69          $fieldNames = explode("_",$fieldName);
     70          $fieldNames[0] = strtolower($fieldNames[0]);
     71          for ($i = 1;$i < count($fieldNames);$i++)
     72          {
     73            $fieldNames[$i] = ucfirst(strtolower($fieldNames[$i]));
     74          }
     75          $fieldName = implode("",$fieldNames);
     76          switch ($memberProfile->getProfile()->getFormType())
     77          {
     78            case "date":
     79              $p[$fieldName] = date("Y/m/d",strtotime($memberProfile->getValue()));
     80              break;
     81            default:
     82              $p[$fieldName] = $memberProfile->getValue();
     83          }
     84        }
     85      }
    5286      $people[] = $p;
    5387    }
Note: See TracChangeset for help on using the changeset viewer.