Author: sevein Date: Fri Oct 7 17:35:43 2011 New Revision: 9984 Log: qtSwordPlugin, create deposit action, use internal array of acceptPackaging, add METS
Added: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/depositSuccess.xml.php Modified: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php Added: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php Fri Oct 7 17:35:43 2011 (r9984) @@ -0,0 +1,36 @@ +<?php + +/* + * This file is part of Qubit Toolkit. + * + * Qubit Toolkit is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Qubit Toolkit is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>. + */ + +class qtSwordPluginDepositAction extends sfAction +{ + public function execute($request) + { + $this->resource = $this->getRoute()->resource; + + // 201 Created + $this->response->setStatusCode('201'); + + // Location + // $this->response->setHttpHeader('Location', '...'); + + // Optional Atom Entry document + + $request->setRequestFormat('xml'); + } +} Modified: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php ============================================================================== --- trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php Fri Oct 7 17:28:43 2011 (r9983) +++ trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/servicedocumentAction.class.php Fri Oct 7 17:35:43 2011 (r9984) @@ -26,25 +26,9 @@ $this->noOp = 'false'; $this->maxUploadSize = QubitDigitalObject::getMaxUploadSize() / 1024; // From bytes to kilobytes - // Logging for dev purposes - /* - $this->logger = sfContext::getInstance()->getLogger(); - $this->logger->debug("START"); - $this->renderArray($_POST); - $this->renderArray($_GET); - $this->renderArray(getallheaders()); - */ - - /* - 'Content-MD5' - 'X-On-Behalf-Of' - 'X-Packaging' - 'Content-Type' - 'Content-Length' - 'X-No-Op' - 'X-Verbose' - 'Content-Disposition: filename=' - */ + // See http://www.swordapp.org/docs/sword-type-1.0.html + $this->packaging = array( + 'METS' => 'http://www.loc.gov/METS/'); if (isset($request->getAttribute('sf_route')->resource)) { @@ -66,12 +50,4 @@ $request->setRequestFormat('xml'); } - - public function renderArray($item) - { - foreach ($item as $key => $value) - { - $this->logger->debug($key . ": " . $value); - } - } } Added: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/depositSuccess.xml.php ============================================================================== Modified: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php ============================================================================== --- trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php Fri Oct 7 17:28:43 2011 (r9983) +++ trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/templates/servicedocumentSuccess.xml.php Fri Oct 7 17:35:43 2011 (r9984) @@ -32,8 +32,9 @@ <sword:treatment>This is a server</sword:treatment> <!-- MAY be included. Used to identify the content packaging types supported by this collection. SHOULD be a URI from [SWORD-TYPES]. The q attribute MAY be used to indicate relative preferences between packaging formats (See Part A Section 1.1). --> - <sword:acceptPackaging q="1.0">http://purl.org/net/sword-types/METSDSpaceSIP</sword:acceptPackaging> - <sword:acceptPackaging q="0.5">http://purl.org/net/sword-types/bagit</sword:acceptPackaging> + <?php foreach ($packaging as $key => $value): ?> + <sword:acceptPackaging q="<?php echo $key ?>"><?php echo $value ?></sword:acceptPackaging> + <?php endforeach; ?> <!-- 0 or more MAY be included to direct clients to nested service definitions. If present, the value MUST be a URI that dereferences to another SWORD Service Document. --> <?php if (0 < count($item->getChildren())): ?> -- You received this message because you are subscribed to the Google Groups "Qubit Toolkit Commits" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/qubit-commits?hl=en.
