Author: jfthomps
Date: Tue Sep  7 18:27:59 2010
New Revision: 993455

URL: http://svn.apache.org/viewvc?rev=993455&view=rev
Log:
VCL-254
block request improvements

added ability to set/modify the owner of a block allocation

Modified:
    incubator/vcl/trunk/web/.ht-inc/blockallocations.php
    incubator/vcl/trunk/web/js/blockallocations.js

Modified: incubator/vcl/trunk/web/.ht-inc/blockallocations.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/blockallocations.php?rev=993455&r1=993454&r2=993455&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/blockallocations.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/blockallocations.php Tue Sep  7 18:27:59 
2010
@@ -121,6 +121,14 @@ function blockAllocationForm() {
                print "postCreate=\"dijit.byId('brname').focus();\">\n";
                print "    </td>\n";
                print "  </tr>\n";
+               print "  <tr>\n";
+               print "    <th align=right>Owner:</th>\n";
+               print "    <td>\n";
+               print "      <input type=\"text\" value=\"{$data['owner']}\" 
dojoType=\"dijit.form.ValidationTextBox\" ";
+               print "id=\"browner\" required=\"true\" 
invalidMessage=\"Unknown user\" style=\"width: 300px\" ";
+               print "validator=\"checkOwner\" onFocus=\"ownerFocus\">\n";
+               print "    </td>\n";
+               print "  </tr>\n";
        }
        print "  <tr>\n";
        print "    <th align=right>Environment:</th>\n";
