Index: pro-bachkim-filespace/sourcecode/application/config/autoload.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/config/autoload.php	(revision 23)
+++ pro-bachkim-filespace/sourcecode/application/config/autoload.php	(revision 42)
@@ -53,5 +53,5 @@
 */
 
-$autoload['libraries'] = array('database');
+$autoload['libraries'] = array('database','curl', 'xml', 'vservices');
 
 
Index: pro-bachkim-filespace/sourcecode/application/libraries/XML.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/libraries/XML.php	(revision 42)
+++ pro-bachkim-filespace/sourcecode/application/libraries/XML.php	(revision 42)
@@ -0,0 +1,214 @@
+<?php
+#$Id$
+
+/*
+* XML.inc.php
+*
+* Class to convert an XML file into an object
+*
+* Copyright (C) 2006  Oliver Strecke <oliver.strecke@browsertec.de>
+*
+*   This library is free software; you can redistribute it and/or
+*   modify it under the terms of the GNU Lesser General Public
+*   License as published by the Free Software Foundation; either
+*   version 2 of the License, or (at your option) any later version.
+*
+*   This library is distributed in the hope that it will be useful,
+*   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+*   Lesser General Public License for more details.
+*
+*   You should have received a copy of the GNU Lesser General Public
+*   License along with this library; if not, write to the Free Software
+*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+*/
+
+class XML{
+	var $_parser;
+	var $_xml_data;
+	var $_actual_tag;
+
+	//Constructor...
+	function xml($encoding="UTF-8"){
+	    $this->_parser=xml_parser_create($encoding);
+	    $this->_xml_data="";
+	    $this->_actual_tag=$this;
+	
+	    xml_set_object($this->_parser,$this);
+	    xml_parser_set_option($this->_parser,XML_OPTION_CASE_FOLDING,false);
+	    xml_set_element_handler($this->_parser,"tag_open","tag_close");
+	    xml_set_character_data_handler($this->_parser,"tag_data");
+	    xml_set_default_handler($this->_parser,"tag_data");
+	}
+
+	//get XML data from file...
+	function file_read($xml_file){
+		if(file_exists($xml_file)){
+			$this->_xml_data=implode("",file($xml_file));
+			return 1;
+		}else{
+			return 0;
+		}
+
+	}
+
+	//parse XML data...
+	function parse($xml_data=0){
+		if($xml_data)$this->_xml_data=$xml_data;
+		xml_parse($this->_parser,$this->_xml_data);
+	  xml_parser_free($this->_parser);
+	  return 1;
+	}
+
+  function tag_open($parser,$name,$attrs){
+  	//create new tag...
+  	#$actual_tag=&$this->_actual_tag;
+   	$tag=new XML_TAG($this->_actual_tag);
+   	$tag->_name=$name;
+   	$tag->_param=$attrs;
+   	if($name=="br" && isset($this->_actual_tag->_value))$this->_actual_tag->_value=$this->_actual_tag->_value."\n"; else $this->_actual_tag->_value="\n";
+
+   	//add tag object to parent/actual tag object...
+   	#if(is_object($this->_actual_tag)){
+   	if(!is_a($this->_actual_tag,"XML")){
+  	#if(is_object($this->_actual_tag->$name) || is_array($this->_actual_tag->$name)){
+   		if(isset($this->_actual_tag->$name)){
+   			//same child objects -> Array...
+   			$last_index=$this->_actual_tag->new_child_array($tag,$name);
+   			$this->_actual_tag=&$this->_actual_tag->{$name}[$last_index];
+   		}else{
+   			//add new child object to actual tag...
+   			$this->_actual_tag->new_child($tag,$name);
+  	    $this->_actual_tag=&$this->_actual_tag->$name;
+   		}
+   	}else{
+   		//copy first tag object in this object...
+   		$this->$name=$tag;
+   		$this->_actual_tag=&$this->{$name};
+   	}
+   	return 1;
+  }
+
+  function tag_data($parser,$string){
+   	if(strlen(trim($string))>0){
+   	  if(isset($this->_actual_tag->_value))$this->_actual_tag->_value=$this->_actual_tag->_value.$string; else $this->_actual_tag->_value=$string;
+   	}
+    return 1;
+  }
+
+  function tag_close($parser,$name){
+    $this->_actual_tag=&$this->_actual_tag->_parent;
+    return 1;
+  }
+
+  function file_write($xml_file){
+    $fp=fopen($xml_file,"w");
+    preg_match_all("/\<\?xml(.*)\?\>/",$this->_xml_data,$result_array);
+    if(is_array($result_array)){
+      foreach($result_array[1] as $header){
+        fputs($fp,"<?xml$header?>\n");
+      }
+    }
+    $this->tag_write($fp,$this);
+    fclose($fp);
+    return 1;
+  }
+
+  function tag_write($fp,$tag,$indent=0){
+    $return=0;
+    $tmp_array=get_object_vars($tag);
+    $indent_string="";
+    for($i=0;$i<$indent;$i++)$indent_string.="  ";
+    foreach($tmp_array as $tag_name=>$tag){
+      if(is_a($tag,"XML_TAG") && substr($tag_name,0,1)!="_"){
+        $return=1;
+        fputs($fp,"\n$indent_string<$tag_name");
+        foreach($tag->_param as $name=>$value){
+          fputs($fp," $name='".htmlentities($value)."'");
+        }
+        fputs($fp,">");
+        $result=$this->tag_write($fp,$tag,$indent+1);
+        if($result){
+          fputs($fp,"\n");
+          fputs($fp,"$indent_string</$tag_name>");
+        }else{
+          fputs($fp,htmlentities($tag->_value));
+          fputs($fp,"</$tag_name>");
+        }
+      }else if(is_array($tag) && substr($tag_name,0,1)!="_"){
+        $return=1;
+        foreach($tag as $i=>$tmp_tag){
+          fputs($fp,"\n$indent_string<$tag_name");
+          foreach($tmp_tag->_param as $name=>$value){
+            fputs($fp," $name='".htmlentities($value)."'");
+          }
+          fputs($fp,">");
+          $result=$this->tag_write($fp,$tmp_tag,$indent+1);
+          if($result){
+            fputs($fp,"\n");
+            fputs($fp,"$indent_string</$tag_name>");
+          }else{
+            fputs($fp,htmlentities($tmp_tag->_value));
+            fputs($fp,"</$tag_name>");
+          }
+        }
+      }
+    }
+    return $return;
+  }
+
+	//Debug...
+	function debug($exit=0){
+		echo "<pre>";
+		print_r($this);
+		echo "</pre>";
+		if($exit)exit;
+	}
+}
+
+class XML_TAG{
+	var $_parent;
+	var $_name;
+	var $_value;
+	var $_param;
+
+	//Constructor...
+	function xml_tag(&$parent){
+    $this->_parent=&$parent;
+		$this->_name="";
+		$this->_value=false;
+		$this->_param=Array();
+		return 1;
+	}
+
+	//simply add new child to this object...
+	function new_child($child,$child_name){
+	  if(isset($this->$child_name)){
+      $this->new_child_array($child,$child_name);
+	  }else{
+  	  $this->$child_name=&$child;
+	  }
+	}
+
+	//add child array for more same childs to this object...
+	function new_child_array($child,$child_name){
+		//create array and set old child object to the first array element...
+		if(is_object($this->$child_name)){
+			$tmp_obj=$this->$child_name;
+			$this->$child_name=Array();
+			$this->new_child_array($tmp_obj,$child_name);
+		}
+		//push child reference into child array...
+		$this->{$child_name}[]=&$child;
+		$last_index=count($this->$child_name)-1;
+		return $last_index;
+	}
+
+	//Debug...
+	function debug(){
+	  echo "<pre>";
+	  print_r($this);
+	  echo "</pre>";
+	}
+}
+?>
Index: pro-bachkim-filespace/sourcecode/application/libraries/vservices.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/libraries/vservices.php	(revision 42)
+++ pro-bachkim-filespace/sourcecode/application/libraries/vservices.php	(revision 42)
@@ -0,0 +1,48 @@
+<?php
+
+Class VServices {
+	
+	private $_apiUrl;
+	private $_curlObj;
+	private $_userId;
+	
+	public function __construct() {
+		
+	}
+	
+	public function setApiUrl($url) {
+		$this->_apiUrl = $url;
+	}
+	
+	public function setConnection($curl) {
+		$this->_curlObj = $curl;
+	}
+	
+	public function setUserId ($userId) {
+		$this->_userId = $userId;
+	}
+	
+	public function getPrivateTree () {
+		$this->_curlObj->create($this->_apiUrl. 'space/dir/isgetall/1');
+		$this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
+		$this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
+		
+		$post = array('userid' => $this->_userId);
+		$this->_curlObj->post($post);
+		return $this->_curlObj->execute();
+	}
+	
+	public function createDir ($dirName, $parentId) {
+		$this->_curlObj->create($this->_apiUrl. 'space/mkdir');
+		$this->_curlObj->option(CURLOPT_BUFFERSIZE, 10);
+		$this->_curlObj->options(array(CURLOPT_BUFFERSIZE => 10));
+		
+		$post = array('userid' => $this->_userId, 'parent_id' => $parentId, 'name' => $dirName);
+		$this->_curlObj->post($post);
+		return $this->_curlObj->execute();
+	}
+		
+	public function __destruct() {
+		
+	}
+}
Index: pro-bachkim-filespace/sourcecode/application/modules/ajax/controllers/privatecontent.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/modules/ajax/controllers/privatecontent.php	(revision 23)
+++ pro-bachkim-filespace/sourcecode/application/modules/ajax/controllers/privatecontent.php	(revision 42)
@@ -7,49 +7,76 @@
  */
 
