| 1 |
<?php |
<?php |
| 2 |
// $Id: $ |
// $Id: export_dxml.module,v 1.1 2005/11/28 08:21:15 puregin Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 8 |
*/ |
*/ |
| 9 |
|
|
| 10 |
/** |
/** |
| 11 |
|
* Implementation of hook_perm(). |
| 12 |
|
*/ |
| 13 |
|
function export_dxml_perm() { |
| 14 |
|
return array('export books as dxml'); |
| 15 |
|
} |
| 16 |
|
|
| 17 |
|
|
| 18 |
|
/** |
| 19 |
* Implementation of hook_link(). |
* Implementation of hook_link(). |
| 20 |
*/ |
*/ |
| 21 |
function export_dxml_link($type, $node = 0, $main = 0) { |
function export_dxml_link($type, $node = 0, $main = 0) { |
| 22 |
$links = array(); |
$links = array(); |
| 23 |
if ($type == 'node' && isset($node->parent)) { |
if ($type == 'node' && isset($node->parent)) { |
| 24 |
if (!$main) { |
if (!$main) { |
| 25 |
if (user_access('export books')) { |
if (user_access('export books as dxml')) { |
| 26 |
$links[] = l(t('export Drupal XML'), 'book/export/dxml/'. $node->nid, array('title' => t('Export this book page and its sub-pages as Drupal XML (suitable for re-import)'))); |
$links[] = l(t('export Drupal XML'), 'book/export/dxml/'. $node->nid, array('title' => t('Export this book page and its sub-pages as Drupal XML (suitable for re-import)'))); |
| 27 |
} |
} |
| 28 |
} |
} |
| 31 |
return $links; |
return $links; |
| 32 |
} |
} |
| 33 |
|
|
|
/* |
|
|
* dxml: Drupal book XML is supported in export_dxml.module |
|
|
* opml: OPML (Outline Processor Markup Language) is supported in export_opml.module |
|
|
*/ |
|
|
|
|
| 34 |
/** |
/** |
| 35 |
* This function is called by book_export() to generate DXML for export. |
* This function is called by book_export() to generate DXML for export. |
| 36 |
* |
* |
| 46 |
* - the DXML representing the node and its children in the book hierarchy |
* - the DXML representing the node and its children in the book hierarchy |
| 47 |
*/ |
*/ |
| 48 |
function book_export_dxml($nid, $depth) { |
function book_export_dxml($nid, $depth) { |
| 49 |
if (user_access('export books')) { |
if (user_access('export books as dxml')) { |
| 50 |
drupal_set_header('Content-Type: text/xml; charset=utf-8'); |
drupal_set_header('Content-Type: text/xml; charset=utf-8'); |
| 51 |
$xml = "<?xml version='1.0'?>\n"; |
$xml = "<?xml version='1.0'?>\n"; |
| 52 |
$xml .= "<!DOCTYPE book PUBLIC \"-//Drupal//DTD DXML V1.0//EN\" \"http://drupal.org/xml/dxml.dtd\">\n"; |
$xml .= "<!DOCTYPE book PUBLIC \"-//Drupal//DTD DXML V1.0//EN\" \"http://drupal.org/xml/dxml.dtd\">\n"; |
| 171 |
'callback' => 'export_dxml_admin', |
'callback' => 'export_dxml_admin', |
| 172 |
'type' => MENU_NORMAL_ITEM, |
'type' => MENU_NORMAL_ITEM, |
| 173 |
'weight' => 0); |
'weight' => 0); |
| 174 |
|
$items[] = array( |
| 175 |
|
'path' => 'book/export', |
| 176 |
|
'callback' => 'book_export', |
| 177 |
|
'access' => (user_access('export books as dxml') && user_access('access content')), |
| 178 |
|
'type' => MENU_CALLBACK); |
| 179 |
} |
} |
| 180 |
|
|
| 181 |
return $items; |
return $items; |