Permalink
Browse files

make profiles deleteable

  • Loading branch information...
1 parent 65a6a0c commit 92853518080a213270f1aa7b754e60a36151b688 @splitbrain committed Mar 23, 2012
Showing with 17 additions and 5 deletions.
  1. +16 −5 admin.php
  2. +1 −0 lang/en/lang.php
View
@@ -69,12 +69,20 @@ function getMenuSort() {
}
/**
- * handle user request
+ * handle profile saving/deleting
*/
function handle() {
if(isset($_REQUEST['prf']) && is_array($_REQUEST['prf'])){
- if($this->profno === '') $this->profno = count($this->profiles);
- $this->profiles[$this->profno] = $_REQUEST['prf'];
+ if(isset($_REQUEST['sync__delete']) && $this->profno !== ''){
+ // delete profile
+ unset($this->profiles[$this->profno]);
+ $this->profiles = array_values($this->profiles); //reindex
+ $this->profno = '';
+ }else{
+ // add/edit profile
+ if($this->profno === '') $this->profno = count($this->profiles);
+ $this->profiles[$this->profno] = $_REQUEST['prf'];
+ }
$this->_profileSave();
// reset the client
@@ -288,14 +296,17 @@ function _profileform($no=''){
echo '<label for="sync__type2">'.$this->getLang('type2').'</label> ';
echo '</div>';
-
-
echo '<div class="submit">';
echo '<input type="submit" value="'.$this->getLang('save').'" class="button" />';
if($no !== '' && $this->profiles[$no]['ltime']){
echo '<small>'.$this->getLang('changewarn').'</small>';
}
echo '</div>';
+
+ echo '<div class="submit">';
+ echo '<input name="sync__delete" type="submit" value="'.$this->getLang('delete').'" class="button" />';
+ echo '</div>';
+
echo '</fieldset>';
echo '</form>';
}
View
@@ -16,6 +16,7 @@
$lang['select'] = 'Select';
$lang['create'] = 'Create new Sync Profile';
$lang['edit'] = 'Edit Sync Profile';
+$lang['delete'] = 'Delete Sync Profile';
$lang['server'] = 'XMLRPC URL';
$lang['user'] = 'Username';

0 comments on commit 9285351

Please sign in to comment.