@@ -258,10 +266,10 @@ function blockAllocationForm() {
        print "<td>\n";
 
        print "Start:<div type=\"text\" id=\"weeklyaddstart\" 
dojoType=\"dijit.form.TimeTextBox\" ";
-       print "required=\"true\" onChange=\"blockFormWeeklyAddBtnCheck(1);\" 
style=\"width: 70px\"></div>\n";
+       print "required=\"true\" onChange=\"blockFormWeeklyAddBtnCheck(1);\" 
style=\"width: 78px\"></div>\n";
        print "End:<div type=\"text\" id=\"weeklyaddend\" 
dojoType=\"vcldojo.TimeTextBoxEnd\" ";
        print "required=\"true\" onChange=\"blockFormWeeklyAddBtnCheck(0);\" 
startid=\"weeklyaddstart\" ";
-       print "style=\"width: 70px\"></div>\n";
+       print "style=\"width: 78px\"></div>\n";
        print "<button dojoType=\"dijit.form.Button\" type=\"button\" 
disabled=\"true\" ";
        print "id=\"requestBlockWeeklyAddBtn\">\n";
        print "  Add\n";
@@ -272,11 +280,11 @@ function blockAllocationForm() {
        print "<div dojoType=\"dojo.data.ItemFileWriteStore\" 
jsId=\"requestBlockAddWeeklyStore\" ";
        print "data=\"blockFormAddWeeklyData\"></div>\n";
        print "<table dojoType=\"dojox.grid.DataGrid\" 
jsId=\"requestBlockAddWeeklyGrid\" sortInfo=1 ";
-       print "store=\"requestBlockAddWeeklyStore\" style=\"width: 314px; 
height: 120px;\">\n";
+       print "store=\"requestBlockAddWeeklyStore\" style=\"width: 330px; 
height: 120px;\">\n";
        print "<thead>\n";
        print "<tr>\n";
-       print "<th field=\"start\" width=\"94px\" 
formatter=\"gridTimePrimary\">Start</th>\n";
-       print "<th field=\"end\" width=\"94px\" 
formatter=\"timeFromTextBox\">End</th>\n";
+       print "<th field=\"start\" width=\"102px\" 
formatter=\"gridTimePrimary\">Start</th>\n";
+       print "<th field=\"end\" width=\"102px\" 
formatter=\"timeFromTextBox\">End</th>\n";
        print "<th field=\"remove\" width=\"80px\">Remove</th>\n";
        print "</tr>\n";
        print "</thead>\n";
@@ -324,10 +332,10 @@ function blockAllocationForm() {
        printSelectInput('day', $dayArr, $data['mndayid'], 0, 0, 'mnday');
        print " of every month<br><br>\n";
        print "Start:<div type=\"text\" id=\"monthlyaddstart\" 
dojoType=\"dijit.form.TimeTextBox\" ";
-       print "required=\"true\" onChange=\"blockFormMonthlyAddBtnCheck(1)\" 
style=\"width: 70px\"></div>\n";
+       print "required=\"true\" onChange=\"blockFormMonthlyAddBtnCheck(1)\" 
style=\"width: 78px\"></div>\n";
        print "End:<div type=\"text\" id=\"monthlyaddend\" 
dojoType=\"vcldojo.TimeTextBoxEnd\" ";
        print "required=\"true\" onChange=\"blockFormMonthlyAddBtnCheck(0)\" 
startid=\"monthlyaddstart\" ";
-       print "style=\"width: 70px\"></div>\n";
+       print "style=\"width: 78px\"></div>\n";
        print "<button dojoType=\"dijit.form.Button\" type=\"button\" 
disabled=\"true\" ";
        print "id=\"requestBlockMonthlyAddBtn\">\n";
        print "  Add\n";
@@ -339,11 +347,11 @@ function blockAllocationForm() {
        print "<div dojoType=\"dojo.data.ItemFileWriteStore\" 
jsId=\"requestBlockAddMonthlyStore\" ";
        print "data=\"blockFormAddMonthlyData\"></div>\n";
        print "<table dojoType=\"dojox.grid.DataGrid\" 
jsId=\"requestBlockAddMonthlyGrid\" sortInfo=1 ";
-       print "store=\"requestBlockAddMonthlyStore\" style=\"width: 314px; 
height: 120px;\">\n";
+       print "store=\"requestBlockAddMonthlyStore\" style=\"width: 330px; 
height: 120px;\">\n";
        print "<thead>\n";
        print "<tr>\n";
-       print "<th field=\"start\" width=\"94px\" 
formatter=\"gridTimePrimary\">Start</th>\n";
-       print "<th field=\"end\" width=\"94px\" 
formatter=\"timeFromTextBox\">End</th>\n";
+       print "<th field=\"start\" width=\"102px\" 
formatter=\"gridTimePrimary\">Start</th>\n";
+       print "<th field=\"end\" width=\"102px\" 
formatter=\"timeFromTextBox\">End</th>\n";
        print "<th field=\"remove\" width=\"80px\">Remove</th>\n";
        print "</tr>\n";
        print "</thead>\n";
@@ -353,7 +361,7 @@ function blockAllocationForm() {
        # list of times
        print "<div id=\"listtab\" dojoType=\"dijit.layout.ContentPane\" 
title=\"List of Times\" {$data['type2']['list']}>\n";
        print "Date:<div type=\"text\" id=\"listadddate\" 
dojoType=\"dijit.form.DateTextBox\" ";
-       print "required=\"true\" onChange=\"blockFormListAddBtnCheck\" 
style=\"width: 80px\"></div>\n";
+       print "required=\"true\" onChange=\"blockFormListAddBtnCheck\" 
style=\"width: 95px\"></div>\n";
        print "Start:<input type=\"text\" id=\"listaddstart\" 
dojoType=\"dijit.form.TimeTextBox\" ";
        print "required=\"true\" onChange=\"blockFormListAddBtnCheck\" />\n";
        print "End:<input type=\"text\" id=\"listaddend\" 
dojoType=\"vcldojo.TimeTextBoxEnd\" ";
@@ -370,10 +378,10 @@ function blockAllocationForm() {
        print "data=\"blockFormAddListData\"></div>\n";
        print "<div>\n"; # grid wrapper
        print "<table dojoType=\"dojox.grid.DataGrid\" 
jsId=\"requestBlockAddListGrid\" sortInfo=1 ";
-       print "store=\"requestBlockAddListStore\" style=\"width: 450px; height: 
200px;\">\n";
+       print "store=\"requestBlockAddListStore\" style=\"width: 465px; height: 
200px;\">\n";
        print "<thead>\n";
        print "<tr>\n";
-       print "<th field=\"date1\" width=\"100px\" 
formatter=\"gridDateTimePrimary\">Date</th>\n";
+       print "<th field=\"date1\" width=\"115px\" 
formatter=\"gridDateTimePrimary\">Date</th>\n";
        print "<th field=\"start\" width=\"115px\" 
formatter=\"timeFromTextBox\">Start</th>\n";
        print "<th field=\"end\" width=\"108px\" 
formatter=\"timeFromTextBox\">End</th>\n";
        print "<th field=\"remove\" width=\"80px\">Remove</th>\n";
@@ -412,6 +420,8 @@ function blockAllocationForm() {
        print "    blockFormConfirm('$arg');\n";
        print "  </script>\n";
        print "</button>\n";
+       $cont = addContinuationsEntry('AJvalidateUserid');
+       print "<input type=\"hidden\" id=\"valuseridcont\" value=\"$cont\">\n";
 
        print "<div id=\"confirmDialog\" dojoType=\"dijit.Dialog\" 
title=\"Confirm Block Allocation\">\n";
        print "<h2>Confirm Block Allocation</h2>\n";
@@ -422,6 +432,10 @@ function blockAllocationForm() {
        print "    <td><span id=\"confname\"></span></td>\n";
        print "  </tr>\n";
        print "  <tr>\n";
+       print "    <th align=\"right\"><span 
id=\"confownertitle\"></span></th>\n";
+       print "    <td><span id=\"confowner\"></span></td>\n";
+       print "  </tr>\n";
+       print "  <tr>\n";
        print "    <th align=\"right\">Environment:</th>\n";
        print "    <td><span id=\"confimage\"></span></td>\n";
        print "  </tr>\n";
@@ -609,7 +623,7 @@ function AJblockAllocationSubmit() {
                       .        "{$data['seats']}, "
                       .        "{$data['groupid']}, "
                       .        "'{$data['type']}', "
-                      .        "{$user['id']}, "
+                      .        "{$data['ownerid']}, "
                       .        "{$data['admingroupid']}, "
                       .        "$mnid, "
                       .        "'{$data['expiretime']}', "
@@ -653,7 +667,7 @@ function AJblockAllocationSubmit() {
                       .     "imageid = {$data['imageid']}, "
                       .     "numMachines = {$data['seats']}, "
                       .     "groupid = {$data['groupid']}, "
-                      .     "ownerid = {$user['id']}, "
+                      .     "ownerid = {$data['ownerid']}, "
                       .     "admingroupid = {$data['admingroupid']}, "
                       .     "repeating = '{$data['type']}', "
                       .     "expireTime = '{$data['expiretime']}' "
@@ -1069,6 +1083,8 @@ function getCurrentBlockHTML($listonly=0
        $groupids = implode(',', array_keys($groups));
        $query = "SELECT b.id, "
               .        "b.name AS blockname, "
+              .        "b.ownerid, "
+              .        "CONCAT(u.unityid, '@', ua.name) AS owner, "
               .        "b.imageid, "
               .        "i.prettyname AS image, "
               .        "b.numMachines AS machinecnt, "
@@ -1083,6 +1099,8 @@ function getCurrentBlockHTML($listonly=0
               . "LEFT JOIN affiliation a ON (g.affiliationid = a.id) "
               . "LEFT JOIN usergroup ga ON (b.admingroupid = ga.id) "
               . "LEFT JOIN affiliation aa ON (ga.affiliationid = aa.id) "
+              . "LEFT JOIN user u ON (b.ownerid = u.id) "
+              . "LEFT JOIN affiliation ua ON (u.affiliationid = ua.id) "
               . "WHERE (b.ownerid = {$user['id']} ";
        if(! empty($groupids))
                $query .=   "OR b.admingroupid IN ($groupids) ";
@@ -1297,6 +1315,10 @@ function getCurrentBlockHTML($listonly=0
        $rt .= "    <td><span id=\"confname\"></span></td>\n";
        $rt .= "  </tr>\n";
        $rt .= "  <tr>\n";
+       $rt .= "    <th align=\"right\">Owner:</th>\n";
+       $rt .= "    <td><span id=\"confowner\"></span></td>\n";
+       $rt .= "  </tr>\n";
+       $rt .= "  <tr>\n";
        $rt .= "    <th align=\"right\">Environment:</th>\n";
        $rt .= "    <td><span id=\"confimage\"></span></td>\n";
        $rt .= "  </tr>\n";
@@ -1394,6 +1416,8 @@ function getUserCurrentBlockHTML($liston
        global $user, $days;
        $query = "SELECT b.id, "
               .        "b.name AS blockname, "
+              .        "b.ownerid, "
+              .        "CONCAT(u.unityid, '@', ua.name) AS owner, "
               .        "i.prettyname AS image, "
               .        "b.numMachines AS machinecnt, "
               .        "CONCAT(g.name, '@', a.name) AS `group`, "
@@ -1403,6 +1427,8 @@ function getUserCurrentBlockHTML($liston
               .      "usergroup g, "
               .      "affiliation a, "
               .      "blockRequest b "
+              . "LEFT JOIN user u ON (b.ownerid = u.id) "
+              . "LEFT JOIN affiliation ua ON (u.affiliationid = ua.id) "
               . "WHERE b.ownerid = {$user['id']} AND "
               .       "b.imageid = i.id AND "
               .       "b.status IN ('accepted', 'requested') AND "
@@ -1568,6 +1594,10 @@ function getUserCurrentBlockHTML($liston
        $rt .= "    <td><span id=\"confname\"></span></td>\n";
        $rt .= "  </tr>\n";
        $rt .= "  <tr>\n";
+       $rt .= "    <th align=\"right\">Owner:</th>\n";
+       $rt .= "    <td><span id=\"confowner\"></span></td>\n";
+       $rt .= "  </tr>\n";
+       $rt .= "  <tr>\n";
        $rt .= "    <th align=\"right\">Environment:</th>\n";
        $rt .= "    <td><span id=\"confimage\"></span></td>\n";
        $rt .= "  </tr>\n";
@@ -2047,6 +2077,8 @@ function AJdeleteBlockAllocationConfirm(
        $data = getContinuationVar();
        if($data['available'] == 'weekly') {
                $rt = array('name' => $data['blockname'],
+                           'ownerid' => $data['ownerid'],
+                           'owner' => $data['owner'],
                            'image' => $data['image'],
                            'seats' => $data['machinecnt'],
                            'usergroup' => $data['group'],
@@ -2065,6 +2097,8 @@ function AJdeleteBlockAllocationConfirm(
        }
        elseif($data['available'] == 'monthly') {
                $rt = array('name' => $data['blockname'],
+                           'ownerid' => $data['ownerid'],
+                           'owner' => $data['owner'],
                            'image' => $data['image'],
                            'seats' => $data['machinecnt'],
                            'usergroup' => $data['group'],
@@ -2088,6 +2122,8 @@ function AJdeleteBlockAllocationConfirm(
        }
        elseif($data['available'] == 'list') {
                $rt = array('name' => $data['blockname'],
+                           'ownerid' => $data['ownerid'],
+                           'owner' => $data['owner'],
                            'image' => $data['image'],
                            'seats' => $data['machinecnt'],
                            'usergroup' => $data['group'],
@@ -2145,6 +2181,8 @@ function AJviewBlockAllocation() {
        $data = getContinuationVar();
        if($data['available'] == 'weekly') {
                $rt = array('name' => $data['blockname'],
+                           'ownerid' => $data['ownerid'],
+                           'owner' => $data['owner'],
                            'image' => $data['image'],
                            'seats' => $data['machinecnt'],
                            'usergroup' => $data['group'],
@@ -2162,6 +2200,8 @@ function AJviewBlockAllocation() {
        }
        elseif($data['available'] == 'monthly') {
                $rt = array('name' => $data['blockname'],
+                           'ownerid' => $data['ownerid'],
+                           'owner' => $data['owner'],
                            'image' => $data['image'],
                            'seats' => $data['machinecnt'],
                            'usergroup' => $data['group'],
@@ -2184,6 +2224,8 @@ function AJviewBlockAllocation() {
        }
        elseif($data['available'] == 'list') {
                $rt = array('name' => $data['blockname'],
+                           'ownerid' => $data['ownerid'],
+                           'owner' => $data['owner'],
                            'image' => $data['image'],
                            'seats' => $data['machinecnt'],
                            'usergroup' => $data['group'],
@@ -2898,6 +2940,7 @@ function processBlockAllocationInput() {
        $return = array();
        $method = getContinuationVar('method');
        $return['name'] = processInputVar('name', ARG_STRING);
+       $return['owner'] = processInputVar('owner', ARG_STRING);
        $return['imageid'] = processInputVar('imageid', ARG_NUMERIC);
        $return['seats'] = processInputVar('seats', ARG_NUMERIC);
        $return['groupid'] = processInputVar('groupid', ARG_NUMERIC);
@@ -2914,6 +2957,12 @@ function processBlockAllocationInput() {
                $errmsg = 'The submitted image is invalid.';
                $err = 1;
        }
+       if(! $err && $method != 'request' && ! 
validateUserid($return['owner'])) {
+               $errmsg = 'The submitted owner is invalid.';
+               $err = 1;
+       }
+       else
+               $return['ownerid'] = getUserlistID($return['owner']);
        $groups = getUserGroups(0, $user['affiliationid']);
        $extragroups = getContinuationVar('extragroups');
        if(! $err && ! array_key_exists($return['groupid'], $groups) &&
@@ -3168,6 +3217,8 @@ function getBlockAllocationStatus($id) {
 /// \b name - name of block allocation\n
 /// \b imageid - id of image\n
 /// \b seats - number of machines allocated for block allocation\n
+/// \b ownerid - id from user table of block allocation owner\n
+/// \b owner - block allocation owner\n
 /// \b usergroupid - id of group associated with block allocation\n
 /// \b admingroupid - id of admin group associated with block allocation\n
 /// \b repeating - weekly, monthly, or list\n
@@ -3192,6 +3243,8 @@ function getBlockAllocationData($blockid
        $rt = array('name' => '',
                    'imageid' => '',
                    'seats' => MIN_BLOCK_MACHINES,
+                   'ownerid' => '',
+                   'owner' => '',
                    'usergroupid' => '',
                    'admingroupid' => '',
                    'repeating' => '',
@@ -3215,6 +3268,8 @@ function getBlockAllocationData($blockid
        $query = "SELECT b.name, "
               .        "b.imageid, "
               .        "b.numMachines AS seats, "
+              .        "b.ownerid, "
+              .        "CONCAT(u.unityid, '@', a.name) AS owner, "
               .        "b.groupid AS usergroupid, "
               .        "b.admingroupid, "
               .        "b.repeating, "
@@ -3226,6 +3281,8 @@ function getBlockAllocationData($blockid
               .        "d.weeknum AS mnweeknumid "
               . "FROM blockWebDate d, "
               .      "blockRequest b "
+              . "LEFT JOIN user u ON (b.ownerid = u.id) "
+              . "LEFT JOIN affiliation a ON (u.affiliationid = a.id) "
               . "WHERE b.id = d.blockRequestid AND "
               .       "b.id = $blockid";
        $qh = doQuery($query, 101);

Modified: incubator/vcl/trunk/web/js/blockallocations.js
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/blockallocations.js?rev=993455&r1=993454&r2=993455&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/blockallocations.js (original)
+++ incubator/vcl/trunk/web/js/blockallocations.js Tue Sep  7 18:27:59 2010
@@ -1,3 +1,6 @@
+var timeout = null;
+var ownervalid = true;
+
 var blockFormAddWeeklyData = {
        identifier: 'id',
        items: []
@@ -358,7 +361,8 @@ function blockFormConfirm(mode) {
        if(! dijit.byId('machinecnt').isValid() ||
           (dijit.byId('imagesel') && ! dijit.byId('imagesel').isValid()) ||
           (dijit.byId('groupsel') && ! dijit.byId('groupsel').isValid()) ||
-               (dijit.byId('brname') && ! dijit.byId('brname').isValid())) {
+               (dijit.byId('brname') && ! dijit.byId('brname').isValid()) ||
+               (dijit.byId('browner') && ! dijit.byId('browner').isValid())) {
                alert('Please fix invalid values before submitting.');
                return;
        }
@@ -447,6 +451,8 @@ function blockFormVerifyWeekly(mode) {
        if(mode != 'request') {
                dojo.byId('confnametitle').innerHTML = 'Name:';
                dojo.byId('confname').innerHTML = 
dijit.byId('brname').textbox.value;
+               dojo.byId('confownertitle').innerHTML = 'Owner:';
+               dojo.byId('confowner').innerHTML = 
dijit.byId('browner').textbox.value;
        }
        dojo.byId('confimage').innerHTML = getSelectText('imagesel');
        dojo.byId('confseats').innerHTML = dijit.byId('machinecnt').value;
@@ -538,6 +544,7 @@ function blockFormSubmitWeekly(mode) {
                    days: days2};
        if(mode != 'request') {
                data.name = dijit.byId('brname').value;
+               data.owner = dijit.byId('browner').value;
                data.admingroupid = getSelectValue('admingroupsel');
        }
        else
@@ -589,6 +596,8 @@ function blockFormVerifyMonthly(mode) {
        if(mode != 'request') {
                dojo.byId('confnametitle').innerHTML = 'Name:';
                dojo.byId('confname').innerHTML = 
dijit.byId('brname').textbox.value;
+               dojo.byId('confownertitle').innerHTML = 'Owner:';
+               dojo.byId('confowner').innerHTML = 
dijit.byId('browner').textbox.value;
        }
        dojo.byId('confimage').innerHTML = getSelectText('imagesel');
        dojo.byId('confseats').innerHTML = dijit.byId('machinecnt').value;
@@ -671,6 +680,7 @@ function blockFormSubmitMonthly(mode) {
                    times: alltimes};
        if(mode != 'request') {
                data.name = dijit.byId('brname').value;
+               data.owner = dijit.byId('browner').value;
                data.admingroupid = getSelectValue('admingroupsel');
        }
        else
@@ -696,6 +706,8 @@ function blockFormVerifyList(mode) {
        if(mode != 'request') {
                dojo.byId('confnametitle').innerHTML = 'Name:';
                dojo.byId('confname').innerHTML = 
dijit.byId('brname').textbox.value;
+               dojo.byId('confownertitle').innerHTML = 'Owner:';
+               dojo.byId('confowner').innerHTML = 
dijit.byId('browner').textbox.value;
        }
        dojo.byId('confimage').innerHTML = getSelectText('imagesel');
        dojo.byId('confseats').innerHTML = dijit.byId('machinecnt').value;
@@ -758,6 +770,7 @@ function blockFormSubmitList(mode) {
                    slots: allslots};
        if(mode != 'request') {
                data.name = dijit.byId('brname').value;
+               data.owner = dijit.byId('browner').value;
                data.admingroupid = getSelectValue('admingroupsel');
        }
        else
@@ -770,6 +783,7 @@ function clearHideConfirmForm() {
        dijit.byId('confirmDialog').hide();
        dojo.byId('confnametitle').innerHTML = '';
        dojo.byId('confname').innerHTML = '';
+       dojo.byId('confowner').innerHTML = '';
        dojo.byId('confimage').innerHTML = '';
        dojo.byId('confseats').innerHTML = '';
        dojo.byId('confgroup').innerHTML = '';
@@ -790,6 +804,7 @@ function clearHideConfirmForm() {
 function clearHideConfirmDelete() {
        dijit.byId('confirmDialog').hide();
        dojo.byId('confname').innerHTML = '';
+       dojo.byId('confowner').innerHTML = '';
        dojo.byId('confimage').innerHTML = '';
        dojo.byId('confseats').innerHTML = '';
        dojo.byId('confgroup').innerHTML = '';
@@ -808,6 +823,7 @@ function clearHideConfirmDelete() {
 function clearHideView() {
        dijit.byId('viewDialog').hide();
        dojo.byId('confname').innerHTML = '';
+       dojo.byId('confowner').innerHTML = '';
        dojo.byId('confimage').innerHTML = '';
        dojo.byId('confseats').innerHTML = '';
        dojo.byId('confgroup').innerHTML = '';
@@ -880,6 +896,7 @@ function deleteBlockConfirm(cont) {
 function deleteBlockConfirmCB(data, ioArgs) {
        if(data.items.repeating == 'weekly') {
                dojo.byId('confname').innerHTML = data.items.name;
+               dojo.byId('confowner').innerHTML = data.items.owner;
                dojo.byId('confimage').innerHTML = data.items.image;
                dojo.byId('confseats').innerHTML = data.items.seats;
                dojo.byId('confgroup').innerHTML = data.items.usergroup;
@@ -896,6 +913,7 @@ function deleteBlockConfirmCB(data, ioAr
        }
        else if(data.items.repeating == 'monthly') {
                dojo.byId('confname').innerHTML = data.items.name;
+               dojo.byId('confowner').innerHTML = data.items.owner;
                dojo.byId('confimage').innerHTML = data.items.image;
                dojo.byId('confseats').innerHTML = data.items.seats;
                dojo.byId('confgroup').innerHTML = data.items.usergroup;
@@ -912,6 +930,7 @@ function deleteBlockConfirmCB(data, ioAr
        }
        else if(data.items.repeating == 'list') {
                dojo.byId('confname').innerHTML = data.items.name;
+               dojo.byId('confowner').innerHTML = data.items.owner;
                dojo.byId('confimage').innerHTML = data.items.image;
                dojo.byId('confseats').innerHTML = data.items.seats;
                dojo.byId('confgroup').innerHTML = data.items.usergroup;
@@ -941,6 +960,7 @@ function viewBlockAllocation(cont) {
 function viewBlockAllocationCB(data, ioArgs) {
        if(data.items.repeating == 'weekly') {
                dojo.byId('confname').innerHTML = data.items.name;
+               dojo.byId('confowner').innerHTML = data.items.owner;
                dojo.byId('confimage').innerHTML = data.items.image;
                dojo.byId('confseats').innerHTML = data.items.seats;
                dojo.byId('confgroup').innerHTML = data.items.usergroup;
@@ -956,6 +976,7 @@ function viewBlockAllocationCB(data, ioA
        }
        else if(data.items.repeating == 'monthly') {
                dojo.byId('confname').innerHTML = data.items.name;
+               dojo.byId('confowner').innerHTML = data.items.owner;
                dojo.byId('confimage').innerHTML = data.items.image;
                dojo.byId('confseats').innerHTML = data.items.seats;
                dojo.byId('confgroup').innerHTML = data.items.usergroup;
@@ -971,6 +992,7 @@ function viewBlockAllocationCB(data, ioA
        }
        else if(data.items.repeating == 'list') {
                dojo.byId('confname').innerHTML = data.items.name;
+               dojo.byId('confowner').innerHTML = data.items.owner;
                dojo.byId('confimage').innerHTML = data.items.image;
                dojo.byId('confseats').innerHTML = data.items.seats;
                dojo.byId('confgroup').innerHTML = data.items.usergroup;
@@ -1256,3 +1278,38 @@ function blockTimesGridEnd(val) {
        var min = parseInt(val.substr(14, 2), 10);
        return formatHourMin(hour, min);
 }
+
+function ownerFocus() {
+       if(! dijit.byId('browner')._hasBeenBlurred)
+               dijit.byId('browner')._hasBeenBlurred = true;
+}
+
+function checkOwner(val, constraints) {
+       if(! dijit.byId('browner')._hasBeenBlurred)
+               return true;
+       if(timeout != null)
+               clearTimeout(timeout);
+       timeout = setTimeout(checkOwner2, 700);
+       return ownervalid;
+}
+
+function checkOwner2() {
+       var data = {user: dijit.byId('browner').textbox.value,
+                   continuation: dojo.byId('valuseridcont').value};
+       RPCwrapper(data, checkOwnerCB, 1);
+}
+
+function checkOwnerCB(data, ioArgs) {
+       var obj = dijit.byId('browner');
+       if(data.items.status && data.items.status == 'invalid') {
+               obj.attr('state', 'Error');
+               obj._setStateClass();
+               obj.displayMessage(obj.getErrorMessage('Unknown user'));
+               ownervalid = false;
+       }
+       else {
+               dijit.byId('browner').attr('valid', true);
+               obj._setStateClass();
+               ownervalid = true;
+       }
+}


Reply via email to