+/* private $_aryDir = array(
+ 0 => array ('id' => 1, 'name' => 'Dir 1', 'parentID' => 0),
+		1 => array ('id' => 2, 'name' => 'Dir 2', 'parentID' => 0),
+		2 => array ('id' => 3, 'name' => 'Dir 1.1', 'parentID' => 1),
+		3 => array ('id' => 4, 'name' => 'Dir 1.1.1', 'parentID' => 3),
+		4 => array ('id' => 5, 'name' => 'Dir 1.1.1.1', 'parentID' => 4),
+		5 => array ('id' => 6, 'name' => 'Dir 1.1.2', 'parentID' => 3),
+		6 => array ('id' => 7, 'name' => 'Dir 3', 'parentID' => 0),
+		7 => array ('id' => 8, 'name' => 'Dir 3.1', 'parentID' => 7)
+);
+
+private $_aryFile = array(
+		0 => array('id' => 1, 'name' => 'File 1', 'minetype' => 'text', 'size' => '1.5MB', 'parentID' => 1),
+		1 => array('id' => 2, 'name' => 'File 2', 'minetype' => 'text', 'size' => '1.6MB', 'parentID' => 1),
+		2 => array('id' => 3, 'name' => 'File 3', 'minetype' => 'text', 'size' => '1.7MB', 'parentID' => 2),
+		3 => array('id' => 4, 'name' => 'File 4', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 2),
+		4 => array('id' => 5, 'name' => 'File 5', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 0),
+		5 => array('id' => 6, 'name' => 'File 6', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 3),
+		5 => array('id' => 7, 'name' => 'File 7', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 5)
+); */
+
 class PrivateContent extends MX_Controller 
 {
-	/* private $_aryDir = array(
-				0 => array ('id' => 1, 'name' => 'Dir 1', 'parentID' => 0),
-				1 => array ('id' => 2, 'name' => 'Dir 2', 'parentID' => 0),
-				2 => array ('id' => 3, 'name' => 'Dir 1.1', 'parentID' => 1),
-				3 => array ('id' => 4, 'name' => 'Dir 1.1.1', 'parentID' => 3),
-				4 => array ('id' => 5, 'name' => 'Dir 1.1.1.1', 'parentID' => 4),
-				5 => array ('id' => 6, 'name' => 'Dir 1.1.2', 'parentID' => 3),
-				6 => array ('id' => 7, 'name' => 'Dir 3', 'parentID' => 0),
-				7 => array ('id' => 8, 'name' => 'Dir 3.1', 'parentID' => 7)
-		);
-	
-	private $_aryFile = array(
-				0 => array('id' => 1, 'name' => 'File 1', 'minetype' => 'text', 'size' => '1.5MB', 'parentID' => 1),
-				1 => array('id' => 2, 'name' => 'File 2', 'minetype' => 'text', 'size' => '1.6MB', 'parentID' => 1),
-				2 => array('id' => 3, 'name' => 'File 3', 'minetype' => 'text', 'size' => '1.7MB', 'parentID' => 2),
-				3 => array('id' => 4, 'name' => 'File 4', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 2),
-				4 => array('id' => 5, 'name' => 'File 5', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 0),
-				5 => array('id' => 6, 'name' => 'File 6', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 3),
-				5 => array('id' => 7, 'name' => 'File 7', 'minetype' => 'text', 'size' => '1.8MB', 'parentID' => 5)
-		); */
-	
+
 	public function __construct() {
 		parent::__construct();
 		$this->load->model('Directory_model', 'objDirectory', TRUE);
+		$this->vservices->setApiUrl($this->config->item('api_url'));
+		$this->vservices->setConnection($this->curl);
+		$this->vservices->setUserId(33);
 	}
 	
 	public function getContent () {
-		$aryData = array('DIRECTORIES' =>  $this->objDirectory->getAllDirectory() , 'FILES' => $this->objDirectory->getAllFile(), 'ENCRYPT' => md5('abcdef'));
+		$xmlData = $this->vservices->getPrivateTree();
+		$this->xml->parse($xmlData);
+
+		$aryDirs = array();
+		$aryFiles = array();
+		
+		$aryError = array('err' => $this->xml->tree->_param['err'], 'errCode' => $this->xml->tree->_param['errCode']);
+		
+		if (is_array($this->xml->tree->folderlist->folder)) {
+			foreach($this->xml->tree->folderlist->folder as $key=>$value){
+				$aryDirs[] = array('id' => $value->_param['id'], 'name' => $value->_value, 'parentID' => $value->_param['parentid'] == -1 ? 0:$value->_param['parentid']);
+			}
+		}
+		else if (isset($this->xml->tree->folderlist->folder)) {
+			$folder = $this->xml->tree->folderlist->folder;
+			$aryDirs[] = array('id' => $folder->_param['id'], 'name' => $folder->_value,'parentID' => $folder->_param['parentid'] == -1 ? 0:$folder->_param['parentid']);
+		}
+		
+		if (is_array($this->xml->tree->filelist->file)) {
+			foreach($this->xml->tree->filelist->file as $key=>$value){
+				$aryFiles[] = array('id' => $value->_param['id'], 'name' => $value->_value, 'parentID' => $value->_param['parentid'] == -1 ? 0:$value->_param['parentid'], 'minetype' => $value->_param['filetype']);
+			}
+		}else if (isset($this->xml->tree->filelist->file)) {
+			$file = $this->xml->tree->filelist->file;
+			$aryFiles[] = array('id' => $file->_param['id'], 'name' => $file->_value,'parentID' => $file->_param['parentid'] == -1 ? 0:$file->_param['parentid'], 'minetype' => $file->_param['filetype']);
+		}
+		
+		$aryData = array('DIRECTORIES' =>  $aryDirs , 'FILES' => $aryFiles, 'ERROR' => $aryError);
 		echo json_encode($aryData);
 	}
 
 	public function createDir () {
-		$parentDir =  $this->input->post('parentID',TRUE);
-		$name =  $this->input->post('name',TRUE);
-		
-		if (!is_null($parentDir) && !is_null($name)) {
-			
-			$maxID = $this->objDirectory->getMaxID (true);
-			$aryDir = array('id' => (int)$maxID + 1, 'name' => $name, 'parentID' => $parentDir, 'maxID' => $maxID);
-			
-			$result = $this->objDirectory->createDir($aryDir);
-			echo json_encode($aryDir);
-		}
+		$parentDir =  $this->input->post('fparentid',TRUE);
+		$name =  $this->input->post('fname',TRUE);
+		$xmlData = $this->vservices->createDir($name, $parentDir);
+		$this->xml->parse($xmlData);
+		$aryError = array('err' => $this->xml->status->_param['err'], 'errCode' => $this->xml->status->_param['errCode']);
+		$aryData = array('id' => $this->xml->status->_param['id'], 'name' => $name, 'parentID' => $parentDir, 'ERROR' => $aryError);
+		echo json_encode($aryData);
 	}
 	
@@ -74,5 +101,8 @@
 		echo json_encode($aryData);
 	}
