Skip to content

Commit

Permalink
extensive workig of query types and requests
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Apr 18, 2021
1 parent 379d340 commit 101f618
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 45 deletions.
1 change: 0 additions & 1 deletion action.php
Expand Up @@ -20,7 +20,6 @@ class action_plugin_xcom extends DokuWiki_Action_Plugin {
public function register(Doku_Event_Handler $controller) {

$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handle_dokuwiki_started');
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this,'handle_meta_headers');

}

Expand Down
30 changes: 8 additions & 22 deletions lang/en/functions.txt
@@ -1,3 +1,4 @@

==== dokuwiki.getPagelist ====

^Name|''dokuwiki.getPagelist'' |
Expand All @@ -7,7 +8,7 @@
==== dokuwiki.search ====

^Name |''dokuwiki.search'' |
^Parameters |(string) a query string as described on [[doku>www.dokuwiki.org/search|search]]|
^Parameters |(string) a query string as described on [[doku>www.dokuwiki.org/www.dokuwiki.org/search|search]]|
^Description|Performs a fulltext search based on the raw string|

==== dokuwiki.getTitle ====
Expand All @@ -17,115 +18,100 @@
^Data |(string) the title of the wiki|
^Description|Returns the title of the wiki.|

==== dokuwiki.appendPage ====

==== dokuwiki.appendPage ====
^Name |''dokuwiki.appendPage '' |
^Parameters |(string) [[doku>:pagename]], (string) raw Wiki text, (array) attrs \\ Where ''attrs'' can be one of the following: \\ 1. ''(sum;summary text)'' \\ 2. ''(minor;1)'' \\ The semi-colons after ''sum'' and ''minor'' are required. The summary text should not be enclosed in quotation marks.|
^Description|Appends text to a Wiki Page.|

==== wiki.aclCheck ====

^Name |''wiki.aclCheck'' |
^Parameters |(string) [[doku>:pagename]]|
^Description|Returns the permission of the given wikipage.|

==== wiki.getPage ====

^Name |''wiki.getPage'' |
^Parameters |(string) [[doku>:pagename]]|
^Description|Returns the raw Wiki text for a page.|

==== wiki.getPageVersions ====

==== wiki.getPageVersions ====
^Name |''wiki.getPageVersions'' |
^Parameters |(string) [[doku>:pagename]] , (int) offset. Note: the pagname is required in both the ID and Options fileds.|
^ Parameters | (string) [[doku>:pagename]] , (int) offset |
^Description|Returns the available versions of a Wiki page. The number of pages in the result is controlled \\ via the [[doku>:config:recent]] configuration setting. The offset can be used to list earlier versions in the history.|

==== wiki.getPageInfo ====

^Name |''wiki.getPageInfo'' |
^Parameters |(string) [[doku>:pagename]]|
^Description|Returns information about a Wiki page.|

==== wiki.getPageHTML ====

==== wiki.getPageHTML ====
^Name |''wiki.getPageHTML'' |
^Parameters |(string) [[doku>:pagename]]|
^Description|Returns the rendered XHTML body of a Wiki page.|

==== wiki.putPage ====

