Created
September 17, 2009 21:45
-
-
Save web-zen/188744 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>CCOP Task Manager for XML Docs</title> | |
<!-- Embedded CSS --> | |
<style type="text/css"> | |
#dlgAddTask .bd{height:25em; width:26em;} | |
#dlgAddTask label{display:block; float:left; width:11em; clear:left;} | |
#dlgAddTask select{margin:5px; width:12em;} | |
#dlgAddTask input{margin:5px;} | |
#standard input{display:block; clear:both;} | |
.hide { display: none; } | |
.showBlock { display: block; } | |
</style> | |
</head> | |
<body class="yui-skin-sam main"> | |
<div id="doc3" class="yui-t3"> | |
<div id="hd"> | |
<?php | |
require_once("includes/header.php") | |
?> | |
</div> | |
<div id="bd"> | |
<div id="yui-main"> | |
<h2 id="mainHeader" style="padding: 0em 0em 0em 1em;">Task Manager for XML Docs</h2> | |
<div id="dt-container" class="yui-dt-body" style="padding: 0em 0em 1em 1em;"></div> | |
<div id="addBTN" class="yui-dt-body" style="padding: 0em 0em 1em 50em;"> | |
<button id="btnAddTask">Add a New Task</button> | |
<div id="dlgAddTask"> | |
<div class="hd">Add a New Task</div> | |
<div class="bd"> | |
<form id="frmAddTask" method="POST" action="taskmanager_db.php?action=insert-newtask"> | |
<label for="title">Title:</label><input type="textbox" name="title" id="title" class="text"/> | |
<label for="description">Task Description:</label><input type="textbox" name="taskdesc" id="taskdesc" class="text"/> | |
<label for='doctype'>Document Type:</label> | |
<select name='doctype' id='doctype' onchange='DocTypeonchange(this.options[this.selectedIndex].value);'> | |
<option selected='selected' value='Component' >Component</option> | |
<option value='System'>System</option> | |
</select> | |
<div id='divSysNum'> | |
<label for='sysNum'>SysNum:</label> | |
<select name='sysNum' id='sysNum' onchange='DocTypeonchange();'> | |
</select> | |
<img id='addSysNum' src="images/add.png" width="16" height="16" onclick="createNewSysNum()"> | |
</div> | |
<label for="xmldocuri">XML Doc URI:</label><input type="textbox" name="xmldocuri" id="xmldocuri" class="text" value=".\documents\component\"/> | |
<label for="xmldocfilename">XML Doc Filename:</label><input type="textbox" name="xmldocfilename" id="xmldocfilename" class="text" value="DComp_"/> | |
<?php | |
$SQL="SELECT UserID, CONCAT(LastName, ',', Firstname) AS FullName FROM cushman_synchro.Users ORDER BY LastName, FirstName"; | |
// prepare statement | |
if ($stmt = $oTechdocs->prepare($SQL)) { | |
$stmt->execute() or die ("Could not execute statement"); // execute prepared statement | |
$stmt->bind_result($UserID, $FullName); | |
while ($r = $stmt->fetch()) { | |
$array[$UserID] = $FullName; | |
} | |
echo "<label for='authorid'>Author:</label><select name='authorid'>"; | |
foreach ($array as $UserID => $FullName) { | |
echo "<option value='$UserID'>$FullName</option>"; | |
} | |
echo "</select>"; | |
echo "<label for='reviewerid'>Reviewer:</label><select name='reviewerid'>"; | |
echo "<option value=''></option>"; | |
foreach ($array as $UserID => $FullName) { | |
echo "<option value='$UserID'>$FullName</option>"; | |
} | |
echo "</select>"; | |
echo '<label for="editorid">Editor:</label><select name="editorid">'; | |
echo "<option value=''></option>"; | |
foreach ($array as $UserID => $FullName) { | |
echo "<option value='$UserID'>$FullName</option>"; | |
} | |
echo "</select>"; | |
echo "<label for='publisherid'>Publisher:</label><select name='publisherid'>"; | |
echo "<option value=''></option>"; | |
foreach ($array as $UserID => $FullName) { | |
echo "<option value='$UserID'>$FullName</option>"; | |
} | |
echo "</select>"; | |
?> | |
<script>var jsUsers = <?php echo json_encode($array)?>; | |
</script> | |
<?php | |
$stmt->close(); // close statement | |
} | |
?> | |
<br> | |
<label for="standard">Standard:</label><input type=checkbox name="standard" id="standard" value=1></input> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div id="ft"> | |
<?php | |
require_once("includes/footer.php") | |
?> | |
</div> | |
</div> | |
<!--Include YUI Loader: --> | |
<script type="text/javascript" src="frameworks/yui_2.7.0b/yui/build/yuiloader/yuiloader-min.js"></script> | |
<script type="text/javascript" src="js/loader-config.js"></script> | |
<script type="text/javascript"> | |
(function() { | |
var loader = new YAHOO.util.YUILoader(_yuiloader_config.config); | |
var modules = _yuiloader_config.modules; | |
for (i=0; i < modules.length; ++i) { | |
loader.addModule(modules[i]); | |
} | |
loader.require(["animation","base","button","connection","container","cookie","datasource","datatable","paginator", "dragdrop", "element","json", "logger", "menu","reset-fonts-grids", "yuiloader-dom-event", "maincss", "taskmanagerDataTable"]); | |
// Load the files using the insert() method. | |
loader.insert({ | |
onSuccess: function() { | |
var _myComponents = ["js/menu-renderer.js"]; | |
YAHOO.util.Get.script(_myComponents, { | |
onSuccess: function() { | |
}}); | |
}, | |
onFailure:function(msg) { | |
YAHOO.log(msg,'error','myPage'); | |
var t = 0; | |
} | |
} | |
); | |
})(); | |
</script> | |
<script type="text/javascript"> | |
function createNewSysNum() { // Create a new System Number | |
var newSysNum = prompt("Enter the SysNum you would like to add", "") | |
// validate entry is positive Integer | |
if (!/\D/.test(newSysNum) && newSysNum!=""){ // if is a number and not empty string | |
} else { | |
alert('Only Integers allowed for folder names here, ex: 876'); | |
return // is not a positive integer | |
} | |
// Ajax call to create directory | |
YAHOO.util.Connect.asyncRequest( | |
'GET', | |
'taskmanager_db.php?action=createSysNum&newSysNum='+ newSysNum, | |
{ | |
success: function (o) { | |
if (o.statusText == 'OK') { //alert("Ok: " + o.statusText ); | |
if (o.responseText){ | |
if(o.responseText.indexOf('exists') != -1){ // check if dir already exists | |
alert(o.responseText); | |
return; | |
} | |
DocTypeonchange("System", function() { // if directory is created then repopulate select box | |
var myselect=document.getElementById("sysNum"); | |
for (var i=0; i< myselect.options.length; i++) { | |
if (myselect[i].value == o.responseText) { // i is your index | |
myselect.selectedIndex = i; | |
} | |
} | |
document.getElementById('xmldocuri').value = '.\\documents\\system\\'+ o.responseText + '\\'; | |
document.getElementById('xmldocfilename').value = 'D'+ o.responseText + '_'; | |
}); | |
} | |
} else { | |
alert(o.statusText ); | |
} | |
}, | |
failure: function (o) { | |
alert(o.statusText); | |
}, | |
scope:this | |
} | |
); | |
} | |
function DocTypeonchange(args, mycallback){ // set options when Component or System selected | |
if (args=="Component"){ // set options for Component | |
document.getElementById('divSysNum').setAttribute('style', 'display:none'); | |
document.getElementById('xmldocuri').value = '.\\documents\\component\\'; | |
document.getElementById('xmldocfilename').value = 'DComp_'; | |
} | |
if (args=="System"){ // set options for System | |
// choose an existing sysnum or add a sysnum folder | |
YAHOO.util.Connect.asyncRequest( | |
'GET', | |
'taskmanager_db.php?action=getSysNums', | |
{ | |
success: function (o) { | |
if (o.statusText == 'OK') { | |
// clear entries from select box | |
var optSysNum = document.getElementById('sysNum'); | |
while (optSysNum.options.length > 0) { | |
optSysNum.options[0] = null; | |
} | |
// get array from php and build select box | |
var sysNumList = []; | |
sysNumList = YAHOO.lang.JSON.parse(o.responseText); | |
function addOption(selectbox, text, value ){ | |
var optn = document.createElement("OPTION"); | |
optn.text = text; | |
optn.value = value; | |
selectbox.options.add(optn); | |
} | |
for (x in sysNumList){ | |
addOption(document.getElementById('sysNum'), sysNumList[x], sysNumList[x]); | |
} | |
if (mycallback){ | |
mycallback(); | |
} | |
} else { | |
alert(o.statusText ); | |
} | |
}, | |
failure: function (o) { | |
alert(o.statusText); | |
}, | |
scope:this | |
} | |
); | |
YAHOO.util.Dom.addClass('divSysNum', 'showBlock'); | |
//docum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment