| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- MWF.require("MWF.widget.MaskNode", null, false);
- MWF.xApplication.O2Bug.options.multitask = false;
- MWF.xApplication.O2Bug.Main = new Class({
- Extends: MWF.xApplication.Common.Main,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "name": "O2Bug",
- "icon": "icon.png",
- "width": "1200",
- "height": "700",
- "isResize": true,
- "isMax": true,
- "title": MWF.xApplication.O2Bug.LP.title
- },
- onQueryLoad: function(){
- this.lp = MWF.xApplication.O2Bug.LP;
- },
- loadApplication: function(callback){
- this.loadTitle();
- this.loadFilter();
- },
- loadTitle: function(){
- this.loadTitleBar();
- this.loadTitleUserNode();
- this.loadCreateActionNode();
- this.loadTitleTextNode();
- this.loadSearchNode();
- },
- loadTitleBar: function(){
- this.titleBar = new Element("div", {
- "styles": this.css.titleBar
- }).inject(this.content);
- },
- loadTitleUserNode: function(){
- this.titleUserNode = new Element("div", {
- "styles": this.css.titleUserNode
- }).inject(this.titleBar);
- this.titleUserIconNode = new Element("div", {
- "styles": this.css.titleUserIconNode
- }).inject(this.titleUserNode);
- this.titleUserTextNode = new Element("div", {
- "styles": this.css.titleUserTextNode,
- "text": this.desktop.session.user.name
- }).inject(this.titleUserNode);
- },
- loadCreateActionNode: function() {
- this.createAction = new Element("div", {
- "styles": this.css.createAction
- }).inject(this.titleBar);
- this.createAction.addEvents({
- "click": function(e){
- this.createBug();
- }.bind(this)
- });
- },
- loadTitleTextNode: function(){
- this.titleTextNode = new Element("div", {
- "styles": this.css.titleTextNode,
- "text": this.lp.title
- }).inject(this.titleBar);
- },
- loadSearchNode: function(){
- this.searchBarAreaNode = new Element("div", {
- "styles": this.css.searchBarAreaNode
- }).inject(this.titleBar);
- this.searchBarNode = new Element("div", {
- "styles": this.css.searchBarNode
- }).inject(this.searchBarAreaNode);
- this.searchBarActionNode = new Element("div", {
- "styles": this.css.searchBarActionNode
- }).inject(this.searchBarNode);
- this.searchBarInputBoxNode = new Element("div", {
- "styles": this.css.searchBarInputBoxNode
- }).inject(this.searchBarNode);
- this.searchBarInputNode = new Element("input", {
- "type": "text",
- "value": this.lp.searchKey,
- "styles": this.css.searchBarInputNode
- }).inject(this.searchBarInputBoxNode);
- var _self = this;
- this.searchBarActionNode.addEvent("click", function(){
- this.searchTask();
- }.bind(this));
- this.searchBarInputNode.addEvents({
- "focus": function(){
- if (this.value==_self.lp.searchKey) this.set("value", "");
- },
- "blur": function(){if (!this.value) this.set("value", _self.lp.searchKey);},
- "keydown": function(e){
- if (e.code==13){
- this.searchTask();
- e.preventDefault();
- }
- }.bind(this),
- "selectstart": function(e){
- e.preventDefault();
- }
- });
- },
- loadFilter: function(){
- this.filterBar = new Element("div", {"styles": this.css.filterBar}).inject(this.content);
- this.filterTitleNode = new Element("div", {"styles": this.css.filterTitleNode}).inject(this.filterBar);
- this.filterTitleNode.set("text", this.lp.filter);
- this.filterContentNode = new Element("div", {"styles": this.css.filterContentNode}).inject(this.filterBar);
- var html = this.lp.bugType+": <select id='sel_bugType'></select><span> </span>"+
- this.lp.creator+": <select id='sel_creator'></select><span> </span>"+
- this.lp.targetUser+": <select id='sel_targetUser'></select><span> </span>"+
- this.lp.status+": <select id='sel_status'></select><span> </span>";
- this.filterContentNode.set("html", html);
- this.filterBugTypeNode = this.filterContentNode.getElementById("sel_bugType");
- this.filterCreatorNode = this.filterContentNode.getElementById("sel_targetUser");
- this.filterTargetUserNode = this.filterContentNode.getElementById("sel_targetUser");
- this.filterStatusNode = this.filterContentNode.getElementById("sel_status");
- Object.each(this.lp.bugTypeList, function(v, k){new Element("option", {"value": k,"text": v}).inject(this.filterBugTypeNode)}.bind(this));
- Object.each(this.lp.statusList, function(v, k){new Element("option", {"value": k,"text": v}).inject(this.filterStatusNode)}.bind(this));
- },
- createBug: function(){
- this.note = new MWF.xApplication.O2Bug.Note(null, this.createAction, this);
- }
- });
- MWF.xApplication.O2Bug.Note = new Class({
- initialize: function(data, node, app){
- this.data = data;
- this.startNode = node;
- this.app = app;
- this.css = this.app.css;
- this.container = this.app.content;
- this.isNew = ((this.data) && (this.data.id)) ? true : false;
- this.load();
- },
- load: function(){
- if (!this.data) this.createNewData();
- this.mask = new MWF.widget.MaskNode(this.container, {"loading": false});
- this.mask.load();
- this.createNode();
- this.show();
- //this.loadContent();
- },
- createNewData: function(){
- this.data = {}
- },
- createNode: function(){
- var size = this.startNode.getSize();
- this.node = new Element("div", {
- "styles": this.css.bugNoteNode
- }).inject(this.container);
- this.node.setStyles({
- "width": ""+size.x+"px",
- "height": ""+size.y+"px"
- });
- this.node.position({
- relativeTo: this.startNode,
- position: 'topLeft',
- edge: 'topLeft'
- });
- },
- show: function(){
- var o = this.getNodeCoordinates();
- var fx = new Fx.Morph(this.node, {
- "duration": "500",
- "transition": Fx.Transitions.Expo.easeOut
- });
- fx.start({
- "opacity": 1,
- "width": ""+ o.width+"px",
- "height": ""+ o.height+"px",
- "left": ""+ o.left+"px",
- "top": ""+ o.top+"px"
- }).chain(function(){
- this.setNodeSizeFun = this.setNodeSize.bind(this);
- this.app.addEvent("resize", this.setNodeSizeFun);
- }.bind(this));
- },
- setNodeSize: function(){
- var o = this.getNodeCoordinates();
- this.node.setStyles({
- "width": ""+ o.width+"px",
- "height": ""+ o.height+"px",
- "left": ""+ o.left+"px",
- "top": ""+ o.top+"px"
- });
- },
- getNodeCoordinates: function(){
- var size = this.container.getSize();
- var w = size.x*0.8;
- if (w<800) w = 800;
- var h = size.y*0.8;
- if (h<300) h = 300;
- var position = this.container.getPosition(this.container.getOffsetParent());
- var l = size.x/2-w/2;
- if (l<0) l=0;
- l = position.x+l;
- var t = size.y/2-h/2;
- if (t<0) t=0;
- t = position.y+t;
- return {
- "width": w,
- "height": h,
- "left": l,
- "top": t
- }
- },
- });
|