Browse Source

Merge branch 'master' of http://10.1.235.20:3000/ipu/android-share

wangxl 8 years ago
parent
commit
be3cea78b0
51 changed files with 646 additions and 266 deletions
  1. 8 4
      display-client/AndroidManifest.xml
  2. 2 0
      display-client/assets/mobile-action.xml
  3. 2 2
      display-client/project.properties
  4. 0 0
      display-client/res/drawable/composer_button.png
  5. 0 0
      display-client/res/drawable/composer_camera.png
  6. 0 0
      display-client/res/drawable/composer_icn_plus.png
  7. 0 0
      display-client/res/drawable/composer_music.png
  8. 0 0
      display-client/res/drawable/composer_place.png
  9. 0 0
      display-client/res/drawable/composer_sleep.png
  10. 0 0
      display-client/res/drawable/composer_sun.png
  11. 0 0
      display-client/res/drawable/composer_thought.png
  12. 0 0
      display-client/res/drawable/composer_with.png
  13. 0 0
      display-client/res/drawable/friends_delete.png
  14. 3 3
      display-client/src/com/ai/ipu/display/MainActivity.java
  15. 104 101
      display-server/src/main/java/com/ai/server/bean/UploadDownloadWithTfsBean.java
  16. 42 0
      display-server/src/main/java/com/ai/server/dao/FileDao.java
  17. 37 0
      display-server/src/main/java/com/ai/server/dao/TfsMapDao.java
  18. 2 0
      display-server/src/main/java/com/ai/server/util/Constant.java
  19. 181 0
      display-server/src/main/java/com/ai/tfs/DbFs.java
  20. 105 0
      display-server/src/main/java/com/ai/tfs/DbFsUnique.java
  21. 11 0
      display-server/src/main/resources/database.xml
  22. 7 8
      display-server/src/main/resources/memcache.xml
  23. 3 3
      display-server/src/main/resources/tfs.xml
  24. 1 1
      display-server/src/main/webapp/biz/js/more/scene/TfsDemo.js
  25. 7 0
      display-server/src/main/webapp/biz/js/plugin/pageHandler/pageHandler.js
  26. 2 0
      display-server/src/main/webapp/res/js/mobile/expand-mobile.js
  27. 1 1
      display-server/src/main/webapp/template/webapp/more/scene/TfsDemo.html
  28. 7 0
      display-server/src/main/webapp/template/webapp/plugin/PageHandler/PageHandler.html
  29. 0 17
      ipu-pathmenu/project.properties
  30. 0 8
      ipupathmenu-lib/.classpath
  31. 0 26
      ipupathmenu-lib/AndroidManifest.xml
  32. BIN
      ipupathmenu-lib/libs/ipupathmenu1.0.jar
  33. 0 20
      ipupathmenu-lib/proguard-project.txt
  34. 0 15
      ipupathmenu-lib/project.properties
  35. 0 11
      ipupathmenu-lib/res/values-v11/styles.xml
  36. 0 12
      ipupathmenu-lib/res/values-v14/styles.xml
  37. 0 7
      ipupathmenu-lib/res/values/dimens.xml
  38. 0 6
      ipupathmenu-lib/res/values/strings.xml
  39. 0 20
      ipupathmenu-lib/res/values/styles.xml
  40. 1 1
      wade-mobile-common/.classpath
  41. BIN
      wade-mobile-common/libs/ipu-count-1.0.jar
  42. BIN
      wade-mobile-common/libs/ipu-count-3.0.jar
  43. BIN
      wade-mobile-common/libs/ipu-mobile-3.0.jar
  44. BIN
      wade-mobile-common/libs/wade-mobile-com.jar
  45. BIN
      wade-mobile-common/libs/wade-mobile-func.jar
  46. BIN
      wade-mobile-common/libs/wade-mobile-ui.jar
  47. BIN
      wade-mobile-common/libs/wade-mobile.jar
  48. 77 0
      wade-mobile-common/res/layout/browser.xml
  49. 8 0
      wade-mobile-common/res/values/strings_browser.xml
  50. BIN
      wade-mobile-func/libs/wade-mobile-com.jar
  51. 35 0
      wade-mobile-func/src/com/wade/mobile/func/MobileBrowser.java

+ 8 - 4
display-client/AndroidManifest.xml

@ -112,6 +112,10 @@
112 112
        <activity
113 113
            android:name="com.wade.mobile.ui.activity.OpenUrlActivity">
114 114
        </activity>
115
        <!-- 打开自定义浏览器 -->
116
        <activity
117
            android:name="com.wade.mobile.common.browser.BrowserActivity">
118
        </activity>
115 119
        <!-- 侧滑菜单 -->
116 120
        <activity android:name="com.wade.mobile.ui.activity.SlidingMenuActivity"
117 121
            android:theme="@style/SlidingMenuTheme" >
@ -136,17 +140,17 @@
136 140
        </activity> 
137 141
        -->
138 142
        <!-- 单个扫码 -->
139
        <activity
143
        <!-- <activity
140 144
            android:name="com.ai.ipu.scan.activity.CaptureSingleActivity"
141 145
            android:configChanges="orientation|keyboardHidden"   
142 146
            android:screenOrientation="portrait" >
143
        </activity>
147
        </activity> -->
144 148
        <!-- 多个扫码 -->
145
        <activity
149
      <!--   <activity
146 150
            android:name="com.ai.ipu.scan.activity.CaptureMultipleActivity"
147 151
            android:configChanges="orientation|keyboardHidden"   
148 152
            android:screenOrientation="portrait" >
149
        </activity>
153
        </activity> -->
150 154
        <!-- 音乐播放服务 -->
151 155
        <service android:name="com.wade.mobile.common.audio.play.AudioPlayerService" />
152 156
        <!-- 录制声音

+ 2 - 0
display-client/assets/mobile-action.xml

@ -22,6 +22,8 @@
22 22
	<action name="downloadWithServlet" class="com.wade.mobile.func.MobileNetWork" method="downloadWithServlet"></action>
23 23
	<action name="uploadWithServlet" class="com.wade.mobile.func.MobileNetWork" method="uploadWithServlet"></action>
24 24
	<action name="openBrowser" class="com.wade.mobile.func.MobileNetWork" method="openBrowser" ></action>
25
	<!-- 打开浏览器插件 -->
26
	<action name="openIpuBrowser" class="com.wade.mobile.func.MobileBrowser" method="openIpuBrowser" ></action>
25 27
	<!-- NFC -->
26 28
	<action name="initNfc" class="com.wade.mobile.func.MobileDevice" method="initNfc"></action>
27 29
	

+ 2 - 2
display-client/project.properties

@ -13,5 +13,5 @@
13 13
# Project target.
14 14
target=android-22
15 15
android.library=false
16
android.library.reference.1=../wade-mobile-common
17
android.library.reference.2=../wade-mobile-lib
16
android.library.reference.1=..\\wade-mobile-common
17
android.library.reference.2=..\\wade-mobile-lib

