From a3b0cccbe1f160358c154d9fb1debf0f20f695ef Mon Sep 17 00:00:00 2001 From: lainme Date: Fri, 18 Mar 2011 14:39:28 +0800 Subject: [PATCH 1/6] Add simplified Chinese. Some improvement. --- admin.php | 121 ++++++++++++++++++++++++------------------- lang/en/lang.php | 2 + lang/zh/intro.txt | 3 ++ lang/zh/lang.php | 62 ++++++++++++++++++++++ lang/zh/list.txt | 3 ++ lang/zh/nochange.txt | 3 ++ lang/zh/sync.txt | 3 ++ 7 files changed, 145 insertions(+), 52 deletions(-) create mode 100644 lang/zh/intro.txt create mode 100644 lang/zh/lang.php create mode 100644 lang/zh/list.txt create mode 100644 lang/zh/nochange.txt create mode 100644 lang/zh/sync.txt diff --git a/admin.php b/admin.php index 7966ee2..4b1fc1d 100644 --- a/admin.php +++ b/admin.php @@ -80,6 +80,11 @@ function handle() { // reset the client $this->client = null; } + + if($_REQUEST['delprofile']){ + $this->_profileDel(); + $this->profno = ''; + } } /** @@ -151,6 +156,7 @@ function html() { echo $this->locale_xhtml('intro'); echo '
'; + $this->_profilelist($this->profno); if($this->profno !=='' ){ echo '
'; @@ -182,7 +188,14 @@ function _profileSave(){ $profiles = $conf['metadir'].'/sync.profiles'; io_saveFile($profiles,serialize($this->profiles)); } + + function _profileDel(){ + global $conf; + $profiles = $conf['metadir'].'/sync.profiles'; + io_deletefromfile($profiles,serialize($this->profiles)); + } + //io_deletefromfile($profiles, serialize()); /** * Check connection for choosen profile and display last sync date. */ @@ -220,20 +233,19 @@ function _profileView(){ function _profilelist($no=''){ echo '
'; echo '
'.$this->getLang('profile').''; - echo ''; echo ''; + echo ''; echo '
'; echo '
'; } @@ -253,6 +265,9 @@ function _profileform($no=''){ echo ''; + echo ' '; + echo ''; + echo ' '; echo ''; echo 'http://example.com/dokuwiki/lib/exe/xmlrpc.php'; @@ -603,59 +618,61 @@ function _getSyncList($type='pages'){ global $conf; $no = $this->profno; $list = array(); - $ns = $this->profiles[$no]['ns']; + $namespaces = explode(",",$this->profiles[$no]['ns']); - // get remote file list - if($type == 'pages'){ - $ok = $this->client->query('dokuwiki.getPagelist',$ns, - array('depth' => (int) $this->profiles[$no]['depth'], - 'hash' => true)); - }else{ - $ok = $this->client->query('wiki.getAttachments',$ns, - array('depth' => (int) $this->profiles[$no]['depth'], - 'hash' => true)); - } - if(!$ok){ - msg('Failed to fetch remote file list. '. - $this->client->getErrorMessage(),-1); - return false; - } - $remote = $this->client->getResponse(); - // put into synclist - foreach($remote as $item){ - $list[$item['id']]['remote'] = $item; - unset($list[$item['id']]['remote']['id']); - } - unset($remote); + foreach($namespaces as $ns){ + // get remote file list + if($type == 'pages'){ + $ok = $this->client->query('dokuwiki.getPagelist',$ns, + array('depth' => (int) $this->profiles[$no]['depth'], + 'hash' => true)); + }else{ + $ok = $this->client->query('wiki.getAttachments',$ns, + array('depth' => (int) $this->profiles[$no]['depth'], + 'hash' => true)); + } + if(!$ok){ + msg('Failed to fetch remote file list. '. + $this->client->getErrorMessage(),-1); + return false; + } + $remote = $this->client->getResponse(); + // put into synclist + foreach($remote as $item){ + $list[$item['id']]['remote'] = $item; + unset($list[$item['id']]['remote']['id']); + } + unset($remote); - // get local file list - $local = array(); - $dir = utf8_encodeFN(str_replace(':', '/', $ns)); - require_once(DOKU_INC.'inc/search.php'); - if($type == 'pages'){ - search($local, $conf['datadir'], 'search_allpages', - array('depth' => (int) $this->profiles[$no]['depth'], - 'hash' => true), $dir); - }else{ - search($local, $conf['mediadir'], 'search_media', - array('depth' => (int) $this->profiles[$no]['depth'], - 'hash' => true), $dir); - } + // get local file list + $local = array(); + $dir = utf8_encodeFN(str_replace(':', '/', $ns)); + require_once(DOKU_INC.'inc/search.php'); + if($type == 'pages'){ + search($local, $conf['datadir'], 'search_allpages', + array('depth' => (int) $this->profiles[$no]['depth'], + 'hash' => true), $dir); + }else{ + search($local, $conf['mediadir'], 'search_media', + array('depth' => (int) $this->profiles[$no]['depth'], + 'hash' => true), $dir); + } - // put into synclist - foreach($local as $item){ - // skip identical files - if($list[$item['id']]['remote']['hash'] == $item['hash']){ - unset($list[$item['id']]); - continue; + // put into synclist + foreach($local as $item){ + // skip identical files + if($list[$item['id']]['remote']['hash'] == $item['hash']){ + unset($list[$item['id']]); + continue; + } + + $list[$item['id']]['local'] = $item; + unset($list[$item['id']]['local']['id']); } + unset($local); - $list[$item['id']]['local'] = $item; - unset($list[$item['id']]['local']['id']); + ksort($list); } - unset($local); - - ksort($list); return $list; } @@ -688,4 +705,4 @@ function _diff($id){ echo ''; } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/lang/en/lang.php b/lang/en/lang.php index 2fdc462..6e813a5 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -14,9 +14,11 @@ $lang['profile'] = 'Sync Profile'; $lang['newprofile'] = 'New Profile...'; $lang['select'] = 'Select'; +$lang['delete'] = 'Delete'; $lang['create'] = 'Create new Sync Profile'; $lang['edit'] = 'Edit Sync Profile'; +$lang['name'] = 'Profile Name'; $lang['server'] = 'XMLRPC URL'; $lang['user'] = 'Username'; $lang['pass'] = 'Password'; diff --git a/lang/zh/intro.txt b/lang/zh/intro.txt new file mode 100644 index 0000000..be71c44 --- /dev/null +++ b/lang/zh/intro.txt @@ -0,0 +1,3 @@ +====== Wiki 同步 ====== + +这个工具允许您将当前 Wiki 与其它多个 Wiki 的内容同步。用来同步的其它 Wiki 可以通过配置文件选择。同步可以限制在特定的命名空间。 diff --git a/lang/zh/lang.php b/lang/zh/lang.php new file mode 100644 index 0000000..100a95d --- /dev/null +++ b/lang/zh/lang.php @@ -0,0 +1,62 @@ + Date: Fri, 18 Mar 2011 14:53:07 +0800 Subject: [PATCH 2/6] Clean code --- admin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/admin.php b/admin.php index 4b1fc1d..be75e38 100644 --- a/admin.php +++ b/admin.php @@ -195,7 +195,6 @@ function _profileDel(){ io_deletefromfile($profiles,serialize($this->profiles)); } - //io_deletefromfile($profiles, serialize()); /** * Check connection for choosen profile and display last sync date. */ From 330edce2cda62d06e2fb0bab041dde5a7dfbbbfa Mon Sep 17 00:00:00 2001 From: lainme Date: Mon, 21 Mar 2011 14:29:22 +0800 Subject: [PATCH 3/6] Fix bug when delete profile --- admin.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin.php b/admin.php index be75e38..f47df2d 100644 --- a/admin.php +++ b/admin.php @@ -84,6 +84,7 @@ function handle() { if($_REQUEST['delprofile']){ $this->_profileDel(); $this->profno = ''; + $this->client = null; } } @@ -192,7 +193,9 @@ function _profileSave(){ function _profileDel(){ global $conf; $profiles = $conf['metadir'].'/sync.profiles'; - io_deletefromfile($profiles,serialize($this->profiles)); + unset($this->profiles[$this->profno]); + io_saveFile($profiles,serialize($this->profiles)); + //io_deleteFromFile($profiles,serialize($this->profiles[$this->profno])); } /** From 7bb454be53f8fa1c97dd946e255217b59d4c5a26 Mon Sep 17 00:00:00 2001 From: lainme Date: Mon, 21 Mar 2011 14:31:41 +0800 Subject: [PATCH 4/6] Delete not used --- admin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/admin.php b/admin.php index f47df2d..01f496b 100644 --- a/admin.php +++ b/admin.php @@ -195,7 +195,6 @@ function _profileDel(){ $profiles = $conf['metadir'].'/sync.profiles'; unset($this->profiles[$this->profno]); io_saveFile($profiles,serialize($this->profiles)); - //io_deleteFromFile($profiles,serialize($this->profiles[$this->profno])); } /** From 10a665838635c16b12662a815ffc44a77cde1b61 Mon Sep 17 00:00:00 2001 From: lainme Date: Mon, 21 Mar 2011 14:35:01 +0800 Subject: [PATCH 5/6] Right numbering in profile list --- admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin.php b/admin.php index 01f496b..a70eb38 100644 --- a/admin.php +++ b/admin.php @@ -240,7 +240,7 @@ function _profilelist($no=''){ $srv = parse_url($opts['server']); echo ''; } From 1012b35ebcbf03f93a9cdb5053dbfbbd356afcbd Mon Sep 17 00:00:00 2001 From: dragonauta Date: Fri, 8 Jul 2011 02:54:46 +0800 Subject: [PATCH 6/6] spanish translation added --- lang/es/intro.txt | 4 +++ lang/es/lang.php | 60 ++++++++++++++++++++++++++++++++++++++++++++ lang/es/list.txt | 4 +++ lang/es/nochange.txt | 5 ++++ lang/es/sync.txt | 4 +++ 5 files changed, 77 insertions(+) create mode 100644 lang/es/intro.txt create mode 100644 lang/es/lang.php create mode 100644 lang/es/list.txt create mode 100644 lang/es/nochange.txt create mode 100644 lang/es/sync.txt diff --git a/lang/es/intro.txt b/lang/es/intro.txt new file mode 100644 index 0000000..79e3127 --- /dev/null +++ b/lang/es/intro.txt @@ -0,0 +1,4 @@ +====== Sincronización de la Wiki ====== + +Esta herramienta le permite sincronizar el contenido de su wiki con otras wikis. Múltiples wikis pueden ser configuradas usando perfiles de sincronización. La Sincronización puede ser restringida a ciertos namespaces. + diff --git a/lang/es/lang.php b/lang/es/lang.php new file mode 100644 index 0000000..eb7eefc --- /dev/null +++ b/lang/es/lang.php @@ -0,0 +1,60 @@ +