Ignore:
Timestamp:
Jun 26, 2014 5:37:23 PM (11 years ago)
Author:
dungnv
Message:
 
Location:
pro-bachkim-filespace/sourcecode/application/modules
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • pro-bachkim-filespace/sourcecode/application/modules/ajax/controllers/privatecontent.php

    r15 r16  
    6363                echo json_encode($aryChild);
    6464        }
     65       
     66        public function rename() {
     67                $id =  $this->input->post('id',TRUE);
     68                $newName =  $this->input->post('newname',TRUE);
     69                $objectType =  $this->input->post('objtype',TRUE);
     70
     71                $aryData = array();
     72                $aryData['RESULT'] = $this->objDirectory->rename($id, $newName, $objectType);;
     73                $aryData['UPDATED'] = array('id' => $id, 'name' => $newName, 'type' => $objectType);
     74                echo json_encode($aryData);
     75        }
    6576
    6677}
  • pro-bachkim-filespace/sourcecode/application/modules/ajax/models/directory_model.php

    r12 r16  
    154154                if (file_exists($file) && count($aryDataSet) > 0) {
    155155                        $h = fopen ($file, $flag);
    156                         foreach ($aryDataSet as $key => $line) {
     156                        foreach ($aryDataSet as $key => $aryTmp) {
    157157                                $line = implode(',',$aryTmp);
    158                                 fwrite($line."\n", $h);
     158                                fwrite($h, $line."\n");
    159159                        }
    160160                        fclose ($h);
     
    176176        }
    177177       
     178        public function rename ($id, $newName, $type = 'directory') {
     179               
     180                if (!$newName || !$id) return FALSE;
     181                $aryObj = $type == 'directory' ? $this->getAllDirectory() : $this->getAllFile();
     182                $dbFile = $type == 'directory' ? $dbFile = 'directory.db' : $dbFile = 'file.db';
     183               
     184                if (count($aryObj) > 0) {
     185                        foreach ($aryObj as $key => $obj) {
     186                                if ($obj['id'] == $id) break;
     187                        }
     188                       
     189                        $aryObj[$key]['name'] = $newName;
     190                       
     191                        return $this->writeDB($dbFile, $aryObj);
     192                }
     193               
     194                return FALSE;
     195        }
     196       
    178197}
  • pro-bachkim-filespace/sourcecode/application/modules/filemanager/views/main.php

    r10 r16  
    2525                                <button id="btnDel" class="btn btn-success" title="Xóa"><i class="icon-eraser"></i></button>
    2626                                <button id="btnCopy" class="btn btn-success" title="Sao chép"><i class="icon-copy"></i></button>
    27                                 <button id="btnCut"class="btn btn-success" title="Cắt"><i class="icon-cut"></i></button>
    28                                 <button id="btnPaste"class="btn btn-success" title="Dán"><i class="icon-paste"></i></button>
     27                                <button id="btnCut" class="btn btn-success" title="Cắt"><i class="icon-cut"></i></button>
     28                                <button id="btnPaste" class="btn btn-success" title="Dán"><i class="icon-paste"></i></button>
    2929                        </div>
    3030                        <div class="btn-group">
Note: See TracChangeset for help on using the changeset viewer.