ipupathmenu-lib/res/drawable-hdpi/composer_button.png → display-client/res/drawable/composer_button.png


ipupathmenu-lib/res/drawable-hdpi/composer_camera.png → display-client/res/drawable/composer_camera.png


ipupathmenu-lib/res/drawable-hdpi/composer_icn_plus.png → display-client/res/drawable/composer_icn_plus.png


ipupathmenu-lib/res/drawable-hdpi/composer_music.png → display-client/res/drawable/composer_music.png


ipupathmenu-lib/res/drawable-hdpi/composer_place.png → display-client/res/drawable/composer_place.png


ipupathmenu-lib/res/drawable-hdpi/composer_sleep.png → display-client/res/drawable/composer_sleep.png


ipupathmenu-lib/res/drawable-hdpi/composer_sun.png → display-client/res/drawable/composer_sun.png


ipupathmenu-lib/res/drawable-hdpi/composer_thought.png → display-client/res/drawable/composer_thought.png


ipupathmenu-lib/res/drawable-hdpi/composer_with.png → display-client/res/drawable/composer_with.png


ipupathmenu-lib/res/drawable-hdpi/friends_delete.png → display-client/res/drawable/friends_delete.png


+ 3 - 3
display-client/src/com/ai/ipu/display/MainActivity.java

