[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
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/Results.php,v 1.11 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: 18844 $ 16 * @since Horde 3.0 17 * @package Horde_SyncML 18 */ 19 class Horde_SyncML_Command_Results extends Horde_SyncML_Command { 20 21 var $_cmdRef; 22 var $_type; 23 var $_data; 24 var $_locSourceURI; 25 var $_deviceInfo; 26 27 function endElement($uri, $element) 28 { 29 #Horde::logMessage('SyncML: put endelement ' . $element . ' stack ' . $this->_xmlStack, __FILE__, __LINE__, PEAR_LOG_DEBUG); 30 switch ($this->_xmlStack) { 31 case 5: 32 switch($element) { 33 case 'DataStore': 34 $this->_deviceInfo['dataStore'][$this->_sourceReference] = array( 35 'maxGUIDSize' => $this->_maxGUIDSize, 36 'rxPreference' => $this->_rxPreference, 37 'txPreference' => $this->_txPreference, 38 'syncCapabilities' => $this->_syncCapabilities, 39 ); 40 break; 41 case 'DevID': 42 $this->_deviceInfo['deviceID'] = trim($this->_chars); 43 break; 44 case 'DevTyp': 45 $this->_deviceInfo['deviceType'] = trim($this->_chars); 46 break; 47 case 'Man': 48 $this->_deviceInfo['manufacturer'] = trim($this->_chars); 49 break; 50 case 'Mod': 51 $this->_deviceInfo['model'] = trim($this->_chars); 52 break; 53 case 'OEM': 54 $this->_deviceInfo['oem'] = trim($this->_chars); 55 break; 56 case 'SwV': 57 $this->_deviceInfo['softwareVersion'] = trim($this->_chars); 58 break; 59 case 'SupportLargeObjs': 60 $this->_deviceInfo['supportLargeObjs'] = true; 61 break; 62 case 'SupportNumberOfChanges': 63 $this->_deviceInfo['supportNumberOfChanges'] = true; 64 break; 65 case 'VerDTD': 66 $this->_deviceInfo['DTDVersion'] = trim($this->_chars); 67 break; 68 } 69 break; 70 case 6: 71 switch($element) { 72 case 'MaxGUIDSize': 73 $this->_maxGUIDSize = trim($this->_chars); 74 break; 75 case 'Rx-Pref': 76 $this->_rxPreference = array( 77 'contentType' => $this->_contentType, 78 'contentVersion' => $this->_contentVersion, 79 ); 80 break; 81 case 'SourceRef': 82 $this->_sourceReference = trim($this->_chars); 83 break; 84 case 'Tx-Pref': 85 $this->_txPreference = array( 86 'contentType' => $this->_contentType, 87 'contentVersion' => $this->_contentVersion, 88 ); 89 break; 90 } 91 break; 92 case 7: 93 switch($element) { 94 case 'CTType': 95 $this->_contentType = trim($this->_chars); 96 break; 97 case 'SyncType': 98 $this->_syncCapabilities[] = trim($this->_chars); 99 break; 100 case 'VerCT': 101 $this->_contentVersion = trim($this->_chars); 102 break; 103 } 104 break; 105 } 106 107 parent::endElement($uri, $element); 108 } 109 110 function output($currentCmdID, &$output) 111 { 112 if(!isset($this->_locSourceURI)) 113 { 114 Horde::logMessage('SyncML: BIG TODO!!!!!!!!!!!!!!!!!! parse reply', __FILE__, __LINE__, PEAR_LOG_DEBUG); 115 $state = &$_SESSION['SyncML.state']; 116 117 $status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Results'); 118 $status->setCmdRef($this->_cmdID); 119 120 $ref = ($state->getVersion() == 0) ? './devinf10' : './devinf11'; 121 122 $status->setSourceRef($ref); 123 124 if($state->isAuthorized()) 125 { 126 if(count((array)$this->_deviceInfo) > 0) 127 { 128 $state->setClientDeviceInfo($this->_deviceInfo); 129 $state->writeClientDeviceInfo(); 130 } 131 } 132 133 return $status->output($currentCmdID, $output); 134 } 135 else 136 { 137 Horde::logMessage('SyncML: BIG TODO!!!!!!!!!!!!!!!!!! generate reponse', __FILE__, __LINE__, PEAR_LOG_DEBUG); 138 $state = $_SESSION['SyncML.state']; 139 140 $attrs = array(); 141 $output->startElement($state->getURI(), 'Results', $attrs); 142 143 $output->startElement($state->getURI(), 'CmdID', $attrs); 144 $chars = $currentCmdID; 145 $output->characters($chars); 146 $output->endElement($state->getURI(), 'CmdID'); 147 148 $output->startElement($state->getURI(), 'MsgRef', $attrs); 149 $chars = $state->getMsgID(); 150 $output->characters($chars); 151 $output->endElement($state->getURI(), 'MsgRef'); 152 153 $output->startElement($state->getURI(), 'CmdRef', $attrs); 154 $chars = $this->_cmdRef; 155 $output->characters($chars); 156 $output->endElement($state->getURI(), 'CmdRef'); 157 158 $output->startElement($state->getURI(), 'Meta', $attrs); 159 $output->startElement($state->getURIMeta(), 'Type', $attrs); 160 $output->characters($this->_type); 161 $output->endElement($state->getURIMeta(), 'Type'); 162 $output->endElement($state->getURI(), 'Meta'); 163 164 $output->startElement($state->getURI(), 'Item', $attrs); 165 $output->startElement($state->getURI(), 'Source', $attrs); 166 $output->startElement($state->getURI(), 'LocURI', $attrs); 167 $chars = $this->_locSourceURI; 168 $output->characters($chars); 169 $output->endElement($state->getURI(), 'LocURI'); 170 $output->endElement($state->getURI(), 'Source'); 171 172 $output->startElement($state->getURI(), 'Data', $attrs); 173 174 // Need to send this information as opaque data so the WBXML 175 // will understand it. 176 $output->opaque($this->_data); 177 178 $output->endElement($state->getURI(), 'Data'); 179 $output->endElement($state->getURI(), 'Item'); 180 181 $output->endElement($state->getURI(), 'Results'); 182 183 $currentCmdID++; 184 185 return $currentCmdID; 186 } 187 } 188 189 /** 190 * Setter for property cmdRef. 191 * 192 * @param string $cmdRef New value of property cmdRef. 193 */ 194 function setCmdRef($cmdRef) 195 { 196 $this->_cmdRef = $cmdRef; 197 } 198 199 /** 200 * Setter for property Type. 201 * 202 * @param string $type New value of property type. 203 */ 204 function setType($type) 205 { 206 $this->_type = $type; 207 } 208 209 /** 210 * Setter for property data. 211 * 212 * @param string $data New value of property data. 213 */ 214 function setData($data) 215 { 216 $this->_data = $data; 217 } 218 219 /** 220 * Setter for property locSourceURI. 221 * 222 * @param string $locSourceURI New value of property locSourceURI. 223 */ 224 function setlocSourceURI($locSourceURI) 225 { 226 $this->_locSourceURI = $locSourceURI; 227 } 228 229 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |