manual update improve
diff --git a/code/default/launcher/lang/zh_CN/LC_MESSAGES/messages.po b/code/default/launcher/lang/zh_CN/LC_MESSAGES/messages.po
index 135bd53cd0..885b5a33aa 100644
--- a/code/default/launcher/lang/zh_CN/LC_MESSAGES/messages.po
+++ b/code/default/launcher/lang/zh_CN/LC_MESSAGES/messages.po
@@ -177,10 +177,19 @@ msgid "no hash check"
 msgstr "不校验"
 
 msgid "Set as local version"
-msgstr "设置本地版本"
+msgstr "设置为本地版本"
 
-msgid "Input version"
-msgstr "输入版本"
+msgid "Delete local version"
+msgstr "删除本地版本"
+
+msgid "Target version"
+msgstr "目标版本"
+
+msgid "Local"
+msgstr "本地"
+
+msgid "Released"
+msgstr "已发布"
 
 msgid "(Remote Web Control Enabled)"
 msgstr "(已允许远程连接)"
@@ -224,6 +233,9 @@ msgstr "下载中……"
 msgid "Download completed"
 msgstr "下载完成"
 
+msgid "Deleted successfully"
+msgstr "删除成功"
+
 msgid "System"
 msgstr "系统"
 
diff --git a/code/default/launcher/update_from_github.py b/code/default/launcher/update_from_github.py
index 76058d5e92..8f78e98e68 100644
--- a/code/default/launcher/update_from_github.py
+++ b/code/default/launcher/update_from_github.py
@@ -302,6 +302,23 @@ def download_overwrite_new_version(xxnet_version,checkhash=1):
     os.remove(xxnet_zip_file)
     shutil.rmtree(xxnet_unzip_path, ignore_errors=True)
 
+def get_local_versions():
+    code_path = os.path.join(root_path, os.pardir)
+    files_in_code_path = os.listdir(code_path)
+    local_versions = []
+    for name in files_in_code_path:
+        start_script = os.path.join(code_path, name, "launcher", "start.py")
+        if os.path.isfile(start_script):
+            local_versions.append(name)
+    return local_versions
+
+def del_version(version):
+    try:
+        shutil.rmtree( os.path.join(top_path, "code", version) )
+        return True
+    except Exception as e:
+        xlog.warn("deleting fail: %s", e)
+        return False
 
 def update_current_version(version):
     start_script = os.path.join(top_path, "code", version, "launcher", "start.py")
diff --git a/code/default/launcher/web_control.py b/code/default/launcher/web_control.py
index da8381fef3..e95a9b7fd4 100644
--- a/code/default/launcher/web_control.py
+++ b/code/default/launcher/web_control.py
@@ -491,7 +491,22 @@ def req_update_handler(self):
                 data = '{"res":"success"}'
             else:
                 data = '{"res":"false", "reason": "version not exist"}'
-
+        elif reqs['cmd'] == ['get_localversions']:
+            local_versions = update_from_github.get_local_versions()
+            
+            s = ""
+            for v in local_versions:
+                if not s == "":
+                    s += ","
+                s += ' { "v":"%s" } ' % (v)
+            data = '[  %s  ]' %(s)
+        elif reqs['cmd'] == ['del_localversion']:
+            if update_from_github.del_version( reqs['version'][0] ):
+                data = '{"res":"success"}'
+            else:
+                data = '{"res":"fail"}'
+            
+            
         self.send_response('text/html', data)
 
     def req_config_proxy_handler(self):
diff --git a/code/default/launcher/web_ui/config_update.html b/code/default/launcher/web_ui/config_update.html
index 13ea3c0f6a..27d1f1deda 100644
--- a/code/default/launcher/web_ui/config_update.html
+++ b/code/default/launcher/web_ui/config_update.html
@@ -62,24 +62,34 @@
         </div>
         <br/>
         <div class="row-fluid">
-            <div class="span2">
-                <label>{{ _( "Input version" ) }} :</label>
-            </div>
-            <div class="span2">
-                <input id="manual-version" style="width: 8em"/>
-            </div>
+            <table>
+                <tr>
+                    <td >
+                        <label>{{ _( "Target version" ) }} :</label>
+                    </td>
+                    <td>
+                        <input id="manual-version" style="width: 8em"/>
+                    </td>
+                    <td>
+                        <select id="local-versions-selector"> <option>{{ _( "Local" ) }}</option> </select>
+                    </td>
+                    <td>
+                        <select id="released-versions-selector"><option>{{ _( "Released" ) }}</option> </select>
+                    </td>
+                </tr>
+            </table>
         </div>
         <br/>
         <div class="row-fluid">
