[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/horde/Horde/SyncML/Command/ -> Status.php (source)

   1  <?php
   2  
   3  include_once 'Horde/SyncML/State.php';
   4  include_once 'Horde/SyncML/Command.php';
   5  
   6  /**
   7   * $Horde: framework/SyncML/SyncML/Command/Status.php,v 1.15 2004/07/02 19:24:44 chuck Exp $
   8   *
   9   * Copyright 2003-2004 Anthony Mills <amills@pyramid6.com>
  10   *
  11   * See the enclosed file COPYING for license information (LGPL). If you
  12   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  13   *
  14   * @author  Anthony Mills <amills@pyramid6.com>
  15   * @version $Revision: 21249 $
  16   * @since   Horde 3.0
  17   * @package Horde_SyncML
  18   */
  19  class Horde_SyncML_Command_Status extends Horde_SyncML_Command {
  20  
  21      var $_response;
  22  
  23      var $_cmdRef;
  24  
  25      /**
  26       * Must be present.
  27       */
  28      var $_cmd;
  29  
  30      /**
  31       * Must if not null (what does this mean?).
  32       */
  33      var $_sourceRef;
  34  
  35      var $_targetRef;
  36  
  37      var $_chalMetaFormat;
  38  
  39      var $_chalMetaType;
  40  
  41      var $_chalMetaNextNonce;
  42  
  43      var $_itemDataAnchorNext;
  44  
  45      var $_itemDataAnchorLast;
  46  
  47      var $_itemTargetLocURI;
  48  
  49      var $_itemSourceLocURI;
  50  
  51      function Horde_SyncML_Command_Status($response = null, $cmd = null)
  52      {
  53          if ($response != null) {
  54              $this->_response = $response;
  55          }
  56  
  57          if ($cmd != null) {
  58              $this->_cmd = $cmd;
  59          }
  60      }
  61  
  62      function output($currentCmdID, &$output)
  63      {
  64          $attrs = array();
  65  
  66          $state = $_SESSION['SyncML.state'];
  67  
  68          if ($this->_cmd != null) {
  69              $attrs = array();
  70              $output->startElement($state->getURI(), 'Status', $attrs);
  71  
  72              $output->startElement($state->getURI(), 'CmdID', $attrs);
  73              $chars = $currentCmdID;
  74              $output->characters($chars);
  75              $output->endElement($state->getURI(), 'CmdID');
  76  
  77              $output->startElement($state->getURI(), 'MsgRef', $attrs);
  78              $chars = $state->getMsgID();
  79              $output->characters($chars);
  80              $output->endElement($state->getURI(), 'MsgRef');
  81  
  82              $output->startElement($state->getURI(), 'CmdRef', $attrs);
  83              $chars = $this->_cmdRef;
  84              $output->characters($chars);
  85              $output->endElement($state->getURI(), 'CmdRef');
  86  
  87              $output->startElement($state->getURI(), 'Cmd', $attrs);
  88              $chars = $this->_cmd;
  89              $output->characters($chars);
  90              $output->endElement($state->getURI(), 'Cmd');
  91  
  92              if (isset($this->_targetRef)) {
  93                  $output->startElement($state->getURI(), 'TargetRef', $attrs);
  94                  $chars = $this->_targetRef;
  95                  $output->characters($chars);
  96                  $output->endElement($state->getURI(), 'TargetRef');
  97              }
  98  
  99              if (isset($this->_sourceRef)) {
 100                  $output->startElement($state->getURI(), 'SourceRef', $attrs);
 101                  $chars = $this->_sourceRef;
 102                  $output->characters($chars);
 103                  $output->endElement($state->getURI(), 'SourceRef');
 104              }
 105  
 106              // If we are responding to the SyncHdr and we are not
 107              // authorized then request basic authorization.
 108              //
 109              // FIXME: Right now we always send this, ignoring the
 110              // isAuthorized() test. Is that correct?
 111              if ($this->_cmd == 'SyncHdr' && !$state->isAuthorized()) {
 112                  $this->_chalMetaFormat = 'b64';
 113                  $this->_chalMetaType = 'syncml:auth-basic';
 114              }
 115  
 116              if (isset($this->_chalMetaFormat) && isset($this->_chalMetaType)) {
 117                  $output->startElement($state->getURI(), 'Chal', $attrs);
 118                  $output->startElement($state->getURI(), 'Meta', $attrs);
 119  
 120                  $metainfuri = $state->getURIMeta();
 121  
 122                  $output->startElement($metainfuri, 'Format', $attrs);
 123                  $chars = $this->_chalMetaFormat;
 124                  $output->characters($chars);
 125                  $output->endElement($metainfuri, 'Format');
 126  
 127                  $output->startElement($metainfuri, 'Type', $attrs);
 128                  $chars = $this->_chalMetaType;
 129                  $output->characters($chars);
 130                  $output->endElement($metainfuri, 'Type');
 131  
 132                  // $output->startElement($metainfuri, 'NextNonce', $attrs);
 133                  // $chars = $this->_chalMetaNextNonce;
 134                  // $output->characters($chars);
 135                  // $output->endElement($metainfuri, 'NextNonce');
 136  
 137                  $output->endElement($state->getURI(), 'Meta');
 138                  $output->endElement($state->getURI(), 'Chal');
 139              }
 140  
 141              $output->startElement($state->getURI(), 'Data', $attrs);
 142              $chars = $this->_response;
 143              $output->characters($chars);
 144              $output->endElement($state->getURI(), 'Data');
 145  
 146              if (isset($this->_itemDataAnchorNext) || isset($this->_itemDataAnchorLast)) {
 147                  $output->startElement($state->getURI(), 'Item', $attrs);
 148                  $output->startElement($state->getURI(), 'Data', $attrs);
 149  
 150                  $metainfuri = $state->getURIMeta();
 151                  // $metainfuri = $state->getURI(); // debug by FOU
 152  
 153                  $output->startElement($metainfuri, 'Anchor', $attrs);
 154  
 155                  if (isset($this->_itemDataAnchorNext)) {
 156  
 157                    $output->startElement($metainfuri, 'Next', $attrs);
 158                    $chars = $this->_itemDataAnchorNext;
 159                    $output->characters($chars);
 160                    $output->endElement($metainfuri, 'Next');
 161                  }
 162  
 163                  if (isset($this->_itemDataAnchorLast)) {
 164  
 165                    $output->startElement($metainfuri, 'Last', $attrs);
 166                    $chars = $this->_itemDataAnchorLast;
 167                    $output->characters($chars);
 168                    $output->endElement($metainfuri, 'Last');
 169                  }
 170  
 171                  $output->endElement($metainfuri, 'Anchor');
 172  
 173                  $output->endElement($state->getURI(), 'Data');
 174                  $output->endElement($state->getURI(), 'Item');
 175              }
 176  
 177              if (isset($this->_itemTargetLocURI) && isset($this->_itemSourceLocURI)) {
 178                  $output->startElement($state->getURI(), 'Item', $attrs);
 179  
 180                  $output->startElement($state->getURI(), 'Target', $attrs);
 181                  $output->startElement($state->getURI(), 'LocURI', $attrs);
 182                  $output->characters($this->_itemTargetLocURI);
 183                  $output->endElement($state->getURI(), 'LocURI');
 184                  $output->endElement($state->getURI(), 'Target');
 185  
 186                  $output->startElement($state->getURI(), 'Source', $attrs);
 187                  $output->startElement($state->getURI(), 'LocURI', $attrs);
 188                  $output->characters($this->_itemSourceLocURI);
 189                  $output->endElement($state->getURI(), 'LocURI');
 190                  $output->endElement($state->getURI(), 'Source');
 191  
 192                  $output->endElement($state->getURI(), 'Item');
 193              }
 194  
 195              $output->endElement($state->getURI(), 'Status');
 196  
 197              $currentCmdID++;
 198              
 199              // moredata pending request them
 200  /*            if($this->_response == RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED) {
 201          $output->startElement($state->getURI(), 'Alert', $attrs);
 202  
 203          $output->startElement($state->getURI(), 'CmdID', $attrs);
 204          $chars = $currentCmdID;
 205          $output->characters($chars);
 206          $output->endElement($state->getURI(), 'CmdID');
 207  
 208          $output->startElement($state->getURI(), 'Data', $attrs);
 209          $output->characters(ALERT_NEXT_MESSAGE);
 210          $output->endElement($state->getURI(), 'Data');
 211          
 212          if (isset($this->_itemTargetLocURI) && isset($this->_itemSourceLocURI)) {
 213              $output->startElement($state->getURI(), 'Item', $attrs);
 214              
 215              $output->startElement($state->getURI(), 'Target', $attrs);
 216              $output->startElement($state->getURI(), 'LocURI', $attrs);
 217              $output->characters($this->_itemTargetLocURI);
 218              $output->endElement($state->getURI(), 'LocURI');
 219              $output->endElement($state->getURI(), 'Target');
 220              
 221              $output->startElement($state->getURI(), 'Source', $attrs);
 222              $output->startElement($state->getURI(), 'LocURI', $attrs);
 223              $output->characters($this->_itemSourceLocURI);
 224              $output->endElement($state->getURI(), 'LocURI');
 225              $output->endElement($state->getURI(), 'Source');
 226          }
 227  
 228          $output->endElement($state->getURI(), 'Alert');        
 229  
 230          $currentCmdID++;
 231              } */
 232          }
 233  
 234          return $currentCmdID;
 235      }
 236  
 237      /**
 238       * Setter for property response.
 239       *
 240       * @param string $response  New value of property response.
 241       */
 242      function setResponse($response)
 243      {
 244          $this->_response = $response;
 245      }
 246  
 247      /**
 248       * Setter for property cmd.
 249       *
 250       * @param string $cmd  New value of property cmd.
 251       */
 252      function setCmd($cmd)
 253      {
 254          $this->_cmd = $cmd;
 255      }
 256  
 257      /**
 258       * Setter for property cmdRef.
 259       *
 260       * @param string $cmdRef  New value of property cmdRef.
 261       */
 262      function setCmdRef($cmdRef)
 263      {
 264          $this->_cmdRef = $cmdRef;
 265      }
 266  
 267      /**
 268       * Setter for property sourceRef.
 269       *
 270       * @param string $sourceRef  New value of property sourceRef.
 271       */
 272      function setSourceRef($sourceRef)
 273      {
 274          $this->_sourceRef = $sourceRef;
 275      }
 276  
 277      /**
 278       * Setter for property targetRef.
 279       *
 280       * @param string $targetRef  New value of property targetRef.
 281       */
 282      function setTargetRef($targetRef)
 283      {
 284          $this->_targetRef = $targetRef;
 285      }
 286  
 287      /**
 288       * Setter for property itemDataAnchorNext.
 289       *
 290       * @param string $itemDataAnchorNext  New value of property itemDataAnchorNext.
 291       */
 292      function setItemDataAnchorNext($itemDataAnchorNext)
 293      {
 294          $this->_itemDataAnchorNext = $itemDataAnchorNext;
 295      }
 296  
 297      /**
 298       * Setter for property itemDataAnchorLast.
 299       *
 300       * @param string $itemDataAnchorLast  New value of property itemDataAnchorLast.
 301       */
 302      function setItemDataAnchorLast($itemDataAnchorLast)
 303      {
 304          $this->_itemDataAnchorLast = $itemDataAnchorLast;
 305      }
 306  
 307      /**
 308       * Setter for property itemSourceLocURI.
 309       *
 310       * @param string $itemSourceLocURI  New value of property itemSourceLocURI.
 311       */
 312      function setItemSourceLocURI($itemSourceLocURI)
 313      {
 314          $this->_itemSourceLocURI = $itemSourceLocURI;
 315      }
 316  
 317      /**
 318       * Setter for property itemTargetLocURI.
 319       *
 320       * @param string $itemTargetLocURI  New value of property itemTargetLocURI.
 321       */
 322      function setItemTargetLocURI($itemTargetLocURI)
 323      {
 324          $this->_itemTargetLocURI = $itemTargetLocURI;
 325      }
 326  }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7