mirror of
https://github.com/splitbrain/dokuwiki-plugin-sync.git
synced 2025-08-15 23:33:02 +00:00
localization
darcs-hash:20090219210953-7ad00-b8be3c1c23d150dcb09f76f88cef3d9559bb042d.gz
This commit is contained in:
71
admin.php
71
admin.php
@ -68,9 +68,11 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
if(count($list)){
|
||||
$this->_form($this->profno,$list,$lnow,$rnow);
|
||||
}else{
|
||||
echo '<p>No changes were found.</p>';
|
||||
echo $this->locale_xhtml('nochange');
|
||||
}
|
||||
}else{
|
||||
echo $this->locale_xhtml('intro');
|
||||
|
||||
// profile management
|
||||
$this->_profilelist($this->profno);
|
||||
$this->_profileform($this->profno);
|
||||
@ -99,22 +101,22 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
global $conf;
|
||||
echo '<form action="" method="post">';
|
||||
echo '<input type="hidden" name="no" value="'.hsc($no).'" />';
|
||||
echo '<fieldset><legend>Synchronize Wikis</legend>';
|
||||
echo '<fieldset><legend>'.$this->getLang('syncstart').'</legend>';
|
||||
if($this->profiles[$no]['ltime']){
|
||||
echo '<p>Last sync: '.strftime($conf['dformat'],$this->profiles[$no]['ltime']).'</p>';
|
||||
echo '<p>'.$this->getLang('lastsync').' '.strftime($conf['dformat'],$this->profiles[$no]['ltime']).'</p>';
|
||||
}else{
|
||||
echo '<p>This profile was never synchronized before.</p>';
|
||||
echo '<p>'.$this->getLang('neversync').'</p>';
|
||||
}
|
||||
echo '<input name="startsync" type="submit" value="Start Synchronization" class="button" />';
|
||||
echo '<input name="startsync" type="submit" value="'.$this->getLang('syncstart').'" class="button" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
function _profilelist($no=''){
|
||||
echo '<form action="" method="post">';
|
||||
echo '<fieldset><legend>Sync Profile</legend>';
|
||||
echo '<fieldset><legend>'.$this->getLang('profile').'</legend>';
|
||||
echo '<select name="no" class="edit"';
|
||||
echo ' <option value="">New profile...</option>';
|
||||
echo ' <option value="">'.$this->getLang('newprofile').'</option>';
|
||||
foreach($this->profiles as $pno => $opts){
|
||||
$srv = parse_url($opts['server']);
|
||||
|
||||
@ -124,7 +126,7 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
echo '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<input type="submit" value="Go" class="button" />';
|
||||
echo '<input type="submit" value="'.$this->getLang('select').'" class="button" />';
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
}
|
||||
@ -133,48 +135,56 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
echo '<form action="" method="post">';
|
||||
echo '<fieldset><legend>';
|
||||
if($no !== ''){
|
||||
echo 'Edit Sync Profile';
|
||||
echo $this->getLang('edit');
|
||||
}else{
|
||||
echo 'Create New Sync Profile';
|
||||
echo $this->getLang('create');
|
||||
}
|
||||
echo '</legend>';
|
||||
|
||||
echo '<input type="hidden" name="no" value="'.hsc($no).'" />';
|
||||
|
||||
echo '<label for="sync__server">XMLRPC URL</label> ';
|
||||
echo '<label for="sync__server">'.$this->getLang('server').'</label> ';
|
||||
echo '<input type="text" name="p[server]" id="sync__server" class="edit" value="'.hsc($this->profiles[$no]['server']).'" /><br />';
|
||||
echo '<sample>http://example.com/dokuwiki/lib/exe/xmlrpc.php</sample><br />';
|
||||
|
||||
echo '<label for="sync__server">Namespace</label> ';
|
||||
echo '<label for="sync__ns">'.$this->getLang('ns').'</label> ';
|
||||
echo '<input type="text" name="p[ns]" id="sync__ns" class="edit" value="'.hsc($this->profiles[$no]['ns']).'" /><br />';
|
||||
|
||||
echo '<label for="sync__user">User</label> ';
|
||||
echo '<label for="sync__user">'.$this->getLang('user').'</label> ';
|
||||
echo '<input type="text" name="p[user]" id="sync__user" class="edit" value="'.hsc($this->profiles[$no]['user']).'" /><br />';
|
||||
|
||||
echo '<label for="sync__pass">Password</label> ';
|
||||
echo '<label for="sync__pass">'.$this->getLang('pass').'</label> ';
|
||||
echo '<input type="password" name="p[pass]" id="sync__pass" class="edit" value="'.hsc($this->profiles[$no]['pass']).'" /><br />';
|
||||
|
||||
echo '<input type="submit" value="save" class="button" />';
|
||||
if($no !== ''){
|
||||
echo '<br /><small>Changing a profile will reset the last sync time</small>';
|
||||
echo '<input type="submit" value="'.$this->getLang('save').'" class="button" />';
|
||||
if($no !== '' && $this->profiles[$no]['ltime']){
|
||||
echo '<br /><small>'.$this->getLang('changewarn').'</small>';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
function _sync($no,&$synclist,$ltime,$rtime){
|
||||
echo $this->locale_xhtml('sync');
|
||||
echo '<ul>';
|
||||
$client = new IXR_Client($this->profiles[$no]['server']);
|
||||
$client->user = $this->profiles[$no]['user'];
|
||||
$client->pass = $this->profiles[$no]['pass'];
|
||||
foreach((array) $synclist as $id => $dir){
|
||||
@set_time_limit(30);
|
||||
flush();
|
||||
if($dir == 0) continue;
|
||||
if($dir == 0){
|
||||
echo '<li class="ok"><div class="li">';
|
||||
echo $this->getLang('skipped').' '.hsc($id).' ';
|
||||
echo '</div></li>';
|
||||
continue;
|
||||
}
|
||||
if($dir == -1){
|
||||
//pull
|
||||
$ok = $client->query('wiki.getPage',$id);
|
||||
if(!$ok){
|
||||
echo '<li class="error"><div class="li">';
|
||||
echo 'failed to pull '.hsc($id).' ';
|
||||
echo $this->getLang('pullfail').' '.hsc($id).' ';
|
||||
echo hsc($client->getErrorMessage());
|
||||
echo '</div></li>';
|
||||
continue;
|
||||
@ -182,7 +192,7 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
$data = $client->getResponse();
|
||||
saveWikiText($id,$data,'synced',false);
|
||||
echo '<li class="ok"><div class="li">';
|
||||
echo 'pulled '.hsc($id);
|
||||
echo $this->getLang('pullok').' '.hsc($id).' ';
|
||||
echo '</div></li>';
|
||||
continue;
|
||||
}
|
||||
@ -192,13 +202,13 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
$ok = $client->query('wiki.putPage',$id,$data,array('sum'=>'synced'));
|
||||
if(!$ok){
|
||||
echo '<li class="error"><div class="li">';
|
||||
echo 'failed to push '.hsc($id).' ';
|
||||
echo $this->getLang('pushfail').' '.hsc($id).' ';
|
||||
echo hsc($client->getErrorMessage());
|
||||
echo '</div></li>';
|
||||
continue;
|
||||
}
|
||||
echo '<li class="ok"><div class="li">';
|
||||
echo 'pushed '.hsc($id);
|
||||
echo $this->getLang('pushok').' '.hsc($id).' ';
|
||||
echo '</div></li>';
|
||||
|
||||
continue;
|
||||
@ -213,6 +223,8 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
$this->profiles[$no]['letime'] = $letime;
|
||||
$this->profiles[$no]['retime'] = $retime;
|
||||
$this->_profileSave();
|
||||
|
||||
echo '<p>'.$this->getLang('syncdone').'</p>';
|
||||
}
|
||||
|
||||
function _form($no,$synclist,$lnow,$rnow){
|
||||
@ -223,18 +235,19 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
$letime = (int) $this->profiles[$no]['letime'];
|
||||
$retime = (int) $this->profiles[$no]['retime'];
|
||||
|
||||
echo $this->locale_xhtml('list');
|
||||
echo '<form action="" method="post">';
|
||||
echo '<table class="inline">';
|
||||
echo '<input type="hidden" name="lnow" value="'.$lnow.'" />';
|
||||
echo '<input type="hidden" name="rnow" value="'.$rnow.'" />';
|
||||
echo '<input type="hidden" name="no" value="'.$no.'" />';
|
||||
echo '<tr>
|
||||
<th>page</th>
|
||||
<th>local</th>
|
||||
<th>'.$this->getLang('page').'</th>
|
||||
<th>'.$this->getLang('local').'</th>
|
||||
<th>></th>
|
||||
<th>=</th>
|
||||
<th><</th>
|
||||
<th>remote</th>
|
||||
<th>'.$this->getLang('remote').'</th>
|
||||
</tr>';
|
||||
foreach($synclist as $id => $item){
|
||||
// check direction
|
||||
@ -263,13 +276,13 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
echo '</td>';
|
||||
|
||||
echo '<td>';
|
||||
echo '<input type="radio" name="sync['.hsc($id).']" value="1" title="push local version to remote wiki" '.(($dir == 1)?'checked="checked"':'').' />';
|
||||
echo '<input type="radio" name="sync['.hsc($id).']" value="1" title="'.$this->getLang('push').'" '.(($dir == 1)?'checked="checked"':'').' />';
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo '<input type="radio" name="sync['.hsc($id).']" value="0" title="keep both versions" '.(($dir == 0)?'checked="checked"':'').' />';
|
||||
echo '<input type="radio" name="sync['.hsc($id).']" value="0" title="'.$this->getLang('keep').'" '.(($dir == 0)?'checked="checked"':'').' />';
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo '<input type="radio" name="sync['.hsc($id).']" value="-1" title="pull remote version to local wiki" '.(($dir == -1)?'checked="checked"':'').' />';
|
||||
echo '<input type="radio" name="sync['.hsc($id).']" value="-1" title="'.$this->getLang('pull').'" '.(($dir == -1)?'checked="checked"':'').' />';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td>';
|
||||
@ -284,7 +297,7 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
echo '<input type="submit" value="Synchronize!" class="button" />';
|
||||
echo '<input type="submit" value="'.$this->getLang('syncstart').'" class="button" />';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
4
lang/en/intro.txt
Normal file
4
lang/en/intro.txt
Normal file
@ -0,0 +1,4 @@
|
||||
====== Wiki Synchronization ======
|
||||
|
||||
This tool allows you to synchronize the contents of your wiki with other wikis. Multiple other wikis can be setup using synchronization profiles. Synchronization can be restricted to certain namespaces.
|
||||
|
34
lang/en/lang.php
Normal file
34
lang/en/lang.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
$lang['syncstart'] = 'Start Synchronization';
|
||||
$lang['lastsync'] = 'Last Synchronization:';
|
||||
$lang['neversync'] = 'This profile was never synced before.';
|
||||
$lang['profile'] = 'Sync Profile';
|
||||
$lang['newprofile'] = 'New Profile...';
|
||||
$lang['select'] = 'Select';
|
||||
$lang['create'] = 'Create new Sync Profile';
|
||||
$lang['edit'] = 'Edit Sync Profile';
|
||||
|
||||
$lang['server'] = 'XMLRPC URL';
|
||||
$lang['user'] = 'Username';
|
||||
$lang['pass'] = 'Password';
|
||||
$lang['ns'] = 'Namespace';
|
||||
|
||||
$lang['save'] = 'Save';
|
||||
$lang['changewarn'] = 'Resaving this profile will reset the sync times. You will need to manually choose the sync directions for all files on the next sync.';
|
||||
|
||||
$lang['pullfail'] = 'pull failed:';
|
||||
$lang['pullok'] = 'pull succeded:';
|
||||
$lang['pushfail'] = 'push failed:';
|
||||
$lang['pushok'] = 'push succeded:';
|
||||
$lang['skipped'] = 'skipped:';
|
||||
|
||||
$lang['page'] = 'Pagename';
|
||||
$lang['local'] = 'Local Wiki';
|
||||
$lang['remote'] = 'Remote Wiki';
|
||||
|
||||
$lang['push'] = 'Push local revision to remote wiki.';
|
||||
$lang['pull'] = 'Pull remote revision to local wiki.';
|
||||
$lang['keep'] = 'Skip this file and keep both revisions as is.';
|
||||
|
||||
$lang['syncdone'] = 'Synchronization finished.';
|
4
lang/en/list.txt
Normal file
4
lang/en/list.txt
Normal file
@ -0,0 +1,4 @@
|
||||
====== Files to Synchronize ======
|
||||
|
||||
A list of files that differ between your local and the remote wiki is shown below. You need to decide which file you want to keep.
|
||||
|
5
lang/en/nochange.txt
Normal file
5
lang/en/nochange.txt
Normal file
@ -0,0 +1,5 @@
|
||||
====== Wikis are in Sync ======
|
||||
|
||||
There were no differences found between your local wiki and the remote wiki. No need to synchronize.
|
||||
|
||||
|
4
lang/en/sync.txt
Normal file
4
lang/en/sync.txt
Normal file
@ -0,0 +1,4 @@
|
||||
====== Synchronization... ======
|
||||
|
||||
The synchronization process has been initiated. Check the progress below.
|
||||
|
Reference in New Issue
Block a user