-
Notifications
You must be signed in to change notification settings - Fork 0
/
dragdropboard.html
556 lines (489 loc) · 21.8 KB
/
dragdropboard.html
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
<!DOCTYPE HTML>
<html>
<head>
<script language="javascript" type="text/javascript" src="create_new.js"></script>
<script type="text/javascript">
var task_id = 0;
var story_id = 0;
var dependancy_id = 0;
var blocker_id = 0;
function create_new_task() {
// alert("test!");
var new_task = document.createElement('div');
new_task.id = "task_" + task_id;
task_id++;
// alert(new_task.id + ", " + task_id);
new_task.className = 'task_note';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_task.setAttributeNode(candragya);
new_task.setAttributeNode(dragstart);
// document.getElementById("note_holder").appendChild(new_task);
document.getElementById("committed_tasks").appendChild(new_task);
var new_task_title = document.createElement('p');
new_task.appendChild(new_task_title);
new_task_title.textContent = "Task: "; // + Date();
var new_task_story = document.createElement('p');
var new_task_owner = document.createElement('p');
var new_task_id = document.createElement('p');
new_task.appendChild(new_task_story);
new_task.appendChild(new_task_owner);
new_task.appendChild(new_task_id);
new_task_story.textContent = "Story: "; // + Date();
new_task_owner.textContent = "Owner: "; // + Date();
new_task_id.textContent = "ID: " + new_task.id;
// + ', ' + new_task.className);
// body...
}
function create_new_story() {
// alert("test!");
var new_story = document.createElement('div');
new_story.id = "story_" + story_id;
story_id++;
new_story.className = 'story_note';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_story.setAttributeNode(candragya);
new_story.setAttributeNode(dragstart);
// document.getElementById("note_holder").appendChild(new_story);
document.getElementById("backlog").appendChild(new_story);
var new_story_title = document.createElement('p');
new_story.appendChild(new_story_title);
new_story_title.textContent = "Story: "; // + Date();
var new_story_story = document.createElement('p');
var new_story_owner = document.createElement('p');
new_story.appendChild(new_story_story);
new_story.appendChild(new_story_owner);
new_story_story.textContent = "Desc: "; // + Date();
new_story_owner.textContent = "Owner: "; // + Date();
// + ', ' + new_story.className);
// body...
}
function create_new_dependancy() {
// alert("test!");
var new_dependancy = document.createElement('div');
new_dependancy.id = "dependancy_" + dependancy_id;
dependancy_id++;
// alert(new_dependancy.id + ", " + dependancy_id);
new_dependancy.className = 'dependancy_note';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_dependancy.setAttributeNode(candragya);
new_dependancy.setAttributeNode(dragstart);
// get element id based on where it needs to be and what it needs to be attached to.
document.getElementById("backlog").appendChild(new_dependancy);
var new_dependancy_title = document.createElement('p');
new_dependancy.appendChild(new_dependancy_title);
new_dependancy_title.textContent = "Dependancy: "; // + Date();
var new_dependancy_story = document.createElement('p');
var new_dependancy_owner = document.createElement('p');
new_dependancy.appendChild(new_dependancy_story);
new_dependancy.appendChild(new_dependancy_owner);
new_dependancy_story.textContent = "Story or Task: "; // + Date();
new_dependancy_owner.textContent = "Owner: "; // + Date();
}
function create_new_blocker() {
// alert("test!");
var new_blocker = document.createElement('div');
new_blocker.id = "blocker_" + blocker_id;
blocker_id++;
// alert(new_blocker.id + ", " + blocker_id);
new_blocker.className = 'blocker_note';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_blocker.setAttributeNode(candragya);
new_blocker.setAttributeNode(dragstart);
// Place according to the needed location.
document.getElementById("backlog").appendChild(new_blocker);
var new_blocker_title = document.createElement('p');
new_blocker.appendChild(new_blocker_title);
new_blocker_title.textContent = "Blocker: "; // + Date();
var new_blocker_story = document.createElement('p');
var new_blocker_owner = document.createElement('p');
new_blocker.appendChild(new_blocker_story);
new_blocker.appendChild(new_blocker_owner);
new_blocker_story.textContent = "Story or Task: "; // + Date();
new_blocker_owner.textContent = "Owner: "; // + Date();
}
// =================================================================
function create_new_task_small() {
// alert("test!");
var new_task = document.createElement('div');
new_task.id = "task_" + task_id;
task_id++;
// alert(new_task.id + ", " + task_id);
new_task.className = 'task_note_small';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_task.setAttributeNode(candragya);
new_task.setAttributeNode(dragstart);
// document.getElementById("note_holder").appendChild(new_task);
document.getElementById("div1").appendChild(new_task);
var new_task_id = document.createElement('p');
new_task.appendChild(new_task_id);
new_task_id.textContent = "ID: " + new_task.id;
}
function create_new_story_small() {
// alert("test!");
var new_story = document.createElement('div');
new_story.id = "story_" + story_id;
story_id++;
new_story.className = 'story_note_small';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_story.setAttributeNode(candragya);
new_story.setAttributeNode(dragstart);
// document.getElementById("note_holder").appendChild(new_story);
document.getElementById("div1").appendChild(new_story);
var new_story_id = document.createElement('p');
new_story.appendChild(new_story_id);
new_story_id.textContent = "ID: " + new_story.id;
}
}
function create_new_dependancy_small() {
// alert("test!");
var new_dependancy = document.createElement('div');
new_dependancy.id = "dependancy_" + dependancy_id;
dependancy_id++;
// alert(new_dependancy.id + ", " + dependancy_id);
new_dependancy.className = 'dependancy_note_small';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_dependancy.setAttributeNode(candragya);
new_dependancy.setAttributeNode(dragstart);
// get element id based on where it needs to be and what it needs to be attached to.
document.getElementById("div1").appendChild(new_dependancy);
var new_dependancy_id = document.createElement('p');
new_dependancy.appendChild(new_dependancy_id);
new_dependancy_id.textContent = "ID: " + new_dependancy.id;
}
function create_new_blocker_small() {
// alert("test!");
var new_blocker = document.createElement('div');
new_blocker.id = "blocker_" + blocker_id;
blocker_id++;
// alert(new_blocker.id + ", " + blocker_id);
new_blocker.className = 'blocker_note_small';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_blocker.setAttributeNode(candragya);
new_blocker.setAttributeNode(dragstart);
// Place according to the needed location.
document.getElementById("div1").appendChild(new_blocker);
var new_blocker_id = document.createElement('p');
new_blocker.appendChild(new_blocker_id);
new_blocker_id.textContent = "ID: " + new_blocker.id;
}
</script>
<style>
#div1, #div2, #div3, #note_holder
{float:left; width:200px; height:350px; margin:10px;padding:10px;border:1px solid #aaaaaa;}
#div1 {background-color:red}
#div2 {background-color:green}
#div3 {background-color:blue}
#div_drag {float:left; width:40px; height:20px; margin:5px;padding:5px;border:1px solid #aaaaaa;background-color:yellow}
.story_note, .task_note, .dependancy_note, .blocker_note {float:left; width:80px; height:80px; margin:5px;padding:5px;border:1px solid #aaaaaa;}
.story_note_small, .task_note_small, .dependancy_note_small, .blocker_note_small {float:left; width:40px; height:20px; margin:5px;padding:5px;border:1px solid #aaaaaa;}
.story_note, .story_note_small {background-color:green} /*{float:left; width:40px; height:20px; margin:5px;padding:5px;border:1px solid #aaaaaa;background-color:green}*/
.task_note, .task_note_small {background-color:yellow} /*{float:left; width:40px; height:20px; margin:5px;padding:5px;border:1px solid #aaaaaa;background-color:yellow}*/
.dependancy_note, .dependancy_note_small {background-color:red} /*{float:left; width:40px; height:20px; margin:5px;padding:5px;border:1px solid #aaaaaa;background-color:red}*/
.blocker_note, .blocker_note_small {background-color:purple} /*{float:left; width:40px; height:20px; margin:5px;padding:5px;border:1px solid #aaaaaa;background-color:purple}*/
#board {background-color: white ; display: block; border: 1px solid black; width: auto; height: 600px; padding: 5px; }
#backlog {background-color: lightblue ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#committed_stories {background-color: blue ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#committed_tasks {background-color: white ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#tasks_in_progress {background-color: aqua ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#completed_tasks {background-color: white ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#done_stories {background-color: chartreuse ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#current_sprints {background-color: white ; display: block; border: 1px solid black; width: 250px; height: 200px; padding: 5px; float: left; }
#Change_Sprint {background-color: orange;}
#Add_Spint {background-color: orange;}
#Add_Story {background-color: orange;}
#Add_Task {background-color: orange;}
#Add_Dependancy {background-color: orange;}
#Add_Blocker {background-color: orange;}
</style>
<script>
function allowDrop(ev) {
ev.preventDefault();
// alert(ev.cancelable);
}
function denyDrop(ev) {
ev.stopPropagation();
}
function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));
}
function showdate() {
var d = new Date();
var e = new Date(milliseconds);
var f = new Date(dateString);
var g = new Date(year, month, day, hours, minutes, seconds, milliseconds);
// window.alert('dates: '+d+', '+e+', '+f+', '+g);
alert('dates: '+d.toString()+', '+e.toString()+', '+f.toString()+', '+g.toString());
}
function myFunction() {
var d = new Date();
var e = new Date(milliseconds);
var f = new Date(dateString);
var g = new Date(year, month, day, hours, minutes, seconds, milliseconds);
// document.getElementById("showme").value = 'dates: '+d+', '+e+', '+f+', '+g;
document.getElementById("showme").innerHTML = Date();
document.getElementById("testdate").innerHTML = d; // new Date();
}
function inform(){
alert("You have activated me by clicking the grey button! Note that the event handler is added within the event that it handles, in this case, the form button event tag")
}
function test_date() {
var my_date = Date();
var my_date2 = new Date();
alert(my_date + ", " + my_date2 + '!');
}
</script>
</head>
<body>
<!-- do i want to do this with tables and rows or just divs? -->
<!-- I think that I will add .. never mind, i was thinking a row could cross multiple divs -->
<div id="board">
<div id="backlog" ondrop="drop(event)" ondragover="allowDrop(event)" ><h2 ondragover="denyDrop(event)">Backlog</h2></div>
<div id="committed_stories" ondrop="drop(event)" ondragover="allowDrop(event)" ><h2 ondragover="denyDrop(event)">Committed Stories</h2></div>
<div id="committed_tasks" ondrop="drop(event)" ondragover="allowDrop(event)" ><h2 ondragover="denyDrop(event)">Committed Tasks</h2></div>
<div id="tasks_in_progress" ondrop="drop(event)" ondragover="allowDrop(event)" ><h2 ondragover="denyDrop(event)">Tasks in Progress</h2></div>
<div id="completed_tasks" ondrop="drop(event)" ondragover="allowDrop(event)" ><h2 ondragover="denyDrop(event)">Completed Tasks</h2></div>
<div id="done_stories" ondrop="drop(event)" ondragover="allowDrop(event)" ><h2 ondrop="denyDrop(event)" ondragover="denyDrop(event)">Done Stories</h2></div>
<div id="current_sprints" >
<h2>Current Sprint</h2>
<p id="Sprint_Name"></p>
<p id="Sprint_Dates"></p>
<button id="Change_Sprint">Change Sprint</button>
<button id="Add_Spint">Add Spint</button>
<button id="Add_Story" onclick="create_new_story(), create_new_story_small()">Add Story</button>
<button id="Add_Task" onclick="create_new_task(), create_new_task_small()">Add Task</button>
<button id="Add_Dependancy" onclick="create_new_dependancy(), create_new_dependancy_small()">Add Dependancy</button>
<button id="Add_Blocker" onclick="create_new_blocker(), create_new_blocker_small()">Add Blocker</button>
<!-- <button onclick="add_div(), test_date()">ADD A NEW DIV!</button> works -->
<button onclick="add_div()">ADD A NEW DIV!</button>
</div>
</div>
<!-- text area object? -->
<!-- upon object being placed in area, the target object will update its location -->
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)">
<img src="img_w3slogo.gif" draggable="true" ondragstart="drag(event)" id="drag1" width="88" height="31">
</div>
<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)">
<div id="div_drag" draggable="true" ondragstart="drag(event)" id="drag2"></div>
<form>
<input type="button" name="test" value="Click me" onclick="inform()">
</form>
</div>
<div id="div3" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="story_note_small" draggable="true" ondragstart="drag(event)" id="drag2"></div>
<div class="task_note_small" draggable="true" ondragstart="drag(event)" id="drag3"></div>
<div class="dependancy_note_small" draggable="true" ondragstart="drag(event)" id="drag4"></div>
<div class="blocker_note_small" draggable="true" ondragstart="drag(event)" id="drag5"></div>
<div class="story_note_small" draggable="true" ondragstart="drag(event)" id="drag6"></div>
<div class="task_note_small" draggable="true" ondragstart="drag(event)" id="drag7"></div>
<div class="dependancy_note_small" draggable="true" ondragstart="drag(event)" id="drag8"></div>
<div class="blocker_note_small" draggable="true" ondragstart="drag(event)" id="drag9"></div>
<div class="story_note_small" draggable="true" ondragstart="drag(event)" id="drag10"></div>
<div class="task_note_small" draggable="true" ondragstart="drag(event)" id="drag11"></div>
<div class="dependancy_note_small" draggable="true" ondragstart="drag(event)" id="drag12"></div>
<div class="blocker_note_small" draggable="true" ondragstart="drag(event)" id="drag13"></div>
</div>
<div id="note_holder"><h2>Note Holder</h2></div>
<button onclick="send_text()">Send Text</button>
<p id="pull_text">Pull Text</p>
<p>-----------------------</p>
<p id="new_text"></p>
<p>-----------------------</p>
<p id="demo"></p>
<p>-----------------------</p>
<button onclick="change_me()">click me</button>
<p id="demo2">ha ha ha!</p>
<p>-----------------------</p>
<form name"add_new_task">
<input type="text" name="this_title" value="Enter Task Name Here"><br>
<input type="text" name="this_story" value="Enter Story Name Here"><br>
<input type="text" name="this_owner" value="Enter Owner's Name Here"><br>
<input type="text" name="dependancy" value="Enter Dependancy Name Here"><br>
<input type="submit" value="Submit" onclick="add_note()">
</form>
<hr>
<button onclick="showdate()" >Show Dates</button>
<button onclick="myFunction()" >Show more Dates</button>
<button onclick="alert(Date());" >Re-Show Dates</button>
<span>Test2<textarea id="showme">Test</textarea>Test3</span>
<span id="testdate">Blah blah blah</span>
<button onclick="alert(document.getElementById("testdate").textContent);">text content</button>
<button onclick="test_date()" >Re-Show Dates</button>
<hr>
<button onclick="add_div()">ADD A NEW DIV!</button>
<button onclick="add_note()">ADD A NEW NOTE!</button>
<!-- Add Database -->
<!-- Oracle Database -->
<!-- Andrew -->
<!-- None -->
<script type="text/javascript">
var task_id = 0;
var story_id = 0;
function send_text () {
var x = document.getElementById("pull_text")[0].textContent;
document.getElementById("new_text").innerHTML = x;
var y = getElementsByTagName("BUTTON")[0].textContent;
document.getElementById("demo").innerHTML = y;
}
function change_me () {
document.getElementById("demo2").textContent = "Paragraph changed!";
document.getElementById("pull_text").textContent = Date();
}
function add_note () {
// var note_holder = document.getElementById("note_holder");
var new_task = document.createElement('div');
new_task.id = "task_" + task_id;
task_id++;
new_task.className = 'task_note';
// add to note holder div
document.getElementById("note_holder").appendChild(new_task);
// get the text info
var this_title = document.add_new_task.this_title.value;
var this_title2 = document.getElementByName(this_title).value;
alert(this_title2);
var this_story = document.add_new_task.this_story.value;
var this_story2 = document.getElementByName(this_story).value;
alert(this_story2);
var this_owner = document.add_new_task.this_owner.value;
var this_owner2 = document.getElementByName(this_owner).value;
alert(this_owner2);
// create the elements
var task_title = document.createElement('p');
var task_story = document.createElement('p');
var task_owner = document.createElement('p');
// add the note div
new_task.appendChild(task_title);
new_task.appendChild(task_story);
new_task.appendChild(task_owner);
// set everything else
/*
task_title.id = this_title + '_' + task_id;
task_title.name = "title" + task_id;
// task_title.innerHTML = "Title:" + this_title;
document.getElementById(task_title.id).textContent = this_title;
task_story.id = this_story + '_' + task_id;
task_story.name = "story" + task_id;
// task_story.innerHTML = "Story:" + this_story;
document.getElementById(task_story.id).textContent = this_story;
task_owner.id = this_owner + '_' + task_id;
task_owner.name = "owner" + task_id;
// task_owner.innerHTML = "Owner:" + this_owner;
document.getElementById(task_owner.id).textContent = this_owner;
*/
task_title.textContent = "Title: " + this_title;
task_story.textContent = "Story: " + this_story;
task_owner.textContent = "Owner: " + this_owner;
// new_task.name("title")
// new_task.name("story")
// new_task.name("owner")
// setAttributeNode(att);
}
function add_div() {
// alert("test!");
var new_task = document.createElement('div');
new_task.id = "task_" + task_id;
task_id++;
// alert(new_task.id + ", " + task_id);
new_task.className = 'task_note';
var candragya = document.createAttribute("draggable");
var dragstart = document.createAttribute("ondragstart");
candragya.value = "true";
dragstart.value = "drag(event)";
// isdraggable
// isdragstart
new_task.setAttributeNode(candragya);
new_task.setAttributeNode(dragstart);
// document.getElementById("note_holder").appendChild(new_task);
document.getElementById("backlog").appendChild(new_task);
var new_task_title = document.createElement('p');
new_task.appendChild(new_task_title);
new_task_title.textContent = "Title: "; // + Date();
var new_task_story = document.createElement('p');
var new_task_owner = document.createElement('p');
var new_task_id = document.createElement('p');
new_task.appendChild(new_task_story);
new_task.appendChild(new_task_owner);
new_task.appendChild(new_task_id);
new_task_story.textContent = "Story: "; // + Date();
new_task_owner.textContent = "Owner: "; // + Date();
new_task_id.textContent = "ID: "; // + new_task.id;
// + ', ' + new_task.className);
// body...
}
/*
// Your existing code unmodified...
var iDiv = document.createElement('div');
iDiv.id = 'block';
iDiv.className = 'block';
document.getElementsByTagName('body')[0].appendChild(iDiv);
// Now create and append to iDiv
var innerDiv = document.createElement('div');
innerDiv.className = 'block-2';
// The variable iDiv is still good... Just append to it.
iDiv.appendChild(innerDiv);
*/
</script>
<script language="JavaScript">
<!--
function submitForm(){
if(document.myForm.myText.value == ""){
alert("Please enter some text first");
}else{
document.myForm.mySubmit.click();
}
}
-->
</script>
<form name="myForm">
Please Enter some text and click the link.<br>
<input type=TEXT value="" name="myText">
<input type=SUBMIT value="Submit" name="mySubmit">
</form>
<br>
<a href="javascript:submitForm()">Click here to submit the form</a>
</body>
</html>