@ -8,23 +8,23 @@ import android.os.Bundle;
8 8
import android.util.DisplayMetrics;
9 9
import android.view.View;
10 10
11
import com.ai.ipu.ipupathmenu.PathMenu;
12
import com.ai.ipu.ipupathmenu.PathMenu.OnButtonClickListener;
13 11
import com.ai.ipu.mobile.app.AppInfoUtil;
14 12
import com.ai.ipu.mobile.app.ApplicationManager;
15 13
import com.ai.ipu.mobile.app.MobileCheck;
16 14
import com.ai.ipu.mobile.app.MobileOperation;
17 15
import com.ai.ipu.mobile.res.assets.AssetsUtil;
18 16
import com.ai.ipu.mobile.util.IpuMobileLog;
19
//import com.baidu.mapapi.SDKInitializer;
20 17
import com.umeng.analytics.MobclickAgent;
21 18
import com.wade.mobile.app.AppRecord;
22 19
import com.wade.mobile.frame.activity.TemplateMainActivity;
23 20
import com.wade.mobile.frame.config.ServerConfig;
24 21
import com.wade.mobile.func.MobileUI;
25 22
import com.wade.mobile.ui.comp.dialog.ConfirmBlockDialog;
23
import com.wade.mobile.ui.comp.menu.PathMenu;
24
import com.wade.mobile.ui.comp.menu.PathMenu.OnButtonClickListener;
26 25
import com.wade.mobile.ui.view.FlipperLayout;
27 26
import com.wade.mobile.util.Constant;
27
import com.wade.mobile.util.Constant.LoadingDialogStyle;
28 28
import com.wade.mobile.util.Messages;
29 29
30 30
public class MainActivity extends TemplateMainActivity {

+ 104 - 101
display-server/src/main/java/com/ai/server/bean/UploadDownloadWithTfsBean.java

@ -1,173 +1,176 @@
1 1
package com.ai.server.bean;
2 2

3 3
import java.io.FileInputStream;
4
import java.io.IOException;
5 4
import java.io.InputStream;
5
import java.util.Date;
6 6
import java.util.Iterator;
7 7
import java.util.List;
8
import java.util.Map;
9
import java.util.Set;
10 8

11 9
import javax.servlet.http.HttpServletRequest;
12 10

13 11
import org.apache.commons.fileupload.FileItem;
14 12
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
15 13
import org.apache.commons.fileupload.servlet.ServletFileUpload;
14
import org.apache.commons.lang3.StringUtils;
16 15

17 16
import com.ai.ipu.basic.file.FileUtil;
18
import com.ai.ipu.basic.file.PropertiesHelper;
17
import com.ai.ipu.basic.log.ILogger;
18
import com.ai.ipu.basic.log.IpuLoggerFactory;
19 19
import com.ai.ipu.fs.IBaseFs;
20
import com.ai.ipu.fs.impl.UniqueCacheFs;
21
import com.ai.ipu.fs.util.FsFactory;
22 20
import com.ai.ipu.server.servlet.ServletManager;
23
import com.ai.ipu.server.util.MobileUtility;
21
import com.ai.ipu.server.util.MobileServerException;
24 22
import com.ai.server.core.bean.IpuAppBean;
23
import com.ai.server.dao.FileDao;
24
import com.ai.server.util.Constant;
25
import com.ai.tfs.DbFs;
25 26
import com.ailk.common.data.IData;
26 27
import com.ailk.common.data.IDataset;
27 28
import com.ailk.common.data.impl.DataMap;
28
import com.ailk.common.data.impl.DatasetList;
29 29

30 30
public class UploadDownloadWithTfsBean extends IpuAppBean {
31 31

32
    private final String path = this.getClass().getClassLoader().getResource("tfsdb.properties").getPath();
32
    transient protected static final ILogger log = IpuLoggerFactory.createLogger(UploadDownloadWithTfsBean.class);
33

34
    private static final String IPU_FILE = "ipu_file";
33 35

34 36
    /**
35
     * 将流文件上传至tfs服务端,且修改tfsdb.properties文件
37
     * 将流文件上传至tfs服务端,且记录数据库
36 38
     * 
37 39
     * @param param
38 40
     * @return
39 41
     * @throws Exception
40 42
     */
41 43
    public IData uploadPic(IData param) throws Exception {
42
        String fileName = param.getString("fileName");
43
        // 1.从客户端接受流文件
44
        DiskFileItemFactory factory = new DiskFileItemFactory(); // 获得磁盘文件条目工厂
45
        ServletFileUpload upload = new ServletFileUpload(factory);
46
        HttpServletRequest request = ServletManager.getRequest();
47
        if (!ServletFileUpload.isMultipartContent(request)) {
48
            MobileUtility.error("没有检测到文件,请重新提交!");
49
        }
50
        List<FileItem> fileList = upload.parseRequest(request);
51
        Iterator<FileItem> it = fileList.iterator();
44
        IData result = new DataMap();
52 45
        InputStream is = null;
53
        while (it.hasNext()) {
54
            FileItem item = it.next();
55
            if (!item.isFormField()) {
56
                is = item.getInputStream();
57
                break;
58
            }
59
        }
60

61
        // 2.将流文件存放tfs服务端,并返回存放信息
62
        String fileHashCode = null;
63 46
        FileInputStream fis = null;
64 47
        try {
65
            UniqueCacheFs ucfs = new UniqueCacheFs();
48
            String fileName = param.getString("fileName");
49
            // 1.从客户端接受流文件
50
            DiskFileItemFactory factory = new DiskFileItemFactory(); // 获得磁盘文件条目工厂
51
            ServletFileUpload upload = new ServletFileUpload(factory);
52
            HttpServletRequest request = ServletManager.getRequest();
53
            if (!ServletFileUpload.isMultipartContent(request)) {
54
                throw new MobileServerException("没有检测到文件,请重新提交!");
55
            }
56
            List<FileItem> fileList = upload.parseRequest(request);
57
            Iterator<FileItem> it = fileList.iterator();
58
            while (it.hasNext()) {
59
                FileItem item = it.next();
60
                if (!item.isFormField()) {
61
                    is = item.getInputStream();
62
                    break;
63
                }
64
            }
65

66
            // 2.将流文件存放tfs服务端,并返回存放信息
67
            String fileHashCode = null;
68
            IBaseFs fs = new DbFs();
66 69
            fis = (FileInputStream) is;
67
            fileHashCode = ucfs.saveFile(fis);
70
            fileHashCode = fs.saveFile(fis);
71
            log.debug("fileName=[" + fileName + "] 上传tfs成功,返回值fileHashCode=[" + fileHashCode + "]");
72

73
            // 3.业务数据保存。无就插入;有不必插入
74
            if (fileHashCode != null) {
75
                FileDao dao = new FileDao(Constant.CONNNAME);
76
                IData fileParam = new DataMap();
77
                fileParam.put("file_name", fileName);
78
                fileParam.put("file_hash_code", fileHashCode);
79
                // fileParam.put("file_path", null);
80
                fileParam.put("create_time", new Date());
81
                IDataset list = dao.queryFileListByFileHashCode(fileParam);
82
                if (list == null || list.isEmpty()) {
83
                    dao.insertFile(fileParam);
84
                    log.debug("fileHashCode=[" + fileHashCode + "] 未经存在,插入业务数据库表tab_file。");
85
                } else {
86
                    log.debug("fileHashCode=[" + fileHashCode + "] 已经存在,跳过插入业务数据库表tab_file步骤。");
87
                }
88
            }
89

90
            result.put("flag", "success");
68 91
        }
69 92
        catch (Exception e) {
70
            // TODO Auto-generated catch block
71
            e.printStackTrace();
93
            log.error(e.getMessage());
94
            result.put("flag", "fail");
72 95
        }
73 96
        finally {
74 97
            if (fis != null) {
75
                fis.close();
98
                try {
99
                    fis.close();
100
                }
101
                catch (Exception e) {
102
                    log.error(e.getMessage());
103
                }
76 104
            }
77 105
            if (is != null) {
78
                is.close();
106
                try {
107
                    is.close();
108
                }
109
                catch (Exception e) {
110
                    log.error(e.getMessage());
111
                }
79 112
            }
80 113
        }
81

82
        // 3.将信息记录数据库,或tfsdb.properties文件
83
        PropertiesHelper pro = new PropertiesHelper(path);
84
        String value = fileName + "," + fileHashCode + "," + "123";
85
        Set<Object> keySet = pro.keySet();
86
        String key = getNextKey(keySet);
87
        pro.put(key, value);
88

89
        IData result = new DataMap();
90
        result.put("flag", "success");
91 114
        return result;
92 115
    }
93 116

94
    private String getNextKey(Set<Object> keySet) {
95
        int maxNum = 0;
96
        for (Object key : keySet) {
97
            maxNum = Integer.valueOf((String) key) > maxNum ? Integer.valueOf((String) key) : maxNum;
98
        }
99
        return (maxNum + 1) + "";
100
    }
101

102 117
    public InputStream downloadPic(IData param) throws Exception {
103 118
        String id = param.getString("id");
104
        // 1.遍历tfsdb.properties文件,找到fileHashCode值
105
        PropertiesHelper pro = new PropertiesHelper(path);
106
        String value = pro.getProperty(id);
107
        String[] arr = value.split(",");
108
        if (arr.length != 3) {
109
            MobileUtility.error("读取tfsdb.properties格式有误。");
119
        if (StringUtils.isEmpty(id)) {
120
            throw new MobileServerException("参数id缺失。");
121
        }
122

123
        // 1.找到fileHashCode值
124
        FileDao dao = new FileDao(Constant.CONNNAME);
125
        IData fileObj = dao.queryFileListById(param);
126
        String fileName = fileObj.getString("file_name");
127
        if (null == fileObj || null == fileObj.getString("file_hash_code") || "".equals(fileObj.getString("file_hash_code"))) {
128
            throw new MobileServerException("数据库未找到记录。");
110 129
        }
111
        String fileName = arr[0];
112
        String fileHashCode = arr[1];
113
        String md5 = arr[2];
130
        String fileHashCode = fileObj.getString("file_hash_code");
114 131

115 132
        // 2.根据fileHashCode从tfs获取,并转化为本地文件
116
        IBaseFs fs = FsFactory.getUniqueCacheFs();
117
        String localFileName = "temp/"+fileName;
118
        boolean result = fs.takeFile(fileHashCode, localFileName);
119
        
120
        if(result){
121
            return new FileInputStream(FileUtil.connectFilePath("c:/", localFileName));
133
        IBaseFs fs = new DbFs();
134
        String path = FileUtil.connectFilePath(System.getProperty("catalina.base"), IPU_FILE, fileName);// 相对路径,转为输入流传到客户端app
135
        boolean result = fs.takeFile(fileHashCode, path);
136

137
        if (result) {
138
            return new FileInputStream(path);
122 139
        }
123 140
        return null;
124 141
    }
125 142

126 143
    public IData deletePic(IData param) throws Exception {
127 144
        String id = param.getString("id");
145
        if (StringUtils.isEmpty(id)) {
146
            throw new MobileServerException("参数id缺失。");
147
        }
128 148

129 149
        // 1.删除tfs服务端资源
130
        PropertiesHelper pro = new PropertiesHelper(path);
131
        String value = pro.getProperty(id);
132
        String[] arr = value.split(",");
133
        if (arr.length != 3) {
134
            MobileUtility.error("读取tfsdb.properties格式有误。");
150
        FileDao dao = new FileDao(Constant.CONNNAME);
151
        IData fileObj = dao.queryFileListById(param);
152
        if (null == fileObj || null == fileObj.getString("file_hash_code") || "".equals(fileObj.getString("file_hash_code"))) {
153
            throw new MobileServerException("数据库未找到记录。");
154
        }
155
        String fileHashCode = fileObj.getString("file_hash_code");
156
        IBaseFs fs = new DbFs();
157
        boolean deleteResult = fs.deleteFile(fileHashCode);
158
        if (!deleteResult) {
159
            throw new MobileServerException("tfs删除资源失败。");
135 160
        }
136
        String fileName = arr[0];
137
        String fileHashCode = arr[1];
138
        String md5 = arr[2];
139
        UniqueCacheFs ucfs = new UniqueCacheFs();
140
        ucfs.deleteFile(fileHashCode);
141 161

142
        // 2.删除tfsdb.properties一条记录
143
        pro.remove(id);
162
        // 2.删除数据库记录
163
        dao.deleteFileById(param);
144 164

145 165
        IData result = new DataMap();
146 166
        result.put("flag", "success");
147 167
        return result;
148 168
    }
149 169

150
    public IData getPictureList(IData param) throws IOException {
170
    public IData getPictureList(IData param) throws Exception {
151 171
        IData result = new DataMap();
152
        IDataset list = new DatasetList();
153
        IData obj = new DataMap();
154
        PropertiesHelper pro = new PropertiesHelper(path);
155
        Map<String, ?> map = pro.getProMap();
156
        Set<String> keySet = map.keySet();
157
        String value;
158
        for (String key : keySet) {
159
            obj = new DataMap();
160
            obj.put("id", key);
161
            value = (String) map.get(key);
162
            String[] arr = value.split(",");
163
            if (arr.length != 3) {
164
                MobileUtility.error("tfsdb.properties配置有误。");
165
            }
166
            obj.put("fileName", arr[0]);
167
            obj.put("fileHashCode", arr[1]);
168
            obj.put("fileMD5", arr[2]);
169
            list.add(obj);
170
        }
172
        FileDao dao = new FileDao(Constant.CONNNAME);
173
        IDataset list = dao.queryFileList(null);
171 174
        result.put("infoList", list);
172 175
        return result;
173 176
    }

+ 42 - 0
display-server/src/main/java/com/ai/server/dao/FileDao.java

@ -0,0 +1,42 @@
1
package com.ai.server.dao;
2

3
import com.ai.ipu.server.db.dao.impl.BaseDAO;
4
import com.ailk.common.data.IData;
5
import com.ailk.common.data.IDataset;
6

7
public class FileDao extends BaseDAO {
8

9
    public FileDao(String connName) throws Exception {
10
        super(connName);
11
    }
12

13
    public IDataset queryFileList(IData param) throws Exception {
14
        String sql = "SELECT * FROM tab_file ORDER BY create_time DESC";
15
        return this.queryList(sql, param);
16
    }
17

18
    public IDataset queryFileListByFileHashCode(IData param) throws Exception {
19
        String sql = "SELECT * FROM tab_file WHERE file_hash_code=:file_hash_code";
20
        return this.queryList(sql, param);
21
    }
22
    
23
    public IData queryFileListById(IData param) throws Exception {
24
        String sql = "SELECT * FROM tab_file WHERE id=:id";
25
        return this.queryList(sql, param).first();
26
    }
27

28
    public void insertFile(IData param) throws Exception {
29
        String sql = "INSERT INTO tab_file (file_name, file_hash_code, file_path, create_time, remark) VALUES(:file_name, :file_hash_code, :file_path, :create_time, :remark)";
30
        this.executeUpdate(sql, param);
31
    }
32

33
    public void deleteFileByFileHashCode(IData param) throws Exception {
34
        String sql = "DELETE FROM tab_file WHERE file_hash_code=:file_hash_code";
35
        this.executeUpdate(sql, param);
36
    }
37
    
38
    public void deleteFileById(IData param) throws Exception {
39
        String sql = "DELETE FROM tab_file WHERE id=:id";
40
        this.executeUpdate(sql, param);
41
    }
42
}

+ 37 - 0
display-server/src/main/java/com/ai/server/dao/TfsMapDao.java

@ -0,0 +1,37 @@
1
package com.ai.server.dao;
2

3
import com.ai.ipu.server.db.dao.impl.BaseDAO;
4
import com.ailk.common.data.IData;
5
import com.ailk.common.data.IDataset;
6

7
public class TfsMapDao extends BaseDAO {
8

9
    public TfsMapDao(String connName) throws Exception {
10
        super(connName);
11
    }
12

13
    public IData queryTfsMapListByFileHashCode(IData param) throws Exception {
14
        String sql = "SELECT * FROM common_tfs_map WHERE file_hash_code=:file_hash_code";
15
        return this.queryList(sql, param).first();
16
    }
17
    
18
    public IDataset queryTfsMapTfsListByMd5(IData param) throws Exception {
19
        String sql = "SELECT * FROM common_tfs_map WHERE md5=:md5";
20
        return this.queryList(sql, param);
21
    }
22

23
    public void insertTfsMap(IData param) throws Exception {
24
        String sql = "INSERT INTO common_tfs_map (file_hash_code, md5) VALUES(:file_hash_code, :md5)";
25
        this.executeUpdate(sql, param);
26
    }
27

28
    public void deleteTfsMapByFileHashCode(IData param) throws Exception {
29
        String sql = "DELETE FROM common_tfs_map WHERE file_hash_code=:file_hash_code";
30
        this.executeUpdate(sql, param);
31
    }
32
    
33
    public void updateTfsMap(IData param) throws Exception {
34
        String sql = "UPDATE common_tfs_map SET md5=:md5 WHERE file_hash_code=:file_hash_code";
35
        this.executeUpdate(sql, param);
36
    }
37
}

+ 2 - 0
display-server/src/main/java/com/ai/server/util/Constant.java

@ -1,6 +1,8 @@
1 1
package com.ai.server.util;
2 2

3 3
public class Constant {
4
    public static final String CONNNAME = "display";
5
    
4 6
    public static final String SUCCESS = "success";
5 7
    
6 8
	public static class Cache{

+ 181 - 0
display-server/src/main/java/com/ai/tfs/DbFs.java

@ -0,0 +1,181 @@
1
package com.ai.tfs;
2

3
import java.io.File;
4
import java.io.FileInputStream;
5
import java.io.OutputStream;
6

7
import com.ai.ipu.basic.cipher.MD5;
8
import com.ai.ipu.basic.file.FileUtil;
9
import com.ai.ipu.fs.cache.IFsUnique;
10
import com.ai.ipu.fs.impl.BaseFs;
11
import com.ai.ipu.fs.util.FsConstant;
12
import com.ai.ipu.fs.util.FsFactory;
13

14
/**
15
 * @author chengwb3 以MD5值为key的一系列操作,数据库存放记录
16
 */
17
public class DbFs extends BaseFs {
18

19
    private String fsUniqueClassPath = "com.ai.tfs.DbFsUnique";
20

21
    private IFsUnique fsUnique;
22

23
    public DbFs() throws Exception {
24
        fsUnique = FsFactory.getFsUnique(fsUniqueClassPath);
25
    }
26

27
    public String saveFile(String fileName) throws Exception {
28
        String md5 = MD5.hexDigestByFilePath(getLocalFileName(fileName)); // 计算md5值是为了排重
29
        String tfsFileHashCode = fsUnique.checkExists(md5);
30
        if (tfsFileHashCode != null) {
31
            return tfsFileHashCode;
32
        } else {
33
            tfsFileHashCode = super.saveFile(fileName);
34
            fsUnique.recordUnique(md5, tfsFileHashCode);// 上传排重时使用
35
        }
36
        return tfsFileHashCode;
37
    }
38

39
    @Override
40
    public String saveFile(FileInputStream fis) throws Exception {
41
        String md5 = MD5.hexDigest(fis); // 计算md5值是为了排重
42
        String tfsFileHashCode = fsUnique.checkExists(md5);
43
        if (tfsFileHashCode != null) {
44
            return tfsFileHashCode;
45
        } else {
46
            tfsFileHashCode = super.saveFile(fis);
47
            fsUnique.recordUnique(md5, tfsFileHashCode);// 上传排重时使用
48
        }
49
        return tfsFileHashCode;
50
    }
51

52
    /*
53
     * 通过fileHashCode获取文件,并转化为指定localFileName的文件
54
     * localFileName是绝对路径。例如:/home/ipuapp/web/deploy/8081 + / + ipu_file
55
     */
56
    @Override
57
    public boolean takeFile(String tfsFileHashCode, String localFileName) throws Exception {
58
        String cacheFilePath = FileUtil.connectFilePath(FsConstant.CACHE_DIRECTORY, tfsFileHashCode);
59
        File cacheFile = new File(FileUtil.connectFilePath(tfsUploadFileHome, cacheFilePath));
60

61
        String md5 = DbFsUnique.getMd5ByFileHashCode(tfsFileHashCode);
62
        // 使用缓存文件需要先判断md5值是否相同
63

64
        if (needLocalFileCache && cacheFile.exists() && MD5.hexDigestByFile(cacheFile).equals(md5)) {
65
            FileUtil.initDirectory(localFileName);
66
            FileUtil.writeFile(new FileInputStream(cacheFile), localFileName);
67
            return true;
68
        } else {
69
            /* 没有目录先建目录 */
70
            FileUtil.initDirectory(FileUtil.connectFilePath(tfsUploadFileHome, cacheFilePath));
71
            FileUtil.initDirectory(localFileName);
72

73
            boolean bo = super.takeFile(tfsFileHashCode, cacheFilePath);// 先下载到缓存目录下
74
            if (bo) {
75
                FileUtil.copyFile(FileUtil.connectFilePath(tfsUploadFileHome, cacheFilePath), localFileName);
76
                fsUnique.recordUnique(md5, tfsFileHashCode);
77
            }
78
            return bo;
79
        }
80
    }
81

82
    // public boolean takeFile(String tfsFileHashCode, String localFileName)
83
    // throws Exception {
84
    // String cacheFilePath =
85
    // FileUtil.connectFilePath(FsConstant.CACHE_DIRECTORY, tfsFileHashCode);
86
    // File cacheFile = new File(FileUtil.connectFilePath(tfsUploadFileHome,
87
    // cacheFilePath));
88
    //
89
    // String md5 = DbFsUnique.getMd5ByFileHashCode(tfsFileHashCode);
90
    // // 使用缓存文件需要先判断md5值是否相同
91
    //
92
    // if (needLocalFileCache && cacheFile.exists() &&
93
    // MD5.hexDigestByFile(cacheFile).equals(md5)) {
94
    //
95
    // FileUtil.writeFile(new FileInputStream(cacheFile),
96
    // getLocalFileName(localFileName));
97
    // return true;
98
    // } else {
99
    // /* 没有目录先建目录 */
100
    // FileUtil.initDirectory(FileUtil.connectFilePath(tfsUploadFileHome,
101
    // cacheFilePath));
102
    // FileUtil.initDirectory(FileUtil.connectFilePath(tfsUploadFileHome,
103
    // localFileName));
104
    //
105
    // boolean bo = super.takeFile(tfsFileHashCode, cacheFilePath);// 先下载到缓存目录下
106
    // if (bo) {
107
    // FileUtil.copyFile(FileUtil.connectFilePath(tfsUploadFileHome,
108
    // cacheFilePath),
109
    // FileUtil.connectFilePath(tfsUploadFileHome, localFileName));
110
    // fsUnique.recordUnique(md5, tfsFileHashCode);
111
    // }
112
    // return bo;
113
    // }
114
    // }
115

116
    @Override
117
    public boolean takeFile(String tfsFileHashCode, OutputStream out) throws Exception {
118

119
        String cacheFilePath = FileUtil.connectFilePath(FsConstant.CACHE_DIRECTORY, tfsFileHashCode);
120
        File cacheFile = new File(FileUtil.connectFilePath(tfsUploadFileHome, cacheFilePath));
121

122
        String md5 = DbFsUnique.getMd5ByFileHashCode(tfsFileHashCode);
123
        // 使用缓存文件需要先判断md5值是否相同
124
        if (needLocalFileCache && cacheFile.exists() && MD5.hexDigestByFile(cacheFile).equals(md5)) {
125
            FileUtil.writeFile(new FileInputStream(cacheFile), out);// 是否需要内部关闭out输出流
126
            return true;
127
        } else {
128
            /* 没有目录先建目录 */
129
            FileUtil.initDirectory(FileUtil.connectFilePath(tfsUploadFileHome, cacheFilePath));
130

131
            boolean bo = super.takeFile(tfsFileHashCode, cacheFilePath);// 先下载到缓存目录下
132
            if (bo) {
133
                FileInputStream fis = new FileInputStream(FileUtil.connectFilePath(tfsUploadFileHome, cacheFilePath));
134
                FileUtil.writeFile(fis, out);
135
                fsUnique.recordUnique(md5, tfsFileHashCode);
136
            }
137

138
            return bo;
139
        }
140
    }
141

142
    // public boolean takeFile(String tfsFileHashCode, OutputStream out) throws
143
    // Exception {
144
    //
145
    // String cacheFilePath =
146
    // FileUtil.connectFilePath(FsConstant.CACHE_DIRECTORY, tfsFileHashCode);
147
    // File cacheFile = new File(FileUtil.connectFilePath(tfsUploadFileHome,
148
    // cacheFilePath));
149
    //
150
    // String md5 = DbFsUnique.getMd5ByFileHashCode(tfsFileHashCode);
151
    // // 使用缓存文件需要先判断md5值是否相同
152
    // if (needLocalFileCache && cacheFile.exists() &&
153
    // MD5.hexDigestByFile(cacheFile).equals(md5)) {
154
    // FileUtil.writeFile(new FileInputStream(cacheFile), out);// 是否需要内部关闭out输出流
155
    // return true;
156
    // } else {
157
    // /* 没有目录先建目录 */
158
    // FileUtil.initDirectory(FileUtil.connectFilePath(tfsUploadFileHome,
159
    // cacheFilePath));
160
    //
161
    // boolean bo = super.takeFile(tfsFileHashCode, cacheFilePath);// 先下载到缓存目录下
162
    // if (bo) {
163
    // FileInputStream fis = new
164
    // FileInputStream(FileUtil.connectFilePath(tfsUploadFileHome,
165
    // cacheFilePath));
166
    // FileUtil.writeFile(fis, out);
167
    // fsUnique.recordUnique(md5, tfsFileHashCode);
168
    // }
169
    //
170
    // return bo;
171
    // }
172
    // }
173

174
    public boolean deleteFile(String tfsFileHashCode) throws Exception {
175
        boolean bo = super.deleteFile(tfsFileHashCode);
176
        if (bo) {
177
            fsUnique.cleanUnique(tfsFileHashCode);
178
        }
179
        return bo;
180
    }
181
}

+ 105 - 0
display-server/src/main/java/com/ai/tfs/DbFsUnique.java

@ -0,0 +1,105 @@
1
package com.ai.tfs;
2

3
import com.ai.ipu.basic.log.ILogger;
4
import com.ai.ipu.basic.log.IpuLoggerFactory;
5
import com.ai.ipu.fs.cache.IFsUnique;
6
import com.ai.server.dao.TfsMapDao;
7
import com.ai.server.util.Constant;
8
import com.ailk.common.data.IData;
9
import com.ailk.common.data.IDataset;
10
import com.ailk.common.data.impl.DataMap;
11

12
/**
13
 * @author chengwb3 通过数据库判断唯一性的工具类
14
 */
15
public class DbFsUnique implements IFsUnique {
16

17
    transient protected static final ILogger log = IpuLoggerFactory.createLogger(DbFsUnique.class);
18

19
    /*
20
     * 根据文件的md5,检测tfs是否包含此文件
21
     */
22
    @Override
23
    public String checkExists(String md5) {
24
        String fileHashCode = null;
25
        try {
26
            TfsMapDao dao = new TfsMapDao(Constant.CONNNAME);
27
            IData param = new DataMap();
28
            param.put("md5", md5);
29
            IDataset fileTfsList = dao.queryTfsMapTfsListByMd5(param);
30
            if (fileTfsList != null && !fileTfsList.isEmpty()) {
31
                fileHashCode = fileTfsList.getData(0).getString("file_hash_code");
32
            }
33
        }
34
        catch (Exception e) {
35
            e.printStackTrace();
36
            return fileHashCode;
37
        }
38
        return fileHashCode;
39
    }
40

41
    /*
42
     * 记录数据唯一性
43
     */
44
    @Override
45
    public void recordUnique(String md5, String fileHashCode) {
46
        try {
47
            TfsMapDao dao = new TfsMapDao(Constant.CONNNAME);
48
            IData param = new DataMap();
49
            param.put("file_hash_code", fileHashCode);
50
            param.put("md5", md5);
51
            IData tfsMapObj = dao.queryTfsMapListByFileHashCode(param);
52
            if (null == tfsMapObj) {
53
                log.debug("之前未发现记录,插入数据库。");
54
                dao.insertTfsMap(param);
55
            } else {
56
                if (md5.equals(tfsMapObj.getString("md5"))) {
57
                    log.debug("发现对应记录且相同。");
58
                } else {
59
                    dao.updateTfsMap(param);
60
                    log.debug("发现对应记录且不相同,更改记录。");
61
                }
62
            }
63
        }
64
        catch (Exception e) {
65
            e.printStackTrace();
66
        }
67
    }
68

69
    /*
70
     * 清楚文件记录信息
71
     */
72
    @Override
73
    public boolean cleanUnique(String fileHashCode) {
74
        try {
75
            TfsMapDao dao = new TfsMapDao(Constant.CONNNAME);
76
            IData param = new DataMap();
77
            param.put("file_hash_code", fileHashCode);
78
            dao.deleteTfsMapByFileHashCode(param);
79
        }
80
        catch (Exception e) {
81
            e.printStackTrace();
82
            return false;
83
        }
84
        return true;
85
    }
86

87
    public static String getMd5ByFileHashCode(String fileHashCode) {
88
        String md5 = null;
89
        try {
90
            TfsMapDao dao = new TfsMapDao(Constant.CONNNAME);
91
            IData param = new DataMap();
92
            param.put("file_hash_code", fileHashCode);
93
            IData tfsMapObj = dao.queryTfsMapListByFileHashCode(param);
94
            if (tfsMapObj != null) {
95
                md5 = tfsMapObj.getString("md5");
96
            }
97
        }
98
        catch (Exception e) {
99
            e.printStackTrace();
100
            return md5;
101
        }
102
        return md5;
103
    }
104

105
}

+ 11 - 0
display-server/src/main/resources/database.xml

@ -16,4 +16,15 @@
16 16
		maxIdle="5"
17 17
		maxWait="1000"
18 18
		/>
19
	<display
20
		type="dbcp"
21
		driver="com.mysql.jdbc.Driver"
22
		url="jdbc:mysql://123.57.35.51:3307/display?useUnicode=true"
23
        user="ipu"
24
        passwd="ipumysql"
25
		initialSize="5"
26
		maxActive="20"
27
		maxIdle="5"
28
		maxWait="1000"
29
		/>
19 30
</database>

+ 7 - 8
display-server/src/main/resources/memcache.xml

@ -3,26 +3,25 @@
3 3
<memcache>
4 4
    <default-datacenter>center1</default-datacenter>
5 5
    <datacenter name="center1" >
6
        <!-- codecode查询缓存 -->
7
        <cluster name="codecode_cache">
6
        <!-- 单点登录缓存 -->
7
        <cluster name="SSN_CACHE">
8 8
            <heartbeat-second>2</heartbeat-second>
9 9
            <pool-size>16</pool-size>
10
            <address master="10.1.31.40:10001"/>
10
            <address master="123.57.35.51:10001"/>
11 11
        </cluster>
12 12
        
13
        <!-- 单点登录缓存 -->
14
        <cluster name="SSN_CACHE">
13
        <!-- codecode查询缓存 -->
14
        <cluster name="codecode_cache">
15 15
            <heartbeat-second>2</heartbeat-second>
16 16
            <pool-size>16</pool-size>
17
            <address master="10.1.31.40:10002"/>
17
            <address master="123.57.35.51:10002"/>
18 18
        </cluster>
19 19
        
20 20
        <!-- tfs缓存 -->
21 21
        <cluster name="tfs_cache">
22 22
            <heartbeat-second>2</heartbeat-second>
23 23
            <pool-size>16</pool-size>
24
            <address master="114.215.100.48:11001"/>
25
            <address master="114.215.100.48:11002"/>
24
            <address master="123.57.35.51:10003"/>
26 25
        </cluster>
27 26
    </datacenter>
28 27
</memcache>

+ 3 - 3
display-server/src/main/resources/tfs.xml

@ -1,7 +1,7 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<configs>
3 3
      <!-- 整个进程中系统最多等待多少个请求,取决于你有多少个线程并发的请求TFS -->
4
       <config name="maxWaitThread" value="100"/>
4
       <config name="maxWaitThread" value="1000"/>
5 5
      <!-- 单个请求最大的等待时间(ms) 超过这个时间放弃这次请求-->
6 6
      <config name="timeout" value="20000"/>
7 7
      <!-- Tfs master nameserver ip address -->
@ -9,11 +9,11 @@
9 9
      <!-- TFS在读取文件的时候会缓存block所在的数据服务器ip,这个参数配置了最多缓存的记录个数!-->
10 10
      <config name="maxCacheItemCount" value="10000"/>
11 11
      <!-- 上一项缓存最大有效的时间(ms)!-->
12
      <config name="maxCacheTime" value="5000"/>
12
      <config name="maxCacheTime" value="50000"/>
13 13
      <!-- tfs保存失败后最大重试次数-->
14 14
      <config name="maxTryNum" value="3"/>
15 15
      <!-- tfs本地文件存放的根目录 -->
16
      <config name="uploadFileHome" value="c:/"/>
16
      <config name="uploadFileHome" value="/home/ipuapp/web/webapps/display"/>
17 17
      <!-- 是否开启本地文件缓存。缺省为true,开启。不想开启需要设置为false -->
18 18
      <config name="localFileCached" value="false"/>
19 19
      

+ 1 - 1
display-server/src/main/webapp/biz/js/more/scene/TfsDemo.js

@ -1,7 +1,7 @@
1 1
require(["mobile","common","hammer","handlebars","wadeMobile","util"],function(Mobile,Common,Hammer,Handlebars,WadeMobile){	
2 2
	
3 3
	var maxNum = "3";//允许上传的最大数量
4
	var localPicRelativePath = "picture/my2.png";//被查看的图片的本地路径
4
	var localPicRelativePath = "picture/tfsFile.png";//被查看的图片的本地路径
5 5
	
6 6
	initData();
7 7
	

+ 7 - 0
display-server/src/main/webapp/biz/js/plugin/pageHandler/pageHandler.js

@ -12,15 +12,22 @@ require(["domReady!","wadeMobile","mobile","util"], function(doc,WadeMobile,Mobi
12 12
	$("#loadTemplate").tap(function(){
13 13
		Mobile.loadTemplate("PageA");
14 14
	});
15
	// 被打开的url,不管停留在哪一层页面,按返回会提示退出
15 16
	$("#openUrl").tap(function(){
16 17
		Mobile.openUrl("https://www.baidu.com");
17 18
	});
19
	// 被打开的url,不管停留在哪一层页面,直接退出至ipu主页面
18 20
	$("#loadUrl").tap(function(){
19 21
		Mobile.loadUrl("https://www.baidu.com");
20 22
	});
23
	// 打开原生的浏览器窗口
21 24
	$("#openBrowser").tap(function(){
22 25
		WadeMobile.openBrowser("https://www.baidu.com");
23 26
	});
27
	// 在IPU应用中集成浏览器功能,打开自定义浏览器
28
	$("#openIpuBroswer").tap(function() {
29
		WadeMobile.openIpuBrowser("https://www.baidu.com","true");
30
	});
24 31
	$("#back").tap(function(){
25 32
		Mobile.openPage("KeyDownListen");
26 33
	});

+ 2 - 0
display-server/src/main/webapp/res/js/mobile/expand-mobile.js

@ -162,6 +162,8 @@ define(["require"],function(require) {
162 162
				execute("shareByBluetooth", [],err);
163 163
			},openBrowser:function(url,err){
164 164
				execute("openBrowser",[url],err);
165
			},openIpuBrowser:function(url,hasTitle,err){
166
				execute("openIpuBrowser",[url,hasTitle],err);
165 167
			},setSmsListener:function(callback,telString,err){
166 168
				storageCallback("setSmsListener", callback);
167 169
				execute("setSmsListener", [telString],err);

+ 1 - 1
display-server/src/main/webapp/template/webapp/more/scene/TfsDemo.html

@ -38,7 +38,7 @@
38 38
{{#each infoList}}
39 39
<li>
40 40
	<div class="content">
41
		<div class="main">{{fileName}}</div>
41
		<div class="main">{{file_name}}</div>
42 42
		<div class="side">
43 43
			<div class="link" id="download" data-id="{{id}}">查看</div>
44 44
		</div>

+ 7 - 0
display-server/src/main/webapp/template/webapp/plugin/PageHandler/PageHandler.html

@ -69,6 +69,13 @@
69 69
						<div class="fn fn-2">测试</div>
70 70
					</div>
71 71
				</li>
72
				
73
				<li id="openIpuBroswer">
74
					<div class="content">
75
						<div class="main">openIpuBroswer</div>
76
						<div class="fn fn-2">测试</div>
77
					</div>
78
				</li>
72 79
			</ul>
73 80
		</div>
74 81
		

+ 0 - 17
ipu-pathmenu/project.properties

@ -1,17 +0,0 @@
1
# This file is automatically generated by Android Tools.
2
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
#
4
# This file must be checked in Version Control Systems.
5
#
6
# To customize properties used by the Ant build system edit
7
# "ant.properties", and override values to adapt the script to your
8
# project structure.
9
#
10
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12
13
# Project target.
14
target=android-15
15
android.library=true
16
android.library.reference.1=..\\wade-mobile-lib
17
android.library.reference.2=../wade-mobile-common

+ 0 - 8
ipupathmenu-lib/.classpath

@ -1,8 +0,0 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
7
	<classpathentry kind="output" path="bin/classes"/>
8
</classpath>

+ 0 - 26
ipupathmenu-lib/AndroidManifest.xml

@ -1,26 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
    package="com.ai.ipu.ipupathmenu"
4
    android:versionCode="1"
5
    android:versionName="1.0" >
6
7
    <uses-sdk
8
        android:minSdkVersion="15"
9
        android:targetSdkVersion="21" />
10
11
    <application
12
        android:allowBackup="true"
13
        android:label="@string/app_name"
14
        android:theme="@style/AppTheme" >
15
        <activity
16
            android:name=".MainActivity"
17
            android:label="@string/app_name" >
18
            <intent-filter>
19
                <action android:name="android.intent.action.MAIN" />
20
21
                <category android:name="android.intent.category.LAUNCHER" />
22
            </intent-filter>
23
        </activity>
24
    </application>
25
26
</manifest>

BIN
ipupathmenu-lib/libs/ipupathmenu1.0.jar


+ 0 - 20
ipupathmenu-lib/proguard-project.txt

@ -1,20 +0,0 @@
1
# To enable ProGuard in your project, edit project.properties
2
# to define the proguard.config property as described in that file.
3
#
4
# Add project specific ProGuard rules here.
5
# By default, the flags in this file are appended to flags specified
6
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7
# You can edit the include path and order by changing the ProGuard
8
# include property in project.properties.
9
#
10
# For more details, see
11
#   http://developer.android.com/guide/developing/tools/proguard.html
12
13
# Add any project specific keep options here:
14
15
# If your project uses WebView with JS, uncomment the following
16
# and specify the fully qualified class name to the JavaScript interface
17
# class:
18
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19
#   public *;
20
#}

+ 0 - 15
ipupathmenu-lib/project.properties

@ -1,15 +0,0 @@
1
# This file is automatically generated by Android Tools.
2
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
#
4
# This file must be checked in Version Control Systems.
5
#
6
# To customize properties used by the Ant build system edit
7
# "ant.properties", and override values to adapt the script to your
8
# project structure.
9
#
10
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12
13
# Project target.
14
target=android-22
15
android.library=true

+ 0 - 11
ipupathmenu-lib/res/values-v11/styles.xml

@ -1,11 +0,0 @@
1
<resources>
2
3
    <!--
4
        Base application theme for API 11+. This theme completely replaces
5
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
6
    -->
7
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
8
        <!-- API 11 theme customizations can go here. -->
9
    </style>
10
11
</resources>

+ 0 - 12
ipupathmenu-lib/res/values-v14/styles.xml

@ -1,12 +0,0 @@
1
<resources>
2
3
    <!--
4
        Base application theme for API 14+. This theme completely replaces
5
        AppBaseTheme from BOTH res/values/styles.xml and
6
        res/values-v11/styles.xml on API 14+ devices.
7
    -->
8
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
9
        <!-- API 14 theme customizations can go here. -->
10
    </style>
11
12
</resources>

+ 0 - 7
ipupathmenu-lib/res/values/dimens.xml

@ -1,7 +0,0 @@
1
<resources>
2
3
    <!-- Default screen margins, per the Android Design guidelines. -->
4
    <dimen name="activity_horizontal_margin">16dp</dimen>
5
    <dimen name="activity_vertical_margin">16dp</dimen>
6
7
</resources>

+ 0 - 6
ipupathmenu-lib/res/values/strings.xml

@ -1,6 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
4
    <string name="app_name">ipu快捷菜单</string>
5
6
</resources>

+ 0 - 20
ipupathmenu-lib/res/values/styles.xml

@ -1,20 +0,0 @@
1
<resources>
2
3
    <!--
4
        Base application theme, dependent on API level. This theme is replaced
5
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6
    -->
7
    <style name="AppBaseTheme" parent="android:Theme.Light">
8
        <!--
9
            Theme customizations available in newer API levels can go in
10
            res/values-vXX/styles.xml, while customizations related to
11
            backward-compatibility can go here.
12
        -->
13
    </style>
14
15
    <!-- Application theme. -->
16
    <style name="AppTheme" parent="AppBaseTheme">
17
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
18
    </style>
19
20
</resources>

+ 1 - 1
wade-mobile-common/.classpath

@ -1,8 +1,8 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<classpath>
3 3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5 4
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6 5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
7 7
	<classpathentry kind="output" path="bin/classes"/>
8 8
</classpath>

BIN
wade-mobile-common/libs/ipu-count-1.0.jar


BIN
wade-mobile-common/libs/ipu-count-3.0.jar


BIN
wade-mobile-common/libs/ipu-mobile-3.0.jar


BIN
wade-mobile-common/libs/wade-mobile-com.jar


BIN
wade-mobile-common/libs/wade-mobile-func.jar


BIN
wade-mobile-common/libs/wade-mobile-ui.jar


BIN
wade-mobile-common/libs/wade-mobile.jar


+ 77 - 0
wade-mobile-common/res/layout/browser.xml

@ -0,0 +1,77 @@
1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
3
    android:layout_width="fill_parent"
4
    android:layout_height="fill_parent"
5
    android:background="#ffffff"
6
    android:orientation="vertical" >
7

8
    <LinearLayout
9
        android:layout_width="fill_parent"
10
        android:layout_height="wrap_content"
11
        android:orientation="vertical" >
12

13
        <LinearLayout
14
            android:id="@+id/layout"
15
            android:layout_width="fill_parent"
16
            android:layout_height="wrap_content"
17
            android:orientation="horizontal"
18
            android:visibility="gone" >
19

20
            <EditText
21
                android:id="@+id/et_url"
22
                android:layout_width="0dp"
23
                android:layout_height="wrap_content"
24
                android:layout_weight="1"
25
                android:inputType="textUri"
26
                android:singleLine="true" />
27

28
            <Button
29
                android:id="@+id/btn_visit"
30
                android:layout_width="wrap_content"
31
                android:layout_height="wrap_content"
32
                android:text="@string/visit" />
33
        </LinearLayout>
34

35
        <LinearLayout
36
            android:id="@+id/ll_btn"
37
            android:layout_width="fill_parent"
38
            android:layout_height="wrap_content"
39
            android:gravity="center_horizontal"
40
            android:orientation="horizontal" >
41

42
            <Button
43
                android:id="@+id/btn_home"
44
                android:layout_width="wrap_content"
45
                android:layout_height="wrap_content"
46
                android:layout_weight="1"
47
                android:text="@string/home" />
48

49
            <Button
50
                android:id="@+id/btn_left"
51
                android:layout_width="wrap_content"
52
                android:layout_height="wrap_content"
53
                android:layout_weight="1"
54
                android:text="@string/left" />
55

56
            <Button
57
                android:id="@+id/btn_right"
58
                android:layout_width="wrap_content"
59
                android:layout_height="wrap_content"
60
                android:layout_weight="1"
61
                android:text="@string/right" />
62

63
            <Button
64
                android:id="@+id/btn_exit"
65
                android:layout_width="wrap_content"
66
                android:layout_height="wrap_content"
67
                android:layout_weight="1"
68
                android:text="@string/exit" />
69
        </LinearLayout>
70

71
        <WebView
72
            android:id="@+id/web"
73
            android:layout_width="fill_parent"
74
            android:layout_height="fill_parent" />
75
    </LinearLayout>
76

77
</LinearLayout>

+ 8 - 0
wade-mobile-common/res/values/strings_browser.xml

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
    <string name="home">主页</string>
4
    <string name="left">后退</string>
5
    <string name="right">前进</string>
6
    <string name="exit">退出</string>
7
    <string name="visit">访问</string>
8
</resources>

BIN
wade-mobile-func/libs/wade-mobile-com.jar


+ 35 - 0
wade-mobile-func/src/com/wade/mobile/func/MobileBrowser.java

@ -0,0 +1,35 @@
1
package com.wade.mobile.func;
2

3
import org.json.JSONArray;
4

5
import android.content.Intent;
6
import android.os.Bundle;
7

8
import com.wade.mobile.common.browser.BrowserActivity;
9
import com.wade.mobile.frame.IWadeMobile;
10
import com.wade.mobile.frame.plugin.Plugin;
11

12
/**
13
 * 打开浏览器插件
14
 * @author wangyujuan
15
 *
16
 */
17
public class MobileBrowser extends Plugin {
18
	
19
	private int BROWSER = 90004;
20

21
	public MobileBrowser(IWadeMobile wademobile) {
22
		super(wademobile);
23
	}
24

25
	public void openIpuBrowser(JSONArray param) throws Exception {
26
		String url = param.getString(0);
27
		String hasTitle = param.getString(1);
28
		Intent intent = new Intent(context, BrowserActivity.class);
29
	    Bundle bundle=new Bundle();
30
	    bundle.putString("url", url);
31
	    bundle.putString("hasTitle", hasTitle);
32
	    intent.putExtras(bundle);
33
	    startActivityForResult(intent, BROWSER);
34
	}
35
}