-
Notifications
You must be signed in to change notification settings - Fork 3
/
nureport_new.js
124 lines (96 loc) · 4.37 KB
/
nureport_new.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
function nuNextID(){
window.ID = window.ID + 1;
return window.ID;
}
function nuCreateObject(o, sectionTop){
var d = document.createElement('div');
var g = 0;
var s = 0;
d.setAttribute('ondblclick', 'nuShowObjectProperties(this)');
d.setAttribute('onmousedown', 'nuHighlightObject(this, event)');
d.setAttribute('onmouseup', 'nuStopResize(this)');
d.setAttribute('onmousemove', 'nuMouseMove(event)');
if(arguments.length == 0){ //-- new Object
var i = nuNextID();
d.setAttribute('id', 'object' + i);
var z = 99;
for(var v = 0; v< REPORT.groups.length; v++) { //-- find highest z-index
for(var x = 0; x< REPORT.groups[v].sections.length;x++) {
for(var y = 0; y< REPORT.groups[v].sections[x].objects.length;y++) {
if(REPORT.groups[v].sections[x].objects[y].zIndex > z) {
z = REPORT.groups[v].sections[x].objects[y].zIndex;
}
}
}
}
z++;
$('#nuSectionIndex20').after(d);
$('#' + d.id).css({
'position' : 'absolute',
'height' : '20px',
'left' : '100px',
'top' : '50px',
'width' : '100px',
'z-index' : z,
'border-style' : 'solid',
'border-width' : '0px',
'font-family' : 'Arial',
'font-size' : '14px',
'font-weight' : 'normal',
'color' : 'black',
'background-color' : 'white',
'text-align' : 'left',
'cursor' : 'cell',
'overflow' : 'hidden'
})
.addClass( 'nuReportObject');
var o = new nuOBJECT('object' + i, '', z);
}else{ //-- load Object
d.setAttribute('id', o.id);
window.ID = Math.max(window.ID, Number(o.id.substr(6)) + 1);
o.top = nuGetSectionValue(window.GRP[o.group].sections[o.section].sectionID, 'top');
$('#nuSectionIndex20').after(d);
$('#' + d.id).css({
'position' : 'absolute',
'height' : o.height,
'left' : o.left + 30,
'top' : o.top,
'width' : o.width,
'z-index' : o.zIndex,
'border-style' : o.borderStyle,
'border-width' : o.borderWidth,
'font-family' : o.familyFont,
'font-size' : o.fontSize,
'font-weight' : o.fontWeight,
'color' : o.color,
'background-color' : o.backgroundColor,
'text-align' : o.textAlign,
'cursor' : 'cell',
'overflow' : 'hidden',
})
.addClass( 'nuReportObject');
g = o.group;
s = o.section;
}
window.REPORT.groups[g].sections[s].objects.push(o);
$('#' + d.id).draggable({
start: function( event, ui ){
nuSetOffset(this.id);
},
drag: function( event, ui ){
nuMoveSelected(this.id);
},
stop: function( event, ui ){
nuReadjustSections(); //-- make Sections Bigger if an Object overlaps it
nuMoveAllObjects();
nuReopenSelectObjects();
nuSaveReport();
}
});
if(arguments.length == 0){ //-- new Object
nuReadjustSections(); //-- make Sections Bigger if an Object overlaps it
nuMoveAllObjects();
nuReopenSelectObjects();
nuSaveReport();
}
}