diff --git a/frame.js b/frame.js index 32bbdc69..f74d8bf7 100644 --- a/frame.js +++ b/frame.js @@ -271,7 +271,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, if (key == "extra.cmd") { can.onappend.plugin(can, {ctx: line["extra.ctx"], cmd: line["extra.cmd"], arg: line["extra.arg"]}, function(sub) { sub.run = function(event, cmds, cb) { var msg = can.request(event, line, can.Option()) - can.run(event, can.misc.Concat([ctx.ACTION, cli.RUN], cmds), cb, true) + can.run(event, can.misc.Concat([ctx.ACTION, cli.RUN, can.core.Keys(line["extra.ctx"], line["extra.cmd"])], cmds), cb, true) } }, target) } diff --git a/lib/base.js b/lib/base.js index eb8eac93..5f25e692 100644 --- a/lib/base.js +++ b/lib/base.js @@ -121,11 +121,10 @@ Volcanos("base", {help: "数据类型", case "number": res.push(arg); break case "string": res.push(arg); break case "object": - if (arg.length > 0) { - res = res.concat(arg) - } else { - for (var k in arg) { res.push(k, arg[k]) } - } + if (arg.length > 0) { res = res.concat(arg); break } + for (var k in arg) { k && arg[k] && res.push(k, arg[k]) } + break + default: res.push(arg); } } return res diff --git a/lib/user.js b/lib/user.js index 6a4346ed..606bab09 100644 --- a/lib/user.js +++ b/lib/user.js @@ -212,7 +212,7 @@ Volcanos("user", {help: "用户操作", agent: { }, msg, can.Option()); can.run(event, cmds, cb, true) } - target.value = target.value||(item.name&&can.Option(item.name))||"" + target.value = target.value||(item.name&&(msg.Option(item.name)||can.Option(item.name)))||"" can.onappend.figure(can, item, target) } @@ -232,7 +232,7 @@ Volcanos("user", {help: "用户操作", agent: { }, _target: ui._target, }) - can.page.Select(can, ui._target, "textarea,input,select", function(item, index) { + can.page.Select(can, ui._target, "textarea,input", function(item, index) { index == 0 && can.onmotion.focus(can, item) }) diff --git a/page/index.css b/page/index.css index 726e03f5..48cb3649 100644 --- a/page/index.css +++ b/page/index.css @@ -382,6 +382,7 @@ body>div.carte { color:white; padding:4px; min-width:80px; + z-index:0; } body>div.carte div.item { padding:3px 12px; @@ -392,6 +393,7 @@ body>div.carte div.item:hover { body>div.input { position:fixed; background-color:#0d4142a6; + z-index:0; } body>div.input input[type=text] { width:171px; diff --git a/page/index.js b/page/index.js index 2456af44..a14f4b9c 100644 --- a/page/index.js +++ b/page/index.js @@ -1,8 +1,8 @@ Volcanos({name: "chat", panels: [ {name: "Header", help: "标题栏", pos: chat.HEAD, state: ["time", "usernick", "avatar"]}, - {name: "Search", help: "搜索框", pos: chat.AUTO}, {name: "River", help: "群聊组", pos: chat.LEFT, action: ["create", "refresh"]}, {name: "Action", help: "工作台", pos: chat.MAIN}, + {name: "Search", help: "搜索框", pos: chat.AUTO}, {name: "Footer", help: "状态条", pos: chat.FOOT, state: ["ncmd"]}, ], main: {name: "Header", list: ["/publish/order.js"]}, plugin: [ "/plugin/state.js", @@ -17,7 +17,6 @@ Volcanos({name: "chat", panels: [ "/plugin/local/wiki/draw/path.js", "/plugin/local/wiki/draw.js", "/plugin/local/wiki/word.js", - "/plugin/local/team/plan.js", "/plugin/local/chat/div.js", ], river: { serivce: {name: "运营群", storm: { diff --git a/panel/search.css b/panel/search.css index d84e56db..698f6fec 100644 --- a/panel/search.css +++ b/panel/search.css @@ -1,5 +1,4 @@ fieldset.Search { - z-index:10; background:#041a25bd; padding:10px; position:fixed; display:none; diff --git a/plugin/local/team/plan.css b/plugin/local/team/plan.css deleted file mode 100644 index dbab07fa..00000000 --- a/plugin/local/team/plan.css +++ /dev/null @@ -1,30 +0,0 @@ -fieldset.plan>div.output div.prepare { - background-color:blue; - color:white; -} -fieldset.plan>div.output div.process { - background-color:green; - color:white; -} -fieldset.plan>div.output div.cancel { - background-color:yellow; - color:white; -} -fieldset.plan>div.output div.finish { - background-color:red; - color:white; -} - -fieldset.plan>div.output td { - vertical-align:top; -} -fieldset.plan>div.output td.over { - border:solid 2px red; -} -fieldset.plan>div.output td div.date { - color:gray; -} -fieldset.plan>div.output div.project { - max-height:400px; - overflow:auto; -} diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js deleted file mode 100644 index eacd263d..00000000 --- a/plugin/local/team/plan.js +++ /dev/null @@ -1,221 +0,0 @@ -Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { - can.onmotion.clear(can, target) - can.ui = can.onlayout.profile(can) - can.base.isFunc(cb) && cb(msg) - can.onmotion.hidden(can, can._action) - can.onimport[can.Option("scale")||"week"](can, msg) - can.page.Modify(can, can.ui.profile, {style: {display: "block"}}) - can.page.Modify(can, can.ui.project, {style: {"max-height": can.ui.content.offsetHeight}}) - can.page.Modify(can, can.ui.profile, {style: {"max-height": can.ui.content.offsetHeight}}) - }, - _content: function(can, msg, head, list, key, get, set) { - var hash = {}; msg.Table(function(value, index) { - var k = key(can.base.Date(value.begin_time)); hash[k] = (hash[k]||[]).concat([value]) - }), can.Status("count", msg.Length()) - - var begin_time = can.base.Date(can.Option("begin_time")) - can.page.Append(can, can.ui.content, [{view: ["content", "table"], list: can.core.List(list, function(hour, row) { - return {type: "tr", list: can.core.List(head, function(week, col) { - if (row == 0) { return {text: [week, "th"]} } - if (col == 0) { return {text: [hour, "td"]} } - return can.onimport._task(can, msg, get(begin_time, col, row, hash), set(begin_time, col, row)) - })} - }) }]) - }, - _task: function(can, msg, list, time, view) { return {text: ["", "td"], - ondblclick: function(event) { - can.onaction.insertTask(event, can, time+can.base.Time(null, "%y-%m-%d %H:%M:%S").slice(time.length)) - }, - ondrop: function(event) { event.preventDefault() - can.drop(event, event.target, time) - }, - ondragover: function(event) { event.preventDefault() - can.page.Select(can, can.ui.content, "td", function(item) { - can.page.ClassList[event.target == item? "add": "del"](can, item, "over") - }) - }, - list: can.core.List(list, function(task) { return typeof task == "string"? {text: [task, "div", "date"]}: - {text: [can.onexport[view||can.Action("view")||"text"](can, task), "div", can.onexport.style(can, task)], - ondragstart: function(event) { var target = event.target; can.drop = function(event, td, time) { td.append(target) - can.onaction.modifyTask(event, can, task, "begin_time", time+task.begin_time.slice(time.length), task.begin_time) - } }, draggable: time != undefined, - - title: can.onexport.title(can, task), _init: function(target) { - var item = can.onappend.item(can, "item", {nick: task.name+":"+task.text}, function() { - can.core.Timer(10, function() { can.onmotion.select(can, can.ui.content, "td", target.parentNode) }) - can.onimport._profile(can, task) - }, function() { - - }, can.ui.project); can.task || item.click() - target.onclick = function(event) { item.click() } - }, - } - }), - } }, - _profile: function(can, task) { - task.extra && can.core.Item(can.base.Obj(task.extra), function(key, value) { task["extra."+key] = value }), delete(task.extra) - var info = {}; can.core.List(can.onexport.list, function(key) { info[key] = task[key] }), can.Status(info) - - function keys(task, key) { return [task.pod, task.zone, task.id, key].join(".") } - - if (can.task) { - can.page.Cache(keys(can.task, "profile"), can.ui.profile, can.task.id) - can.page.Cache(keys(can.task, "display"), can.ui.display, can.task.id) - } - - can.task = task - var profile = can.page.Cache(keys(task, "profile"), can.ui.profile) - var display = can.page.Cache(keys(task, "display"), can.ui.display) - if (profile || display) { return } - - var table = can.page.Appends(can, can.ui.profile, [{view: ["content", "table"], list: [{th: ["key", "value"]}]}]).first - can.core.Item(task, function(key, value) { can.page.Append(can, table, [{ - td: [key, key == "pod" && value != ""? can.page.Format("a", can.user.MergeURL(can, {pod: value}), value): value], - ondblclick: function(event) { - can.onmotion.modify(can, event.target, function(ev, value, old) { - can.onaction.modifyTask(event, can, task, key, value) - }) - }, - onclick: function(event) { if (event.target.type == "button") { - var msg = can.request(event, can.task) - can.run(event, [ctx.ACTION, event.target.name], function(msg) { - can.run() - }, true) - } }, - }]) }) - - task["extra.cmd"] && can.onappend.plugin(can, {ctx: task["extra.ctx"], cmd: task["extra.cmd"], arg: task["extra.arg"]}, function(sub, meta) { - sub.run = function(event, cmds, cb) { var msg = can.request(event, {"task.zone": task.zone, "task.id": task.id}) - can.run(event, can.misc.Concat([ctx.ACTION, cli.RUN], cmds), function(msg) { - can.base.isFunc(cb) && cb(msg) - }, true) - } - }, can.ui.display) - can.page.Modify(can, can.ui.display, {style: {display: "block"}}) - // can.onmotion.show(can, can.ui.display) - }, - - day: function(can, msg) { - var head = ["hour", "task"] - var list = [0]; for (var i = 7; i < 24; i++) { list.push(can.base.Number(i, 2)) } - - function key(time) { return can.base.Number(time.getHours(), 2) } - function get(begin_time, col, row, hash) { return hash[list[row]] } - function set(begin_time, col, row) { return can.base.Time(begin_time, "%y-%m-%d ")+list[row] } - - can.onimport._content(can, msg, head, list, key, get, set) - }, - week: function(can, msg) { - var head = ["hour"].concat(["周日", "周一", "周二", "周三", "周四", "周五", "周六"]) - var list = [0]; for (var i = 7; i < 24; i++) { list.push(can.base.Number(i, 2)) } - - function key(time) { return time.getDay()+" "+can.base.Number(time.getHours(), 2) } - function get(begin_time, col, row, hash) { return hash[col-1+" "+list[row]] } - function set(begin_time, col, row) { return can.base.Time(can.base.TimeAdd(begin_time, -begin_time.getDay()+col-1), "%y-%m-%d ")+list[row] } - - can.onimport._content(can, msg, head, list, key, get, set) - }, - month: function(can, msg) { - var head = ["order"].concat(["周日", "周一", "周二", "周三", "周四", "周五", "周六"]) - var list = [0]; for (var i = 1; i < 6; i++) { list.push(i) } - - function key(time) { return can.base.Time(time, "%y-%m-%d") } - function get(begin_time, col, row, hash) { - var begin = can.base.TimeAdd(begin_time, -(begin_time.getDate()-1)) - var last = can.base.TimeAdd(begin_time, -(begin_time.getDate()-1)-begin.getDay()) - var day = can.base.TimeAdd(last, (row-1)*7+col) - return [day.getDate()+""].concat(hash[key(day)]||[]) - } - function set(begin_time, col, row) { - var begin = can.base.TimeAdd(begin_time, -(begin_time.getDate()-1)) - var last = can.base.TimeAdd(begin_time, -(begin_time.getDate()-1)-begin.getDay()) - var day = can.base.TimeAdd(last, (row-1)*7+col) - return key(day) - } - - can.onimport._content(can, msg, head, list, key, get, set) - }, - year: function(can, msg) { - var head = ["month"].concat(["周日", "周一", "周二", "周三", "周四", "周五", "周六"]); - var list = [0]; for (var i = 1; i < 13; i++) { list.push(i) } - - function key(time) { return can.base.Time(time, "%y-%m ")+time.getDay() } - function get(begin_time, col, row, hash) { return hash[begin_time.getFullYear()+"-"+can.base.Number(row, 2)+" "+(col-1)] } - function set(begin_time, col, row) { return begin_time.getFullYear()+"-"+can.base.Number(list[row], 2) } - - can.onimport._content(can, msg, head, list, key, get, set) - }, - long: function(can, msg) { - var begin_time = can.base.Date(can.base.Time(can.Option("begin_time"))) - var begin = begin_time.getFullYear() - 5 - - var head = ["month"]; for (var i = 0; i < 10; i++) { head.push(begin+i) } - var list = [0]; for (var i = 1; i < 13; i++) { list.push(i) } - - function key(time) { return can.base.Time(time, "%y-%m") } - function get(begin_time, col, row, hash) { return hash[begin+col-1+"-"+can.base.Number(row, 2)] } - function set(begin_time, col, row) { return begin+col-1+"-"+can.base.Number(row, 2) } - - can.onimport._content(can, msg, head, list, key, get, set) - }, -}, ["/plugin/local/team/plan.css"]) -Volcanos("onaction", {help: "组件交互", list: [ - ["level", "all", "l1", "l2", "l3", "l4", "l5"], - ["status", "all", "prepare", "process", "cancel", "finish"], - ["score", "all", "s1", "s2", "s3", "s4", "s5"], - ["view", "", "name", "text", "level", "score"], - ], - insertTask: function(event, can, time) { var msg = can.sup.request(event, {begin_time: time}) - can.user.input(event, can, can.Conf("feature.insert"), function(event, button, data, list) { - var args = [ctx.ACTION, "insert"]; can.core.Item(data, function(key, value) { - if (key == "begin_time") { value = value || time } - if (key == "close_time") { value = value || time } - key && value && args.push(key, value) - }), can.run(event, args) - }) - }, - modifyTask: function(event, can, task, key, value) { - var msg = can.request(event, task) - can.run(event, [ctx.ACTION, "modify", key, value, task[key]], function(msg) { - task[key] = value, can.onimport._profile(can, task) - can.user.toast(can, "修改成功") - }, true) - }, - - _filter: function(event, can, key, value) { var count = 0 - if (value == "all") { - can.page.Select(can, can.ui.content, "div.item", function(item) { - can.page.ClassList.del(can, item, "hidden") - count++ - }) - } else { - can.page.Select(can, can.ui.content, "div.item", function(item) { - can.page.ClassList.add(can, item, "hidden") - }) - can.page.Select(can, can.ui.content, "div."+value, function(item) { - can.page.ClassList.del(can, item, "hidden") - count++ - }) - } - can.Status("count", count) - can.Action(key, value) - }, - level: function(event, can, key, value) { can.onaction._filter(event, can, key, value) }, - status: function(event, can, key, value) { can.onaction._filter(event, can, key, value) }, - score: function(event, can, key, value) { can.onaction._filter(event, can, key, value) }, - view: function(event, can, key, value) { - can.Action(key, value) - can.onmotion.clear(can, can.ui.project) - can.onmotion.clear(can, can.ui.content) - can.onimport[can.Option("scale")](can, can._msg) - }, -}) -Volcanos("onexport", {help: "导出数据", list: ["count", "begin_time", "zone", "id", "type", "name", "text"], - name: function(can, task) { return task.name }, - text: function(can, task) { return task.name+": "+(task.text||"") }, - level: function(can, task) { return "l-"+(task.level||3)+": "+(task.name||"") }, - score: function(can, task) { return "s-"+(task.level||3)+": "+(task.name||"") }, - title: function(can, task) { return task.zone+": "+(task.type||"") }, - style: function(can, task) { return ["item", task.status, "id"+task.id, "l"+(task.level||""), "s"+(task.score||"")].join(" ") }, -}) - diff --git a/proto.js b/proto.js index 4dfa8efd..6bba060c 100644 --- a/proto.js +++ b/proto.js @@ -157,7 +157,7 @@ function shy(help, meta, list, cb) { cb.meta = next(lang.OBJECT)|| {} cb.list = next(lang.OBJECT)||[] return cb -}; var _can_name = "" +}; var _can_name = "", _can_path = "" var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args: {}, pack: {}, libs: [], cache: {}}, function(name, can, libs, cb) { var meta = arguments.callee.meta, list = arguments.callee.list if (typeof name == lang.OBJECT) { var Config = name; Config.panels = Config.panels||[], Config.main = Config.main||{} @@ -192,7 +192,6 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args: typeof cb == lang.FUNCTION && setTimeout(function() { cb(can) }, 10) return // 加载完成 } - if (!libs[0]) { return can.require(libs.slice(1), cb, each) } libs[0] = libs[0].toLowerCase() // 请求模块 @@ -201,7 +200,10 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args: }, request: function(event, option) { event = event||{} var msg = event._msg||can.misc.Message(event, can); event._msg = msg - function set(key, value) { can.base.isUndefined(msg[key]) && msg.Option(key, value) } + function set(key, value) { + can.misc.Log(key, msg.Option(key)) + msg.Option(key) || msg.Option(key, value) + } can.core.List(arguments, function(option, index) { if (index == 0) { return } can.base.isFunc(option.Option)? can.core.List(option.Option(), function(key) { @@ -231,9 +233,18 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args: list.push(can) } if (can._follow) { libs = libs.concat(meta.libs, meta.volcano) } + if (libs && libs.length > 0) { + for (var i = 0; i < libs.length; i++) { + if (libs[i] == "") { + libs[i] = _can_path.replace(".js", ".css") + } else if (libs[i][0] != "/") { + libs[i] = _can_path.slice(0, _can_path.lastIndexOf("/")+1)+libs[i] + } + } + } return can.require(libs, cb), can }) -Volcanos.meta._load = function(url, cb) { +Volcanos.meta._load = function(url, cb) { _can_path = url switch (url.split("?")[0].split(ice.PT).pop().toLowerCase()) { case "css": var item = document.createElement(kit.MDB_LINK) diff --git a/publish/chrome/contexts.css b/publish/chrome/contexts.css index 6c6207a5..4420031b 100644 --- a/publish/chrome/contexts.css +++ b/publish/chrome/contexts.css @@ -83,7 +83,7 @@ fieldset.contexts div.code { body>div.toast { background:#0e3369b3; color:yellow; - position:fixed; z-index:100; + position:fixed; padding:5px; overflow:auto; } body>div.toast a { @@ -121,7 +121,6 @@ body>div.carte { background:#295b61; color:white; padding:4px; - z-index:30; min-width:80px; } body>div.carte div.item { @@ -134,7 +133,6 @@ body>div.carte div.item:hover { body>div.input { position:fixed; background-color:#0d4142a6; - z-index:50; } body>div.input textarea { box-shadow: 4px 4px 10px 1px #626bd0;