==== wiki.putPage ====
^Name |''wiki.putPage'' |
^Parameters |(string) [[doku>:pagename]] , (string) raw Wiki text, (array) attrs \\ Where ''attrs'' is either ''minor'' or it is''sum'', which specifies change summary. The format is the same is in [[#dokuwikiappendpage|dokuwiki.appendPage]]|
^Description|Saves a Wiki Page to the remote wiki.|

==== wiki.listLinks ====

^Name |''wiki.listLinks'' |
^Parameters |(string) [[doku>www.dokuwiki.org/:pagename|:pagename]]|
^ Parameters | (string) [[doku>:pagename]] |
^Description|Returns a list of all links contained in a Wiki page.|

==== wiki.getAllPages ====

^Name |''wiki.getAllPages'' |
^Description|Returns a list of all Wiki pages in the remote Wiki.|

==== wiki.getBackLinks ====

^Name |''wiki.getBackLinks'' |
^Parameters |(string) [[doku>:pagename]]|
^Description|Returns a list of [[doku>:backlinks]] of a Wiki page.|

==== wiki.getRecentChanges ====

^Name |''wiki.getRecentChanges'' |
^Parameters |(int) timestamp (See below: [[#timestamp|]])|
^Description|Returns a list of recent changes since given timestamp. \\ As stated in [[doku>:recent_changes]]: Only the most recent change for each page is listed, \\ regardless of how many times that page was changed.|

==== wiki.getRecentMediaChanges ====

^Name |''wiki.getRecentMediaChanges'' |
^Parameters |(int) timestamp (See below: [[#timestamp|]])|
^Description|Returns a list of recent changed media since given timestamp.|

==== wiki.getAttachments ====

^Name|''wiki.getAttachments'' |
^Parameters|(String) namespace, (array) options|
^Description|Returns a list of media files in a given namespace. The options array holds a regular expression in this format: ''(#pattern#)''. The hashes are regular expression pattern delimiters; everything between them will be matched against the media file names in ''namespace'' and only the matching files will be returned. |

==== wiki.getAttachment ====

^Name |''wiki.getAttachment'' |
^Parameters |(String) id|
^Description|Returns the binary data of a media file|

==== wiki.getAttachmentInfo ====

^Name |''wiki.getAttachmentInfo'' |
^Parameters |(String) id|
^Description|Returns information about a media file|

==== wiki.deleteAttachment ====

^Name |''wiki.deleteAttachment'' |
^Parameters |(String) id|
^Description|Deletes a file. Fails if the file is still referenced from any page in the wiki.|

==== plugin.acl.addAcl ====

^Name |''plugin.acl.addAcl'' |
^Parameters |(String) scope, (String) username, (int) permission|
^Description|Add an ACL rule. Use ''@groupname'' instead of ''user'' to add an ACL rule for a group|

==== plugin.acl.delAcl ====

^Name |''plugin.acl.delAcl'' |
^Parameters |(String) scope, (String) username|
^Description|Delete any ACL rule matching the given scope and user. Use ''@groupname'' instead of ''user'' to delete the ACL rules for the group|

==== plugin.xcom.getMedia ====

^Name |''plugin.xcom.getMedia'' |
^Parameters |(String) id|
^Description|List the media files in a page (id)|
Expand Down
12 changes: 7 additions & 5 deletions script.js
Expand Up @@ -58,12 +58,13 @@ function xmlrpc() {
xcom_remote_url = xcom_getInputValue('xcom_url');
xcom_remote_url = xcom_remote_url.replace(/[\/\\]$/,"");
xcom_remote_url += '/doku.php?';
// console.log(SafeFN_encode('??A??lÉ áéíóúýcdenrštžu'));
//alert(xcom_remote_url);
xcom_clear('xcom_qstatus',false);
var options = xcom_params();
xcom_query_status(options);

if(!options) {
var func = options[0];
if(!func || !options) {
alert('No function selected');
return false;
}
var func = options[0];
Expand All @@ -84,6 +85,7 @@ function xmlrpc() {
params += '&credentials=' + str;
params += '&debug=' + document.getElementById('xcom_debug').checked;

// if(!confirm(params)) return;
jQuery.ajax({
url: DOKU_BASE + 'lib/plugins/xcom/scripts/xml.php',
data: params,
Expand Down Expand Up @@ -360,7 +362,7 @@ function xcom_check_opts(fn,page,opts) {
xcom_msg("Wrong parameter count: " + fn + " does not take options")
return false;
}
regex = RegExp('^[%0-9\\w_:\.\\]]+$');
regex = RegExp('^[0-9\\a-z_:\|\.\\]]+$');
if(!regex.test(page)) {
xcom_msg("Bad DokuWiki ID");
return false;
Expand Down Expand Up @@ -401,9 +403,9 @@ function xcom_check_opts(fn,page,opts) {
alert("needs sum or minor edit statement");
return false;

break;
/*
case 'dokuwiki.appendPage': string [[doku>:pagename]],string wiki text, string, (sum;summary text),(minor;n)
break;
case 'wiki.getPageVersions': (string) [[doku>:pagename]] , (int) offset
break;
Expand Down
17 changes: 0 additions & 17 deletions scripts/xml.php
Expand Up @@ -69,7 +69,6 @@


$retv = $client->getResponse();

if($fn =='wiki.putPage' || $fn=='dokuwiki.appendPage') {
$resp = print_r($resp,1);
$_retv =print_r($retv,1);
Expand Down Expand Up @@ -160,20 +159,4 @@ function xcom_lock($page, $lock, $client) {

return false;

}
function get_ixrdate($text) {
static $i = 0;
$i++;
$text = print_r($text,1);

$text = preg_replace_callback(
"/^([\s\S]+)\[date\]\s*=>\s*(\d{4,}[\s\d\-\.\:]+)(([\s\S]+))$/ms",
function ($matches) { ;
return $matches[2];
},
$text
);

$text = preg_replace("/000\s*$/","",$text);
return $text;
}

0 comments on commit 101f618

Please sign in to comment.