synced with public irext consol

This commit is contained in:
strawmanbobi
2016-12-10 11:15:33 +08:00
parent 2090caab15
commit a0e34ae1d0
11 changed files with 24 additions and 56 deletions

View File

@@ -28,7 +28,7 @@ var Category = dbOrm.define('category',
}
);
Category.createCategory = function (category, callback) {
Category.createCategory = function(category, callback) {
var date = dateUtils.formatDate(new Date(), "yyyy-MM-dd hh:mm:ss");
var newCategory = new Category({
name: category.name,
@@ -49,7 +49,7 @@ Category.createCategory = function (category, callback) {
});
};
Category.findCategoryByConditions = function (conditions, callback) {
Category.findCategoryByConditions = function(conditions, callback) {
Category.find(conditions)
.run(function (error, categories) {
if (error) {
@@ -62,8 +62,8 @@ Category.findCategoryByConditions = function (conditions, callback) {
});
};
Category.listCategories = function (conditions, from, count, sortField, callback) {
if ("id" == sortField && 0 != from) {
Category.listCategories = function(conditions, from, count, sortField, callback) {
if("id" == sortField && 0 != from) {
conditions.id = orm.gt(from);
Category.find(conditions).limit(parseInt(count)).orderRaw("?? ASC", [sortField])
.run(function (listCategoriesErr, categories) {
@@ -90,8 +90,8 @@ Category.listCategories = function (conditions, from, count, sortField, callback
};
Category.getCategoryByID = function (categoryID, callback) {
Category.get(categoryID, function (error, category) {
Category.getCategoryByID = function(categoryID, callback) {
Category.get(categoryID, function(error, category) {
if (error) {
logger.error("get category by ID error : " + error);
callback(errorCode.FAILED, null);
@@ -103,8 +103,8 @@ Category.getCategoryByID = function (categoryID, callback) {
};
/* For internal use only */
Category.listRemoteCategories = function (conditions, from, count, sortField, callback) {
if ("id" == sortField && 0 != from) {
Category.listRemoteCategories = function(conditions, from, count, sortField, callback) {
if("id" == sortField && 0 != from) {
conditions.id = orm.gt(from);
Category.find(conditions).limit(parseInt(count)).orderRaw("?? ASC", [sortField])
.run(function (listCategoriesErr, categories) {

View File

@@ -5,12 +5,12 @@
// system inclusion
var constants = require('../mini_poem/configuration/constants');
var logger = require('../mini_poem/logging/logger4js').helper;
// local inclusion
var ServiceResponse = require('../response/service_response.js');
var LoginResponse = require('../response/login_response.js');
var logger = require('../mini_poem/logging/logger4js').helper;
var certificateLogic = require('../work_unit/certificate_logic.js');

View File

@@ -5,6 +5,8 @@
// system inclusion
var constants = require('../mini_poem/configuration/constants');
var logger = require('../mini_poem/logging/logger4js').helper;
var formidable = require('formidable');
var fs = require('fs');
@@ -17,8 +19,6 @@ var CityResponse = require('../response/city_response.js');
var OperatorResponse = require('../response/operator_response.js');
var RemoteIndexResponse = require('../response/remote_index_response.js');
var logger = require('../mini_poem/logging/logger4js').helper;
var internalLogic = require('../work_unit/internal_logic.js');
var Enums = require('../constants/enums');
@@ -437,7 +437,7 @@ exports.createProtocol = function (req, res) {
}).on('error', function(err) {
logger.error("formidable parse form error : " + err);
res.send("<html>" +
"<body> " +
"<body>" +
"<div style='width: 100%; text-align: center; color: #FF0000'>协议文件提交失败</div>" +
"</body>" +
"</html>");
@@ -458,18 +458,19 @@ exports.createProtocol = function (req, res) {
internalLogic.createProtocolWorkUnit(protocol, filePath, contentType, adminID, function (createProtocolErr) {
if(errorCode.SUCCESS.code == createProtocolErr.code) {
res.send("<html>" +
"<body> " +
"<body>" +
"<div style='width: 100%; text-align: center;'>协议文件提交成功</div>" +
"</body>" +
"</html>");
res.end();
} else {
res.send("<html>" +
"<body> " +
"<body>" +
"<div style='width: 100%; text-align: center; color: #FF0000'>协议文件提交失败</div>" +
"</body>" +
"</html>");
res.end();
}
res.end();
});
}
});

View File

@@ -5,6 +5,8 @@
// system inclusion
var constants = require('../mini_poem/configuration/constants');
var logger = require('../mini_poem/logging/logger4js').helper;
var formidable = require('formidable');
var fs = require('fs');
@@ -13,7 +15,6 @@ var ServiceResponse = require('../response/service_response.js');
var StatResponse = require('../response/stat_response.js');
var IntegerResponse = require('../response/integer_response');
var logger = require('../mini_poem/logging/logger4js').helper;
var statLogic = require('../work_unit/stat_logic.js');

View File

@@ -88,7 +88,7 @@
<span class="glyphicon glyphicon-download" style="vertical-align:middle; margin-bottom: 3px;"></span>
</button>
</div>
<button id="publish_button" class="btn btn-normal btn-success" onclick="onPublishRemote();" style="font-size: 14px; display: none;">
<button id="publish_button" class="btn btn-normal btn-success" onclick="onPublishRemote();" style="font-size: 14px;">
<span class="glyphicon glyphicon-send" style="vertical-align:middle; margin-bottom: 3px;"></span>
</button>
<button id="search_bin_button" class="btn btn-normal btn-default" onclick="onSearchRemote();" style="font-size: 14px;">

View File

@@ -86,9 +86,6 @@ $(document).ready(function() {
id = localStorage.getItem(LS_KEY_ID);
token = localStorage.getItem(LS_KEY_TOKEN);
client = getParameter('client');
if (null != client && client == 'console') {
hideSidebar();
}
// showMenu(id, token, 'remote');
initializeSelectors();

View File

@@ -1,8 +0,0 @@
body {
font-family: , Arial
}
.starter-template {
padding: 40px 15px;
text-align: center;
}

View File

@@ -1,23 +0,0 @@
/**
* Created by Strawmanbobi
* 2016-12-01
*/
var id, token;
var LS_KEY_ID = "user_name";
var LS_KEY_TOKEN = "token";
$(document).ready(function() {
id = localStorage.getItem(LS_KEY_ID);
token = localStorage.getItem(LS_KEY_TOKEN);
showMenu(id, token, "doc");
});
$("#menu_toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
function navigation(anchor) {
$.mobile.navigate("#"+anchor);
}

View File

@@ -537,8 +537,6 @@ exports.createRemoteIndexWorkUnit = function(remoteIndex, filePath, contentType,
exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) {
// delete remote information from release server first
var queryParams = new Map();
queryParams.put("app_key", REQUEST_APP_KEY);
queryParams.put("app_token", REQUEST_APP_TOKEN);
var key = "admin_name_" + adminID;
adminAuth.getAuthInfo(key, function(getAdminAuthErr, result) {
@@ -548,9 +546,11 @@ exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) {
callback(errorCode.FAILED);
return;
}
remoteIndex.admin_id = adminID;
var requestSender =
new RequestSender(PRIMARY_SERVER_ADDRESS,
PRIMARY_SERVER_PORT,
new RequestSender(EXTERNAL_SERVER_ADDRESS,
EXTERNAL_SERVER_PORT,
DELETE_REMOTE_INDEX_SERVICE,
queryParams);

View File

@@ -7,12 +7,12 @@
require('../mini_poem/configuration/constants');
var RequestSender = require('../mini_poem/http/request.js');
var Map = require('../mini_poem/mem/map.js');
var logger = require('../mini_poem/logging/logger4js').helper;
// local inclusion
var Enums = require('../constants/enums.js');
var ErrorCode = require('../constants/error_code.js');
var logger = require('../mini_poem/logging/logger4js').helper;
var enums = new Enums();
var errorCode = new ErrorCode();