steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync Add.php, NONE, 1.1 ContentSyncElement.php, NONE, 1.1 Delete.php, NONE, 1.1 Replace.php, NONE, 1.1 SyncElement.php, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Fri Oct 14 16:33:14 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync

Added Files:
	Add.php ContentSyncElement.php Delete.php Replace.php 
	SyncElement.php 
Log Message:
Separated Horde Framework from kolab-resource-handlers

--- NEW FILE: Add.php ---
<?php

include_once 'Horde/SyncML/State.php';
include_once 'Horde/SyncML/Command/Sync/SyncElement.php';

/**
 * $Horde: framework/SyncML/SyncML/Command/Sync/Add.php,v 1.9 2004/05/26 17:43:29 chuck Exp $
 *
 * Copyright 2003-2004 Anthony Mills <amills at pyramid6.com>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Anthony Mills <amills at pyramid6.com>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_SyncML
 */
class Horde_SyncML_Command_Sync_Add extends Horde_SyncML_Command_Sync_SyncElement {

    function output($currentCmdID, $output)
    {
        $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Add');
        $status->setCmdRef($this->_cmdID);

        if (isset($this->_luid)) {
            $status->setSourceRef($this->_luid);
        }

        return $status->output($currentCmdID, $output);
    }

}

--- NEW FILE: ContentSyncElement.php ---
<?php

include_once 'Horde/SyncML/State.php';
include_once 'Horde/SyncML/Command/Sync/SyncElement.php';

/**
 * $Horde: framework/SyncML/SyncML/Command/Sync/ContentSyncElement.php,v 1.11 2004/05/26 17:43:29 chuck Exp $
 *
 * Copyright 2003-2004 Anthony Mills <amills at pyramid6.com>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Anthony Mills <amills at pyramid6.com>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_SyncML
 */
class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_Sync_SyncElement {

    var $_content;

    function getContent()
    {
        return $this->_content;
    }

    function setContent($content)
    {
        $this->_content = $content;
    }

    function endElement($uri, $element)
    {
        switch ($this->_xmlStack) {
        case 2:
            if ($element == 'Data') {
                $this->_content = trim($this->_chars);
            }
            break;
        }

        parent::endElement($uri, $element);
    }

    function outputCommand($currentCmdID, $output, $command)
    {
        $state = $_SESSION['SyncML.state'];

        $attrs = array();
        $output->startElement($state->getURI(), $command, $attrs);

        $output->startElement($state->getURI(), 'CmdID', $attrs);
        $chars = $currentCmdID;
        $output->characters($chars);
        $output->endElement($state->getURI(), 'CmdID');

        if (isset($this->_content)) {
            $output->startElement($state->getURI(), 'Data', $attrs);
            $chars = $this->_content;
            $output->characters($chars);
            $output->endElement($state->getURI(), 'Data');
        }

        $output->endElement($state->getURI(), $command);

        return $currentCmdID++;
    }

}

--- NEW FILE: Delete.php ---
<?php

include_once 'Horde/SyncML/State.php';
include_once 'Horde/SyncML/Command/Sync/SyncElement.php';

/**
 * $Horde: framework/SyncML/SyncML/Command/Sync/Delete.php,v 1.8 2004/05/26 17:32:50 chuck Exp $
 *
 * Copyright 2003-2004 Anthony Mills <amills at pyramid6.com>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Anthony Mills <amills at pyramid6.com>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_SyncML
 */
class Horde_SyncML_Command_Sync_Delete extends Horde_SyncML_Command_Sync_SyncElement {

    function output($currentCmdID, $output)
    {
        $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Delete');
        $status->setCmdRef($this->_cmdID);

        if (isset($this->_luid)) {
            $status->setSourceRef($this->_luid);
        }

        return $status->output($currentCmdID, $output);
    }

}

--- NEW FILE: Replace.php ---
<?php

include_once 'Horde/SyncML/State.php';
include_once 'Horde/SyncML/Command/Sync/SyncElement.php';

/**
 * $Horde: framework/SyncML/SyncML/Command/Sync/Replace.php,v 1.8 2004/05/26 17:32:50 chuck Exp $
 *
 * Copyright 2003-2004 Anthony Mills <amills at pyramid6.com>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Anthony Mills <amills at pyramid6.com>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_SyncML
 */
class Horde_SyncML_Command_Sync_Replace extends Horde_SyncML_Command_Sync_SyncElement {

    function output($currentCmdID, $output)
    {
        $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Replace');
        $status->setCmdRef($this->_cmdID);

        if (isset($this->_luid)) {
            $status->setSourceRef($this->_luid);
        }

        return $status->output($currentCmdID, $output);
    }

}

--- NEW FILE: SyncElement.php ---
<?php

include_once 'Horde/SyncML/State.php';
include_once 'Horde/SyncML/Command.php';

/**
 * $Horde: framework/SyncML/SyncML/Command/Sync/SyncElement.php,v 1.10 2004/05/26 17:46:15 chuck Exp $
 *
 * Copyright 2003-2004 Anthony Mills <amills at pyramid6.com>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Anthony Mills <amills at pyramid6.com>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_SyncML
 */
class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {

    var $_luid;
    var $_guid;
    var $_isSource;

    function &factory($command, $params = null)
    {
        @include_once 'Horde/SyncML/Command/Sync/' . $command . '.php';
        $class = 'Horde_SyncML_Command_Sync_' . $command;
        if (class_exists($class)) {
            return $ret = &new $class($params);
        } else {
            require_once 'PEAR.php';
            return PEAR::raiseError('Class definition of ' . $class . ' not found.');
        }
    }

    function startElement($uri, $element, $attrs)
    {
        parent::startElement($uri, $element, $attrs);

        switch ($this->_xmlStack) {
        case 2:
            if ($element == 'Source') {
                $this->_isSource = true;
            }
            break;
        }
    }

    function endElement($uri, $element)
    {
        switch ($this->_xmlStack) {
        case 1:
            // Need to add sync elements to the Sync method?
            break;

        case 2:
            if ($element == 'Source') {
                $this->_isSource = false;
            } elseif ($element == 'Data') {
                $this->_content = trim($this->_chars);
            }
            break;

        case 3:
            if ($element == 'LocURI' && $this->_isSource) {
                $this->_luid = trim($this->_chars);
            }
            break;
        }

        parent::endElement($uri, $element);
    }

    function getLUID()
    {
        return $this->_luid;
    }

    function getGUID()
    {
        return $this->_guid;
    }

    function setLUID($luid)
    {
        $this->_luid = $luid;
    }

    function setGUID($guid)
    {
        $this->_guid = $guid;
    }

    function getContent()
    {
        return $this->_content;
    }

    function setContent($content)
    {
        $this->_content = $content;
    }

}





More information about the commits mailing list