-
+	
+	public function upload() {
+		
+	}
 }
 
Index: pro-bachkim-filespace/sourcecode/application/modules/filemanager/views/main.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/modules/filemanager/views/main.php	(revision 23)
+++ pro-bachkim-filespace/sourcecode/application/modules/filemanager/views/main.php	(revision 42)
@@ -34,5 +34,5 @@
 			<div class="btn-group">
 				<button class="btn btn-warning" title="Táº£i xuá»ng"><i class="icon-cloud-download"></i></button>
-				<button class="btn btn-info" title="Táº£i lÃªn"><i class="icon-cloud-upload"></i></button>
+				<button id="btnUpload" class="btn btn-info" title="Táº£i lÃªn"><i class="icon-cloud-upload"></i></button>
 			</div>
 		</div>
Index: pro-bachkim-filespace/sourcecode/application/views/layout/contextmenu.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/views/layout/contextmenu.php	(revision 23)
+++ pro-bachkim-filespace/sourcecode/application/views/layout/contextmenu.php	(revision 42)
@@ -1,4 +1,5 @@
 <ul id="treeMenu" class="contextMenu">
-	<li class="share"><a href="#share">Chia sáº»</a></li>
+	<li class="newfolder"><a href="#newfolder">Táº¡o thÆ° má»¥c má»i</a></li>
+	<li class="share separator"><a href="#share">Chia sáº»</a></li>
 	<li class="copy separator"><a href="#copy">Sao chÃ©p Äáº¿n ...</a></li>
 	<li class="cut"><a href="#cut">Di chuyá»n Äáº¿n...</a></li>