-            <div class="span2">
-                <button class="btn btn-primary ladda-button" data-style="slide-up" id="manual-upgrade-to">{{ _( "Upgrade to" ) }} ({{ _( "no hash check" ) }})</button>
-            </div>
-        </div>
-        <br/>
-        <div class="row-fluid">
-            <div class="span2">
-                <button class="btn btn-primary ladda-button" data-style="slide-up" id="set-as-local-version">{{ _( "Set as local version" ) }}</button>
-            </div>
+            <table>
+                <tr>
+                    <button class="btn btn-primary ladda-button" data-style="slide-up" id="manual-upgrade-to">{{ _( "Upgrade to" ) }} ({{ _( "no hash check" ) }})</button>
+  
+                    <button class="btn btn-primary ladda-button" data-style="slide-up" id="set-as-local-version">{{ _( "Set as local version" ) }}</button>
+                    
+                    <button class="btn btn-warning ladda-button" data-style="slide-up" id="delete-local-version">{{ _( "Delete local version" ) }}</button>
+                </tr>
+            </table>
         </div>
     </div>
 
@@ -265,7 +275,8 @@
     $('#set-as-local-version').click(function(){
 
         var v = $('#manual-version').val();
-
+        
+        var pageRequests={};
         pageRequests['cmd'] = 'set_localversion';
         pageRequests['version'] = v;
         $.ajax({
@@ -285,5 +296,100 @@
             }
         });
     });
+    
+    $('#delete-local-version').click(function(){
 
-</script>
\ No newline at end of file
+        var v = $('#manual-version').val();
+        
+        var pageRequests={};
+        pageRequests['cmd'] = 'del_localversion';
+        pageRequests['version'] = v;
+        $.ajax({
+            type: 'GET',
+            url: '/update',
+            data: pageRequests,
+            dataType: 'JSON',
+            success: function(result) {
+                if ( result['res'] == 'success' ) {
+                    tip('{{ _( "Deleted successfully" ) }}', 'success');
+                }else{
+                    tip('{{ _( "Deleting local version fail" ) }}', 'warning');
+                }
+            },
+            error: function() {
+                displayErrorMessage();
+            }
+        });
+    });
+
+    function show_localversions()
+    {
+        var pageRequests = {};
+        pageRequests['cmd'] = 'get_localversions';
+        $.ajax({
+            type: 'GET',
+            url: '/update',
+            data: pageRequests,
+            dataType: 'json',
+            success: function(result) {
+                
+                $("#local-versions-selector").html("");
+                
+                var lv = result;
+                for(var i = 0 ; i < lv.length; ++i)
+                {
+                    var v = lv[i]['v'];
+                    var new_option = document.getElementById("local-versions-selector").appendChild(document.createElement("option"));
+                    new_option.value=v;
+                    $(new_option).text(v);
+                }
+            },
+            error: function() {
+                tip( 'Getting local versions failed.');
+            }
+        });
+    }
+    
+    function show_releasedversions()
+    {
+        $.ajax({
+            type: 'GET',
+            url: 'https://api.github.com/repos/XX-net/XX-Net/releases',
+            dataType: 'json',
+            success: function(result) {
+                
+                $("#released-versions-selector").html("");
+                
+                var vs = result;
+                for(var i = 0 ; i < 30 && vs[i]; ++i)
+                {
+                    var v = vs[i]['tag_name'];
+                    var new_option = document.getElementById("released-versions-selector").appendChild(document.createElement("option"));
+                    new_option.value=v;
+                    $(new_option).text(v);
+                }
+            },
+            error: function() {
+                tip( 'Getting released versions failed.');
+            }
+        });
+        show_releasedversions = function(){};
+    }
+    
+    $(function(){
+        $("#local-versions-selector").focus(function(){
+            show_localversions();
+        });
+        $("#local-versions-selector").change(function(){
+            $("#manual-version").val($("#local-versions-selector").val());
+        });
+        
+        $("#released-versions-selector").focus(function(){
+            show_releasedversions();
+        });
+        $("#released-versions-selector").change(function(){
+            $("#manual-version").val($("#released-versions-selector").val());
+        });
+        
+    });
+</script>
