Ready for 7.10.29 development.
BIN
www/extras/wobject/Calendar/images/delete.gif
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
www/extras/wobject/Calendar/images/more.gif
Normal file
|
After Width: | Height: | Size: 56 B |
BIN
www/extras/wobject/Calendar/images/start.jpg
Normal file
|
After Width: | Height: | Size: 809 B |
BIN
www/extras/wobject/Calendar/images/stop.jpg
Normal file
|
After Width: | Height: | Size: 806 B |
110
www/extras/wobject/Carousel/carousel.js
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
|
||||
if ( typeof WebGUI == 'undefined' ) {
|
||||
WebGUI = {};
|
||||
}
|
||||
if ( typeof WebGUI.Carousel == 'undefined' ) {
|
||||
WebGUI.Carousel = {};
|
||||
}
|
||||
|
||||
WebGUI.Carousel.Editor
|
||||
= function ( id, mceConfig, items, i18n ) {
|
||||
this.id = id;
|
||||
this.mceConfig = mceConfig;
|
||||
this.items = items;
|
||||
this.i18n = i18n;
|
||||
|
||||
// Initialize a tabview
|
||||
this.tabView = new YAHOO.widget.TabView( this.id, {
|
||||
orientation : "left"
|
||||
} );
|
||||
|
||||
// Add a tab for each item
|
||||
for ( var i = 0; i < this.items.length; i++ ) {
|
||||
this.addTab( this.items[i] );
|
||||
}
|
||||
|
||||
// We're new!
|
||||
if ( this.items.length == 0 ) {
|
||||
this.addTab( );
|
||||
}
|
||||
|
||||
// Find the form and eventize it!
|
||||
var form = document.getElementById( this.id );
|
||||
while ( form.tagName != "FORM" ) {
|
||||
form = form.parentNode;
|
||||
}
|
||||
YAHOO.util.Event.on( form, 'submit', this.handleSubmit, this, true );
|
||||
};
|
||||
|
||||
WebGUI.Carousel.Editor.prototype.addTab
|
||||
= function ( data ) {
|
||||
var num = this.tabView.get('tabs').length + 1;
|
||||
if ( !data ) {
|
||||
data = { text : "", itemId : 'carousel_item_' + num };
|
||||
}
|
||||
|
||||
var tab = new YAHOO.widget.Tab( {
|
||||
label : num,
|
||||
content : ''
|
||||
} );
|
||||
this.tabView.addTab( tab );
|
||||
this.tabView.selectTab( num - 1 );
|
||||
|
||||
var el = tab.get('contentEl');
|
||||
|
||||
var delBtn = document.createElement( 'input' );
|
||||
delBtn.type = "button";
|
||||
delBtn.style.cssFloat = "right";
|
||||
delBtn.value = this.i18n['delete'];
|
||||
YAHOO.util.Event.on( delBtn, "click", function(){
|
||||
this.tabView.removeTab( tab );
|
||||
}, this, true );
|
||||
el.appendChild( delBtn );
|
||||
|
||||
var input = document.createElement( 'input' );
|
||||
input.type = "text";
|
||||
input.value = data.itemId;
|
||||
el.appendChild( document.createTextNode( "ID: " ) );
|
||||
el.appendChild( input );
|
||||
|
||||
var ta = document.createElement( 'textarea' );
|
||||
ta.className = "carouselInput";
|
||||
ta.name = "carouselInput" + num;
|
||||
ta.id = ta.name;
|
||||
ta.style.height = "300px";
|
||||
ta.appendChild( document.createTextNode( data.text ) );
|
||||
el.appendChild( ta );
|
||||
|
||||
var conf = this.mceConfig;
|
||||
conf.mode = "exact";
|
||||
conf.elements = ta.name;
|
||||
|
||||
tinyMCE.init( conf );
|
||||
};
|
||||
|
||||
WebGUI.Carousel.Editor.prototype.handleSubmit
|
||||
= function ( ) {
|
||||
var tabs = this.tabView.get('tabs');
|
||||
var items = [];
|
||||
for ( var i = 0; i < tabs.length; i++ ) {
|
||||
var item = { };
|
||||
var tab = tabs[i];
|
||||
var elem = tab.get('contentEl');
|
||||
|
||||
var id = elem.getElementsByTagName( 'input' )[1];
|
||||
item.itemId = id.value;
|
||||
|
||||
var text = elem.getElementsByTagName( 'textarea' )[0];
|
||||
// Force the TinyMCE to update the textarea
|
||||
tinyMCE.getInstanceById( text.id ).save();
|
||||
|
||||
item.text = text.value;
|
||||
|
||||
item.sequenceNumber = i;
|
||||
|
||||
items.push( item );
|
||||
}
|
||||
var json = YAHOO.lang.JSON.stringify( items );
|
||||
document.getElementById( 'items_formId' ).value = json;
|
||||
};
|
||||
|
||||
BIN
www/extras/wobject/Dashboard/add2.gif
Normal file
|
After Width: | Height: | Size: 923 B |
BIN
www/extras/wobject/Dashboard/background.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
www/extras/wobject/Dashboard/bg.gif
Normal file
|
After Width: | Height: | Size: 46 B |
BIN
www/extras/wobject/Dashboard/body_bg.gif
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
www/extras/wobject/Dashboard/bookmark.gif
Normal file
|
After Width: | Height: | Size: 1 KiB |
BIN
www/extras/wobject/Dashboard/closeMod.gif
Normal file
|
After Width: | Height: | Size: 88 B |
BIN
www/extras/wobject/Dashboard/column_dot.gif
Normal file
|
After Width: | Height: | Size: 43 B |
BIN
www/extras/wobject/Dashboard/content_bg.gif
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
258
www/extras/wobject/Dashboard/dashboard.css
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
body
|
||||
{
|
||||
margin: 0;
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.dashboardColumn
|
||||
{
|
||||
width: 100%;
|
||||
background: none;
|
||||
background-color:transparent;
|
||||
}
|
||||
.dashboardColumn td {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#dashboardContainer
|
||||
{
|
||||
font: 11px Lucida Grande, Verdana, Arial, Helvetica, sans serif;
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
#dashboardChooserContainer
|
||||
{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
border:0px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#position1 {
|
||||
width:200px;
|
||||
max-width:200px;
|
||||
width:expression("200px");
|
||||
}
|
||||
|
||||
#position1 td {
|
||||
margin-top:40px;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
tbody.availableDashlet * div.content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#availableDashlets * td {
|
||||
width:200px;
|
||||
max-width:200px;
|
||||
}
|
||||
|
||||
#availableDashlets * div.content {
|
||||
width:200px;
|
||||
max-width:200px;
|
||||
height:0px;
|
||||
display:none;
|
||||
overflow-x:hidden;
|
||||
overflow-y:hidden;
|
||||
}
|
||||
|
||||
#columnsContainerDiv
|
||||
{
|
||||
margin:6px;
|
||||
}
|
||||
|
||||
td
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
font: 12px Lucida Grande, Verdana, Arial, Helvetica, sans serif;
|
||||
font-weight:bold;
|
||||
margin:0px;
|
||||
margin-bottom:3px;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font: 19px Verdana;
|
||||
margin-bottom:0px;
|
||||
padding-bottom:0px;
|
||||
}
|
||||
|
||||
ul
|
||||
{
|
||||
margin-top:2px;
|
||||
left:-10px;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
div.weatherTitle
|
||||
{
|
||||
font-weight:bold;
|
||||
color:white;
|
||||
}
|
||||
|
||||
div.content
|
||||
{
|
||||
overflow-x:hidden;
|
||||
border-bottom:solid orange 1px;
|
||||
border-top:solid orange 1px;
|
||||
border-left:solid orange 1px;
|
||||
border-right:solid orange 1px;
|
||||
margin-bottom:10px;
|
||||
padding:5px;
|
||||
padding-top:10px;
|
||||
background: #fff url('content_bg.gif') no-repeat top right;
|
||||
}
|
||||
|
||||
div.content a:link, div.content a:visited
|
||||
{
|
||||
color:#F48117;
|
||||
}
|
||||
|
||||
table.tableSearch
|
||||
{
|
||||
background-color:#F2F2F2;
|
||||
border:solid #CCC 1px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table.tableSearch td select
|
||||
{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
div.dragTitle
|
||||
{
|
||||
overflow-x:visible;
|
||||
background: url('dragable_bg.gif');
|
||||
width:100%;
|
||||
z-index:998;
|
||||
border:solid black 0px;
|
||||
height:22px;
|
||||
top:0px;
|
||||
left:0px;
|
||||
right:30px;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
span.headerTitle
|
||||
{
|
||||
height:22px;
|
||||
clip:rect(auto,auto,auto,auto);
|
||||
overflow:hidden;
|
||||
display:block;
|
||||
float:left;
|
||||
line-height:18px;
|
||||
z-index:999;
|
||||
margin-right:10px;
|
||||
padding-left:9px;
|
||||
padding-top:2px;
|
||||
}
|
||||
|
||||
span.options
|
||||
{
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:0px;
|
||||
right:-1px;
|
||||
float:right;
|
||||
z-index:1000;
|
||||
padding-right:35px;
|
||||
background: transparent url('dragtitle_bg.gif') no-repeat top right;
|
||||
}
|
||||
span.options img {
|
||||
opacity:0;
|
||||
filter:alpha(opacity=0);
|
||||
}
|
||||
span.options:hover img {
|
||||
opacity:100;
|
||||
}
|
||||
span.optionsHoverIE img {
|
||||
filter:alpha(opacity=100);
|
||||
}
|
||||
div#availableDashlets * span.options:hover {
|
||||
opacity:0;
|
||||
filter:alpha(opacity=0);
|
||||
}
|
||||
div#availableDashlets * span.options {
|
||||
display:none;
|
||||
opacity:0;
|
||||
top:500px;
|
||||
filter:alpha(opacity=0);
|
||||
}
|
||||
div#availableDashlets * div.dragTrigger {
|
||||
background: none;
|
||||
float:none;
|
||||
margin-bottom:0px;
|
||||
/* height:auto;*/
|
||||
}
|
||||
div#availableDashlets * div.dragTitle {
|
||||
background:none;
|
||||
/* height:auto;*/
|
||||
overflow:hidden;
|
||||
float:none;
|
||||
background-color: #eeeeee;
|
||||
border: solid #bbbbbb 1px;
|
||||
color: black;
|
||||
}
|
||||
div#availableDashlets * span.headerTitle {
|
||||
display:block;
|
||||
width:100%;
|
||||
line-height:auto;
|
||||
/* height:22px;*/
|
||||
background: none;
|
||||
}
|
||||
|
||||
#hideNewContentButton,#showNewContentButton {
|
||||
/* position:absolute;*/
|
||||
color: #465D94;
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
top: 20px;
|
||||
cursor: pointer; cursor: hand;
|
||||
left: 20px;
|
||||
width:200px;
|
||||
}
|
||||
#availableBox {
|
||||
display:none;
|
||||
/* width:200px;
|
||||
max-width:200px;
|
||||
width:expression("200px");*/
|
||||
}
|
||||
#availableBox2 {
|
||||
padding-top:40px;
|
||||
border:solid navy 2px;
|
||||
height: 600px;
|
||||
/* width:200px;
|
||||
max-width:200px;
|
||||
width:expression("200px");*/
|
||||
}
|
||||
|
||||
#availableDashlets {
|
||||
/* width:200px;
|
||||
max-width:200px;
|
||||
width:expression("200px");*/
|
||||
}
|
||||
|
||||
.availableDashlet
|
||||
{
|
||||
/* width:200px;
|
||||
max-width:200px;
|
||||
width:expression("200px");*/
|
||||
}
|
||||
|
||||
#availableDashlets tbody {
|
||||
height: 0px;
|
||||
}
|
||||
#leftBox {
|
||||
width:210px;
|
||||
}
|
||||
#rightBox {
|
||||
width:100%;
|
||||
}
|
||||
BIN
www/extras/wobject/Dashboard/delete_btn.jpg
Normal file
|
After Width: | Height: | Size: 997 B |
BIN
www/extras/wobject/Dashboard/dragable_bg.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
96
www/extras/wobject/Dashboard/draggable.css
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
div.dragable:hover
|
||||
{
|
||||
border: 1px dashed #aaaaaa;
|
||||
}
|
||||
|
||||
.dragable
|
||||
{
|
||||
position: relative;
|
||||
/*width:100%;*/
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
div.dragTrigger
|
||||
{
|
||||
position: relative;
|
||||
top:0px;
|
||||
left:0px;
|
||||
cursor: move;
|
||||
width:100%;
|
||||
font-size:10pt;
|
||||
font-weight:bold;
|
||||
font-face:verdana;
|
||||
color:white;
|
||||
height:22px;
|
||||
}
|
||||
|
||||
div.dragging
|
||||
{
|
||||
overflow-x:visible;
|
||||
position: relative;
|
||||
width: auto;
|
||||
filter:alpha(opacity=60);
|
||||
opacity:.60;
|
||||
cursor: pointer; cursor: hand;
|
||||
z-index: 2000;
|
||||
/* border: 1px dotted #cccccc; */
|
||||
}
|
||||
|
||||
div.dragging div.content
|
||||
{
|
||||
opacity:.60;
|
||||
filter: alpha(opacity=60);
|
||||
}
|
||||
|
||||
.draggedOverTop{
|
||||
position: relative;
|
||||
border: 1px dotted white;
|
||||
margin-top: -1px;
|
||||
border-top: 50px #dddddd solid;
|
||||
}
|
||||
|
||||
.draggedOverBottom {
|
||||
position: relative;
|
||||
border: 1px dotted white;
|
||||
margin-bottom: -1px;
|
||||
border-bottom: 50px #dddddd solid;
|
||||
}
|
||||
|
||||
.hidden
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.blank
|
||||
{
|
||||
position: relative;
|
||||
opacity:0.5;
|
||||
-moz-opacity:0.5;
|
||||
filter: alpha(opacity=50);
|
||||
cursor: pointer; cursor: hand;
|
||||
background-color: white;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.blankOver
|
||||
{
|
||||
position: relative;
|
||||
cursor: pointer; cursor: hand;
|
||||
background-color: #dddddd;
|
||||
}
|
||||
|
||||
.empty
|
||||
{
|
||||
position: relative;
|
||||
padding: 0px;
|
||||
margin: 3px;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.blankTable {
|
||||
width:100%;
|
||||
}
|
||||
.blankColumn {
|
||||
width:100%;
|
||||
}
|
||||
1210
www/extras/wobject/Dashboard/draggable.js
Normal file
BIN
www/extras/wobject/Dashboard/dragtitle_bg.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
www/extras/wobject/Dashboard/edit_btn.jpg
Normal file
|
After Width: | Height: | Size: 855 B |
BIN
www/extras/wobject/Dashboard/gmail.gif
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
www/extras/wobject/Dashboard/header_bg.gif
Normal file
|
After Width: | Height: | Size: 199 B |
BIN
www/extras/wobject/Dashboard/hide_btn.jpg
Normal file
|
After Width: | Height: | Size: 799 B |
BIN
www/extras/wobject/Dashboard/move_btn.jpg
Normal file
|
After Width: | Height: | Size: 680 B |
BIN
www/extras/wobject/Dashboard/note.gif
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
www/extras/wobject/Dashboard/permissions_btn.jpg
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
www/extras/wobject/Dashboard/reload.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
www/extras/wobject/Dashboard/search.gif
Normal file
|
After Width: | Height: | Size: 350 B |
BIN
www/extras/wobject/Dashboard/showModBlueNav.gif
Normal file
|
After Width: | Height: | Size: 58 B |
BIN
www/extras/wobject/Dashboard/weather.gif
Normal file
|
After Width: | Height: | Size: 1 KiB |
BIN
www/extras/wobject/Dashboard/weather_delete.gif
Normal file
|
After Width: | Height: | Size: 127 B |
BIN
www/extras/wobject/Dashboard/writely.gif
Normal file
|
After Width: | Height: | Size: 607 B |
BIN
www/extras/wobject/EMS/close12_1.gif
Normal file
|
After Width: | Height: | Size: 85 B |
BIN
www/extras/wobject/EMS/indicator.gif
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
114
www/extras/wobject/EMS/submission.css
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
legend {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
.submission_title {
|
||||
background: #d8d8d8 url(../../yui/build/assets/skins/sam/sprite.png) repeat-x;
|
||||
border: solid #a3a3a3;
|
||||
border-width: 0 1px 0;
|
||||
font-family: arial;
|
||||
font-weight: bold;
|
||||
font-size: 14pt;
|
||||
}
|
||||
.submission_body {
|
||||
background: #FFFFFF;
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
.submission_desc {
|
||||
background: #d8d8d8;
|
||||
}
|
||||
.userArea {
|
||||
font-family: arial;
|
||||
font-size: 9pt;
|
||||
color: black;
|
||||
background-color: white;
|
||||
overflow: auto;
|
||||
height: 310px;
|
||||
}
|
||||
.hd_searchBtn {
|
||||
background-color:silver;
|
||||
color:white;
|
||||
border:solid gray 1px;
|
||||
text-decoration:none;
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
font-size:9pt;
|
||||
}
|
||||
.inputBox {
|
||||
border:solid gray 1px;
|
||||
font-size:9pt;
|
||||
}
|
||||
.grayArea {
|
||||
background-color:#F2F2F2;
|
||||
border:solid #E8E8E8 1px;
|
||||
padding:3px;
|
||||
-moz-box-sizing:border-box;
|
||||
}
|
||||
#solutionDialog {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.whiteArea {
|
||||
font-family: arial;
|
||||
font-size: 9pt;
|
||||
color: black;
|
||||
}
|
||||
.solutionArea {
|
||||
font-family: arial;
|
||||
font-size: 9pt;
|
||||
color: black;
|
||||
background-color:#FFFFFF;
|
||||
overflow: auto;
|
||||
height: 160px;
|
||||
}
|
||||
#userList_div {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
font-family: arial;
|
||||
font-size: 10pt;
|
||||
border: solid #CACACA 1px;
|
||||
}
|
||||
* html #userList_div {
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#userList_div img {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
#userList_div td {
|
||||
background-color: #F2F2F2;
|
||||
border-top: solid #F9F9F9 1px;
|
||||
border-bottom: solid #E0E0E0 1px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
#userList_div tr.odd td {
|
||||
background-color: #EAEAEA;
|
||||
}
|
||||
.submission_private {
|
||||
background-color:#AA0002;
|
||||
border:solid #E8E8E8 1px;
|
||||
color:white;
|
||||
font-size: 9pt;
|
||||
font-weight: bold;
|
||||
text-align:center;
|
||||
-moz-box-sizing:border-box;
|
||||
}
|
||||
.submission_public {
|
||||
background-color:#00FF00;
|
||||
border:solid #E8E8E8 1px;
|
||||
color:white;
|
||||
font-size: 0pt;
|
||||
font-weight: bold;
|
||||
text-align:center;
|
||||
-moz-box-sizing:border-box;
|
||||
}
|
||||
.dyn_form_field {
|
||||
width: 120px;
|
||||
}
|
||||
408
www/extras/wobject/EMS/submission.js
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
|
||||
/*** The WebGUI EMS Submission system
|
||||
* Requires: YAHOO, Dom, Event, DataSource, DataTable, Paginator, Container
|
||||
*
|
||||
*/
|
||||
|
||||
var DataSource = YAHOO.util.DataSource,
|
||||
DataTable = YAHOO.widget.DataTable,
|
||||
Paginator = YAHOO.widget.Paginator;
|
||||
|
||||
if ( typeof WebGUI == "undefined" ) {
|
||||
WebGUI = {};
|
||||
}
|
||||
|
||||
/*** WebGUI EMS Object
|
||||
*
|
||||
* This object renders the WebGUI EMS Submission datatable
|
||||
*
|
||||
* @method WebGUI.EMS.constructor
|
||||
* @param configs {Object} object containing configuration necessary for creating the datatable.
|
||||
TODO -- fix this to match what EMS really needs
|
||||
* datasource {String} Required URL that returns the JSON data structure of data to be displayed.
|
||||
* container {String} Required id of the HTML Element in which to render both the datatable and the pagination
|
||||
* dtContainer {String} Required id of the HTML Element in which to render the datatable
|
||||
* view {String} Required String which is passed to the ticket to properly return uses to the right view [all,my,search].
|
||||
* fields {ArrayRef} Required Array Reference of Objects used by the DataSource to configure and store data to be used by the data table
|
||||
* columns {ArrayRef} Required Array Reference of Objects which define the columns for the datatable to render
|
||||
* p_containers {ArrayRef} Required Array Reference containing the ids of the HTML Elements in which to render pagination.
|
||||
* defaultSort {Object} Optional Custom object which defines which column and direction the paginator should sort by
|
||||
* initRequestString {String} Optional Parameters to append to the end of the url when initializing the datatable
|
||||
*/
|
||||
|
||||
|
||||
WebGUI.EMS = function (configs) {
|
||||
// Initialize configs
|
||||
this._configs = {};
|
||||
if(configs) {
|
||||
this._configs = configs;
|
||||
WebGUI.EMS.url = configs.url;
|
||||
WebGUI.EMS.tabContent = configs.tabContent;
|
||||
}
|
||||
WebGUI.EMS.items = new Object();
|
||||
|
||||
if(!this._configs.initRequestString) {
|
||||
this._configs.initRequestString = ';startIndex=0';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Internationalization
|
||||
// this comes first because it is used in other areas...
|
||||
///////////////////////////////////////////////////////////////
|
||||
WebGUI.EMS.i18n = new WebGUI.i18n( {
|
||||
namespaces : {
|
||||
'Asset_EMSSubmission' : [
|
||||
''
|
||||
],
|
||||
'Asset_EventManagementSystem' : [
|
||||
'close tab',
|
||||
''
|
||||
]
|
||||
}
|
||||
// onpreload : {
|
||||
// fn : this.initialize,
|
||||
// obj : this,
|
||||
// override : true,
|
||||
// }
|
||||
} );
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Protected Static Methods
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
//***********************************************************************************
|
||||
// This Method updates the window.location.hash when the user changes tabs
|
||||
WebGUI.EMS.changeTab = function ( e ) {
|
||||
alert('tab changed');
|
||||
var index = WebGUI.EMS.tabs.getTabIndex( e.newValue );
|
||||
if( index == 0 ) {
|
||||
window.location.hash = '';
|
||||
} else {
|
||||
window.location.hash = WebGUI.EMS.Tabs[index].id;
|
||||
}
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// This method closes the active tab
|
||||
//
|
||||
// Parameters: ( integer ) -- if a ticket id is passed in then remove the tab for that ticket
|
||||
// ( e, object ) -- cancel the event and close the tab associated with the object
|
||||
// ( ) -- get the current tab from the tabview object and close it
|
||||
//
|
||||
WebGUI.EMS.closeTab = function ( e, myTab ) {
|
||||
var index;
|
||||
if( typeof(e) == "string" || typeof(e) == "number" ) {
|
||||
index = e;
|
||||
myTab = WebGUI.EMS.items[index].tab;
|
||||
} else {
|
||||
if( typeof(e) != "undefined" ) {
|
||||
YAHOO.util.Event.preventDefault(e);
|
||||
}
|
||||
if( typeof(myTab) == "undefined" ) {
|
||||
myTab = WebGUI.EMS.tabs.get('activeTab');
|
||||
}
|
||||
index = WebGUI.EMS.tabs.getTabIndex(myTab);
|
||||
}
|
||||
delete WebGUI.EMS.items[index];
|
||||
WebGUI.EMS.tabs.removeTab(myTab);
|
||||
if( WebGUI.EMS.lastTab ) {
|
||||
WebGUI.EMS.tabs.set('activeTab',WebGUI.EMS.lastTab);
|
||||
}
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// Custom function to handle pagination requests
|
||||
WebGUI.EMS.handlePagination = function (state,dt) {
|
||||
var sortedBy = dt.get('sortedBy');
|
||||
// Define the new state
|
||||
var newState = {
|
||||
startIndex: state.startIndex,
|
||||
sorting: {
|
||||
key: sortedBy.key,
|
||||
dir: ((sortedBy.dir === DataTable.CLASS_ASC) ? "asc" : "desc")
|
||||
},
|
||||
pagination : { // Pagination values
|
||||
startIndex: state.startIndex, // Go to the proper page offset
|
||||
rowsPerPage: state.rowsPerPage // Return the proper rows per page
|
||||
}
|
||||
};
|
||||
|
||||
// Create callback object for the request
|
||||
var oCallback = {
|
||||
success: dt.onDataReturnSetRows,
|
||||
failure: dt.onDataReturnSetRows,
|
||||
scope: dt,
|
||||
argument: newState // Pass in new state as data payload for callback function to use
|
||||
};
|
||||
|
||||
// Send the request
|
||||
dt.getDataSource().sendRequest(WebGUI.EMS.buildQueryString(newState, dt), oCallback);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
//This method is out here so it can be overridden. The datatable uses this method to sort it's columns
|
||||
WebGUI.EMS.newTab = function(url) {
|
||||
// the 'loading' 'indicator'
|
||||
if( typeof(WebGUI.EMS.loadingIndicator) == "undefined" ) {
|
||||
WebGUI.EMS.loadingIndicator = new YAHOO.widget.Overlay( "loadingIndicator", {
|
||||
fixedcenter : true,
|
||||
visible : false
|
||||
} );
|
||||
WebGUI.EMS.loadingIndicator.setBody( "Loading ..." +
|
||||
"<img id='loadingIndicator' title='Loading' src='/extras/wobject/EMS/indicator.gif'/>"
|
||||
);
|
||||
WebGUI.EMS.loadingIndicator.render(document.body);
|
||||
}
|
||||
WebGUI.EMS.loadingIndicator.show();
|
||||
|
||||
// Create callback object for the request
|
||||
var oCallback = {
|
||||
success: function(o) {
|
||||
var response = eval('(' + o.responseText + ')');
|
||||
var myTab;
|
||||
if(response.hasError){
|
||||
var message = "";
|
||||
for(var i = 0; i < response.errors.length; i++) {
|
||||
message += response.errors[i];
|
||||
}
|
||||
alert(message);
|
||||
return;
|
||||
// currently only one tab exists, so instead of checking we just delete it and recreate
|
||||
// this condition is going to have to search for the id in the list
|
||||
} else { // if( typeof(WebGUI.EMS.items[response.title]) == "undefined"
|
||||
// || WebGUI.EMS.items[response.title] == null ) { // }
|
||||
// if there is a tab .. close it,
|
||||
// at least until I can get the JS/HTML re-written to handle multiple tabs
|
||||
// there should only be one
|
||||
for( var item in WebGUI.EMS.items ) { WebGUI.EMS.closeTab(item) }
|
||||
var myContent = document.createElement("div");
|
||||
myContent.innerHTML = response.text;
|
||||
myTab = new YAHOO.widget.Tab({
|
||||
label: response.title + '<span class="close"><img src="/extras/wobject/EMS/close12_1.gif" alt="X" title="' +
|
||||
WebGUI.EMS.i18n.get('Asset_EventManagementSystem','close tab') + '" /></span>',
|
||||
contentEl: myContent
|
||||
});
|
||||
// initHoverHelp( myTab );
|
||||
WebGUI.EMS.tabs.addTab( myTab );
|
||||
var index = WebGUI.EMS.tabs.getTabIndex(myTab);
|
||||
YAHOO.util.Event.on(myTab.getElementsByClassName('close')[0], 'click', WebGUI.EMS.closeTab , myTab);
|
||||
WebGUI.EMS.items[index] = new Object();
|
||||
WebGUI.EMS.items[index].tab = myTab;
|
||||
WebGUI.EMS.items[index].id = response.id;
|
||||
WebGUI.EMS.items[index].title = response.title;
|
||||
//} else {
|
||||
//myTab = WebGUI.EMS.items[response.title].tab;
|
||||
//myTab.set('content', response.text);
|
||||
}
|
||||
// make sure the script on the ticket has run
|
||||
// if( typeof( WebGUI.ticketJScriptRun ) == "undefined" ) {
|
||||
// eval( document.getElementById("ticketJScript").innerHTML );
|
||||
// }
|
||||
// delete WebGUI.ticketJScriptRun;
|
||||
WebGUI.EMS.loadingIndicator.hide();
|
||||
WebGUI.EMS.lastTab = WebGUI.EMS.tabs.get('activeTab');
|
||||
WebGUI.EMS.tabs.set('activeTab',myTab);
|
||||
},
|
||||
failure: function(o) {
|
||||
WebGUI.EMS.loadingIndicator.hide();
|
||||
alert("AJAX call failed");
|
||||
}
|
||||
};
|
||||
var request = YAHOO.util.Connect.asyncRequest('GET', url + ';asJson=1' , oCallback);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
//This method is out here so it can be overridden. The datatable uses this method to sort it's columns
|
||||
WebGUI.EMS.sortColumn = function(oColumn,sDir) {
|
||||
// Default ascending
|
||||
var sDir = "desc";
|
||||
|
||||
// If already sorted, sort in opposite direction
|
||||
if(oColumn.key === this.get("sortedBy").key) {
|
||||
sDir = (this.get("sortedBy").dir === DataTable.CLASS_ASC) ? "desc" : "asc";
|
||||
}
|
||||
|
||||
// Define the new state
|
||||
var newState = {
|
||||
startIndex: 0,
|
||||
sorting: { // Sort values
|
||||
key: oColumn.key,
|
||||
dir: (sDir === "asc") ? DataTable.CLASS_ASC : DataTable.CLASS_DESC
|
||||
},
|
||||
pagination : { // Pagination values
|
||||
startIndex: 0, // Default to first page when sorting
|
||||
rowsPerPage: this.get("paginator").getRowsPerPage() // Keep current setting
|
||||
}
|
||||
};
|
||||
|
||||
// Create callback object for the request
|
||||
var oCallback = {
|
||||
success: this.onDataReturnSetRows,
|
||||
failure: this.onDataReturnSetRows,
|
||||
scope: this,
|
||||
argument: newState // Pass in new state as data payload for callback function to use
|
||||
};
|
||||
|
||||
// Send the request
|
||||
this.getDataSource().sendRequest(WebGUI.EMS.buildQueryString(newState, this), oCallback);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// This method checks for modifier keys pressed during the mouse click
|
||||
function eventModifiers( e ) {
|
||||
if( e.event.modifiers ) {
|
||||
return e.event.modifiers & (Event.ALT_MASK | Event.CONTROL_MASK
|
||||
| Event.SHIFT_MASK | Event.META_MASK);
|
||||
} else {
|
||||
return e.event.altKey | e.event.shiftKey | e.event.ctrlKey;
|
||||
}
|
||||
}
|
||||
|
||||
//***********************************************************************************
|
||||
// This method does the actual work of loading an item into a tab
|
||||
//
|
||||
WebGUI.EMS.loadItem = function ( contentId ) {
|
||||
var submissionId = parseInt( contentId, 10 );
|
||||
var url;
|
||||
// compare contentId with submissionId incase we get an assetId that starts with numeric chars
|
||||
if( contentId == submissionId ) {
|
||||
url = WebGUI.EMS.tabContent['editSubmission'] + ";submissionId=" + submissionId;
|
||||
} else {
|
||||
url = WebGUI.EMS.tabContent[contentId];
|
||||
}
|
||||
WebGUI.EMS.newTab(url);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// Load an item when the user clicks on an anchor html element
|
||||
//
|
||||
WebGUI.EMS.loadItemFromAnchor = function ( anchorObject ) {
|
||||
var tabContent = anchorObject.hash.substring(1);
|
||||
WebGUI.EMS.loadItem(tabContent);
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// This method is subscribed to by the DataTable and thus becomes a member of the DataTable
|
||||
// class even though it is a member of the EMS Class. For this reason, a EMS instance
|
||||
// is actually passed to the method as it's second parameter.
|
||||
//
|
||||
WebGUI.EMS.loadItemFromTable = function ( evt, obj ) {
|
||||
// if the user pressed a modifier key we want to default
|
||||
if( eventModifiers( evt ) ) { return }
|
||||
var target = evt.target;
|
||||
YAHOO.util.Event.stopEvent(evt.event);
|
||||
var elCell = this.getTdEl(target);
|
||||
if(elCell) {
|
||||
var oRecord = this.getRecord(elCell);
|
||||
var submissionId = oRecord.getData('submissionId');
|
||||
|
||||
if( typeof( WebGUI.EMS.items[submissionId] ) != "undefined" ) {
|
||||
WebGUI.EMS.tabs.set('activeTab',WebGUI.EMS.items[submissionId].tab);
|
||||
WebGUI.EMS.loadingIndicator.hide();
|
||||
} else {
|
||||
WebGUI.EMS.loadItem( submissionId );
|
||||
}
|
||||
} else {
|
||||
alert("Could not get table cell for " + target);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Public Instance Methods
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
//***********************************************************************************
|
||||
this.getDataTable = function() {
|
||||
if(!this.EMSQ) {
|
||||
return {};
|
||||
}
|
||||
return this.EMSQ;
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
this.getDefaultSort = function() {
|
||||
if(this._configs.defaultSort) {
|
||||
return this._configs.defaultSort;
|
||||
}
|
||||
return {
|
||||
"key" : "creationDate",
|
||||
"dir" : DataTable.CLASS_DESC
|
||||
};
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
// Override this method if you want pagination to work differently
|
||||
this.getPaginator = function () {
|
||||
return new Paginator({
|
||||
containers : this._configs.p_containers,
|
||||
pageLinks : 5,
|
||||
rowsPerPage : 25,
|
||||
rowsPerPageOptions : [25,50,100],
|
||||
template : "<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}"
|
||||
});
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
this.initDataTable = function () {
|
||||
var datasource = new DataSource(this._configs.datasource);
|
||||
datasource.responseType = DataSource.TYPE_JSON;
|
||||
datasource.responseSchema = {
|
||||
resultsList : 'records',
|
||||
fields : this._configs.fields,
|
||||
metaFields : { totalRecords: 'totalRecords' }
|
||||
};
|
||||
|
||||
// Initialize the data table
|
||||
this.EMSQ = new DataTable(
|
||||
this._configs.dtContainer,
|
||||
this._configs.columns,
|
||||
datasource,
|
||||
{
|
||||
initialRequest : this._configs.initRequestString,
|
||||
paginationEventHandler : WebGUI.EMS.handlePagination,
|
||||
paginator : this.getPaginator(),
|
||||
dynamicData : true,
|
||||
sortedBy : this.getDefaultSort()
|
||||
}
|
||||
);
|
||||
this.EMSQ.subscribe("rowMouseoverEvent", this.EMSQ.onEventHighlightRow);
|
||||
this.EMSQ.subscribe("rowMouseoutEvent", this.EMSQ.onEventUnhighlightRow);
|
||||
this.EMSQ.subscribe("cellClickEvent",WebGUI.EMS.loadItemFromTable,this);
|
||||
// Override function for custom server-side sorting
|
||||
this.EMSQ.sortColumn = WebGUI.EMS.sortColumn;
|
||||
this.EMSQ.handleDataReturnPayload = function (oReq, oRes, oPayload ) {
|
||||
oPayload.totalRecords = parseInt( oRes.meta.totalRecords );
|
||||
return oPayload;
|
||||
};
|
||||
this.EMSQ.generateRequest = WebGUI.EMS.buildQueryString;
|
||||
|
||||
//Work around nested scoping for the callback
|
||||
var myEMSQ = this.EMSQ;
|
||||
//ensure no memory leaks with the datatable
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Public Static Methods
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
//***********************************************************************************
|
||||
WebGUI.EMS.formatTitle = function ( elCell, oRecord, oColumn, orderNumber ) {
|
||||
elCell.innerHTML = '<a href="' + oRecord.getData('url') + '>'
|
||||
+ oRecord.getData( 'title' )
|
||||
+ '</a>'
|
||||
;
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
WebGUI.EMS.buildQueryString = function ( state, dt ) {
|
||||
var query = ";startIndex=" + state.pagination.startIndex
|
||||
+ ';orderByDirection=' + ((state.sortedBy.dir === DataTable.CLASS_ASC) ? "ASC" : "DESC")
|
||||
+ ';rowsPerPage=' + state.pagination.rowsPerPage
|
||||
+ ';orderByColumn=' + state.sortedBy.key
|
||||
;
|
||||
return query;
|
||||
};
|
||||
|
||||
BIN
www/extras/wobject/Profiler/blank.png
Normal file
|
After Width: | Height: | Size: 144 B |
BIN
www/extras/wobject/Profiler/downsimple.png
Normal file
|
After Width: | Height: | Size: 201 B |
455
www/extras/wobject/Profiler/sortabletable.js
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Sortable Table 1.12 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| A DOM 1 based script that allows an ordinary HTML table to be sortable. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 1998 - 2004 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| This software is provided "as is", without warranty of any kind, express or |
|
||||
| implied, including but not limited to the warranties of merchantability, |
|
||||
| fitness for a particular purpose and noninfringement. In no event shall the |
|
||||
| authors or copyright holders be liable for any claim, damages or other |
|
||||
| liability, whether in an action of contract, tort or otherwise, arising |
|
||||
| from, out of or in connection with the software or the use or other |
|
||||
| dealings in the software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| This software is available under the three different licenses mentioned |
|
||||
| below. To use this software you must chose, and qualify, for one of those. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
|
||||
| Permits anyone the right to use the software in a non-commercial context |
|
||||
| free of charge. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
|
||||
| Permits the license holder the right to use the software in a commercial |
|
||||
| context. Such license must be specifically obtained, however it's valid for |
|
||||
| any number of implementations of the licensed software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|
||||
| Permits anyone the right to use and modify the software without limitations |
|
||||
| as long as proper credits are given and the original and modified source |
|
||||
| code are included. Requires that the final product, software derivate from |
|
||||
| the original source or any software utilizing a GPL component, such as |
|
||||
| this, is also licensed under the GPL license. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| 2003-01-10 | First version |
|
||||
| 2003-01-19 | Minor changes to the date parsing |
|
||||
| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |
|
||||
| 2003-02-01 | Sloppy typo like error fixed in getInnerText |
|
||||
| 2003-07-04 | Added workaround for IE cellIndex bug. |
|
||||
| 2003-11-09 | The bDescending argument to sort was not correctly working |
|
||||
| | Using onclick DOM0 event if no support for addEventListener |
|
||||
| | or attachEvent |
|
||||
| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |
|
||||
| | easier to add new, custom sort types. |
|
||||
| 2004-01-27 | Switch to use descending = false as the default sort order. |
|
||||
| | Change defaultDescending to suit your needs. |
|
||||
| 2004-03-14 | Improved sort type None look and feel a bit |
|
||||
| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |
|
||||
| | can use another tHead or no tHead, and you can chose some |
|
||||
| | other tBody. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created 2003-01-10 | All changes are in the log above. | Updated 2004-08-26 |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function SortableTable(oTable, oSortTypes) {
|
||||
|
||||
this.sortTypes = oSortTypes || [];
|
||||
|
||||
this.sortColumn = null;
|
||||
this.descending = null;
|
||||
|
||||
var oThis = this;
|
||||
this._headerOnclick = function (e) {
|
||||
oThis.headerOnclick(e);
|
||||
};
|
||||
|
||||
if (oTable) {
|
||||
this.setTable( oTable );
|
||||
this.document = oTable.ownerDocument || oTable.document;
|
||||
}
|
||||
else {
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
|
||||
// only IE needs this
|
||||
var win = this.document.defaultView || this.document.parentWindow;
|
||||
this._onunload = function () {
|
||||
oThis.destroy();
|
||||
};
|
||||
if (win && typeof win.attachEvent != "undefined") {
|
||||
win.attachEvent("onunload", this._onunload);
|
||||
}
|
||||
}
|
||||
|
||||
SortableTable.gecko = navigator.product == "Gecko";
|
||||
SortableTable.msie = /msie/i.test(navigator.userAgent);
|
||||
// Mozilla is faster when doing the DOM manipulations on
|
||||
// an orphaned element. MSIE is not
|
||||
SortableTable.removeBeforeSort = SortableTable.gecko;
|
||||
|
||||
SortableTable.prototype.onsort = function () {};
|
||||
|
||||
// default sort order. true -> descending, false -> ascending
|
||||
SortableTable.prototype.defaultDescending = false;
|
||||
|
||||
// shared between all instances. This is intentional to allow external files
|
||||
// to modify the prototype
|
||||
SortableTable.prototype._sortTypeInfo = {};
|
||||
|
||||
SortableTable.prototype.setTable = function (oTable) {
|
||||
if ( this.tHead )
|
||||
this.uninitHeader();
|
||||
this.element = oTable;
|
||||
this.setTHead( oTable.tHead );
|
||||
this.setTBody( oTable.tBodies[0] );
|
||||
};
|
||||
|
||||
SortableTable.prototype.setTHead = function (oTHead) {
|
||||
if (this.tHead && this.tHead != oTHead )
|
||||
this.uninitHeader();
|
||||
this.tHead = oTHead;
|
||||
this.initHeader( this.sortTypes );
|
||||
};
|
||||
|
||||
SortableTable.prototype.setTBody = function (oTBody) {
|
||||
this.tBody = oTBody;
|
||||
};
|
||||
|
||||
SortableTable.prototype.setSortTypes = function ( oSortTypes ) {
|
||||
if ( this.tHead )
|
||||
this.uninitHeader();
|
||||
this.sortTypes = oSortTypes || [];
|
||||
if ( this.tHead )
|
||||
this.initHeader( this.sortTypes );
|
||||
};
|
||||
|
||||
// adds arrow containers and events
|
||||
// also binds sort type to the header cells so that reordering columns does
|
||||
// not break the sort types
|
||||
SortableTable.prototype.initHeader = function (oSortTypes) {
|
||||
if (!this.tHead) return;
|
||||
var cells = this.tHead.rows[0].cells;
|
||||
var doc = this.tHead.ownerDocument || this.tHead.document;
|
||||
this.sortTypes = oSortTypes || [];
|
||||
var l = cells.length;
|
||||
var img, c;
|
||||
for (var i = 0; i < l; i++) {
|
||||
c = cells[i];
|
||||
if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {
|
||||
img = doc.createElement("IMG");
|
||||
img.src = getWebguiProperty('extrasURL')+"/wobject/Profiler/blank.png";
|
||||
c.appendChild(img);
|
||||
if (this.sortTypes[i] != null)
|
||||
c._sortType = this.sortTypes[i];
|
||||
if (typeof c.addEventListener != "undefined")
|
||||
c.addEventListener("click", this._headerOnclick, false);
|
||||
else if (typeof c.attachEvent != "undefined")
|
||||
c.attachEvent("onclick", this._headerOnclick);
|
||||
else
|
||||
c.onclick = this._headerOnclick;
|
||||
}
|
||||
else
|
||||
{
|
||||
c.setAttribute( "_sortType", oSortTypes[i] );
|
||||
c._sortType = "None";
|
||||
}
|
||||
}
|
||||
this.updateHeaderArrows();
|
||||
};
|
||||
|
||||
// remove arrows and events
|
||||
SortableTable.prototype.uninitHeader = function () {
|
||||
if (!this.tHead) return;
|
||||
var cells = this.tHead.rows[0].cells;
|
||||
var l = cells.length;
|
||||
var c;
|
||||
for (var i = 0; i < l; i++) {
|
||||
c = cells[i];
|
||||
if (c._sortType != null && c._sortType != "None") {
|
||||
c.removeChild(c.lastChild);
|
||||
if (typeof c.removeEventListener != "undefined")
|
||||
c.removeEventListener("click", this._headerOnclick, false);
|
||||
else if (typeof c.detachEvent != "undefined")
|
||||
c.detachEvent("onclick", this._headerOnclick);
|
||||
c._sortType = null;
|
||||
c.removeAttribute( "_sortType" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SortableTable.prototype.updateHeaderArrows = function () {
|
||||
if (!this.tHead) return;
|
||||
var cells = this.tHead.rows[0].cells;
|
||||
var l = cells.length;
|
||||
var img;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cells[i]._sortType != null && cells[i]._sortType != "None") {
|
||||
img = cells[i].lastChild;
|
||||
if (i == this.sortColumn)
|
||||
img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");
|
||||
else
|
||||
img.className = "sort-arrow";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SortableTable.prototype.headerOnclick = function (e) {
|
||||
// find TD element
|
||||
var el = e.target || e.srcElement;
|
||||
while (el.tagName != "TD")
|
||||
el = el.parentNode;
|
||||
|
||||
this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);
|
||||
};
|
||||
|
||||
// IE returns wrong cellIndex when columns are hidden
|
||||
SortableTable.getCellIndex = function (oTd) {
|
||||
var cells = oTd.parentNode.childNodes
|
||||
var l = cells.length;
|
||||
var i;
|
||||
for (i = 0; cells[i] != oTd && i < l; i++)
|
||||
;
|
||||
return i;
|
||||
};
|
||||
|
||||
SortableTable.prototype.getSortType = function (nColumn) {
|
||||
return this.sortTypes[nColumn] || "String";
|
||||
};
|
||||
|
||||
// only nColumn is required
|
||||
// if bDescending is left out the old value is taken into account
|
||||
// if sSortType is left out the sort type is found from the sortTypes array
|
||||
|
||||
SortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {
|
||||
if (!this.tBody) return;
|
||||
if (sSortType == null)
|
||||
sSortType = this.getSortType(nColumn);
|
||||
|
||||
// exit if None
|
||||
if (sSortType == "None")
|
||||
return;
|
||||
|
||||
if (bDescending == null) {
|
||||
if (this.sortColumn != nColumn)
|
||||
this.descending = this.defaultDescending;
|
||||
else
|
||||
this.descending = !this.descending;
|
||||
}
|
||||
else
|
||||
this.descending = bDescending;
|
||||
|
||||
this.sortColumn = nColumn;
|
||||
|
||||
if (typeof this.onbeforesort == "function")
|
||||
this.onbeforesort();
|
||||
|
||||
var f = this.getSortFunction(sSortType, nColumn);
|
||||
var a = this.getCache(sSortType, nColumn);
|
||||
var tBody = this.tBody;
|
||||
|
||||
a.sort(f);
|
||||
|
||||
if (this.descending)
|
||||
a.reverse();
|
||||
|
||||
if (SortableTable.removeBeforeSort) {
|
||||
// remove from doc
|
||||
var nextSibling = tBody.nextSibling;
|
||||
var p = tBody.parentNode;
|
||||
p.removeChild(tBody);
|
||||
}
|
||||
|
||||
// insert in the new order
|
||||
var l = a.length;
|
||||
for (var i = 0; i < l; i++)
|
||||
tBody.appendChild(a[i].element);
|
||||
|
||||
if (SortableTable.removeBeforeSort) {
|
||||
// insert into doc
|
||||
p.insertBefore(tBody, nextSibling);
|
||||
}
|
||||
|
||||
this.updateHeaderArrows();
|
||||
|
||||
this.destroyCache(a);
|
||||
|
||||
if (typeof this.onsort == "function")
|
||||
this.onsort();
|
||||
};
|
||||
|
||||
SortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {
|
||||
var oThis = this;
|
||||
this._asyncsort = function () {
|
||||
oThis.sort(nColumn, bDescending, sSortType);
|
||||
};
|
||||
window.setTimeout(this._asyncsort, 1);
|
||||
};
|
||||
|
||||
SortableTable.prototype.getCache = function (sType, nColumn) {
|
||||
if (!this.tBody) return [];
|
||||
var rows = this.tBody.rows;
|
||||
var l = rows.length;
|
||||
var a = new Array(l);
|
||||
var r;
|
||||
for (var i = 0; i < l; i++) {
|
||||
r = rows[i];
|
||||
a[i] = {
|
||||
value: this.getRowValue(r, sType, nColumn),
|
||||
element: r
|
||||
};
|
||||
};
|
||||
return a;
|
||||
};
|
||||
|
||||
SortableTable.prototype.destroyCache = function (oArray) {
|
||||
var l = oArray.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
oArray[i].value = null;
|
||||
oArray[i].element = null;
|
||||
oArray[i] = null;
|
||||
}
|
||||
};
|
||||
|
||||
SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {
|
||||
// if we have defined a custom getRowValue use that
|
||||
if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)
|
||||
return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);
|
||||
|
||||
var s;
|
||||
var c = oRow.cells[nColumn];
|
||||
if (typeof c.innerText != "undefined")
|
||||
s = c.innerText;
|
||||
else
|
||||
s = SortableTable.getInnerText(c);
|
||||
return this.getValueFromString(s, sType);
|
||||
};
|
||||
|
||||
SortableTable.getInnerText = function (oNode) {
|
||||
var s = "";
|
||||
var cs = oNode.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
switch (cs[i].nodeType) {
|
||||
case 1: //ELEMENT_NODE
|
||||
s += SortableTable.getInnerText(cs[i]);
|
||||
break;
|
||||
case 3: //TEXT_NODE
|
||||
s += cs[i].nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
SortableTable.prototype.getValueFromString = function (sText, sType) {
|
||||
if (this._sortTypeInfo[sType])
|
||||
return this._sortTypeInfo[sType].getValueFromString( sText );
|
||||
return sText;
|
||||
/*
|
||||
switch (sType) {
|
||||
case "Number":
|
||||
return Number(sText);
|
||||
case "CaseInsensitiveString":
|
||||
return sText.toUpperCase();
|
||||
case "Date":
|
||||
var parts = sText.split("-");
|
||||
var d = new Date(0);
|
||||
d.setFullYear(parts[0]);
|
||||
d.setDate(parts[2]);
|
||||
d.setMonth(parts[1] - 1);
|
||||
return d.valueOf();
|
||||
}
|
||||
return sText;
|
||||
*/
|
||||
};
|
||||
|
||||
SortableTable.prototype.getSortFunction = function (sType, nColumn) {
|
||||
if (this._sortTypeInfo[sType])
|
||||
return this._sortTypeInfo[sType].compare;
|
||||
return SortableTable.basicCompare;
|
||||
};
|
||||
|
||||
SortableTable.prototype.destroy = function () {
|
||||
this.uninitHeader();
|
||||
var win = this.document.parentWindow;
|
||||
if (win && typeof win.detachEvent != "undefined") { // only IE needs this
|
||||
win.detachEvent("onunload", this._onunload);
|
||||
}
|
||||
this._onunload = null;
|
||||
this.element = null;
|
||||
this.tHead = null;
|
||||
this.tBody = null;
|
||||
this.document = null;
|
||||
this._headerOnclick = null;
|
||||
this.sortTypes = null;
|
||||
this._asyncsort = null;
|
||||
this.onsort = null;
|
||||
};
|
||||
|
||||
// Adds a sort type to all instance of SortableTable
|
||||
// sType : String - the identifier of the sort type
|
||||
// fGetValueFromString : function ( s : string ) : T - A function that takes a
|
||||
// string and casts it to a desired format. If left out the string is just
|
||||
// returned
|
||||
// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort
|
||||
// compare function. Takes two values and compares them. If left out less than,
|
||||
// <, compare is used
|
||||
// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function
|
||||
// that takes the row and the column index and returns the value used to compare.
|
||||
// If left out then the innerText is first taken for the cell and then the
|
||||
// fGetValueFromString is used to convert that string the desired value and type
|
||||
|
||||
SortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {
|
||||
this._sortTypeInfo[sType] = {
|
||||
type: sType,
|
||||
getValueFromString: fGetValueFromString || SortableTable.idFunction,
|
||||
compare: fCompareFunction || SortableTable.basicCompare,
|
||||
getRowValue: fGetRowValue
|
||||
};
|
||||
};
|
||||
|
||||
// this removes the sort type from all instances of SortableTable
|
||||
SortableTable.prototype.removeSortType = function (sType) {
|
||||
delete this._sortTypeInfo[sType];
|
||||
};
|
||||
|
||||
SortableTable.basicCompare = function compare(n1, n2) {
|
||||
if (n1.value < n2.value)
|
||||
return -1;
|
||||
if (n2.value < n1.value)
|
||||
return 1;
|
||||
return 0;
|
||||
};
|
||||
|
||||
SortableTable.idFunction = function (x) {
|
||||
return x;
|
||||
};
|
||||
|
||||
SortableTable.toUpperCase = function (s) {
|
||||
return s.toUpperCase();
|
||||
};
|
||||
|
||||
SortableTable.toDate = function (s) {
|
||||
var parts = s.split("-");
|
||||
var d = new Date(0);
|
||||
d.setFullYear(parts[0]);
|
||||
d.setDate(parts[2]);
|
||||
d.setMonth(parts[1] - 1);
|
||||
return d.valueOf();
|
||||
};
|
||||
|
||||
|
||||
// add sort types
|
||||
SortableTable.prototype.addSortType("Number", Number);
|
||||
SortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);
|
||||
SortableTable.prototype.addSortType("Date", SortableTable.toDate);
|
||||
SortableTable.prototype.addSortType("String");
|
||||
// None is a special case
|
||||
BIN
www/extras/wobject/Profiler/upsimple.png
Normal file
|
After Width: | Height: | Size: 201 B |
BIN
www/extras/wobject/ProjectManager/add.gif
Normal file
|
After Width: | Height: | Size: 346 B |
36
www/extras/wobject/ProjectManager/cMenu.css
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
.cMenu_skin {
|
||||
background-color: #FFFFFF;
|
||||
background-image: url(office_xp_menu_left.png);
|
||||
background-repeat: repeat-y;
|
||||
border: 1px solid #8A867A;
|
||||
cursor: default;
|
||||
position: absolute; /* Do not alter this line! */
|
||||
visibility: hidden;
|
||||
z-index: 100;
|
||||
color: #000000;
|
||||
font-family: Tahoma, Helvetica, sans, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 30px;
|
||||
padding-right: 15px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.cMenu_skin A, .cMenu_skin A:link, .cMenu_skin A:visited {
|
||||
font-weight: normal;
|
||||
width: 100%;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
margin: 1px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.cMenu_skin A:hover {
|
||||
background-color: #C1D2EE;
|
||||
border: 1px solid #316AC5;
|
||||
color: #000000;
|
||||
font-family: Tahoma, Helvetica, sans, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
}
|
||||
352
www/extras/wobject/ProjectManager/cMenu.js
Normal file
|
|
@ -0,0 +1,352 @@
|
|||
/*
|
||||
Determine whether the browser is IE5.0.
|
||||
*/
|
||||
function isIE50() { // Private method
|
||||
return isIE5() && !isIE55();
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether the browser is IE5.5.
|
||||
*/
|
||||
function isIE55() { // Private method
|
||||
return navigator.userAgent.indexOf("MSIE 5.5") > -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether the browser is IE5.0 or IE5.5.
|
||||
*/
|
||||
function isIE5() { // Private method
|
||||
return navigator.userAgent.indexOf("MSIE 5") > -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether the browser is IE6.
|
||||
*/
|
||||
function isIE6() { // Private method
|
||||
return navigator.userAgent.indexOf("MSIE 6") > -1 && navigator.userAgent.indexOf("Opera") == -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether the browser is IE.
|
||||
*/
|
||||
function isIE() { // Private method
|
||||
return isIE5() || isIE6();
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether the browser is Opera.
|
||||
*/
|
||||
function isOpera() { // Private method
|
||||
return navigator.userAgent.indexOf("Opera") > -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether the browser is Safari.
|
||||
*/
|
||||
function isSafari() { // Private method
|
||||
return navigator.userAgent.indexOf("Safari") > -1;
|
||||
}
|
||||
|
||||
var ie50 = isIE50(); // Private field
|
||||
var ie55 = isIE55(); // Private field
|
||||
var ie5 = isIE5(); // Private field
|
||||
var ie6 = isIE6(); // Private field
|
||||
var ie = isIE(); // Private field
|
||||
var opera = isOpera(); // Private field
|
||||
var safari = isSafari(); // Private field
|
||||
var pageMode = getPageMode();
|
||||
var px = "px";
|
||||
|
||||
var cMenu_items = new Array();
|
||||
|
||||
if (cMenu_old == undefined)
|
||||
{
|
||||
var cMenu_old = (document.onclick) ? document.onclick : function () {};
|
||||
document.onclick= function () {cMenu_old();cMenu_hide();};
|
||||
}
|
||||
|
||||
/*
|
||||
Determine the page render mode.
|
||||
|
||||
0: Quirks mode.
|
||||
1: Strict mode.
|
||||
*/
|
||||
function getPageMode() { // Private method
|
||||
if (document.compatMode) {
|
||||
switch (document.compatMode) {
|
||||
case "BackCompat":
|
||||
return 0;
|
||||
case "CSS1Compat":
|
||||
return 1;
|
||||
case "QuirksMode":
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ie5) {
|
||||
return 0;
|
||||
}
|
||||
if (safari) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getMainMenuLeftPos(menuObj, x) { // Private method
|
||||
//alert(x);
|
||||
if (x + menuObj.offsetWidth <= getClientWidth()) {
|
||||
return x;
|
||||
}
|
||||
else {
|
||||
return x - menuObj.offsetWidth;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the top position of the pop-up menu.
|
||||
*/
|
||||
function getMainMenuTopPos(menuObj, y) { // Private method
|
||||
//alert(y);
|
||||
if (y + menuObj.offsetHeight <= getClientHeight()) {
|
||||
return y;
|
||||
}
|
||||
else {
|
||||
return y - menuObj.offsetHeight;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the clientHeight property.
|
||||
*/
|
||||
function getClientHeight() { // Private method
|
||||
switch (pageMode) {
|
||||
case 0:
|
||||
return document.body.clientHeight;
|
||||
case 1:
|
||||
if (safari) {
|
||||
return self.innerHeight;
|
||||
}
|
||||
else {
|
||||
if (!opera && document.documentElement && document.documentElement.clientHeight > 0) {
|
||||
return document.documentElement.clientHeight;
|
||||
}
|
||||
else {
|
||||
return document.body.clientHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the clientWidth property.
|
||||
*/
|
||||
function getClientWidth() { // Private method
|
||||
switch (pageMode) {
|
||||
case 0:
|
||||
return document.body.clientWidth;
|
||||
case 1:
|
||||
if (safari) {
|
||||
return self.innerWidth;
|
||||
}
|
||||
else {
|
||||
if (!opera && document.documentElement && document.documentElement.clientWidth > 0) {
|
||||
return document.documentElement.clientWidth;
|
||||
}
|
||||
else {
|
||||
return document.body.clientWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the x-coordinate of the cursor position relative to the window.
|
||||
*/
|
||||
function getX(e) { // Private method
|
||||
if (!e) {
|
||||
var e = window.event;
|
||||
}
|
||||
if (safari) {
|
||||
return e.clientX - getScrollLeft();
|
||||
}
|
||||
else {
|
||||
return e.clientX;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the y-coordinate of the cursor position relative to the window.
|
||||
*/
|
||||
function getY(e) { // Private method
|
||||
if (!e) {
|
||||
var e = window.event;
|
||||
}
|
||||
if (safari) {
|
||||
return e.clientY - getScrollTop();
|
||||
}
|
||||
else {
|
||||
return e.clientY;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the scrollLeft property.
|
||||
*/
|
||||
function getScrollLeft() { // Private method
|
||||
switch (pageMode) {
|
||||
case 0:
|
||||
return document.body.scrollLeft;
|
||||
case 1:
|
||||
if (document.documentElement && document.documentElement.scrollLeft > 0) {
|
||||
return document.documentElement.scrollLeft;
|
||||
}
|
||||
else {
|
||||
return document.body.scrollLeft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Get the scrollTop property.
|
||||
*/
|
||||
function getScrollTop() { // Private method
|
||||
switch (pageMode) {
|
||||
case 0:
|
||||
return document.body.scrollTop;
|
||||
case 1:
|
||||
if (document.documentElement && document.documentElement.scrollTop > 0) {
|
||||
return document.documentElement.scrollTop;
|
||||
}
|
||||
else {
|
||||
return document.body.scrollTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cMenu_renderLeftClick(menuId,e) {
|
||||
cMenu_hide(e);
|
||||
cMenu_show(menuId,e);
|
||||
e.cancelBubble=true;
|
||||
e.returnValue=false;
|
||||
return false;
|
||||
}
|
||||
|
||||
function cMenu_show(menuId,e){
|
||||
// alert(menuId);
|
||||
var menuobj=document.getElementById(menuId)
|
||||
var posx = 0;
|
||||
var posy = 0;
|
||||
var yoffset = 0;
|
||||
var xoffset = 0;
|
||||
var firedobj = ie5?e.srcElement:e.target;
|
||||
/*while (firedobj!=null && firedobj.tagName!="HTML"){
|
||||
//this is a hack, need to revisit
|
||||
if (firedobj.tagName == "DIV") {
|
||||
xoffset+=firedobj.offsetLeft;
|
||||
yoffset+=firedobj.offsetTop;
|
||||
}
|
||||
firedobj=firedobj.offsetParent;
|
||||
}
|
||||
|
||||
var el = document.documentElement;
|
||||
posx = e.clientX - xoffset + (ie5? el.scrollLeft : window.pageXOffset);
|
||||
posy = e.clientY - yoffset + (ie5? el.scrollTop : window.pageYOffset);
|
||||
alert(posx);
|
||||
alert(posy);
|
||||
//menuobj.style.left=posx + "px";
|
||||
//menuobj.style.top=posy + "px";
|
||||
*/
|
||||
var hackedTopOffset = (ie?180:130);
|
||||
menuobj.style.left = (getMainMenuLeftPos(menuobj, getX(e)) + getScrollLeft()) + px;
|
||||
menuobj.style.top = (getMainMenuTopPos(menuobj, getY(e)) + getScrollTop() - hackedTopOffset) + px;
|
||||
//alert(menuobj.style.left);
|
||||
//alert(menuobj.style.top);
|
||||
menuobj.style.visibility="visible"
|
||||
return false
|
||||
}
|
||||
|
||||
function cMenu_hide(){
|
||||
for (i=0;i<cMenu_items.length;i++) {
|
||||
document.getElementById("cMenu_"+cMenu_items[i]+"_menu").style.visibility="hidden"
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function cMenu_createWithImage(imagePath, id, name){
|
||||
cMenu_items.push(id);
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.type = "image";
|
||||
this.imagePath=imagePath;
|
||||
this.linkLabels = new Array();
|
||||
this.linkUrls = new Array();
|
||||
this.draw = cMenu_draw;
|
||||
this.print = cMenu_print;
|
||||
this.addLink = cMenu_addLink;
|
||||
}
|
||||
|
||||
function cMenu_createWithLink(id, name){
|
||||
cMenu_items.push(id);
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.type = "link";
|
||||
this.linkLabels = new Array();
|
||||
this.linkUrls = new Array();
|
||||
this.draw = cMenu_draw;
|
||||
this.print = cMenu_print;
|
||||
this.addLink = cMenu_addLink;
|
||||
}
|
||||
|
||||
function cMenu_draw(){
|
||||
var output = "";
|
||||
output += '<div id="cMenu_' + this.id + '_menu" class="cMenu_skin">';
|
||||
for (i=0;i<this.linkUrls.length;i++) {
|
||||
var urlparts = this.linkUrls[i].split("?");
|
||||
var dataparts = urlparts[1].split(";");
|
||||
var projectId = "";
|
||||
var taskId = "";
|
||||
var insertAt = "";
|
||||
for (var j = 0; j < dataparts.length; j++) {
|
||||
var keyval = dataparts[j].split("=");
|
||||
var key = keyval[0];
|
||||
var val = keyval[1];
|
||||
if(key == "projectId") {
|
||||
projectId = val;
|
||||
}
|
||||
else if(key == "taskId") {
|
||||
taskId = val;
|
||||
}
|
||||
else if(key == "insertAt") {
|
||||
insertAt = val;
|
||||
}
|
||||
}
|
||||
|
||||
var clazz = "submodal-400-300";
|
||||
var id = projectId + "~~" + taskId + "~~" + insertAt;
|
||||
var url = "#";
|
||||
if(this.linkUrls[i].indexOf("delete") != -1) {
|
||||
clazz = "";
|
||||
url = this.linkUrls[i];
|
||||
id = "";
|
||||
}
|
||||
|
||||
output += "<a href=\"" + url + "\" class=\"" + clazz + "\" id=\"" + id +"\">" + this.linkLabels[i] + "</a><br />";
|
||||
}
|
||||
output += '</div>';
|
||||
if (this.type == "image") {
|
||||
output += '<img src="' + this.imagePath + '" id="cMenu_' + this.id + '" onclick="return cMenu_renderLeftClick(\'cMenu_' + this.id + '_menu\',event)" alt="' + this.name + '" title="' + this.name + '" align="absmiddle" />';
|
||||
} else {
|
||||
output += '<a href="#" id="cMenu_' + this.id + '" onclick="return cMenu_renderLeftClick(\'cMenu_' + this.id + '_menu\',event)">' + this.name + '</a>';
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function cMenu_print(){
|
||||
document.write(this.draw());
|
||||
}
|
||||
|
||||
function cMenu_addLink(linkUrl,linkLabel){
|
||||
this.linkUrls.push(linkUrl);
|
||||
this.linkLabels.push(linkLabel);
|
||||
}
|
||||
BIN
www/extras/wobject/ProjectManager/close.gif
Normal file
|
After Width: | Height: | Size: 609 B |
BIN
www/extras/wobject/ProjectManager/delete.gif
Normal file
|
After Width: | Height: | Size: 334 B |
BIN
www/extras/wobject/ProjectManager/edit.gif
Normal file
|
After Width: | Height: | Size: 577 B |
BIN
www/extras/wobject/ProjectManager/groups.gif
Normal file
|
After Width: | Height: | Size: 680 B |
BIN
www/extras/wobject/ProjectManager/maskBG.png
Normal file
|
After Width: | Height: | Size: 137 B |
98
www/extras/wobject/ProjectManager/modal.js
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
|
||||
/**
|
||||
* Initializes popup code on load.
|
||||
*/
|
||||
function initPopUp() {
|
||||
// Add onclick handlers to 'a' elements of class submodal or submodal-width-height
|
||||
var elms = document.getElementsByTagName('a');
|
||||
for (i = 0; i < elms.length; i++) {
|
||||
if (elms[i].className.indexOf("submodal") == 0) {
|
||||
YAHOO.util.Event.addListener(elms[i], "click", showPopWin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getProjectFromId(id) {
|
||||
var parts = id.split("~~");
|
||||
return parts[0];
|
||||
}
|
||||
|
||||
function getTaskFromId(id) {
|
||||
var parts = id.split("~~");
|
||||
return parts[1];
|
||||
}
|
||||
|
||||
function getInsertAtFromId(id) {
|
||||
var parts = id.split("~~");
|
||||
if(parts.length < 3) return null;
|
||||
var pos = parts[2];
|
||||
if(pos == "") return null;
|
||||
return pos;
|
||||
}
|
||||
|
||||
function hidePopWin() {
|
||||
var taskDialog = document.getElementById("popupInner");
|
||||
var parent = taskDialog.parentNode;
|
||||
parent.removeChild(taskDialog);
|
||||
initPopUp();
|
||||
}
|
||||
|
||||
|
||||
function showPopWin( e ) {
|
||||
|
||||
YAHOO.util.Event.stopEvent(e);
|
||||
var link = YAHOO.util.Event.getTarget(e);
|
||||
|
||||
if(link == "") {
|
||||
alert ("Could not get target from event. Pop up failed. Please refresh the page and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
var id = link.id;
|
||||
var url = getWebguiProperty("pageURL");
|
||||
var dataPart = "func=editTask&projectId=" + getProjectFromId(id) + "&taskId=" + getTaskFromId(id);
|
||||
var insertAt = getInsertAtFromId(id);
|
||||
if(insertAt) {
|
||||
dataPart += "&insertAt="+insertAt;
|
||||
}
|
||||
|
||||
this.success = true;
|
||||
this.taskDialog = null;
|
||||
|
||||
var callback = {
|
||||
success : doDialog,
|
||||
failure : function(req) { this.success = false; }
|
||||
}
|
||||
|
||||
if(this.success == false) {
|
||||
alert("Could not retrieve task form due to a connection error. Pop up failed. Please refresh the page and try again.");
|
||||
}
|
||||
|
||||
|
||||
var status = YAHOO.util.Connect.asyncRequest('POST',url,callback,dataPart);
|
||||
|
||||
}
|
||||
|
||||
function doDialog (req) {
|
||||
var contentArea = document.getElementById("PMproject");
|
||||
contentArea.innerHTML = "" + contentArea.innerHTML + req.responseText;
|
||||
var taskDialog = document.getElementById("popupInner");
|
||||
|
||||
// Instantiate the Dialog
|
||||
var dialog = new YAHOO.widget.Dialog(taskDialog, {
|
||||
width : "400px",
|
||||
fixedcenter : false,
|
||||
visible : true,
|
||||
constraintoviewport : false,
|
||||
modal : false,
|
||||
x : 200,
|
||||
y : 200
|
||||
});
|
||||
|
||||
// Render the Dialog
|
||||
dialog.render();
|
||||
}
|
||||
|
||||
YAHOO.util.Event.onDOMReady(initPopUp);
|
||||
|
||||
|
||||
BIN
www/extras/wobject/ProjectManager/office_xp_menu_left.png
Normal file
|
After Width: | Height: | Size: 136 B |
545
www/extras/wobject/ProjectManager/projectDisplay.js
Normal file
|
|
@ -0,0 +1,545 @@
|
|||
var dayMS = 86400000;
|
||||
var popTitle = "Add/Edit Task";
|
||||
|
||||
// To be set by template vars
|
||||
var dunits, hoursPerDay, taskLength;
|
||||
var extrasPath, errorMsgs;
|
||||
var taskArray;
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function parseFloatOrNA(str) {
|
||||
if (str == 'N/A') return 0.0;
|
||||
else return parseFloat(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function buildMenuUrl (urltype,taskId) {
|
||||
if(urltype == "edit") {
|
||||
alert("edit task: "+taskId);
|
||||
} else if(urltype == "insertAbove") {
|
||||
alert("insert task above: "+taskId);
|
||||
} else if(urltype == "insertBelow") {
|
||||
alert("insert task below: "+taskId);
|
||||
} else if(urltype == "delete") {
|
||||
alert("delete task: "+taskId);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function closeImage() {
|
||||
return extrasPath + '/close.gif';
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function configureForTaskType(form) {
|
||||
var te = getTaskElements(form, '');
|
||||
|
||||
switch (getTaskType(form)) {
|
||||
case 'timed':
|
||||
form.end.disabled = false;
|
||||
form.duration.disabled = false;
|
||||
form.lagTime.disabled = false;
|
||||
form.dependants.disabled = false;
|
||||
form.percentComplete.disabled = false;
|
||||
|
||||
if (!form.duration.value || parseFloatOrNA(form.duration.value) == 0)
|
||||
form.duration.value = (dunits == "hrs")? hoursPerDay : 1;
|
||||
if (!form.percentComplete.value || form.percentComplete.value == 'N/A')
|
||||
form.percentComplete.value = 0;
|
||||
if (!form.lagTime.value || form.lagTime.value == 'N/A')
|
||||
form.lagTime.value = 0;
|
||||
|
||||
break;
|
||||
|
||||
case 'progressive':
|
||||
form.end.value = form.start.value;
|
||||
form.end.disabled = true;
|
||||
form.duration.disabled = false;
|
||||
form.dependants.disabled = false;
|
||||
form.lagTime.value = 'N/A';
|
||||
form.lagTime.disabled = true;
|
||||
form.percentComplete.value = 'N/A';
|
||||
form.percentComplete.disabled = true;
|
||||
break;
|
||||
|
||||
case 'milestone':
|
||||
form.duration.value = 0;
|
||||
form.duration.disabled = true;
|
||||
form.lagTime.value = 'N/A';
|
||||
form.lagTime.disabled = true;
|
||||
form.end.disabled = true;
|
||||
form.dependants.disabled = true;
|
||||
form.percentComplete.value = 'N/A';
|
||||
form.percentComplete.disabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
setEndFromStartDate(te);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getCheckedOfNodeList(list) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (list[i].checked) { return list[i].value; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setCheckedOfNodeList(list, value) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
list[i].checked = (list[i].value == value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// TODO: convert this whole bunch of stuff to do with task element groups
|
||||
// to an actual prototype/class?
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getTaskElements(form, suffix) {
|
||||
var te = new Object();
|
||||
var keys = ['start', 'end', 'duration', 'lagTime', 'dependants', 'origStart', 'origEnd',
|
||||
'seqNum', 'taskType', 'orig_start', 'orig_duration', 'orig_dependants', 'orig_end'];
|
||||
for (var i = 0; i < keys.length; i++)
|
||||
te[keys[i]] = form[keys[i]+suffix];
|
||||
return te;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getTaskType(te) {
|
||||
var taskTypeElt = te.taskType;
|
||||
if (taskTypeElt.type == 'hidden') return taskTypeElt.value;
|
||||
else return getCheckedOfNodeList(taskTypeElt);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setTaskType(te, value) {
|
||||
var taskTypeElt = te.taskType;
|
||||
if (taskTypeElt.type == 'hidden') taskTypeElt.value = value;
|
||||
else setCheckedOfNodeList(taskTypeElt, value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function isTimed(te) {
|
||||
return getTaskType(te) == 'timed';
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function isUntimed(te) {
|
||||
return !isTimed(te);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function fracDaysOfDuration(dur) {
|
||||
if (dunits == 'hrs') return dur / hoursPerDay;
|
||||
else return dur;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function durationOfFracDays(days) {
|
||||
if (dunits == 'hrs') return days * hoursPerDay;
|
||||
else return days;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getDuration(te) {
|
||||
return fracDaysOfDuration(parseFloat(te.duration.value));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setDuration(te, days) {
|
||||
te.duration.value = durationOfFracDays(days);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getDateByKey(te, key) {
|
||||
var split = te[key].value.split('-');
|
||||
return new Date(split[0], split[1]-1, split[2], 0, 0, 1, 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getStartDate(te) {
|
||||
return getDateByKey(te, 'start');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getEndDate(te) {
|
||||
return getDateByKey(te, 'end');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setDateByKey(te, key, date) {
|
||||
te[key].value = intlDate(date);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setStartDate(te, date) {
|
||||
setDateByKey(te, 'start', date);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setEndDate(te, date) {
|
||||
setDateByKey(te, 'end', date);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setStartFromEndDate(te) {
|
||||
setStartDate(te, datePlusDays(getEndDate(te), -Math.floor(getTotalDuration(te))));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setEndFromStartDate(te) {
|
||||
setEndDate(te, datePlusDays(getStartDate(te), Math.floor(getTotalDuration(te))));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function setOrigDates(te) {
|
||||
te.orig_start.value = te.start.value;
|
||||
te.orig_end.value = te.end.value;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function datePlusDays(date, days) {
|
||||
var ret = new Date();
|
||||
ret.setTime(date.getTime() + days * dayMS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getTotalDuration(te) {
|
||||
return fracDaysOfDuration(parseFloat(te.duration.value) +
|
||||
parseFloatOrNA(te.lagTime.value));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function maybeDefaultTaskValues(te) {
|
||||
var todayString = intlDate(new Date());
|
||||
//var tomorrowString = intlDate(datePlusDays(new Date(), 1));
|
||||
var timed = isTimed(te);
|
||||
|
||||
//if (te.duration.value == "") te.duration.value = timed? durationOfFracDays(1) : 0;
|
||||
if (te.lagTime.value == "") te.lagTime.value = 0;
|
||||
|
||||
if (te.start.value == "" && te.end.value == "") {
|
||||
te.start.value = todayString;
|
||||
te.end.value = todayString;
|
||||
} else if (te.start.value == "") {
|
||||
setEndFromStartDate(te);
|
||||
} else if (te.end.value == "") {
|
||||
setStartFromEndDate(te);
|
||||
}
|
||||
|
||||
if(timed && te.duration.value == 0) {
|
||||
//TO DO - Calculate duration based on end date
|
||||
}
|
||||
|
||||
updateTaskArray(te);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function updateTaskArray(te) {
|
||||
var seqNum = te.seqNum.value;
|
||||
if (seqNum == "") return;
|
||||
var assoc = taskArray[seqNum];
|
||||
assoc.start = te.start.value;
|
||||
assoc.end = te.end.value;
|
||||
assoc.duration = te.duration.value;
|
||||
assoc.lagTime = ''+parseInt(te.lagTime.value);
|
||||
assoc.predecessor = te.dependants.value;
|
||||
assoc.type = getTaskType(te);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function checkEditTaskForm (form) {
|
||||
if (form.name.value == "") {
|
||||
alert(errorMsgs.name);
|
||||
return;
|
||||
} else if (form.start.value == "") {
|
||||
alert(errorMsgs.start);
|
||||
return;
|
||||
} else if (isTimed(form) && form.end.value == "") {
|
||||
alert(errorMsgs.end);
|
||||
return;
|
||||
}
|
||||
form.submit();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function intlDate(dateObj) {
|
||||
return dateObj.getFullYear()+"-"+pad((dateObj.getMonth()+1))+"-"+pad(dateObj.getDate());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function toDateObj(date) {
|
||||
var to = date.split("-");
|
||||
var dateObj = new Date(to[0],(to[1]-1),to[2],0,0,1,0);
|
||||
return dateObj;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------x
|
||||
function durationChanged(form, suffix, isTaskForm, gotDelay) {
|
||||
if (!isTaskForm && !gotDelay)
|
||||
return window.setTimeout(function() {
|
||||
durationChanged(form, suffix, isTaskForm, true); }, 1);
|
||||
|
||||
var te = getTaskElements(form, suffix);
|
||||
maybeDefaultTaskValues(te);
|
||||
|
||||
// Get the new duration.
|
||||
var duration = getDuration(te);
|
||||
var totalDuration = getTotalDuration(te);
|
||||
|
||||
// We can't have timed tasks with duration zero. Those are called "milestones".
|
||||
if (duration <= 0 && getTaskType(te) == 'timed') {
|
||||
if (isTaskForm) {
|
||||
// Convert to milestone if desired.
|
||||
if (confirm("Zero duration tasks are considered milestones. Do you wish to change this task to a milestone?")) {
|
||||
setTaskType(te, 'milestone');
|
||||
configureForTaskType(form);
|
||||
} else {
|
||||
form.duration.value = form.orig_duration.value;
|
||||
if (getDuration(te) <= 0)
|
||||
setDuration(te, 1);
|
||||
}
|
||||
} else {
|
||||
// Do not let users zero out tasks from the quick view.
|
||||
alert("Zero duration tasks are considered Milestones. Please edit the task by clicking the link if you wish to change this task to a milestone");
|
||||
}
|
||||
}
|
||||
|
||||
switch (getTaskType(te)) {
|
||||
case 'timed':
|
||||
case 'progressive':
|
||||
setEndDate(te, datePlusDays(getStartDate(te), Math.floor(totalDuration)));
|
||||
break;
|
||||
|
||||
case 'milestone':
|
||||
setEndDate(te, getStartDate(te));
|
||||
break;
|
||||
}
|
||||
|
||||
te.orig_duration.value = te.duration.value;
|
||||
updateTaskArray(te);
|
||||
|
||||
if (!isTaskForm) {
|
||||
updateDependantDates();
|
||||
paintGanttChart();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function checkPredecessorCollision(te, isTaskForm) {
|
||||
var predecessor = te.dependants.value;
|
||||
if (predecessor == "") return;
|
||||
var predAssoc = taskArray[predecessor];
|
||||
var predEnd = toDateObj(predAssoc.end);
|
||||
if (predEnd.getTime() >= getStartDate(te).getTime()) {
|
||||
setStartDate(te, predEnd);
|
||||
setEndFromStartDate(te);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function dateChanged(form, suffix, isTaskForm, setWhichWay, gotDelay) {
|
||||
if (!isTaskForm && !gotDelay)
|
||||
return window.setTimeout(function() {
|
||||
dateChanged(form, suffix, isTaskForm, setWhichWay, true); }, 1);
|
||||
|
||||
var te = getTaskElements(form, suffix);
|
||||
maybeDefaultTaskValues(te);
|
||||
setWhichWay(te);
|
||||
checkPredecessorCollision(te, isTaskForm);
|
||||
setOrigDates(te);
|
||||
updateTaskArray(te);
|
||||
|
||||
if (!isTaskForm) {
|
||||
updateDependantDates();
|
||||
paintGanttChart();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function startDateChanged(form, suffix, isTaskForm) {
|
||||
var te = getTaskElements(form,suffix);
|
||||
|
||||
if(isValidDate(te.start.value)) {
|
||||
dateChanged(form, suffix, isTaskForm, setEndFromStartDate);
|
||||
}
|
||||
else {
|
||||
alert("Dates must be valid and in the form yyyy-mm-dd");
|
||||
te.start.value = te.orig_start.value;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function endDateChanged(form, suffix, isTaskForm) {
|
||||
var te = getTaskElements(form,suffix);
|
||||
|
||||
if(isValidDate(te.end.value)) {
|
||||
dateChanged(form, suffix, isTaskForm, setStartFromEndDate);
|
||||
}
|
||||
else {
|
||||
alert("Dates must be valid and in the form yyyy-mm-dd");
|
||||
te.start.value = te.orig_start.value;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function isValidDate(dt) {
|
||||
var datePat = /^(\d{4})-(\d{2})-(\d{2})$/;
|
||||
//match the date pattern
|
||||
if(!dt.match(datePat)){
|
||||
return false;
|
||||
}
|
||||
|
||||
var split = dt.split('-');
|
||||
var yyyy = split[0];
|
||||
var mm = split[1];
|
||||
var dd = split[2];
|
||||
|
||||
// if month out of range
|
||||
if ( mm < 1 || mm > 12 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get last day in month
|
||||
var d = (12 == mm) ? new Date(yyyy + 1, 0, 0) : new Date(yyyy, mm + 1, 0);
|
||||
|
||||
// if date out of range
|
||||
if ( dd < 1 || dd > d.getDate() ) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function predecessorChanged(form, suffix, isTaskForm, gotDelay) {
|
||||
if (!isTaskForm && !gotDelay)
|
||||
return window.setTimeout(function() {
|
||||
predecessorChanged(form, suffix, isTaskForm, true); }, 1);
|
||||
|
||||
var te = getTaskElements(form, suffix);
|
||||
var seqNum = te.seqNum.value, predecessor = te.dependants.value;
|
||||
|
||||
if (predecessor != "") {
|
||||
var assoc = taskArray[predecessor];
|
||||
var revert = function() { te.dependants.value = te.orig_dependants.value; return; }
|
||||
|
||||
if (predecessor < 1) { alert(errorMsgs.noPredecessor); return revert(); }
|
||||
if (seqNum != "") {
|
||||
if (predecessor == seqNum) { alert(errorMsgs.samePredecessor); return revert(); }
|
||||
if (predecessor > seqNum) { alert(errorMsgs.previousPredecessor); return revert(); }
|
||||
}
|
||||
if (assoc["type"] != 'timed') { alert(errorMsgs.untimedPredecessor); return revert(); }
|
||||
}
|
||||
|
||||
te.orig_dependants.value = te.dependants.value;
|
||||
checkPredecessorCollision(te, isTaskForm);
|
||||
updateTaskArray(te);
|
||||
|
||||
if (!isTaskForm) {
|
||||
updateDependantDates();
|
||||
paintGanttChart();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function trim(str) {
|
||||
return str.replace(/^\s+|\s+$/, '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function updateDependantDates() {
|
||||
for (var i = 1; i <= taskLength; i++) {
|
||||
var seq = i;
|
||||
var task = taskArray[seq];
|
||||
var taskId = task["id"];
|
||||
//Calculate duration and duraiton floor
|
||||
var totalDurationInDays = parseFloat(task["duration"]) + parseFloat(task["lagTime"]);
|
||||
if(dunits == "hrs") totalDurationInDays = totalDurationInDays / hoursPerDay;
|
||||
var totalDurationFloor = Math.floor(totalDurationInDays);
|
||||
//alert("Duration Floor is: "+durationFloor);
|
||||
//Get the current elements
|
||||
var currElementStart = document.getElementById("start_"+taskId+"_formId");
|
||||
var currElementEnd = document.getElementById("end_"+taskId+"_formId");
|
||||
//alert("Current Start Date: "+currElementStart.value+" Current End Date: "+currElementEnd.value);
|
||||
//Skip the first record as it is the record that was changed
|
||||
if(seq > 1) {
|
||||
var predecessor = task["predecessor"];
|
||||
//alert("predecessor for "+i+" is "+predecessor);
|
||||
if(predecessor != "") {
|
||||
var pred = taskArray[predecessor];
|
||||
var predEndDate = toDateObj(pred["end"]);
|
||||
var startDate = toDateObj(task["start"]);
|
||||
//alert ("Pred End Date: "+intlDate(predEndDate));
|
||||
//Make sure start date of this task is greater than the end date of the predecessor
|
||||
if(startDate.getTime() <= predEndDate.getTime()) {
|
||||
//Change the start and end dates of the task
|
||||
//Get the day part of the predecessor
|
||||
var predDayPart = parseFloat(pred["dayPart"]);
|
||||
//alert("predDayPart: "+predDayPart);
|
||||
if(predDayPart > 0) {
|
||||
//The previous task took up part of a day. Add the additional day part to the duration
|
||||
totalDurationInDays += predDayPart;
|
||||
totalDurationFloor = Math.floor(totalDurationInDays);
|
||||
}
|
||||
//alert("Duration in Days: "+durationInDays+" Duration Floor: "+durationFloor);
|
||||
//Set the start date of this task to the end date of the predecessor
|
||||
currElementStart.value = pred["end"];
|
||||
//Adjust end date for change in start date and update the object - start date is actually predEndDate now, so use the existing date object
|
||||
predEndDate.setDate(predEndDate.getDate() + totalDurationFloor);
|
||||
currElementEnd.value = intlDate(predEndDate);
|
||||
//alert("Set seq "+i+" to start: "+pred["end"]+" end: "+intlDate(predEndDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update task array with new start/end values
|
||||
taskArray[seq]["start"] = currElementStart.value;
|
||||
taskArray[seq]["end"] = currElementEnd.value;
|
||||
taskArray[seq]["dayPart"] = (totalDurationInDays - Math.floor(totalDurationInDays));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function getDaysInterval(from,to) {
|
||||
var aFrom = from.split("-");
|
||||
var aTo = to.split("-");
|
||||
var fromDate = new Date(aFrom[0],(aFrom[1]-1),aFrom[2],0,0,1,0);
|
||||
var toDate = new Date(aTo[0],(aTo[1]-1),aTo[2],0,0,1,0);
|
||||
var fromEpoch = fromDate.getTime();
|
||||
var toEpoch = toDate.getTime();
|
||||
|
||||
var seconds = toEpoch - fromEpoch;
|
||||
if(seconds == 0) return 0;
|
||||
return (seconds/dayMS);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function pad(date) {
|
||||
var str = ""+date;
|
||||
if(str.length == 1) {
|
||||
str = "0"+str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
function paintGanttChart () {
|
||||
|
||||
var callback = {
|
||||
success : function(req) { document.getElementById('gantt').innerHTML = req.responseText; },
|
||||
failure : function(req) { alert("Could not load gantt chart. Problems with connection. Please refresh the page and try again."); }
|
||||
}
|
||||
|
||||
var postData = YAHOO.util.Connect.setForm(document.forms['editAll']);
|
||||
|
||||
var status = YAHOO.util.Connect.asyncRequest('POST',getWebguiProperty("pageURL"),callback,postData);
|
||||
|
||||
var mwidth = document.getElementById("projectTableWidth").name + "px";
|
||||
var swidth = document.getElementById("projectScrollPercentWidth").name + "%";
|
||||
document.getElementById("mastertable").style.width=mwidth;
|
||||
document.getElementById("scrolltd").style.width=swidth;
|
||||
}
|
||||
15
www/extras/wobject/ProjectManager/styleModal.css
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
body {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
body, html, input {
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size:11px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.info {
|
||||
font-style:italic;
|
||||
font-size: 0.9em;
|
||||
color: #666666;
|
||||
}
|
||||
69
www/extras/wobject/ProjectManager/subModal.css
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* POPUP CONTAINER STYLES
|
||||
*/
|
||||
#popupMask {
|
||||
position: absolute;
|
||||
z-index: 200;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: .4;
|
||||
filter: alpha(opacity=40);
|
||||
/* this hack is so it works in IE
|
||||
* I find setting the color in the css gives me more flexibility
|
||||
* than the PNG solution.
|
||||
*/
|
||||
background-color:transparent !important;
|
||||
background-color: #333333;
|
||||
/* this hack is for opera support
|
||||
* you can uncomment the background-image if you don't care about opera.
|
||||
* this gives you the flexibility to use any bg color that you want, instead of the png
|
||||
*/
|
||||
background-image/**/: url("maskBG.png") !important; // For browsers Moz, Opera, etc.
|
||||
background-image:none;
|
||||
background-repeat: repeat;
|
||||
display:none;
|
||||
}
|
||||
#popupContainer {
|
||||
position: absolute;
|
||||
z-index: 201;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
display:none;
|
||||
padding: 0px;
|
||||
}
|
||||
#popupInner {
|
||||
border: 2px solid #000000;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
#popupFrame {
|
||||
margin: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
z-index: 202;
|
||||
}
|
||||
#popupTitleBar {
|
||||
background-color: #486CAE;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
height: 1.3em;
|
||||
padding: 5px;
|
||||
border-bottom: 2px solid #000000;
|
||||
border-top: 1px solid #78A3F2;
|
||||
border-left: 1px solid #78A3F2;
|
||||
border-right: 1px solid #204095;
|
||||
position: relative;
|
||||
z-index: 203;
|
||||
}
|
||||
#popupTitle {
|
||||
float:left;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
#popupControls {
|
||||
float: right;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
}
|
||||
30
www/extras/wobject/ProjectManager/taskEdit.css
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#taskEdit_resourceList_div {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
font-family: arial;
|
||||
font-size: 10pt;
|
||||
border: solid #CACACA 1px;
|
||||
}
|
||||
|
||||
* html #taskEdit_resourceList_div {
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#taskEdit_resourceList_div img {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#taskEdit_resourceList_div td {
|
||||
background-color: #F2F2F2;
|
||||
border-top: solid #F9F9F9 1px;
|
||||
border-bottom: solid #E0E0E0 1px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#taskEdit_resourceList_div tr.odd td {
|
||||
background-color: #EAEAEA;
|
||||
}
|
||||
113
www/extras/wobject/ProjectManager/taskEdit.js
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
var taskEdit_inited = 0;
|
||||
var taskEdit_pending = null;
|
||||
|
||||
function taskEdit_getResourceListDiv() {
|
||||
return document.getElementById('taskEdit_resourceList_div');
|
||||
}
|
||||
|
||||
function taskEdit_searchPopup(url) {
|
||||
window.open(url, "searchWindow", 'status=1,scrollbars=1,toolbar=0,location=0,menubar=0,directories=0,resizable=1,height=350,width=400');
|
||||
}
|
||||
|
||||
function taskEdit_getResources() {
|
||||
var elts = taskEdit_getResourceListDiv().getElementsByTagName('input');
|
||||
var resources = [];
|
||||
|
||||
for (var i = 0; i < elts.length; i++) {
|
||||
if (elts[i].getAttribute('type') == 'hidden' &&
|
||||
elts[i].getAttribute('name') == 'resources')
|
||||
resources[i] = elts[i].getAttribute('value');
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
|
||||
function taskEdit_updateExclude(id, kind, resources) {
|
||||
var elt = document.getElementById(id);
|
||||
if (!elt) return;
|
||||
|
||||
var resourceIds = [];
|
||||
for (var i = 0; i < resources.length; i++) {
|
||||
var split = resources[i].split(' ', 2);
|
||||
if (split[0] == kind)
|
||||
resourceIds.push(split[1]);
|
||||
}
|
||||
var exclude = resourceIds.join(';');
|
||||
|
||||
var href = elt.getAttribute('href');
|
||||
href = href.replace(/([?;&]exclude=)[^;&]*/, function(str, p1, offset, s) {
|
||||
return p1 + encodeURIComponent(exclude);
|
||||
});
|
||||
elt.setAttribute('href', href);
|
||||
}
|
||||
|
||||
function taskEdit_updateResources(resources) {
|
||||
var div = taskEdit_getResourceListDiv();
|
||||
var savedInnerHTML = div.innerHTML;
|
||||
div.innerHTML = "<p>Please wait…</p>";
|
||||
|
||||
var component = encodeURIComponent(resources.join(';'));
|
||||
var url = document.location.toString();
|
||||
url = url.replace(/[#\?].*/, '');
|
||||
url += '?func=innerHtmlOfResources;resources=' + component;
|
||||
taskEdit_updateExclude("taskEdit_resourceList_addUser_a", 'user', resources);
|
||||
taskEdit_updateExclude("taskEdit_resourceList_addGroup_a", 'group', resources);
|
||||
|
||||
taskEdit_pending = [];
|
||||
|
||||
var callback = {
|
||||
success : function(req) {
|
||||
div.innerHTML = req.responseText;
|
||||
taskEdit_doPending();
|
||||
},
|
||||
failure : function(req) {
|
||||
// ToDo: Need better error handling
|
||||
div.innerHTML = savedInnerHTML;
|
||||
taskEdit_doPending();
|
||||
}
|
||||
}
|
||||
|
||||
var status = YAHOO.util.Connect.asyncRequest('GET',url,callback);
|
||||
|
||||
}
|
||||
|
||||
function taskEdit_doPending() {
|
||||
for (var i = 0; i < taskEdit_pending.length; i++) {
|
||||
taskEdit_pending[i]();
|
||||
}
|
||||
|
||||
taskEdit_pending = null;
|
||||
}
|
||||
|
||||
function taskEdit_addResource(kind, id) {
|
||||
if (taskEdit_pending != null) {
|
||||
taskEdit_pending.push(function() { taskEdit_addResource(kind, id) });
|
||||
return;
|
||||
}
|
||||
|
||||
var string = kind+' '+id;
|
||||
var resources = taskEdit_getResources();
|
||||
resources.push(string);
|
||||
taskEdit_updateResources(resources);
|
||||
}
|
||||
|
||||
function taskEdit_queueAddResource(kind, id) {
|
||||
window.setTimeout(function() { taskEdit_addResource(kind, id) }, 0);
|
||||
}
|
||||
|
||||
function taskEdit_deleteResource(kind, id) {
|
||||
if (taskEdit_pending != null) {
|
||||
taskEdit_pending.push(function() { taskEdit_deleteResource(kind, id) });
|
||||
return;
|
||||
}
|
||||
|
||||
var string = kind+' '+id;
|
||||
var resources = taskEdit_getResources();
|
||||
for (var i = 0; i < resources.length; i++) {
|
||||
if (resources[i] == string) {
|
||||
resources.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
taskEdit_updateResources(resources);
|
||||
}
|
||||
BIN
www/extras/wobject/ProjectManager/users.gif
Normal file
|
After Width: | Height: | Size: 680 B |
64
www/extras/wobject/SQLReport/editFormDownload.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* changeDownloadType(Element type)
|
||||
* Disables/Enables/Hides/Shows the
|
||||
* downloadFilename
|
||||
* downloadTemplateId
|
||||
* downloadMimeType
|
||||
* form elements whenever the downloadType element is
|
||||
* changed.
|
||||
*/
|
||||
function changeDownloadType(type) {
|
||||
file = document.getElementById("downloadFilename_formId");
|
||||
while (file.nodeName.toLowerCase() != "tr")
|
||||
file = file.parentNode;
|
||||
template = document.getElementById("downloadTemplateId_formId").parentNode;
|
||||
while (template.nodeName.toLowerCase() != "tr")
|
||||
template = template.parentNode;
|
||||
mimeType = document.getElementById("downloadMimeType_formId").parentNode;
|
||||
while (mimeType.nodeName.toLowerCase() != "tr")
|
||||
mimeType = mimeType.parentNode;
|
||||
|
||||
if (type.value == "none") {
|
||||
file.style.display = "none";
|
||||
template.style.display = "none";
|
||||
mimeType.style.display = "none";
|
||||
} else if (type.value == "template") {
|
||||
file.style.display = "";
|
||||
template.style.display = "";
|
||||
mimeType.style.display = "";
|
||||
} else {
|
||||
file.style.display = "";
|
||||
template.style.display = "none";
|
||||
mimeType.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// Add a window.onload event to handle hiding the inappropriate form values
|
||||
|
||||
// addLoadEvent(function)
|
||||
// Adds an event to window.onload without overriding events already there.
|
||||
// Taken from http://simon.incutio.com/archive/2004/05/26/addLoadEvent
|
||||
function addLoadEvent(func) {
|
||||
var oldonload = window.onload;
|
||||
if (typeof window.onload != 'function') {
|
||||
window.onload = func;
|
||||
} else {
|
||||
window.onload = function() {
|
||||
if (oldonload) {
|
||||
oldonload();
|
||||
}
|
||||
func();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
// Find out which radio button is checked by default
|
||||
for (i=0;i<document.forms[0].downloadType.length;i++) {
|
||||
if (document.forms[0].downloadType[i].checked) {
|
||||
changeDownloadType(document.forms[0].downloadType[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
BIN
www/extras/wobject/Shortcut/hline.gif
Normal file
|
After Width: | Height: | Size: 848 B |
51
www/extras/wobject/Shortcut/querybuilder.css
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
.qbtr_alt {
|
||||
background-color:#DCE4EE;
|
||||
}
|
||||
|
||||
.qbtd {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.qbtdleft {
|
||||
padding-right: 5px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.qbtdright {
|
||||
background-image: url(vline.gif);
|
||||
background-repeat: repeat-y;
|
||||
height: 20px;
|
||||
align: right;
|
||||
}
|
||||
|
||||
.qbfieldLabel {
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.qbselect {
|
||||
height: 20px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.qbButton {
|
||||
height: 20px;
|
||||
font-size: 12px;
|
||||
border-width: 1px;
|
||||
-moz-border-radius: 0px;
|
||||
}
|
||||
|
||||
.qbText {
|
||||
background-color: white;
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
|
||||
}
|
||||
|
||||
55
www/extras/wobject/Shortcut/querybuilder.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
function wgCriteriaDisable ( form, toDisable ) {
|
||||
var new_state = toDisable ? false : true;
|
||||
var elements = YAHOO.util.Dom.getElementsByClassName('qbselect');
|
||||
var buttons = YAHOO.util.Dom.getElementsByClassName('qbButton');
|
||||
form.resolveMultiples.disabled = new_state;
|
||||
form.shortcutCriteria.disabled = new_state;
|
||||
for(idx=0; idx < elements.length; idx++) {
|
||||
elements[idx].disabled = new_state;
|
||||
}
|
||||
for(idx=0; idx < buttons.length; idx++) {
|
||||
buttons[idx].disabled = new_state;
|
||||
}
|
||||
}
|
||||
|
||||
function addCriteria ( fieldname, opform, valform ) {
|
||||
var form = opform.form;
|
||||
var operator = getValue(opform);
|
||||
var value = getValue(valform);
|
||||
var criteria = form.shortcutCriteria.value;
|
||||
var conjunction = "";
|
||||
if (form.shortcutCriteria.disabled == true) {
|
||||
return;
|
||||
}
|
||||
if(! /^\s*$/.test(criteria)) {
|
||||
conjunction = " " + getValue(form.conjunction) + " ";
|
||||
}
|
||||
//handle quotes
|
||||
if(/\s+/.test(fieldname)) {
|
||||
fieldname = '"' + fieldname + '"';
|
||||
}
|
||||
if(/^\D*$/.test(value)) {
|
||||
value = '"' + value + '"';
|
||||
}
|
||||
var statement = fieldname + " " + operator + " " + value;
|
||||
form.shortcutCriteria.value = criteria + conjunction + statement;
|
||||
}
|
||||
|
||||
function getValue(sel) {
|
||||
if(sel.type == "text") {
|
||||
return sel.value;
|
||||
}
|
||||
for(i=0;i<sel.length;i++) {
|
||||
if(sel[i].type == "radio") {
|
||||
if(sel[i].checked) {
|
||||
return sel[i].value;
|
||||
}
|
||||
} else {
|
||||
if(sel.options[i].selected) {
|
||||
return sel.options[i].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
BIN
www/extras/wobject/Shortcut/vline.gif
Normal file
|
After Width: | Height: | Size: 869 B |
BIN
www/extras/wobject/StockData/down.gif
Normal file
|
After Width: | Height: | Size: 79 B |
BIN
www/extras/wobject/StockData/nc.gif
Normal file
|
After Width: | Height: | Size: 59 B |
262
www/extras/wobject/StockData/tools.css
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
.qmmt_main
|
||||
{
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #999999;
|
||||
}
|
||||
.qmmt_tab
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
background-color: #dddddd;
|
||||
padding: 1px;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
text-align: center;
|
||||
border-left: 1px solid #999999;
|
||||
border-bottom: 1px solid #999999;
|
||||
border-top: 1px solid #999999;
|
||||
cursor: pointer;
|
||||
voice-family: "\"}\"";
|
||||
voice-family:inherit;
|
||||
}
|
||||
.qmmt_tabactive
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
background-color: #ffffff;
|
||||
padding: 1px;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
text-align: center;
|
||||
border-left: 1px solid #999999;
|
||||
cursor: pointer;
|
||||
voice-family: "\"}\"";
|
||||
voice-family:inherit;
|
||||
}
|
||||
|
||||
.qmmt_realtime_text
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #008000;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.qmmt_text
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
.qmmt_text_bold
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
.qmmt_text_up
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #009900;
|
||||
}
|
||||
.qmmt_text_down
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #ff0000;
|
||||
}
|
||||
.qmmt_cycle
|
||||
{
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.qmmt_cycleup
|
||||
{
|
||||
background-color: #eeffee;
|
||||
color: #000000;
|
||||
}
|
||||
.qmmt_cycledown
|
||||
{
|
||||
background-color: #ffeeee;
|
||||
color: #000000;
|
||||
}
|
||||
.qmmt_header_text
|
||||
{
|
||||
font: 11px Tahoma, Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
text-align: left;
|
||||
}
|
||||
.qmmt_header_bar
|
||||
{
|
||||
background-color: #dddddd;
|
||||
border: 0px solid #999999;
|
||||
padding-left: 3px;
|
||||
text-align: left;
|
||||
}
|
||||
.qmmt_sub_header_bar
|
||||
{
|
||||
background-color: #dddddd;
|
||||
border: 0px solid #999999;
|
||||
padding-left: 3px;
|
||||
text-align: left;
|
||||
}
|
||||
.qmmt_input
|
||||
{
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
a.qmmt {
|
||||
color: #0000aa;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited.qmmt {
|
||||
color: #0000aa;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover.qmmt {
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.qmmt_options_in_money {
|
||||
background-color: #FFFFCC;
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* CSS for Tools using Tree Menu/View */
|
||||
.qm_tree {
|
||||
font-family: Tahoma, Arial, Helvetica, sans-serif;
|
||||
font-size: 10px;
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.qm_tree img {
|
||||
border: 0px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.qm_tree a {
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
.qm_tree a.node, .qm_tree a.nodeSel {
|
||||
white-space: nowrap;
|
||||
padding: 1px 2px 1px 2px;
|
||||
}
|
||||
.qm_tree a.node:hover, .qm_tree a.nodeSel:hover {
|
||||
color: #0000aa;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.qm_tree a.nodeSel {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
.qm_tree .clip {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
/* No Need to really edit this, for Market Depth / Level II row colors */
|
||||
/* Level II Cycles */
|
||||
.qmmt_L2_cycle1 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #FFFEEF;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle2 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F0F7DE;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle3 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F4F0E8;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle4 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #E0E0F7;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle5 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F7F7F7;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle6 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F5E8E8;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle7 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F6EDDA;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle8 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #DCEAEE;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle9 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #E9E2F4;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle10 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #EEF2FA;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle11 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #E1E2FA;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle12 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #EEFAE1;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle13 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #EDFCFB;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle14 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #FBEBE8;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle15 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #EDEDED;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
.qmmt_L2_cycle16 {
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F6EDDA;
|
||||
font-weight: normal;
|
||||
color: #000000; }
|
||||
|
||||
.qmmt_cycleup
|
||||
{
|
||||
background-color: #eeffee;
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
font-weight: normal;
|
||||
}
|
||||
.qmmt_cycledown
|
||||
{
|
||||
background-color: #ffeeee;
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.qmmt_cyclenochange
|
||||
{
|
||||
background-color: #ffffff;
|
||||
font: 10px Tahoma, Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
font-weight: normal;
|
||||
}
|
||||
BIN
www/extras/wobject/StockData/up.gif
Normal file
|
After Width: | Height: | Size: 81 B |
761
www/extras/wobject/Survey/administersurvey.js
Normal file
|
|
@ -0,0 +1,761 @@
|
|||
/*global Survey, YAHOO, alert, scrollPage, window */
|
||||
if (typeof Survey === "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
(function(){
|
||||
|
||||
var INVALID_QUESTION_CLASS = 'survey-invalid'; // CSS class for questions that fail input validation
|
||||
var INVALID_SUBMIT_CLASS = 'survey-submit-invalid'; // CSS class for submit div when questions don't validate
|
||||
var INVALID_QUESTION_MARKER = 'survey-invalid-marker'; // For default '*' invalid field marker
|
||||
|
||||
// All specially-handled question types are listed here
|
||||
// (anything else is assumed to be a multi-choice bundle)
|
||||
var TEXT_TYPES = {
|
||||
'Text': 1,
|
||||
'Email': 1,
|
||||
'Phone Number': 1,
|
||||
'Text Date': 1,
|
||||
'Currency': 1,
|
||||
'TextArea': 1
|
||||
};
|
||||
var NUMBER_TYPES = {
|
||||
'Number':1
|
||||
};
|
||||
var SLIDER_TYPES = {
|
||||
'Slider': 1,
|
||||
'Dual Slider - Range': 1,
|
||||
'Multi Slider - Allocate': 1
|
||||
};
|
||||
var DATE_SHORT = {
|
||||
'Year Month': 1
|
||||
};
|
||||
var COUNTRY = {
|
||||
'Country': 1
|
||||
};
|
||||
var DATE_TYPES = {
|
||||
'Date': 1,
|
||||
'Date Range': 1
|
||||
};
|
||||
var UPLOAD_TYPES = {
|
||||
'File Upload': 1
|
||||
};
|
||||
var HIDDEN_TYPES = {
|
||||
'Hidden': 1
|
||||
};
|
||||
|
||||
var hasFile;
|
||||
var verb = 0;
|
||||
var lastSection = 'first';
|
||||
|
||||
var toValidate;
|
||||
var sliderWidth = 500;
|
||||
var sliders;
|
||||
|
||||
function formsubmit(event){
|
||||
var submit = 1;//boolean for if all was good or not
|
||||
var lowestInvalidY = 0;
|
||||
for (var i in toValidate) {
|
||||
if (YAHOO.lang.hasOwnProperty(toValidate, i)) {
|
||||
var answered = 0;
|
||||
if (toValidate[i].type === 'Multi Slider - Allocate') {
|
||||
var total = 0;
|
||||
for (var z in toValidate[i].answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(toValidate[i].answers, z)) {
|
||||
total += Math.round(document.getElementById(z).value);
|
||||
}
|
||||
}
|
||||
if (total === toValidate[i].total) {
|
||||
answered = 1;
|
||||
}
|
||||
else {
|
||||
var amountLeft = toValidate[i].total - total;
|
||||
alert("Please allocate the remaining " + amountLeft + ".");
|
||||
}
|
||||
}
|
||||
else if (toValidate[i].type === 'Number') {
|
||||
answered = 1;
|
||||
for (var z1 in toValidate[i].answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(toValidate[i].answers, z1)) {
|
||||
// We rely on server-side validation for actual value checking,
|
||||
// and onblur js for user-friendly validation, so here we only
|
||||
// need to check that required values look like numbers
|
||||
var m = parseFloat(document.getElementById(z1).value, 10);
|
||||
if (!YAHOO.lang.isNumber(m)) {
|
||||
answered = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (toValidate[i].type === 'Year Month') {
|
||||
answered = 1;//set to true, then let a single failure set it back to false.
|
||||
for (var z2 in toValidate[i].answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(toValidate[i].answers, z2)) {
|
||||
var month = document.getElementById(z2+'-month').value;
|
||||
var year = document.getElementById(z2+'-year').value;
|
||||
if (month == ''){
|
||||
answered = 0;
|
||||
}
|
||||
var yInt = parseInt(year, 10);
|
||||
if(!yInt) {
|
||||
answered = 0;
|
||||
}
|
||||
if(yInt < 1000 || yInt > 3000) {
|
||||
answered = 0;
|
||||
}
|
||||
if (answered == 1){
|
||||
document.getElementById(z2).value = month + "-" + year;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var z3 in toValidate[i].answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(toValidate[i].answers, z3)) {
|
||||
var v = document.getElementById(z3).value;
|
||||
if (YAHOO.lang.isValue(v) && v !== '') {
|
||||
answered = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var node = document.getElementById(i + 'required');
|
||||
|
||||
var q_parent_node = YAHOO.util.Dom.getAncestorByClassName(node, 'question');
|
||||
if (!answered) {
|
||||
submit = 0;
|
||||
|
||||
// Apply INVALID_QUESTION_CLASS to the parent question div for people who want to skin Survey
|
||||
YAHOO.util.Dom.addClass(q_parent_node, INVALID_QUESTION_CLASS);
|
||||
|
||||
// Insert default '*' marker (can be hidden via CSS for those who want something different)
|
||||
node.innerHTML = "<span class='" + INVALID_QUESTION_MARKER + "'>*</span>";
|
||||
|
||||
// Keep track of the lowest y-coord invalid question (to scroll to)
|
||||
var qY = YAHOO.util.Dom.getY(q_parent_node);
|
||||
lowestInvalidY = lowestInvalidY && lowestInvalidY < qY ? lowestInvalidY : qY;
|
||||
}
|
||||
else {
|
||||
YAHOO.util.Dom.removeClass(q_parent_node, INVALID_QUESTION_CLASS);
|
||||
node.innerHTML = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
var submitButton = document.getElementById('submitbutton');
|
||||
var submitDiv = submitButton && YAHOO.util.Dom.getAncestorByTagName(submitButton, 'div');
|
||||
|
||||
if (submit) {
|
||||
if (submitDiv) {
|
||||
YAHOO.util.Dom.removeClass(submitDiv, INVALID_SUBMIT_CLASS);
|
||||
}
|
||||
YAHOO.log("Submitting");
|
||||
Survey.Comm.callServer('', 'submitQuestions', 'surveyForm', hasFile);
|
||||
}
|
||||
else {
|
||||
if (submitDiv) {
|
||||
YAHOO.util.Dom.addClass(submitDiv, INVALID_SUBMIT_CLASS);
|
||||
}
|
||||
|
||||
// Scroll page to the y-coord of the lowest invalid question
|
||||
if (lowestInvalidY) {
|
||||
scrollPage(lowestInvalidY, 1.5, YAHOO.util.Easing.easeOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function goBack(event){
|
||||
YAHOO.log("Going back");
|
||||
Survey.Comm.callServer('', 'goBack');
|
||||
}
|
||||
|
||||
function scrollPage(to, dur, ease) {
|
||||
var setAttr = function(a, v, u) {
|
||||
window.scroll(0, v);
|
||||
};
|
||||
|
||||
var anim = new YAHOO.util.Anim(null,
|
||||
{ 'scroll' : {
|
||||
from : YAHOO.util.Dom.getDocumentScrollTop(),
|
||||
to : to }
|
||||
},
|
||||
dur, ease
|
||||
);
|
||||
anim.setAttribute = setAttr;
|
||||
anim.animate();
|
||||
}
|
||||
|
||||
function numberHandler(event, objs){
|
||||
|
||||
var value = parseFloat(this.value, 10);
|
||||
|
||||
// Get the constraints
|
||||
var min = parseFloat(objs.min, 10);
|
||||
var max = parseFloat(objs.max, 10);
|
||||
var step = parseFloat(objs.step, 10);
|
||||
|
||||
if (YAHOO.lang.isNumber(value)) {
|
||||
// Enforce step
|
||||
if (YAHOO.lang.isNumber(step) && value % step != 0){
|
||||
this.value = value - value % step;
|
||||
}
|
||||
// Enforce max/min constraints
|
||||
if (YAHOO.lang.isNumber(min) && value < min){
|
||||
this.value = min;
|
||||
}
|
||||
if (YAHOO.lang.isNumber(max) && value > max){
|
||||
this.value = max;
|
||||
}
|
||||
} else {
|
||||
// Clear value if it is not a valid number
|
||||
this.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
function sliderTextSet(event, objs){
|
||||
this.value = this.value * 1;
|
||||
this.value = YAHOO.lang.isValue(this.value) ? this.value : 0;
|
||||
}
|
||||
|
||||
function sliderManager(q){
|
||||
//total number of pixels in the slider.
|
||||
var total = sliderWidth;
|
||||
|
||||
//steps must be integers
|
||||
var step = Math.round(parseFloat(q.answers[0].step, 10)) || 1;
|
||||
|
||||
//the starting value for the left side of the slider
|
||||
var min = Math.round(parseFloat(q.answers[0].min, 10)) || 0;
|
||||
var max = Math.round(parseFloat(q.answers[0].max, 10));
|
||||
if (!YAHOO.lang.isNumber(max) || max <= min ) { max = min + 10; }
|
||||
|
||||
//The number of values in between the max and min values
|
||||
var distance = max - min;
|
||||
|
||||
//Number of pixels each bug step takes
|
||||
var bugSteps = Math.round(total * step / distance);
|
||||
|
||||
//redefine number of pixels to round number of steps
|
||||
total = distance * bugSteps / step;
|
||||
|
||||
var scale = Math.round(total / distance);
|
||||
|
||||
//max is just the max value, used for determining allocation sliders.
|
||||
var allocMax = max;
|
||||
var type = 'slider';
|
||||
|
||||
//find the maximum difference between an answers max and min
|
||||
for (var _s in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, _s)) {
|
||||
var a1 = q.answers[_s];
|
||||
YAHOO.util.Event.addListener(a1.id, "blur", sliderTextSet);
|
||||
localMax = a1.max - a1.min
|
||||
if (localMax > max) {
|
||||
allocMax = localMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Only validate allocation types which must allocate all their points
|
||||
if (q.questionType === 'Multi Slider - Allocate') {
|
||||
type = 'multi';
|
||||
for (var x1 = 0; x1 < q.answers.length; x1++) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].total = q.answers[x1].max;
|
||||
toValidate[q.id].answers[q.answers[x1].id] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, i)) {
|
||||
var a = q.answers[i];
|
||||
var Event = YAHOO.util.Event;
|
||||
var lang = YAHOO.lang;
|
||||
var id = a.id + 'slider-bg';
|
||||
var s = YAHOO.widget.Slider.getHorizSlider(id, a.id + 'slider-thumb', 0, total, scale * step);
|
||||
s.animate = true;
|
||||
if (YAHOO.lang.isUndefined(sliders[q.id])) {
|
||||
sliders[q.id] = [];
|
||||
}
|
||||
sliders[q.id][a.id] = s;
|
||||
s.input = a.id;
|
||||
s.lastValue = 0;
|
||||
var check = function(){
|
||||
var t = 0;
|
||||
for (var x in sliders[q.id]) {
|
||||
if (YAHOO.lang.hasOwnProperty(sliders[q.id], x)) {
|
||||
t += sliders[q.id][x].getRealValue();
|
||||
}
|
||||
}
|
||||
if (t > allocMax && type === 'multi') {
|
||||
t -= +this.getRealValue();
|
||||
var newVal = (allocMax-t);
|
||||
this.setValue(newVal*bugSteps/step);
|
||||
//document.getElementById(this.input).value = Math.round(parseFloat((((total - t) / total) * distance) + min));
|
||||
document.getElementById(this.input).value = newVal;
|
||||
}
|
||||
else {
|
||||
this.lastValue = this.getValue();
|
||||
document.getElementById(this.input).value = this.getRealValue();
|
||||
}
|
||||
};
|
||||
s.subscribe("change", check);
|
||||
var manualEntry = function(e){
|
||||
// set the value when the 'return' key is detected
|
||||
if (Event.getCharCode(e) === 13 || e.type === 'blur') {
|
||||
var v = parseFloat(this.value, 10);
|
||||
v = (lang.isNumber(v)) ? v : 0;
|
||||
// v *= scale;
|
||||
v = (((v - min) / distance)) * total;
|
||||
// convert the real value into a pixel offset
|
||||
for (var sl in sliders[q.id]) {
|
||||
if (sliders[q.id][sl].input === this.id) {
|
||||
sliders[q.id][sl].setValue(Math.round(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Event.on(document.getElementById(s.input), "blur", manualEntry);
|
||||
Event.on(document.getElementById(s.input), "keypress", manualEntry);
|
||||
var getRealValue = function(){
|
||||
return parseInt((this.getValue() / bugSteps * step) +min, 10);
|
||||
};
|
||||
s.getRealValue = getRealValue;
|
||||
document.getElementById(s.input).value = s.getRealValue();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function handleDualSliders(q){
|
||||
var a1 = q.answers[0];
|
||||
var a2 = q.answers[1];
|
||||
var scale = sliderWidth / a1.max;
|
||||
|
||||
var id = q.id;
|
||||
var a1id = a1.id;
|
||||
var a2id = a2.id;
|
||||
|
||||
var a1h = document.getElementById(a1id);
|
||||
var a2h = document.getElementById(a2id);
|
||||
var a1s = document.getElementById(a1id + 'show');
|
||||
var a2s = document.getElementById(a2id + 'show');
|
||||
var s = YAHOO.widget.Slider.getHorizDualSlider(id + 'slider-bg', a1id + "slider-min-thumb", a2id + "slider-max-thumb", sliderWidth, 1 * scale, [1, sliderWidth]);
|
||||
sliders[id] = s;
|
||||
|
||||
s.minRange = 4;
|
||||
var updateUI = function(){
|
||||
var min = Math.round(s.minVal / scale), max = Math.round(s.maxVal / scale);
|
||||
a1h.value = min;
|
||||
a1s.innerHTML = min;
|
||||
a2h.value = max;
|
||||
a2s.innerHTML = max;
|
||||
};
|
||||
|
||||
// Subscribe to the dual thumb slider's change and ready events to
|
||||
// report the state.
|
||||
// s.subscribe('ready', updateUI);
|
||||
//s.subscribe('change', updateUI);
|
||||
s.subscribe('slideEnd', updateUI);
|
||||
}
|
||||
|
||||
function showCalendar(event, objs){
|
||||
objs[0].show();
|
||||
}
|
||||
|
||||
function selectCalendar(event, args, obj){
|
||||
var id = obj[1];
|
||||
var selected = args[0];
|
||||
var date = selected[0];
|
||||
var year = date[0], month = date[1], day = date[2];
|
||||
var input = document.getElementById(id);
|
||||
input.value = year + "/" + month + "/" + day; // until we can i18n this, use ISO
|
||||
obj[0].hide();
|
||||
}
|
||||
|
||||
function toggleButtonOn( button ) {
|
||||
document.getElementById(button.hid).value = 1;
|
||||
button.className = 'mcbutton-selected';
|
||||
}
|
||||
|
||||
function toggleButtonOff( button ) {
|
||||
document.getElementById(button.hid).value = '';
|
||||
button.className = 'mcbutton';
|
||||
}
|
||||
|
||||
function buttonChanged(event, o){
|
||||
var b = o.button;
|
||||
var maxAnswers = parseInt(o.maxAnswers, 10);
|
||||
var buttons = o.buttons;
|
||||
|
||||
// When maxAnswers is 2 or greater, user is required to manually toggle options on/off
|
||||
// (e.g. simulate checkboxes), and enforce maxAnswers limit
|
||||
// When maxAnswers is 0, user is also required to manually toggle options on/off,
|
||||
// but no limit is placed on maxAnswers
|
||||
// When maxAnswers is 1, simulate radio group instead
|
||||
// (e.g. no need to untoggle selected answer to change to a different answer)
|
||||
if (!maxAnswers || maxAnswers > 1) {
|
||||
|
||||
// Simulate checkbox..
|
||||
|
||||
// See if answer is currently toggled on or off
|
||||
if (b.className === 'mcbutton') {
|
||||
// Answer currently off (unselected). User wants to toggle it on.
|
||||
|
||||
// See if we need to enforce maxAnswers limit
|
||||
if (maxAnswers) {
|
||||
// Count how many buttons are currently selected
|
||||
var bscount = 0;
|
||||
for (var ib in buttons) {
|
||||
if (YAHOO.lang.hasOwnProperty(buttons, ib) && buttons[ib].className === 'mcbutton-selected') {
|
||||
bscount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Proceed if we haven't filled all the allowed selections
|
||||
if (maxAnswers - bscount > 0) {
|
||||
toggleButtonOn(b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// No maxAnswers limit, toggle answer on without counting
|
||||
toggleButtonOn(b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Answer currently on (selected). User wants to toggle it off.
|
||||
toggleButtonOff(b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
// maxAnswers == 1, so simulate Radio group instead
|
||||
|
||||
if (b.className === 'mcbutton-selected') {
|
||||
toggleButtonOff(b);
|
||||
}
|
||||
else {
|
||||
toggleButtonOn(b);
|
||||
}
|
||||
|
||||
// Toggle off all other answers
|
||||
for (var i in buttons) {
|
||||
if (YAHOO.lang.hasOwnProperty(buttons, i) && buttons[i] !== b) {
|
||||
toggleButtonOff(buttons[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var chartsUrl = getWebguiProperty('extrasURL') + "/yui/build/charts/assets/charts.swf";
|
||||
YAHOO.widget.Chart.SWFURL = chartsUrl;
|
||||
// Public API
|
||||
Survey.Summary = {
|
||||
globalSummaryDataTip: function(item, index, series){
|
||||
var toolTipText = "hello";
|
||||
//var toolTipText = series.displayName + " for " + item.section;
|
||||
//toolTipText += "\n" + item[series.yField];
|
||||
return toolTipText;
|
||||
},
|
||||
showSummary: function(summary,html){
|
||||
document.getElementById('survey').innerHTML = html;
|
||||
|
||||
|
||||
//Add totoal summary pie chart
|
||||
var totalSummary = [
|
||||
{ correct: "Correct", count: summary.totalCorrect },
|
||||
{ correct: "Incorrect", count: summary.totalIncorrect }
|
||||
];
|
||||
|
||||
var totalSummaryDS = new YAHOO.util.DataSource( totalSummary );
|
||||
totalSummaryDS.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
totalSummaryDS.responseSchema = { fields: [ "correct", "count" ] };
|
||||
|
||||
var _pie = new YAHOO.widget.PieChart( "chart", totalSummaryDS, {
|
||||
dataField: "count",
|
||||
categoryField: "correct",
|
||||
style:
|
||||
{
|
||||
padding: 10,
|
||||
legend:
|
||||
{
|
||||
display: "left",
|
||||
padding: 10,
|
||||
spacing: 2,
|
||||
font:
|
||||
{
|
||||
family: "Arial",
|
||||
size: 13
|
||||
}
|
||||
}
|
||||
},
|
||||
//only needed for flash player express install
|
||||
expressInstall: chartsUrl
|
||||
});
|
||||
|
||||
//define section datatable columns
|
||||
var myColumnDefs = [
|
||||
{key:"Question ID", sortable:true, resizeable:true},
|
||||
{key:"Question Text", formatter: YAHOO.widget.DataTable.formatText, sortable:true, resizeable:true},
|
||||
{key:"Answer ID", sortable:true, resizeable:true},
|
||||
{key:"Correct", sortable:true, resizeable:true},
|
||||
{key:"Answer Text", formatter: YAHOO.widget.DataTable.formatText, sortable:true, resizeable:true},
|
||||
{key:"Score", sortable:true, resizeable:true},
|
||||
{key:"Value", formatter: YAHOO.widget.DataTable.formatText, sortable:true, resizeable:true}
|
||||
];
|
||||
var sectionSummary = [];
|
||||
//Load up datatables and create section data for bar chart
|
||||
for(var i = 0; i < summary.sections.length; i++){
|
||||
var temp = summary.sections[i];
|
||||
sectionSummary[sectionSummary.length] = {"Total Responses": temp.total, "Correct": temp.correct, "Incorrect": temp.inCorrect, "section": (i+1)};
|
||||
var myDataSource = new YAHOO.util.DataSource(summary.sections[i].responses);
|
||||
//These needs to be put in a destroy call list for when the html dom is recreated, if summaries are going to be uses with page reloads, else memory leak.
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields: ["Question ID","Question Text","Answer ID","Correct","Answer Text","Score","Value"]
|
||||
};
|
||||
var tempText = "section" + (i+1) + "datatable";
|
||||
var _dt = new YAHOO.widget.DataTable(tempText, myColumnDefs, myDataSource, { caption: "Section " + (i+1) } );
|
||||
}
|
||||
|
||||
//Now create section summary bar charts
|
||||
var sectionSummaryDS = new YAHOO.util.DataSource( sectionSummary );
|
||||
sectionSummaryDS.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
sectionSummaryDS.responseSchema =
|
||||
{
|
||||
fields: [ "Total Responses", "Correct", "Incorrect", "section" ]
|
||||
};
|
||||
var sectionSummarySeriesDef =
|
||||
[
|
||||
{
|
||||
displayName: "Total Responses",
|
||||
yField: "Total Responses",
|
||||
style:{size:10}
|
||||
},
|
||||
{
|
||||
displayName: "Correct",
|
||||
yField: "Correct",
|
||||
style:{size:10}
|
||||
},
|
||||
{
|
||||
displayName: "Incorrect",
|
||||
yField: "Incorrect",
|
||||
style:{size:10}
|
||||
}
|
||||
];
|
||||
//create a Numeric Axis for displaying dollars
|
||||
var responseAxis = new YAHOO.widget.NumericAxis();
|
||||
responseAxis.title = "Responses";
|
||||
//create Category Axis to specify a title for the months
|
||||
var sectionAxis = new YAHOO.widget.CategoryAxis();
|
||||
sectionAxis.title = "Sections";
|
||||
//create the Chart
|
||||
var mychart = new YAHOO.widget.ColumnChart( "summarychart", sectionSummaryDS,
|
||||
{
|
||||
series: sectionSummarySeriesDef,
|
||||
xField: "section",
|
||||
xAxis: sectionAxis,
|
||||
yAxis: responseAxis,
|
||||
// dataTipFunction: Survey.Form.globalSummaryDataTip, //try again in 2.7
|
||||
expressInstall: chartsUrl
|
||||
});
|
||||
|
||||
YAHOO.util.Event.addListener("submitbutton", "click", function(){ Survey.Comm.submitSummary(); });
|
||||
}
|
||||
};
|
||||
|
||||
Survey.Form = {
|
||||
displayQuestions: function(params){
|
||||
toValidate = [];
|
||||
var qs = params.questions;
|
||||
var s = params.section;
|
||||
sliders = [];
|
||||
|
||||
//What to show and where
|
||||
document.getElementById('survey').innerHTML = params.html;
|
||||
//var te = document.createElement('span');
|
||||
//te.innerHTML = "<input type=button id=testB name='Reload Page' value='Reload Page'>";
|
||||
//document.getElementById('survey').appendChild(te);
|
||||
//YAHOO.util.Event.addListener("testB", "click", function(){Survey.Comm.callServer('','loadQuestions');});
|
||||
|
||||
if (qs[0]) {
|
||||
if (lastSection !== s.id || s.everyPageTitle === '1') {
|
||||
document.getElementById('headertitle').style.display = 'block';
|
||||
}
|
||||
if (lastSection !== s.id || s.everyPageText === '1') {
|
||||
document.getElementById('headertext').style.display = 'block';
|
||||
}
|
||||
if (lastSection !== s.id && s.questionsOnSectionPage !== '1') {
|
||||
var span = document.createElement("div");
|
||||
span.innerHTML = "<input type=button id='showQuestionsButton' value='Continue'>";
|
||||
span.style.display = 'block';
|
||||
|
||||
document.getElementById('survey-header').appendChild(span);
|
||||
|
||||
YAHOO.util.Event.addListener("showQuestionsButton", "click", function(){
|
||||
document.getElementById('showQuestionsButton').style.display = 'none';
|
||||
if (s.everyPageTitle !== '1') {
|
||||
document.getElementById('headertitle').style.display = 'none';
|
||||
}
|
||||
if (s.everyPageText !== '1') {
|
||||
document.getElementById('headertext').style.display = 'none';
|
||||
}
|
||||
document.getElementById('questions').style.display = 'inline';
|
||||
Survey.Form.addWidgets(qs);
|
||||
});
|
||||
}
|
||||
else {
|
||||
document.getElementById('questions').style.display = 'inline';
|
||||
Survey.Form.addWidgets(qs);
|
||||
}
|
||||
lastSection = s.id;
|
||||
}
|
||||
else {
|
||||
document.getElementById('headertitle').style.display = 'block';
|
||||
document.getElementById('headertext').style.display = 'block';
|
||||
document.getElementById('questions').style.display = 'inline';
|
||||
Survey.Form.addWidgets(qs);
|
||||
}
|
||||
},
|
||||
|
||||
addWidgets: function(qs){
|
||||
hasFile = false;
|
||||
for (var i = 0; i < qs.length; i++) {
|
||||
var q = qs[i];
|
||||
if (!q || !q.answers) {
|
||||
// gracefully handle q with no answers
|
||||
continue;
|
||||
}
|
||||
|
||||
var verts = '';
|
||||
for (var x in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, x)) {
|
||||
for (var y in q.answers[x]) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers[x], y)) {
|
||||
if (YAHOO.lang.isUndefined(q.answers[x][y])) {
|
||||
q.answers[x][y] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check if this question should be validated.
|
||||
//Sliders can't really be not answered, so requiring them makes little sense.
|
||||
if (q.required == true && q.questionType != 'Slider') {
|
||||
toValidate[q.id] = [];
|
||||
toValidate[q.id].type = q.questionType;
|
||||
toValidate[q.id].answers = [];
|
||||
}
|
||||
|
||||
if (DATE_SHORT[q.questionType]) {
|
||||
for (var k = 0; k < q.answers.length; k++) {
|
||||
var ans = q.answers[k];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].type = q.questionType;
|
||||
toValidate[q.id].answers[ans.id] = 1;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (COUNTRY[q.questionType]) {
|
||||
for (var k2 = 0; k2 < q.answers.length; k2++) {
|
||||
var ans2 = q.answers[k2];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].type = q.questionType;
|
||||
toValidate[q.id].answers[ans2.id] = 1;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (DATE_TYPES[q.questionType]) {
|
||||
for (var k3 = 0; k3 < q.answers.length; k3++) {
|
||||
var ans3 = q.answers[k3];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[ans3.id] = 1;
|
||||
}
|
||||
var calid = ans3.id + 'container';
|
||||
var c = new YAHOO.widget.Calendar(calid, {
|
||||
title: 'Choose a date:',
|
||||
close: true,
|
||||
navigator: true
|
||||
});
|
||||
c.selectEvent.subscribe(selectCalendar, [c, ans3.id], true);
|
||||
c.render();
|
||||
c.hide();
|
||||
var btn = new YAHOO.widget.Button({
|
||||
label: "Select Date",
|
||||
id: "pushbutton" + ans3.id,
|
||||
container: ans3.id + 'button'
|
||||
});
|
||||
btn.on("click", showCalendar, [c]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SLIDER_TYPES[q.questionType]) {
|
||||
//First run through and put up the span placeholders and find the max value for an answer, to know how big the allocation points will be.
|
||||
var max = 0;
|
||||
if (q.questionType === 'Dual Slider - Range') {
|
||||
handleDualSliders(q);
|
||||
}
|
||||
else {
|
||||
sliderManager(q);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UPLOAD_TYPES[q.questionType]) {
|
||||
hasFile = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TEXT_TYPES[q.questionType]) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[q.answers[x].id] = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (NUMBER_TYPES[q.questionType]) {
|
||||
for (var x1 in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, x1)) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[q.answers[x1].id] = {'min':q.answers[x1].min,'max':q.answers[x1].max,'step':q.answers[x1].step};
|
||||
}
|
||||
// Attach to the onblur event rather than keydown otherwise things get very cludgy for the end-user
|
||||
YAHOO.util.Event.addListener(q.answers[x1].id, "blur", numberHandler, q.answers[x1]);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Must be a multi-choice bundle
|
||||
var butts = [];
|
||||
verb = 0;
|
||||
for (var j = 0; j < q.answers.length; j++) {
|
||||
var a = q.answers[j];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[a.id] = 1;
|
||||
}
|
||||
var b = document.getElementById(a.id + 'button');
|
||||
if (a.verbatim) {
|
||||
verb = 1;
|
||||
}
|
||||
YAHOO.util.Event.addListener(a.id + 'button', "click", buttonChanged, { button: b, maxAnswers: q.maxAnswers, buttons: butts });
|
||||
b.hid = a.id;
|
||||
butts.push(b);
|
||||
}
|
||||
}
|
||||
YAHOO.util.Event.addListener("backbutton", "click", goBack);
|
||||
YAHOO.util.Event.addListener("submitbutton", "click", formsubmit);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
||||
YAHOO.util.Event.onDOMReady(function(){
|
||||
Survey.Comm.callServer('', 'loadQuestions');
|
||||
});
|
||||
118
www/extras/wobject/Survey/administersurvey/comm.js
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*global Survey, YAHOO, alert, window */
|
||||
if (typeof Survey === "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
(function(){
|
||||
|
||||
var callMade = 0;
|
||||
var request = function(sUrl, callback, postData, form, hasFile){
|
||||
if (form) {
|
||||
if (hasFile) {
|
||||
YAHOO.util.Connect.setForm(form, true);
|
||||
//YAHOO.log('set file was true');
|
||||
}
|
||||
else {
|
||||
//YAHOO.log('set file was false');
|
||||
YAHOO.util.Connect.setForm(form);
|
||||
}
|
||||
//YAHOO.log('setForm was true');
|
||||
}
|
||||
if (callMade) {
|
||||
alert("Your previous action is still being processed. Please try again.");
|
||||
}
|
||||
else {
|
||||
callMade = 1;
|
||||
YAHOO.log(sUrl);
|
||||
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Survey.Comm = {
|
||||
callback: {
|
||||
upload: function(o){
|
||||
callMade = 0;
|
||||
Survey.Comm.callServer('', 'loadQuestions');
|
||||
},
|
||||
success: function(o){
|
||||
window.scrollTo(0, 0);
|
||||
callMade = 0;
|
||||
var response = '';
|
||||
try {
|
||||
response = YAHOO.lang.JSON.parse(o.responseText);
|
||||
}
|
||||
catch (err) {
|
||||
YAHOO.log(err);
|
||||
alert("Oops.. A problem was encountered. Please try again.");
|
||||
return;
|
||||
}
|
||||
if (response.type === 'displayquestions') {
|
||||
Survey.Form.displayQuestions(response);
|
||||
}
|
||||
else{
|
||||
if (response.type === 'forward') {
|
||||
var url;
|
||||
if(response.url.match(/http/)){
|
||||
url = response.url;
|
||||
}else{
|
||||
url = location.protocol+"//"+location.host+"/"+response.url;
|
||||
}
|
||||
window.location = url;
|
||||
}
|
||||
else if(response.type === 'summary'){
|
||||
Survey.Summary.showSummary(response.summary,response.html);
|
||||
}
|
||||
else {
|
||||
alert("bad response");
|
||||
}
|
||||
}
|
||||
},
|
||||
failure: function(o){
|
||||
callMade = 0;
|
||||
if (o.status === -1) {
|
||||
alert("Last request timed out, please try again");
|
||||
}
|
||||
else {
|
||||
alert("Last request failed " + o.statusText);
|
||||
}
|
||||
}
|
||||
},
|
||||
submitSummary: function(data,functionName){
|
||||
var sUrl = "?func=loadQuestions;shownSummary=1";
|
||||
var revision = Survey.Comm.getRevision();
|
||||
if (revision) {
|
||||
sUrl += ";revision=" + revision;
|
||||
}
|
||||
|
||||
request(sUrl, this.callback, null, null, null);
|
||||
},
|
||||
|
||||
getRevision: function() {
|
||||
// Use the appropriate Survey response revision
|
||||
var revision = parseInt(document.getElementById('surveyResponseRevision').value, 10);
|
||||
if (!revision) {
|
||||
YAHOO.log("Revision not found, bad template?");
|
||||
}
|
||||
return revision;
|
||||
|
||||
},
|
||||
|
||||
callServer: function(data, functionName, form, hasFile){
|
||||
var postData;
|
||||
if (!form) {
|
||||
postData = "data=" + YAHOO.lang.JSON.stringify(data, data);
|
||||
}
|
||||
|
||||
//var sUrl = this.url + "?func="+functionName;
|
||||
var sUrl = "?func=" + functionName;
|
||||
|
||||
var revision = Survey.Comm.getRevision();
|
||||
if (revision) {
|
||||
sUrl += ";revision=" + revision;
|
||||
}
|
||||
|
||||
request(sUrl, this.callback, postData, form, hasFile);
|
||||
}
|
||||
};
|
||||
})();
|
||||
BIN
www/extras/wobject/Survey/bg-fader-500.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
www/extras/wobject/Survey/bg-fader.gif
Normal file
|
After Width: | Height: | Size: 433 B |
123
www/extras/wobject/Survey/dd.js
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
var Dom = YAHOO.util.Dom;
|
||||
var Event = YAHOO.util.Event;
|
||||
var DDM = YAHOO.util.DragDropMgr;
|
||||
|
||||
var currentDest;
|
||||
var started = 0;
|
||||
|
||||
Survey.DDList = function(id, sGroup, config) {
|
||||
|
||||
Survey.DDList.superclass.constructor.call(this, id, sGroup, config);
|
||||
|
||||
this.logger = this.logger || YAHOO;
|
||||
var el = this.getDragEl();
|
||||
Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent
|
||||
|
||||
this.goingUp = false;
|
||||
this.lastY = 0;
|
||||
};
|
||||
|
||||
YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
|
||||
|
||||
startDrag: function(x, y) {
|
||||
started +=2;
|
||||
this.logger.log(this.id + " startDrag");
|
||||
|
||||
// make the proxy look like the source element
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
Dom.setStyle(clickEl, "visibility", "hidden");
|
||||
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
|
||||
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
|
||||
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
|
||||
Dom.setStyle(dragEl, "border", "2px solid gray");
|
||||
},
|
||||
|
||||
endDrag: function(e) {
|
||||
|
||||
var srcEl = this.getEl();
|
||||
var proxy = this.getDragEl();
|
||||
|
||||
// Show the proxy element and animate it to the src element's location
|
||||
Dom.setStyle(proxy, "visibility", "");
|
||||
var a = new YAHOO.util.Motion(
|
||||
proxy, {
|
||||
points: {
|
||||
to: Dom.getXY(srcEl)
|
||||
}
|
||||
},
|
||||
0.2,
|
||||
YAHOO.util.Easing.easeOut
|
||||
)
|
||||
var proxyid = proxy.id;
|
||||
var thisid = this.id;
|
||||
|
||||
// Hide the proxy and show the source element when finished with the animation
|
||||
a.onComplete.subscribe(function() {
|
||||
Dom.setStyle(proxyid, "visibility", "hidden");
|
||||
Dom.setStyle(thisid, "visibility", "");
|
||||
});
|
||||
a.animate();
|
||||
},
|
||||
|
||||
onInvalidDrop: function(e, id) {
|
||||
Survey.Data.dragDrop(this.getEl());
|
||||
started += -2;
|
||||
},
|
||||
onDragDrop: function(e, id) {
|
||||
started--;
|
||||
if(started != 1){return;}
|
||||
Survey.Data.dragDrop(this.getEl());
|
||||
},
|
||||
|
||||
onDrag: function(e) {
|
||||
|
||||
// Keep track of the direction of the drag for use during onDragOver
|
||||
var y = Event.getPageY(e);
|
||||
var temp = Survey.Data.ddContainer.body;
|
||||
var dy = YAHOO.util.Dom.getY(temp);
|
||||
var scrollOffset = 30;
|
||||
if((y - scrollOffset) < dy){
|
||||
Survey.Data.ddContainer.body.scrollTop -= 20;
|
||||
}
|
||||
else if((y + scrollOffset) > (dy + temp.offsetHeight)){
|
||||
Survey.Data.ddContainer.body.scrollTop += 20;
|
||||
}
|
||||
if (y < this.lastY) {
|
||||
this.goingUp = true;
|
||||
} else if (y > this.lastY) {
|
||||
this.goingUp = false;
|
||||
}
|
||||
|
||||
this.lastY = y;
|
||||
},
|
||||
|
||||
onDragOver: function(e, id) {
|
||||
|
||||
var srcEl = this.getEl();
|
||||
var destEl = Dom.get(id);
|
||||
|
||||
// We are only concerned with list items, we ignore the dragover
|
||||
// notifications for the list.
|
||||
if (destEl.nodeName.toLowerCase() == "li") {
|
||||
currentDest = destEl;
|
||||
YAHOO.log(destEl);
|
||||
var orig_p = srcEl.parentNode;
|
||||
var p = destEl.parentNode;
|
||||
|
||||
if (this.goingUp) {
|
||||
Survey.Data.ddContainer
|
||||
p.insertBefore(srcEl, destEl); // insert above
|
||||
} else {
|
||||
p.insertBefore(srcEl, destEl.nextSibling); // insert below
|
||||
}
|
||||
|
||||
DDM.refreshCache();
|
||||
}
|
||||
}
|
||||
});
|
||||
242
www/extras/wobject/Survey/editsurvey.js
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
/*global Survey, YAHOO, alert */
|
||||
if (typeof Survey === "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.Data = (function(){
|
||||
|
||||
var lastDataSet = {};
|
||||
var focus;
|
||||
var lastId = -1;
|
||||
|
||||
// Keep references to widgets here so that we can destory any instances before
|
||||
// creating new ones (to avoid memory leaks)
|
||||
var sButton, qButton, aButton;
|
||||
|
||||
return {
|
||||
ddContainer:null,
|
||||
dragDrop: function(did){
|
||||
YAHOO.log('In drag drop');
|
||||
var type = did.className.match("section") ? 'section'
|
||||
: did.className.match("question") ? 'question'
|
||||
: 'answer';
|
||||
|
||||
var first = {
|
||||
id: did.id, // pre-drag index of item
|
||||
type: type
|
||||
};
|
||||
var before = YAHOO.util.Dom.getPreviousSiblingBy( document.getElementById(did.id), function(node){
|
||||
return node.id; // true iff node has a non-empty id
|
||||
});
|
||||
|
||||
var data = {
|
||||
id: '',
|
||||
type: ''
|
||||
};
|
||||
|
||||
if (before) {
|
||||
type = before.className.match("section") ? 'section'
|
||||
: before.className.match("question") ? 'question'
|
||||
: 'answer';
|
||||
data = {
|
||||
id: before.id,
|
||||
type: type
|
||||
};
|
||||
}
|
||||
YAHOO.log(first.id + ' ' + data.id);
|
||||
Survey.Comm.dragDrop(first, data);
|
||||
},
|
||||
|
||||
clicked: function(){
|
||||
Survey.Comm.loadSurvey(this.id);
|
||||
},
|
||||
|
||||
loadData: function(d){
|
||||
focus = d.address;//What is the current highlighted item.
|
||||
var warnings = "";
|
||||
for(var w in d.warnings){
|
||||
if (YAHOO.lang.hasOwnProperty(d.warnings, w)) {
|
||||
warnings += "<div class='warning'>" + d.warnings[w] + "</div>";
|
||||
}
|
||||
}
|
||||
if (document.getElementById('warnings')) {
|
||||
if (warnings !== "") {
|
||||
document.getElementById('warnings').innerHTML = warnings;
|
||||
YAHOO.util.Dom.setStyle('warnings-outer', 'display', 'block');
|
||||
}
|
||||
else {
|
||||
YAHOO.util.Dom.setStyle('warnings-outer', 'display', 'none');
|
||||
}
|
||||
}
|
||||
var showEdit = 1;
|
||||
if (lastId.toString() === d.address.toString()) {
|
||||
showEdit = 0;
|
||||
lastId = -1;
|
||||
}
|
||||
else {
|
||||
lastId = d.address;
|
||||
}
|
||||
|
||||
if (!Survey.Data.ddContainer) {
|
||||
|
||||
// Calculate the bottom of the warnings div (with a little padding)
|
||||
var warningsBottom = YAHOO.util.Dom.getRegion('warnings-outer').bottom + 5;
|
||||
warningsBottom = YAHOO.lang.isValue(warningsBottom) ? warningsBottom : 50;
|
||||
|
||||
// Calculate the bottom of the viewport (with a little padding)
|
||||
var viewPortBottom = YAHOO.util.Dom.getViewportHeight() - 10;
|
||||
|
||||
// Panel has height from bottom of warnings div to bottom of viewport,
|
||||
// but no smaller than 400
|
||||
var panelHeight = viewPortBottom - warningsBottom;
|
||||
panelHeight = panelHeight < 400 ? 400 : panelHeight;
|
||||
|
||||
Survey.Data.ddContainer = new YAHOO.widget.Panel("sections-panel", {
|
||||
width: "400px",
|
||||
height: panelHeight + 'px',
|
||||
visible: true,
|
||||
y: warningsBottom,
|
||||
draggable: true
|
||||
});
|
||||
|
||||
Survey.Data.ddContainer.setHeader(Survey.i18n.get('Asset_Survey','Survey Objects'));
|
||||
Survey.Data.ddContainer.setBody(d.ddhtml);
|
||||
Survey.Data.ddContainer.setFooter(document.getElementById("buttons"));
|
||||
Survey.Data.ddContainer.render();
|
||||
}
|
||||
else {
|
||||
var children = document.getElementById('sections-panel').childNodes;
|
||||
for( i in children){
|
||||
if(children[i].className == 'bd'){
|
||||
YAHOO.util.Event.purgeElement(children[i], true);
|
||||
}
|
||||
}
|
||||
Survey.Data.ddContainer.setBody(d.ddhtml);
|
||||
//Survey.Data.ddContainer.setFooter(document.getElementById("buttons"));
|
||||
}
|
||||
|
||||
// (re)Add resize handler
|
||||
if (Survey.Data.ddContainerResize) {
|
||||
Survey.Data.ddContainerResize.destroy();
|
||||
}
|
||||
Survey.Data.ddContainerResize = new YAHOO.util.Resize('sections-panel', {
|
||||
proxy: true,
|
||||
minWidth: 300,
|
||||
minHeight: 100
|
||||
});
|
||||
Survey.Data.ddContainerResize.on('resize', function(args){
|
||||
Survey.Data.ddContainer.cfg.setProperty("height", args.height + "px");
|
||||
});
|
||||
|
||||
//add event handlers for if a tag is clicked
|
||||
for (var x in d.ids) {
|
||||
if (YAHOO.lang.hasOwnProperty(d.ids, x)) {
|
||||
YAHOO.log('adding handler for ' + d.ids[x]);
|
||||
YAHOO.util.Event.addListener(d.ids[x], "click", this.clicked);
|
||||
var _s = new Survey.DDList(d.ids[x], "sections");
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle class on selected item
|
||||
var selectedId = focus.join('-');
|
||||
selectedId = selectedId === 'undefined' ? "0" : selectedId;
|
||||
if (document.getElementById(selectedId)) {
|
||||
YAHOO.util.Dom.addClass(selectedId, 'selected');
|
||||
}
|
||||
|
||||
if (!sButton) {
|
||||
sButton = new YAHOO.widget.Button({
|
||||
label: Survey.i18n.get('Asset_Survey','add section'),
|
||||
id: "addSection",
|
||||
container: "addSection"
|
||||
});
|
||||
sButton.on("click", this.addSection);
|
||||
}
|
||||
|
||||
if (!qButton) {
|
||||
qButton = new YAHOO.widget.Button({
|
||||
label: Survey.i18n.get('Asset_Survey', 'add question'),
|
||||
id: "addQuestion",
|
||||
container: "addQuestion"
|
||||
});
|
||||
qButton.on("click", this.addQuestion, d.buttons.question);
|
||||
}
|
||||
qButton.removeListener("click", this.addQuestion);
|
||||
qButton.on("click", this.addQuestion, d.buttons.question);
|
||||
|
||||
if (d.buttons.answer) {
|
||||
YAHOO.util.Dom.setStyle('addAnswer', 'display', 'inline');
|
||||
if (!aButton) {
|
||||
aButton = new YAHOO.widget.Button({
|
||||
label: Survey.i18n.get('Asset_Survey',"add answer"),
|
||||
id: "addAnswer",
|
||||
container: "addAnswer"
|
||||
});
|
||||
}
|
||||
aButton.removeListener("click", this.addAnswer);
|
||||
aButton.on("click", this.addAnswer, d.buttons.answer);
|
||||
}else{
|
||||
YAHOO.util.Dom.setStyle('addAnswer', 'display', 'none');
|
||||
}
|
||||
|
||||
if (showEdit == 1) {
|
||||
this.loadObjectEdit(d.edithtml, d.type, d.gotoTargets);
|
||||
}
|
||||
lastDataSet = d;
|
||||
},
|
||||
|
||||
addSection: function(){
|
||||
Survey.Comm.newSection();
|
||||
},
|
||||
|
||||
addQuestion: function(e, id){
|
||||
Survey.Comm.newQuestion(id);
|
||||
},
|
||||
|
||||
addAnswer: function(e, id){
|
||||
Survey.Comm.newAnswer(id);
|
||||
},
|
||||
|
||||
loadObjectEdit: function(edit, type, gotoTargets){
|
||||
if (edit) {
|
||||
Survey.ObjectTemplate.loadObject(edit, type, gotoTargets);
|
||||
}
|
||||
},
|
||||
|
||||
loadLast: function(){
|
||||
this.loadData(lastDataSet);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
// Initialize survey
|
||||
YAHOO.util.Event.onDOMReady(function(){
|
||||
//var ddTarget = new YAHOO.util.DDTarget("sections", "sections");
|
||||
Survey.i18n = new WebGUI.i18n( {
|
||||
'namespaces' : {
|
||||
'Asset_Survey' : [
|
||||
'Make Default Type',
|
||||
'Remove Default Type',
|
||||
'cancel',
|
||||
'add question',
|
||||
'add answer',
|
||||
'add section',
|
||||
'Survey Objects'
|
||||
],
|
||||
'Asset' : [
|
||||
'Copy'
|
||||
],
|
||||
'WebGUI' : [
|
||||
'submit',
|
||||
'preview',
|
||||
'576'
|
||||
]
|
||||
},
|
||||
onpreload : {
|
||||
fn : function () {
|
||||
Survey.ObjectTemplate.initObjectEditor();
|
||||
Survey.Comm.loadSurvey();
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
79
www/extras/wobject/Survey/editsurvey/comm.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*global Survey, YAHOO, alert */
|
||||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.Comm = new function(){
|
||||
var callMade = 0;
|
||||
|
||||
var request = function(sUrl,callback,postData){
|
||||
YAHOO.util.Dom.setStyle('mask-all','display','block');
|
||||
if(callMade == 1){
|
||||
alert("Waiting on previous request");
|
||||
}else{
|
||||
callMade = 1;
|
||||
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
||||
}
|
||||
};
|
||||
this.callback = {
|
||||
success:function(o){
|
||||
YAHOO.util.Dom.setStyle('mask-all','display','none');
|
||||
callMade = 0;
|
||||
Survey.Data.loadData(YAHOO.lang.JSON.parse(o.responseText));
|
||||
},
|
||||
failure: function(o){
|
||||
YAHOO.util.Dom.setStyle('mask-all','display','none');
|
||||
callMade = 0;
|
||||
alert("Last request failed");
|
||||
Survey.Data.loadLast();
|
||||
},
|
||||
timeout: 5000
|
||||
};
|
||||
this.loadSurvey = function(p){
|
||||
var postData = "data="+p;
|
||||
var sUrl = "?func=loadSurvey";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.dragDrop = function(target,before){
|
||||
var p = {};
|
||||
p.target = target;
|
||||
p.before = before;
|
||||
var postData = "data="+YAHOO.lang.JSON.stringify(p);
|
||||
var sUrl = "?func=dragDrop";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.submitEdit = function(p){
|
||||
var postData = "data="+YAHOO.lang.JSON.stringify(p);
|
||||
var sUrl = "?func=submitEdit";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.newSection = function(){
|
||||
var sUrl = "?func=newObject";
|
||||
request(sUrl,this.callback);
|
||||
};
|
||||
this.newQuestion = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=newObject";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.newAnswer = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=newObject";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.deleteAnswer = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=deleteAnswer";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.deleteQuestion = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=deleteQuestion";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
this.deleteSection = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=deleteSection";
|
||||
request(sUrl,this.callback,postData);
|
||||
};
|
||||
}();
|
||||
178
www/extras/wobject/Survey/editsurvey/object.js
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/*global Survey, YAHOO, alert, initHoverHelp, window */
|
||||
if (typeof Survey === "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.ObjectTemplate = (function(){
|
||||
|
||||
// Keep references to widgets here so that we can destory any instances before
|
||||
// creating new ones (to avoid memory leaks)
|
||||
var dialog, editor, resizeGotoExpression, gotoAutoComplete, editing;
|
||||
|
||||
return {
|
||||
hideEditor: function(){
|
||||
YAHOO.util.Dom.setStyle("editor_container","visibility","hidden");
|
||||
},
|
||||
showEditor: function(){
|
||||
editor.get('element').value = YAHOO.util.Dom.get('texteditortarget').value;
|
||||
editor.setEditorHTML(YAHOO.util.Dom.get('texteditortarget').value);
|
||||
YAHOO.util.Dom.setStyle("editor_container","visibility","visible");
|
||||
YAHOO.util.Dom.setXY("editor_container",YAHOO.util.Dom.getXY(YAHOO.util.Dom.get("texteditortarget").id));
|
||||
},
|
||||
|
||||
initObjectEditor: function() {
|
||||
editor = new YAHOO.widget.SimpleEditor("editor", {
|
||||
height: '100px',
|
||||
width: '570px',
|
||||
dompath: false
|
||||
});
|
||||
|
||||
if (editor.get('toolbar')) {
|
||||
editor.get('toolbar').titlebar = false;
|
||||
}
|
||||
editor.render();
|
||||
},
|
||||
|
||||
unloadObject: function(){
|
||||
|
||||
// And then the Dialog that contains it.
|
||||
if (dialog) {
|
||||
dialog.destroy();
|
||||
dialog = null;
|
||||
}
|
||||
|
||||
// remove the goto expression resizer
|
||||
if (resizeGotoExpression) {
|
||||
resizeGotoExpression.destroy();
|
||||
resizeGotoExpression = null;
|
||||
}
|
||||
|
||||
if (gotoAutoComplete) {
|
||||
gotoAutoComplete.destroy();
|
||||
gotoAutoComplete = null;
|
||||
}
|
||||
|
||||
// Remove all hover-help
|
||||
var hovers = YAHOO.util.Dom.getElementsByClassName('wg-hoverhelp');
|
||||
for (var i = 0; i < hovers.length; i++) {
|
||||
var hover = hovers[i];
|
||||
if (!hover) {
|
||||
continue;
|
||||
}
|
||||
YAHOO.util.Event.purgeElement(hover, true);
|
||||
hover.parentNode.removeChild(hover);
|
||||
}
|
||||
|
||||
// Finally, purge everything from the edit node
|
||||
YAHOO.util.Event.purgeElement('edit', true);
|
||||
|
||||
},
|
||||
|
||||
loadObject: function(html, type, gotoTargets){
|
||||
// First unload everything that already exists
|
||||
this.unloadObject();
|
||||
|
||||
document.getElementById('edit').innerHTML = html;
|
||||
|
||||
var btns = [{
|
||||
text: Survey.i18n.get('WebGUI',"submit"),
|
||||
handler: function(){
|
||||
editor.saveHTML();
|
||||
YAHOO.util.Dom.get('texteditortarget').value = editor.getEditorHTML();
|
||||
Survey.ObjectTemplate.hideEditor();
|
||||
this.submit();
|
||||
},
|
||||
isDefault: true
|
||||
}, {
|
||||
text: Survey.i18n.get('Asset',"Copy"),
|
||||
handler: function(){
|
||||
document.getElementById('copy').value = 1;
|
||||
this.submit();
|
||||
}
|
||||
}, {
|
||||
text: Survey.i18n.get('Asset_Survey',"cancel"),
|
||||
handler: function(){
|
||||
this.cancel();
|
||||
Survey.Comm.loadSurvey('-');
|
||||
}
|
||||
}, {
|
||||
text: Survey.i18n.get('WebGUI',"576"),
|
||||
handler: function(){
|
||||
document.getElementById('delete').value = 1;
|
||||
this.submit();
|
||||
}
|
||||
}, {
|
||||
text: Survey.i18n.get('WebGUI',"preview"),
|
||||
handler: function(){
|
||||
if (type === 'answer') {
|
||||
alert('Sorry, preview is only supported for Sections and Questions, not Answers');
|
||||
}
|
||||
else {
|
||||
var msg = 'This will delete any in-progress Survey responses you have made under this ' +
|
||||
'user account and redirect you to the Take Survey page starting at the selected item. ' +
|
||||
"\n\nAre you sure you want to continue?";
|
||||
if (confirm(msg)) {
|
||||
window.location.search = 'func=jumpTo;id=' + dialog.getData().id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
if(type === 'question'){
|
||||
btns[btns.length] = {
|
||||
text: Survey.i18n.get('Asset_Survey',"Make Default Type"),
|
||||
handler: function(){
|
||||
var name = prompt("Please change name to new type, or leave to update current type",document.forms[0].questionType.value);
|
||||
if(name != null){
|
||||
document.getElementById('addtype').value = name;
|
||||
this.submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
btns[btns.length] = {
|
||||
text: Survey.i18n.get('Asset_Survey',"Remove Default Type"),
|
||||
handler: function(){
|
||||
document.getElementById('removetype').value = 1;
|
||||
this.submit();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
dialog = new YAHOO.widget.Dialog(type, {
|
||||
width: "600px",
|
||||
context: [document.body, 'tr', 'tr'],
|
||||
visible: false,
|
||||
buttons: btns,
|
||||
constrainToViewport: true
|
||||
});
|
||||
|
||||
dialog.callback = Survey.Comm.callback;
|
||||
|
||||
dialog.hideEvent.subscribe(Survey.ObjectTemplate.hideEditor);
|
||||
dialog.dragEvent.subscribe(Survey.ObjectTemplate.showEditor);
|
||||
|
||||
dialog.render();
|
||||
|
||||
resizeGotoExpression = new YAHOO.util.Resize('resize_gotoExpression_formId');
|
||||
resizeGotoExpression.on('resize', function(ev) {
|
||||
YAHOO.util.Dom.setStyle('gotoExpression_formId', 'width', (ev.width - 6) + "px");
|
||||
YAHOO.util.Dom.setStyle('gotoExpression_formId', 'height', (ev.height - 6) + "px");
|
||||
|
||||
// Resizing the gotoExpression box can cause the texteditor to move, so update its position
|
||||
YAHOO.util.Dom.setXY("editor_container",YAHOO.util.Dom.getXY(YAHOO.util.Dom.get("texteditortarget").id));
|
||||
});
|
||||
|
||||
// build the goto auto-complete widget
|
||||
if (gotoTargets && document.getElementById('goto')) {
|
||||
var ds = new YAHOO.util.LocalDataSource(gotoTargets);
|
||||
gotoAutoComplete = new YAHOO.widget.AutoComplete('goto', 'goto-yui-ac-container', ds);
|
||||
}
|
||||
|
||||
var textareaId = type + 'Text';
|
||||
var textarea = YAHOO.util.Dom.get(textareaId);
|
||||
|
||||
dialog.show();
|
||||
initHoverHelp(type);
|
||||
Survey.ObjectTemplate.showEditor();
|
||||
}
|
||||
};
|
||||
})();
|
||||
BIN
www/extras/wobject/Survey/gradient-glossy.png
Normal file
|
After Width: | Height: | Size: 132 B |
BIN
www/extras/wobject/Survey/rel_interstitial_loading.gif
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
www/extras/wobject/Survey/thumb-n.gif
Normal file
|
After Width: | Height: | Size: 612 B |
32
www/extras/wobject/Thingy/thingy.css
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*div.workarea { padding:10px; float:left }*/
|
||||
|
||||
ul.draglist {
|
||||
/*position: relative;*/
|
||||
width: 600px;
|
||||
background: #f7f7f7;
|
||||
/*border: 1px solid gray;*/
|
||||
list-style: none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
ul.draglist li {
|
||||
margin: 1px;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
ul.draglist_alt li {
|
||||
margin: 1px;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
|
||||
li.list1 {
|
||||
/*background-color: #D1E6EC;*/
|
||||
border:1px solid #7EA6B2;
|
||||
}
|
||||
|
||||
.formPretext {
|
||||
font-family: helvetica, arial;
|
||||
font-size: 11px;
|
||||
}
|
||||
566
www/extras/wobject/Thingy/thingy.js
Normal file
|
|
@ -0,0 +1,566 @@
|
|||
function setCancelButton () {
|
||||
var cancelButtons = YAHOO.util.Dom.getElementsByClassName('backwardButton','input','application_workarea');
|
||||
function deleteTempThing () {
|
||||
window.location.href = "?func=deleteThingConfirm;thingId="+newThingId;
|
||||
}
|
||||
for (var i = cancelButtons.length; i--; ) {
|
||||
cancelButtons[i].onclick = deleteTempThing;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initOptionalFields(prefix,fieldId) {
|
||||
|
||||
var fieldInThing_module_rendered;
|
||||
|
||||
var height_module = new YAHOO.widget.Module(prefix + "_height_module", { visible: false });
|
||||
height_module.render();
|
||||
|
||||
var width_module = new YAHOO.widget.Module(prefix + "_width_module", { visible: false });
|
||||
width_module.render();
|
||||
|
||||
var size_module = new YAHOO.widget.Module(prefix + "_size_module", { visible: false });
|
||||
size_module.render();
|
||||
|
||||
var vertical_module = new YAHOO.widget.Module(prefix + "_vertical_module", { visible: false });
|
||||
vertical_module.render();
|
||||
|
||||
var values_module = new YAHOO.widget.Module(prefix + "_values_module", { visible: false });
|
||||
values_module.render();
|
||||
|
||||
var defaultValue_module = new YAHOO.widget.Module(prefix + "_defaultValue_module", { visible: false });
|
||||
defaultValue_module.render();
|
||||
|
||||
var fieldInThing_module = new YAHOO.widget.Module(prefix + "_fieldInThing_module", { visible: false });
|
||||
fieldInThing_module.render();
|
||||
|
||||
var defaultFieldInThing_module = new YAHOO.widget.Module(prefix + "_defaultFieldInThing_module", { visible: false });
|
||||
defaultFieldInThing_module.render();
|
||||
|
||||
YAHOO.util.Event.onContentReady(prefix+"_fieldType_formId", checkFieldType);
|
||||
YAHOO.util.Event.addListener(prefix+"_fieldType_formId", "change", checkFieldType);
|
||||
|
||||
function checkFieldType(){
|
||||
if (this.value in hasHeightWidth){
|
||||
height_module.show();
|
||||
width_module.show()
|
||||
}else{
|
||||
height_module.hide();
|
||||
width_module.hide()
|
||||
}
|
||||
if (this.value in hasVertical){
|
||||
vertical_module.show();
|
||||
}else{
|
||||
vertical_module.hide();
|
||||
}
|
||||
if (this.value in hasSize){
|
||||
size_module.show()
|
||||
}else{
|
||||
size_module.hide();
|
||||
}
|
||||
if (this.value in hasValues){
|
||||
values_module.show();
|
||||
}else{
|
||||
values_module.hide();
|
||||
}
|
||||
var valueStart = this.value.slice(0,10);
|
||||
|
||||
if (valueStart != "otherThing"){
|
||||
defaultValue_module.show();
|
||||
}else{
|
||||
defaultValue_module.hide();
|
||||
}
|
||||
if(valueStart == "otherThing"){
|
||||
var thingId = this.value.slice(11);
|
||||
|
||||
var getFieldValues = function() {
|
||||
var fieldInOtherThingId = this.value;
|
||||
var url = location.pathname + "?func=selectDefaultFieldValue;thingId=" + thingId + ";fieldInOtherThingId=" + fieldInOtherThingId + ";fieldId=" + fieldId;
|
||||
|
||||
var handleSuccess = function(o){
|
||||
defaultFieldInThing_module.setBody(o.responseText);
|
||||
defaultFieldInThing_module.show();
|
||||
};
|
||||
|
||||
var handleFailure = function(o) {
|
||||
alert("Get field values failed: " + o.status);
|
||||
};
|
||||
|
||||
var callback =
|
||||
{
|
||||
success:handleSuccess,
|
||||
failure:handleFailure
|
||||
};
|
||||
|
||||
var request = YAHOO.util.Connect.asyncRequest('GET', url, callback);
|
||||
|
||||
};
|
||||
|
||||
if (fieldInThing_module_rendered == thingId){
|
||||
fieldInThing_module.show();
|
||||
defaultFieldInThing_module.show();
|
||||
}else{
|
||||
var url = location.pathname + "?func=selectFieldInThing;thingId=" + thingId + ";prefix=" +prefix + ";fieldId=" + fieldId;
|
||||
var handleSuccess = function(o){
|
||||
fieldInThing_module.setBody(o.responseText);
|
||||
fieldInThing_module.show();
|
||||
fieldInThing_module_rendered = thingId;
|
||||
YAHOO.util.Event.onContentReady(prefix+"_fieldInOtherThing_formId",getFieldValues);
|
||||
YAHOO.util.Event.addListener(prefix+"_fieldInOtherThing_formId","change", getFieldValues);
|
||||
|
||||
};
|
||||
|
||||
var handleFailure = function(o) {
|
||||
alert("Get fields in thing failed: " + o.status);
|
||||
};
|
||||
|
||||
var callback =
|
||||
{
|
||||
success:handleSuccess,
|
||||
failure:handleFailure
|
||||
};
|
||||
|
||||
var request = YAHOO.util.Connect.asyncRequest('GET', url, callback);
|
||||
}
|
||||
}else{
|
||||
fieldInThing_module.hide();
|
||||
defaultFieldInThing_module.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function editListItem(url,fieldId,copy) {
|
||||
|
||||
var handleGetFormSuccess = function(o){
|
||||
|
||||
var handleSuccess = function(o) {
|
||||
var response = o.responseText;
|
||||
var listItemId = response.slice(0,22);
|
||||
var newInnerHTML = response.slice(22);
|
||||
var label = editFieldDialog.getData().label;
|
||||
|
||||
if(copy){
|
||||
addListItemHTML(listItemId, newInnerHTML,label);
|
||||
}
|
||||
|
||||
var li = new YAHOO.util.Element(listItemId);
|
||||
li.set('innerHTML',newInnerHTML);
|
||||
var search_label = new YAHOO.util.Element("search_label_"+listItemId);
|
||||
search_label.set('innerHTML',label);
|
||||
var view_label = new YAHOO.util.Element("view_label_"+listItemId);
|
||||
view_label.set('innerHTML',label);
|
||||
};
|
||||
|
||||
var handleFailure = function(o) {
|
||||
alert("Submission failed: " + o.status);
|
||||
};
|
||||
|
||||
var handleSubmit = function() {
|
||||
this.submit();
|
||||
};
|
||||
var handleCancel = function() {
|
||||
this.cancel();
|
||||
this.destroy();
|
||||
};
|
||||
function optionalFields() {
|
||||
initOptionalFields(dialogId,fieldId);
|
||||
}
|
||||
|
||||
var dialogId = "edit_"+fieldId+"_Dialog";
|
||||
if(copy){
|
||||
dialogId = dialogId + '_copy';
|
||||
}
|
||||
|
||||
editFieldDialog = new YAHOO.widget.Dialog(dialogId, { width:"460px", visible:false, draggable:true,close:true, fixedcenter:true, zIndex:11001, height: "430px",
|
||||
autofillheight:null,
|
||||
buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
|
||||
{ text:"Cancel", handler:handleCancel } ]
|
||||
} );
|
||||
|
||||
if(copy){
|
||||
editFieldDialog.setHeader("Copy Field");
|
||||
}else{
|
||||
editFieldDialog.setHeader("Edit Field");
|
||||
}
|
||||
editFieldDialog.setBody(o.responseText);
|
||||
editFieldDialog.render(document.body);
|
||||
editFieldDialog.callback = { success: handleSuccess, failure: handleFailure };
|
||||
editFieldDialog.show();
|
||||
YAHOO.util.Event.onContentReady(dialogId, optionalFields);
|
||||
initHoverHelp(dialogId);
|
||||
|
||||
};
|
||||
|
||||
var handleGetFormFailure = function(o) {
|
||||
alert("Getting edit field dialog failed: " + o.status);
|
||||
};
|
||||
|
||||
var callbackGetForm =
|
||||
{
|
||||
success:handleGetFormSuccess,
|
||||
failure:handleGetFormFailure,
|
||||
cache:false
|
||||
};
|
||||
|
||||
var request = YAHOO.util.Connect.asyncRequest('GET', url, callbackGetForm);
|
||||
}
|
||||
|
||||
function addListItemHTML(listItemId, newInnerHTML,label){
|
||||
var ul1 = new YAHOO.util.Element('ul1');
|
||||
var li = document.createElement('li');
|
||||
li.id = listItemId;
|
||||
li.className = 'list1';
|
||||
li.innerHTML = newInnerHTML;
|
||||
ul1.appendChild(li);
|
||||
var newListItem = Dom.get(listItemId);
|
||||
new YAHOO.draglist.DDList(newListItem);
|
||||
|
||||
// Add table row to fields on search tab
|
||||
var search_fields_table = new YAHOO.util.Element('search_fields_table');
|
||||
var search_fields_table_rows = search_fields_table.getElementsByTagName("tr");
|
||||
var search_tr = document.createElement('tr');
|
||||
search_tr.id = "search_tr_"+listItemId;
|
||||
search_fields_table.appendChild(search_tr);
|
||||
|
||||
var label_td = document.createElement('td');
|
||||
label_td.id = "search_label_"+listItemId;
|
||||
label_td.className = 'formDescription';
|
||||
label_td.innerHTML = label;
|
||||
search_tr.appendChild(label_td);
|
||||
|
||||
var displayInSearch_td = document.createElement('td');
|
||||
displayInSearch_td.id = "search_displayInSearch_"+listItemId;
|
||||
displayInSearch_td.className = 'tableData';
|
||||
displayInSearch_td.innerHTML = "<input type='checkbox' name='displayInSearch_"+listItemId+"' value='1' checked='checked' />";
|
||||
search_tr.appendChild(displayInSearch_td);
|
||||
|
||||
var searchIn_td = document.createElement('td');
|
||||
searchIn_td.id = "search_searchIn_"+listItemId;
|
||||
searchIn_td.className = 'tableData';
|
||||
// only the first field should be checked by default
|
||||
if (search_fields_table_rows.length == 2){
|
||||
searchIn_td.innerHTML = "<input type='checkbox' name='searchIn_"+listItemId+"' value='1' checked='checked' />";
|
||||
}else{
|
||||
searchIn_td.innerHTML = "<input type='checkbox' name='searchIn_"+listItemId+"' value='1' />";
|
||||
}
|
||||
search_tr.appendChild(searchIn_td);
|
||||
|
||||
var sortBy_td = document.createElement('td');
|
||||
sortBy_td.id = "search_sortBy_"+listItemId;
|
||||
sortBy_td.className = 'tableData';
|
||||
sortBy_td.innerHTML = "<input type='radio' name='sortBy' value='"+listItemId+"' />";
|
||||
search_tr.appendChild(sortBy_td);
|
||||
|
||||
// Add table row to fields on view tab
|
||||
var view_fields_table = new YAHOO.util.Element('view_fields_table');
|
||||
var view_fields_table_rows = view_fields_table.getElementsByTagName("tr");
|
||||
var view_tr = document.createElement('tr');
|
||||
view_tr.id = "view_tr_"+listItemId;
|
||||
view_fields_table.appendChild(view_tr);
|
||||
|
||||
var view_label_td = document.createElement('td');
|
||||
view_label_td.id = "view_label_"+listItemId;
|
||||
view_label_td.className = 'formDescription';
|
||||
view_label_td.innerHTML = label;
|
||||
view_tr.appendChild(view_label_td);
|
||||
|
||||
var display_td = document.createElement('td');
|
||||
display_td.id = "view_display_"+listItemId;
|
||||
display_td.className = 'tableData';
|
||||
display_td.innerHTML = "<input type='checkbox' name='display_"+listItemId+"' value='1' checked='checked' />";
|
||||
view_tr.appendChild(display_td);
|
||||
|
||||
var viewScreenTitle_td = document.createElement('td');
|
||||
viewScreenTitle_td.id = "view_viewScreenTitle_"+listItemId;
|
||||
viewScreenTitle_td.className = 'tableData';
|
||||
|
||||
// only the first field should be checked by default
|
||||
if (view_fields_table_rows.length == 2){
|
||||
viewScreenTitle_td.innerHTML = "<input type='checkbox' name='viewScreenTitle_"+listItemId+"' value='1' checked='checked'/>";
|
||||
}else{
|
||||
viewScreenTitle_td.innerHTML = "<input type='checkbox' name='viewScreenTitle_"+listItemId+"' value='1' />";
|
||||
}
|
||||
view_tr.appendChild(viewScreenTitle_td);
|
||||
}
|
||||
|
||||
|
||||
function initAddFieldDialog() {
|
||||
|
||||
var handleSuccess = function(o) {
|
||||
var response = o.responseText;
|
||||
var thingId = response.slice(0,22);
|
||||
var listItemId = response.slice(22,44);
|
||||
var newInnerHTML = response.slice(44);
|
||||
var label = addFieldDialog.getData().label;
|
||||
addListItemHTML(listItemId, newInnerHTML,label);
|
||||
var idTags = document.getElementsByName( "thingId" );
|
||||
for( var index = 0; index < idTags.length; index++ ) {
|
||||
idTags[index].value = thingId;
|
||||
window.newThingId = thingId;
|
||||
}
|
||||
setCancelButton();
|
||||
};
|
||||
|
||||
var handleFailure = function(o) {
|
||||
alert("Submission failed: " + o.status);
|
||||
};
|
||||
|
||||
var handleSubmit = function() {
|
||||
this.submit();
|
||||
};
|
||||
var handleCancel = function() {
|
||||
this.cancel();
|
||||
};
|
||||
|
||||
var addFieldDialog = new YAHOO.widget.Dialog("addDialog", { width:"460px", visible:false,
|
||||
draggable:true, close:true, fixedcenter:true, zIndex:11002, height: "430px",
|
||||
autofillheight:null,
|
||||
buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
|
||||
{ text:"Cancel", handler:handleCancel } ]
|
||||
} );
|
||||
addFieldDialog.callback = { success: handleSuccess, failure: handleFailure };
|
||||
addFieldDialog.render();
|
||||
|
||||
initOptionalFields("addDialog");
|
||||
|
||||
YAHOO.util.Event.addListener("showAddFormButton", "click", addFieldDialog.show, addFieldDialog, true);
|
||||
|
||||
}
|
||||
|
||||
YAHOO.util.Event.addListener(window, "load", initAddFieldDialog);
|
||||
|
||||
|
||||
function deleteListItem (url,listItemId,thingId) {
|
||||
|
||||
if (confirm("Are you sure you want to delete this field?")){
|
||||
|
||||
var handleSuccess = function(o){
|
||||
|
||||
var ul1 = new YAHOO.util.Element('ul1');
|
||||
var removeElement = YAHOO.util.Dom.get(listItemId);
|
||||
ul1.removeChild(removeElement);
|
||||
|
||||
var search_fields_table = new YAHOO.util.Element('search_fields_table');
|
||||
removeElement = YAHOO.util.Dom.get("search_tr_"+listItemId);
|
||||
search_fields_table.removeChild(removeElement);
|
||||
|
||||
var view_fields_table = new YAHOO.util.Element('view_fields_table');
|
||||
removeElement = YAHOO.util.Dom.get("view_tr_"+listItemId);
|
||||
view_fields_table.removeChild(removeElement);
|
||||
|
||||
};
|
||||
|
||||
var handleFailure = function(o) {
|
||||
alert("Submission failed: " + o.status);
|
||||
};
|
||||
|
||||
var callback =
|
||||
{
|
||||
success:handleSuccess,
|
||||
failure:handleFailure
|
||||
};
|
||||
|
||||
var postData = "func=deleteFieldConfirm;fieldId=" + listItemId + ";thingId=" + thingId;
|
||||
var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, postData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var Dom = YAHOO.util.Dom;
|
||||
var Event = YAHOO.util.Event;
|
||||
var DDM = YAHOO.util.DragDropMgr;
|
||||
YAHOO.namespace ("draglist");
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
YAHOO.draglist.DDApp = {
|
||||
init: function() {
|
||||
|
||||
|
||||
new YAHOO.util.DDTarget("ul1");
|
||||
var ul1=Dom.get("ul1");
|
||||
var items = ul1.getElementsByTagName("li");
|
||||
for (i=0;i<items.length;i=i+1) {
|
||||
new YAHOO.draglist.DDList(items[i].id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
YAHOO.draglist.DDList = function(id, sGroup, config) {
|
||||
|
||||
YAHOO.draglist.DDList.superclass.constructor.call(this, id, sGroup, config);
|
||||
|
||||
this.logger = this.logger || YAHOO;
|
||||
var el = this.getDragEl();
|
||||
|
||||
Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent
|
||||
this.setXConstraint(0,0);
|
||||
|
||||
this.goingUp = false;
|
||||
this.lastY = 0;
|
||||
};
|
||||
|
||||
var getRank = function(ul,curId) {
|
||||
var items = ul.getElementsByTagName("li");
|
||||
var rank;
|
||||
for (i=0;i<items.length;i=i+1) {
|
||||
if(items[i].id == curId){
|
||||
rank = i;
|
||||
}
|
||||
}
|
||||
return rank;
|
||||
};
|
||||
|
||||
var destination = "";
|
||||
var direction = "";
|
||||
var origRank = "";
|
||||
|
||||
YAHOO.extend(YAHOO.draglist.DDList, YAHOO.util.DDProxy, {
|
||||
|
||||
startDrag: function(x, y) {
|
||||
this.logger.log(this.id + " startDrag");
|
||||
|
||||
// make the proxy look like the source element
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
origRank = getRank(clickEl.parentNode,clickEl.id);
|
||||
Dom.setStyle(clickEl, "opacity", 0.20);
|
||||
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
|
||||
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
|
||||
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
|
||||
Dom.setStyle(dragEl, "border", "2px solid gray");
|
||||
},
|
||||
|
||||
endDrag: function(e) {
|
||||
|
||||
var srcEl = this.getEl();
|
||||
var proxy = this.getDragEl();
|
||||
|
||||
var doAnimation = function (){
|
||||
Dom.setStyle(proxy, "visibility", "");
|
||||
var a = new YAHOO.util.Motion(
|
||||
proxy, {
|
||||
points: {
|
||||
to: Dom.getXY(srcEl)
|
||||
}
|
||||
},
|
||||
0.2,
|
||||
YAHOO.util.Easing.easeOut
|
||||
)
|
||||
var proxyid = proxy.id;
|
||||
var thisid = srcEl.id;
|
||||
|
||||
// Hide the proxy and show the source element when finished with the animation
|
||||
a.onComplete.subscribe(function() {
|
||||
Dom.setStyle(proxyid, "visibility", "hidden");
|
||||
//Dom.setStyle(thisid, "visibility", "");
|
||||
Dom.setStyle(thisid, "opacity", 1);
|
||||
});
|
||||
a.animate();
|
||||
}
|
||||
var curRank = getRank(srcEl.parentNode,srcEl.id);
|
||||
|
||||
if (destination == "" || origRank == curRank){
|
||||
doAnimation();
|
||||
}
|
||||
else{
|
||||
var handleSuccess = function(o){
|
||||
|
||||
// Show the proxy element and animate it to the src element's location
|
||||
if (o.responseText == "fieldMoved"){
|
||||
doAnimation();
|
||||
}else{
|
||||
alert('wrong response from moveFieldConfirm : ' + o.responseText);
|
||||
}
|
||||
};
|
||||
|
||||
var handleFailure = function(o) {
|
||||
alert("Submission failed: " + o.status);
|
||||
};
|
||||
|
||||
var callback =
|
||||
{
|
||||
success:handleSuccess,
|
||||
failure:handleFailure
|
||||
};
|
||||
var url = location.pathname;
|
||||
//curRank = curRank +1;
|
||||
//origRank = origRank +1;
|
||||
var postData = "func=moveFieldConfirm;fieldId=" + srcEl.id + ";targetFieldId=" + destination+";direction="+direction;//currentRank="+curRank+";originalRank="+origRank+";
|
||||
var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, postData);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
onDragDrop: function(e, id) {
|
||||
|
||||
// If there is one drop interaction, the li was dropped either on the list,
|
||||
// or it was dropped on the current location of the source element.
|
||||
if (DDM.interactionInfo.drop.length === 1) {
|
||||
|
||||
// The position of the cursor at the time of the drop (YAHOO.util.Point)
|
||||
var pt = DDM.interactionInfo.point;
|
||||
|
||||
// The region occupied by the source element at the time of the drop
|
||||
var region = DDM.interactionInfo.sourceRegion;
|
||||
|
||||
// Check to see if we are over the source element's location. We will
|
||||
// append to the bottom of the list once we are sure it was a drop in
|
||||
// the negative space (the area of the list without any list items)
|
||||
if (!region.intersect(pt)) {
|
||||
var destEl = Dom.get(id);
|
||||
var destDD = DDM.getDDById(id);
|
||||
destEl.appendChild(this.getEl());
|
||||
destDD.isEmpty = false;
|
||||
DDM.refreshCache();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDrag: function(e) {
|
||||
|
||||
// Keep track of the direction of the drag for use during onDragOver
|
||||
var y = Event.getPageY(e);
|
||||
|
||||
if (y < this.lastY) {
|
||||
this.goingUp = true;
|
||||
} else if (y > this.lastY) {
|
||||
this.goingUp = false;
|
||||
}
|
||||
|
||||
this.lastY = y;
|
||||
},
|
||||
|
||||
onDragOver: function(e, id) {
|
||||
|
||||
var srcEl = this.getEl();
|
||||
var destEl = Dom.get(id);
|
||||
|
||||
// We are only concerned with list items, we ignore the dragover
|
||||
// notifications for the list.
|
||||
if (destEl.nodeName.toLowerCase() == "li") {
|
||||
var orig_p = srcEl.parentNode;
|
||||
var p = destEl.parentNode;
|
||||
destination = destEl.id;
|
||||
if (this.goingUp) {
|
||||
direction = 'up';
|
||||
p.insertBefore(srcEl, destEl); // insert above
|
||||
} else {
|
||||
direction = 'down';
|
||||
p.insertBefore(srcEl, destEl.nextSibling); // insert below
|
||||
}
|
||||
|
||||
DDM.refreshCache();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Event.onDOMReady(YAHOO.draglist.DDApp.init, YAHOO.draglist.DDApp, true);
|
||||
|
||||
})();
|
||||
BIN
www/extras/wobject/TimeTracking/delete.gif
Normal file
|
After Width: | Height: | Size: 334 B |
BIN
www/extras/wobject/TimeTracking/edit.gif
Normal file
|
After Width: | Height: | Size: 577 B |
BIN
www/extras/wobject/WeatherData/large_icons/0.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/1.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/10.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/11.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/12.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/13.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/14.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/15.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/16.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/17.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/18.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/19.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/2.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/20.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/21.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/22.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/23.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/24.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/25.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
www/extras/wobject/WeatherData/large_icons/26.png
Normal file
|
After Width: | Height: | Size: 17 KiB |