@@ -10,4 +11,5 @@
 	<li class="open"><a href="#open">Má»</a></li>
 	<li class="preview"><a href="#preview">Xem trÆ°á»c</a></li>
+	<li class="newfolder separator"><a href="#newfolder">Táº¡o thÆ° má»¥c má»i</a></li>
 	<li class="share separator"><a href="#share">Chia sáº»</a></li>
 	<li class="copy separator"><a href="#copy">Sao chÃ©p Äáº¿n ...</a></li>
Index: pro-bachkim-filespace/sourcecode/application/views/layout/footer.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/views/layout/footer.php	(revision 23)
+++ pro-bachkim-filespace/sourcecode/application/views/layout/footer.php	(revision 42)
@@ -13,5 +13,8 @@
 <script src="assets/js/bootstrap/bootstrap.min.js"></script>
 <script src="assets/js/jquery/jquery.confirm.min.js"></script>
-<!-- <script src="assets/js/bootstrap/bootbox.min.js"></script> -->
+<script src="assets/js/bootstrap/ace-elements.min.js"></script>
+
+<script src="assets/js/jquery/jquery.uploadfile.min.js"></script>
+
 <script src="assets/js/jquery/jquery-ui-1.10.4.min.js"></script>
 <script src="assets/js/jquery/jquery.contextMenu.js"></script>
Index: pro-bachkim-filespace/sourcecode/application/views/layout/modalform.php
===================================================================
--- pro-bachkim-filespace/sourcecode/application/views/layout/modalform.php	(revision 23)
+++ pro-bachkim-filespace/sourcecode/application/views/layout/modalform.php	(revision 42)
@@ -109,4 +109,74 @@
 <!-- END:Copy modal box -->
 
-<!-- BEGIN:Delete confirm modal box -->
-<!-- END:Delete confirm modal box -->
+<!-- BEGIN:UPLOAD modal box -->
+<div id="box-upload" class="modal" tabindex="-1">
+	<div class="modal-dialog">
+		<div class="modal-content">
+			<div class="modal-header">
+				<button type="button" class="close" data-dismiss="modal">&times;</button>
+				<h4 class="blue bigger">Táº£i file lÃªn Violet Space</h4>
+			</div>
+
+			<div class="modal-body overflow-visible">
+				<div class="row">
+					<div class="col-xs-12 col-sm-12">
+						<div id="fileuploader">Chá»n file:</div>
+					</div>
+				</div>
+			</div>
+
+			<div class="modal-footer">
+				<button class="btn btn-sm" data-dismiss="modal">
+					<i class="icon-remove"></i>
+					ÄÃ³ng
+				</button>
+
+				<!-- <button class="btn btn-sm btn-primary">
+					<i class="icon-cloud-upload"></i>
+					Táº£i lÃªn
+				</button> -->
+			</div>
+		</div>
+	</div>
+</div>
+<!-- END:UPLOAD modal box -->
+
+<!-- BEGIN:New folder box -->
+<div id="box-newfolder" class="modal" tabindex="-1">
+	<div class="modal-dialog">
+		<div class="modal-content">
+			<div class="modal-header">
+				<button type="button" class="close" data-dismiss="modal">&times;</button>
+				<h4 class="blue bigger">Táº¡o thÆ° má»¥c má»i</h4>
+			</div>
+			<div class="modal-body overflow-visible">
+				<form id="frm-newfolder">
+					<div class="row">
+						<div class="col-xs-12">
+							<div class="input-group">
+								<div class="radio">
+									<label for="f-newfoldername">TÃªn thÆ° má»¥c</label>
+									<div>
+										<input type="text" id="f-newfoldername" name="fname" class="form-control" style="width:525px">
+										<input type="hidden" id="f-parentid" name="fparentid">
+									</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				</form>
+			</div>
+			<div class="modal-footer">
+				<button id="btn-submit-newfolder" class="btn btn-sm btn-primary">
+					<i class="icon-folder-close"></i>
+					OK
+				</button>
+				<button class="btn btn-sm" data-dismiss="modal">
+					<i class="icon-remove"></i>
+					ÄÃ³ng
+				</button>
+			</div>
+		</div>
+	</div>
+</div>
+<!-- END:New folder box -->
