[Rt-commit] r3685 - in rt/branches/3.5-TESTING: . html html/Admin/Elements html/Elements html/NoAuth html/Search html/Ticket html/Ticket/Elements lib/RT lib/t/regression sbin

jesse at bestpractical.com jesse at bestpractical.com
Thu Aug 18 17:46:38 EDT 2005


Author: jesse
Date: Thu Aug 18 17:46:36 2005
New Revision: 3685

Added:
   rt/branches/3.5-TESTING/html/CalPopup.html
   rt/branches/3.5-TESTING/html/NoAuth/cascaded.js
   rt/branches/3.5-TESTING/html/NoAuth/combobox.js
   rt/branches/3.5-TESTING/html/rt.js
Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/html/Admin/Elements/AddCustomFieldValue
   rt/branches/3.5-TESTING/html/Admin/Elements/PickObjects
   rt/branches/3.5-TESTING/html/Elements/EditCustomFieldSelect
   rt/branches/3.5-TESTING/html/Elements/ValidateCustomFields
   rt/branches/3.5-TESTING/html/Search/Bulk.html
   rt/branches/3.5-TESTING/html/Ticket/Create.html
   rt/branches/3.5-TESTING/html/Ticket/Display.html
   rt/branches/3.5-TESTING/html/Ticket/Elements/ShowSummary
   rt/branches/3.5-TESTING/lib/RT/CustomField_Overlay.pm
   rt/branches/3.5-TESTING/lib/t/regression/15cf_pattern.t
   rt/branches/3.5-TESTING/sbin/rt-test-dependencies.in
Log:
 r13209 at hualien:  jesse | 2005-08-18 14:56:02 -0400
  r13194 at hualien:  jesse | 2005-08-18 14:18:36 -0400
  
 


Modified: rt/branches/3.5-TESTING/html/Admin/Elements/AddCustomFieldValue
==============================================================================
--- rt/branches/3.5-TESTING/html/Admin/Elements/AddCustomFieldValue	(original)
+++ rt/branches/3.5-TESTING/html/Admin/Elements/AddCustomFieldValue	Thu Aug 18 17:46:36 2005
@@ -59,6 +59,11 @@
 </TD>
 % if ($CustomField->Type ne 'Combobox') {
 <TD><small>
+<&|/l&>Description</&>:<br>
+<input type="text" size=50 name="CustomField-<%$CustomField->Id%>-Value-new-Description">
+</TD>
+% if ($CustomField->Type ne 'Combobox') {
+<TD><small>
 <&|/l&>Category</&>:<br>
 <input type="text" size=10 name="CustomField-<%$CustomField->Id%>-Value-new-Category">
 </TD>

Modified: rt/branches/3.5-TESTING/html/Admin/Elements/PickObjects
==============================================================================
--- rt/branches/3.5-TESTING/html/Admin/Elements/PickObjects	(original)
+++ rt/branches/3.5-TESTING/html/Admin/Elements/PickObjects	Thu Aug 18 17:46:36 2005
@@ -51,6 +51,7 @@
 % foreach my $Object (@Objects) {
 <tr>
 %   my $id = "Object-".$Object->id."-CF-".$id;
+%   my $id = "Object-".$Object->id."-CF-".$id;
 %   if (!$ReadOnly) {
   <td valign="TOP">
 <input type="checkbox" class="checkbox" id="<% $id %>" name="<% $id %>" value="1" <% $Checked ? 'CHECKED' : ''%>
@@ -59,6 +60,7 @@
 %   }
   <td valign="TOP">
     <label for="<% $id %>">
+    <label for="<% $id %>">
 % if ($Object->Name) {
     <b><%$Object->Name%></b><br>
 % } else {

Added: rt/branches/3.5-TESTING/html/CalPopup.html
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/CalPopup.html	Thu Aug 18 17:46:36 2005
@@ -0,0 +1,83 @@
+<& /Elements/Header &>
+<script>
+function updateParent(strItem) {
+    window.opener.document.getElementById('<%$field%>').value = strItem;
+    window.close();
+}
+</script>
+<a href="javascript: window.close();">close window</a>
+<br><br>
+<div align="center">
+<div class="table-wrapper">
+<table>
+  <caption><%$months[$DisplayedMonth]%> <%$DisplayedYear%></caption>
+  <tr>
+% foreach my $wday (@weekdays) {
+    <th><%$wday%></th>
+% }
+  </tr>
+% foreach my $week (@cal) {
+  <tr>
+%     foreach my $day (@{$week}) {
+    <td>
+%         if ($day) {
+%             my $datestr = sprintf('%04d-%02d-%02d', $DisplayedYear, $DisplayedMonth+1, $day);
+      <dt><a href="javascript: updateParent('<%$datestr%>')"><%$day%></a></dt>
+%         }
+    </td>
+%     } #foreach $day
+  </tr>
+% } # foreach $week
+  <tr>
+  <td colspan="2"><a href="CalPopup.html?DisplayedMonth=<%$prev_month%>&DisplayedYear=<%$prev_year%>&field=<%$field%>">Previous</a></td>
+    <td colspan="3">&nbsp;</td>
+    <td colspan="2"><a href="CalPopup.html?DisplayedMonth=<%$next_month%>&DisplayedYear=<%$next_year%>&field=<%$field%>">Next</a></td>
+</table>
+</div>
+</div>
+
+<%init>
+use Calendar::Simple;
+my @today = localtime(time());
+
+my @weekdays = (loc('Sun'), loc('Mon'), loc('Tue'), loc('Wed'), loc('Thu'), 
+		loc('Fri'), loc('Sat'));
+my @months = (loc('January'), loc('February'), loc('March'), loc('April'), 
+	      loc('May'), loc('June'), loc('July'), loc('August'), 
+	      loc('September'), loc('October'), loc('November'), 
+              loc('December'));
+
+unless ($DisplayedYear) {
+              $DisplayedMonth = $today[4];
+              $DisplayedYear = ($today[5] + 1900);
+}              
+
+my ($prev_year, $next_year, $prev_month, $next_month);
+$prev_month = $next_month = $DisplayedMonth;
+$prev_year = $next_year = $DisplayedYear;
+
+$next_month++;
+$prev_month--;
+
+if ($DisplayedMonth == 11) {
+    $next_year++;
+    $next_month = 0;
+    } 
+elsif ($DisplayedMonth == 0) {
+        $prev_month = 11;
+        $prev_year--;
+
+
+    }
+
+
+
+
+my @cal = calendar($DisplayedMonth+1, $DisplayedYear);
+
+</%init>
+<%args>
+$field => 'none'
+$DisplayedMonth => undef
+$DisplayedYear => undef
+</%args>

Modified: rt/branches/3.5-TESTING/html/Elements/EditCustomFieldSelect
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/EditCustomFieldSelect	(original)
+++ rt/branches/3.5-TESTING/html/Elements/EditCustomFieldSelect	Thu Aug 18 17:46:36 2005
@@ -52,7 +52,7 @@
 %       my $id = $NamePrefix . $CustomField->Id;
 %       my $out = $m->scomp('SELF:options', %ARGS, SelectedRef => \$selected, CategoryRef => \@category);
 %       if (@category) {
-<script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/js/cascaded.js"></script>
+<script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/cascaded.js"></script>
 %#      XXX - Hide this select from w3m?
       <select onchange="filter_cascade('<% $id %>-Values', this.value)" name="<%$id%>-Category"
         <option value="" <% !$selected && 'SELECTED' %>><&|/l&>-</&></option>

Modified: rt/branches/3.5-TESTING/html/Elements/ValidateCustomFields
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/ValidateCustomFields	(original)
+++ rt/branches/3.5-TESTING/html/Elements/ValidateCustomFields	Thu Aug 18 17:46:36 2005
@@ -6,7 +6,7 @@
     my $field = $NamePrefix . $CF->Id . "-Value";
     my $value;
 
-    if ($ARGSRef->{"${field}s-Magic"}) {
+    if ($ARGSRef->{"${field}s-Magic"} and exists $ARGSRef->{"${field}s"}) {
         $value = $ARGSRef->{"${field}s"};
 
         # We only validate Single Combos -- multis can never be user input

Added: rt/branches/3.5-TESTING/html/NoAuth/cascaded.js
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/NoAuth/cascaded.js	Thu Aug 18 17:46:36 2005
@@ -0,0 +1,19 @@
+function filter_cascade (id, val) {
+    var select = document.getElementById(id);
+    if (!select) { return };
+    var i;
+    var children = select.childNodes;
+    for (i in children) {
+        var style = children[i].style;
+        if (!style) { continue };
+        if (val == '') {
+            style.display = 'block';
+            continue;
+        }
+        if (children[i].label.substr(0, val.length) == val) {
+            style.display = 'block';
+            continue;
+        }
+        style.display = 'none';
+    }
+}

Added: rt/branches/3.5-TESTING/html/NoAuth/combobox.js
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/NoAuth/combobox.js	Thu Aug 18 17:46:36 2005
@@ -0,0 +1,246 @@
+function ComboBox_InitWith(n) {
+    if ( typeof( window.addEventListener ) != "undefined" ) {
+        window.addEventListener("load", ComboBox_Init(n), false);
+    } else if ( typeof( window.attachEvent ) != "undefined" ) {
+        window.attachEvent("onload", ComboBox_Init(n));
+    } else {
+        ComboBox_Init(n)();
+    }
+}
+function ComboBox_Init(n) {
+    return function () {
+        if ( ComboBox_UplevelBrowser( n ) ) {
+            ComboBox_Load( n );
+        }
+    }
+}
+function ComboBox_UplevelBrowser( n ) {
+    if( typeof( document.getElementById ) == "undefined" ) return false;
+    var combo = document.getElementById( n + "_Container" );
+    if( combo == null || typeof( combo ) == "undefined" ) return false;
+    if( typeof( combo.style ) == "undefined" ) return false;
+    if( typeof( combo.innerHTML ) == "undefined" ) return false;
+    return true;
+}
+function ComboBox_Load( comboId ) {
+    var combo  = document.getElementById( comboId + "_Container" );
+    var button = document.getElementById( comboId + "_Button" );
+    var list   = document.getElementById( comboId + "_List" );
+    var text   = document.getElementById( comboId );
+    
+    
+    combo.List = list;
+    combo.Button = button;
+    combo.Text = text;
+    combo.style.border = "2px inset ButtonFace";
+    combo.style.padding = "0px";
+    combo.style.margin = "0px";
+    
+    button.Container = combo;
+    button.Toggle = ComboBox_ToggleList;
+    button.onclick = button.Toggle;
+    button.onmouseover = function(e) { this.Container.List.DisableBlur(e); };
+    button.onmouseout = function(e) { this.Container.List.EnableBlur(e); };
+    button.style.padding = "0px";
+    button.style.margin = "0px";
+    button.style.background = "ButtonFace";
+    button.style.color = "ButtonText";
+    button.style.borderLeft = "1px outset ButtonFace";
+    button.style.cursor = "default";
+    button.style.fontSize = "8pt";
+    button.innerHTML = "\u25BC";
+    button.onselectstart = function(e){ return false; };
+    
+    text.Container = combo;
+    text.TypeDown = ComboBox_TextTypeDown;
+    text.KeyAccess = ComboBox_TextKeyAccess;
+    text.onkeyup = function(e) { this.KeyAccess(e); this.TypeDown(e); };
+    text.style.border = "none";
+    text.style.margin = "0px";
+    text.style.padding = "0px";
+    text.style.width = ( list.offsetWidth ) + "px";
+    
+    list.Container = combo;
+    list.Show = ComboBox_ShowList;
+    list.Hide = ComboBox_HideList;
+    list.EnableBlur = ComboBox_ListEnableBlur;
+    list.DisableBlur = ComboBox_ListDisableBlur;
+    list.Select = ComboBox_ListItemSelect;
+    list.ClearSelection = ComboBox_ListClearSelection;
+    list.KeyAccess = ComboBox_ListKeyAccess;
+    list.FireTextChange = ComboBox_ListFireTextChange;
+    list.onchange = null;
+    list.onclick = function(e){ this.Select(e); this.ClearSelection(); this.FireTextChange(); };
+    list.onkeyup = function(e) { this.KeyAccess(e); };
+    list.EnableBlur(null);
+    list.style.position = "absolute";
+    list.style.zIndex = 200;
+    list.size = ComboBox_GetListSize( list );
+    list.IsShowing = true;
+    list.Hide();
+    
+}
+function ComboBox_InitEvent( e ) {
+    if( typeof( e ) == "undefined" && typeof( window.event ) != "undefined" ) e = window.event;
+    if( e == null ) e = new Object();
+    return e;
+}
+function ComboBox_ListClearSelection() {
+            if ( typeof( this.Container.Text.createTextRange ) == "undefined" ) return;
+    var rNew = this.Container.Text.createTextRange();
+    rNew.moveStart('character', this.Container.Text.value.length) ;
+    rNew.select();
+}
+function ComboBox_GetListSize( theList ) {
+    ComboBox_EnsureListSize( theList );
+    return theList.listSize;
+}
+function ComboBox_EnsureListSize( theList ) {
+    if ( typeof( theList.listSize ) == "undefined" ) {
+        if( typeof( theList.getAttribute ) != "undefined" ) {
+            if( theList.getAttribute( "listSize" ) != null && theList.getAttribute( "listSize" ) != "" ) {
+                theList.listSize = theList.getAttribute( "listSize" );
+                return;
+            }
+        }
+        if( theList.options.length > 0 ) {
+            theList.listSize = theList.options.length;
+            return;
+        }
+        theList.listSize = 4;
+    }
+}
+function ComboBox_ListKeyAccess(e) { //Make enter/space and escape do the right thing :)
+    e = ComboBox_InitEvent( e );
+    if( e.keyCode == 13 || e.keyCode == 32 ) {
+        this.Select();
+        return;
+    }
+    if( e.keyCode == 27 ) {
+        this.Hide();
+        this.Container.Text.focus();
+        return;
+    }
+}
+function ComboBox_TextKeyAccess(e) { //Make alt+arrow expand the list
+    e = ComboBox_InitEvent( e );
+    if( e.altKey && (e.keyCode == 38 || e.keyCode == 40) ) {
+            this.Container.List.Show();
+    }
+}
+function ComboBox_TextTypeDown(e) { //Make the textbox do a type-down on the list
+    e = ComboBox_InitEvent( e );
+    var items = this.Container.List.options;
+    if( this.value == "" ) return;
+    var ctrlKeys = Array( 8, 46, 37, 38, 39, 40, 33, 34, 35, 36, 45, 16, 20 );
+    for( var i = 0; i < ctrlKeys.length; i++ ) {
+        if( e.keyCode == ctrlKeys[i] ) return;
+    }
+    for( var i = 0; i < items.length; i++ ) {
+        var item = items[i];
+        if( item.text.toLowerCase().indexOf( this.value.toLowerCase() ) == 0 ) {
+            this.Container.List.selectedIndex = i;
+            if ( typeof( this.Container.Text.createTextRange ) != "undefined" ) {
+                                    this.Container.List.Select();
+                            }
+            break;
+        }
+    }
+}
+function ComboBox_ListFireTextChange() {
+    var textOnChange = this.Container.Text.onchange;
+            if ( textOnChange != null && typeof(textOnChange) == "function" ) {
+                    textOnChange();
+            }
+}
+function ComboBox_ListEnableBlur(e) {
+    this.onblur = this.Hide;
+}
+function ComboBox_ListDisableBlur(e) {
+    this.onblur = null;
+}
+function ComboBox_ListItemSelect(e) {
+    if( this.options.length > 0 ) {
+        var text = this.Container.Text;
+        var oldValue = text.value;
+        var newValue = this.options[ this.selectedIndex ].text;
+        text.value = newValue;
+        if ( typeof( text.createTextRange ) != "undefined" ) {
+            if (newValue != oldValue) {
+                var rNew = text.createTextRange();
+                rNew.moveStart('character', oldValue.length) ;
+                rNew.select();
+            }
+        }
+    }
+    this.Hide();
+    this.Container.Text.focus();
+}
+function ComboBox_ToggleList(e) {
+    if( this.Container.List.IsShowing == true ) {
+        this.Container.List.Hide();
+    } else {
+        this.Container.List.Show();
+    }
+}
+function ComboBox_ShowList(e) {
+    if ( !this.IsShowing && !this.disabled ) {
+        this.style.width = ( this.Container.offsetWidth ) + "px";
+        this.style.top = ( this.Container.offsetHeight + ComboBox_RecursiveOffsetTop(this.Container,true) ) + "px";
+        this.style.left = ( ComboBox_RecursiveOffsetLeft(this.Container,true) ) + "px";
+        ComboBox_SetVisibility(this,true);
+        this.focus();
+        this.IsShowing = true;
+    }
+}
+function ComboBox_HideList(e) {
+    if( this.IsShowing ) {
+                    ComboBox_SetVisibility(this,false);
+        this.IsShowing = false;
+    }
+}
+function ComboBox_SetVisibility(theList,isVisible) {
+    var isIE = ( typeof( theList.dataSrc ) != "undefined" ); // dataSrc is an IE-only property which is unlikely to be supported elsewhere
+    var ua = navigator.userAgent.toLowerCase(); 
+    var isSafari = (ua.indexOf('safari') != - 1);
+    if ( isIE || isSafari) {
+        if ( isVisible ) {
+            theList.style.visibility = "visible";
+        } else {
+            theList.style.visibility = "hidden";
+        }
+    } else { 
+        if ( isVisible ) {
+            theList.style.display = "block";
+        } else {
+            theList.style.display = "none";
+        }
+    }
+}
+function ComboBox_RecursiveOffsetTop(thisObject,isFirst) {
+    if(thisObject.offsetParent) {
+        if ( thisObject.style.position == "absolute" && !isFirst && typeof(document.designMode) != "undefined" ) {
+            return 0;
+        }
+        return (thisObject.offsetTop + ComboBox_RecursiveOffsetTop(thisObject.offsetParent,false));
+    } else {
+        return thisObject.offsetTop;
+    }
+}
+function ComboBox_RecursiveOffsetLeft(thisObject,isFirst) {
+    if(thisObject.offsetParent) {
+        if ( thisObject.style.position == "absolute" && !isFirst && typeof(document.designMode) != "undefined" ) {
+            return 0;
+        }
+        return (thisObject.offsetLeft + ComboBox_RecursiveOffsetLeft(thisObject.offsetParent,false));
+    } else {
+        return thisObject.offsetLeft;
+    }
+}
+function ComboBox_SimpleAttach(selectElement,textElement) {
+    textElement.value = selectElement.options[ selectElement.options.selectedIndex ].text;
+    var textOnChange = textElement.onchange;
+    if ( textOnChange != null && typeof( textOnChange ) == "function" ) {
+        textOnChange();
+    }
+}

Modified: rt/branches/3.5-TESTING/html/Search/Bulk.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Search/Bulk.html	(original)
+++ rt/branches/3.5-TESTING/html/Search/Bulk.html	Thu Aug 18 17:46:36 2005
@@ -166,6 +166,9 @@
 % my $rows = 5;
 % my @add = (NamePrefix => 'Bulk-Add-CustomField-', CustomField => $cf, Rows => $rows, Multiple => ($cf->MaxValues ==1 ? 0 : 1) , Cols => 25);
 % my @del = (NamePrefix => 'Bulk-Delete-CustomField-', CustomField => $cf, Rows => $rows, Multiple => 1, Cols => 25);
+% my $rows = 5;
+% my @add = (NamePrefix => 'Bulk-Add-CustomField-', CustomField => $cf, Rows => $rows, Multiple => ($cf->MaxValues ==1 ? 0 : 1) , Cols => 25);
+% my @del = (NamePrefix => 'Bulk-Delete-CustomField-', CustomField => $cf, Rows => $rows, Multiple => 1, Cols => 25);
 % if ($cf->Type eq 'Select') {
 <td><& /Elements/EditCustomFieldSelect, @add &></td>
 <td><& /Elements/EditCustomFieldSelect, @del &></td>

Modified: rt/branches/3.5-TESTING/html/Ticket/Create.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/Create.html	(original)
+++ rt/branches/3.5-TESTING/html/Ticket/Create.html	Thu Aug 18 17:46:36 2005
@@ -64,7 +64,6 @@
 <td class="label"><&|/l&>Status</&>:
 </td>
 <td class="value">
-<& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new', DefaultValue => 0 &>
 </td>
 <td class="label">
 <&|/l&>Owner</&>:
@@ -237,7 +236,7 @@
 <%INIT>
 
 
-
+my @results;
 my $QueueObj = new RT::Queue($session{'CurrentUser'});
 $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
 my $CFs = $QueueObj->TicketCustomFields();
@@ -294,10 +293,19 @@
 
 # }}}
 
-if ((!exists $ARGS{'AddMoreAttach'}) and ($ARGS{'id'} eq 'new') and $ValidCFs) { # new ticket?
-    $m->comp('Display.html', %ARGS);
-    $RT::Logger->crit("After display call; error is $@");
-    $m->abort();
+if ((!exists $ARGS{'AddMoreAttach'}) and ($ARGS{'id'} eq 'new')) { # new ticket?
+    if ($ValidCFs) {
+        $m->comp('Display.html', %ARGS);
+        $RT::Logger->crit("After display call; error is $@");
+        $m->abort();
+    }
+    else {
+        # Invalid CFs
+        while (my $CF = $CFs->Next) {
+            my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
+            push @results, $CF->Name . ': ' . $msg;
+        }
+    }
 }
 
 my $actions = {

Modified: rt/branches/3.5-TESTING/html/Ticket/Display.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/Display.html	(original)
+++ rt/branches/3.5-TESTING/html/Ticket/Display.html	Thu Aug 18 17:46:36 2005
@@ -60,6 +60,9 @@
 
 <& /Elements/Callback, _CallbackName => 'BeforeShowHistory', Ticket => $TicketObj, %ARGS &>
 
+
+<& /Elements/Callback, _CallbackName => 'BeforeShowHistory', Ticket => $TicketObj, %ARGS &>
+
 <& /Ticket/Elements/ShowHistory , 
       Ticket => $TicketObj, 
       Tickets => $Tickets, 

Modified: rt/branches/3.5-TESTING/html/Ticket/Elements/ShowSummary
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/Elements/ShowSummary	(original)
+++ rt/branches/3.5-TESTING/html/Ticket/Elements/ShowSummary	Thu Aug 18 17:46:36 2005
@@ -64,7 +64,16 @@
 		class => 'ticket-info-people' &>
             <& /Ticket/Elements/ShowPeople, Ticket => $Ticket &>
 	  </&>
-
+	  <&|/Elements/TitleBox, title => loc("Reminders"),
+		title_href =>"$RT::WebPath/Ticket/Reminders.html?id=".$Ticket->Id, 
+		title_class=> 'inverse',  
+		 color => "#666699" &>
+            <form action="<%$RT::WebPath%>/Ticket/Display.html" method="post">
+	  <& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 0 &>
+        <div align="right"><input type="submit" value="Save" /></div>
+        </form>
+	  </&>
+        <br />
 	  <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments &>
 
 	  <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>

Added: rt/branches/3.5-TESTING/html/rt.js
==============================================================================
--- (empty file)
+++ rt/branches/3.5-TESTING/html/rt.js	Thu Aug 18 17:46:36 2005
@@ -0,0 +1,19 @@
+% $r->content_type('application/x-javascript');
+
+function hideshow(num) {
+    idstring = "element-" + num;
+    chunk = document.getElementById(idstring);
+    if ( chunk.style.display == "none")  {
+    chunk.style.display = chunk.style.tag;
+    } else {
+        chunk.style.tag = chunk.style.display;
+        chunk.style.display = "none";
+    }
+}   
+
+function openCalWindow(field) {
+    var objWindow = window.open('<%$RT::WebPath%>/CalPopup.html?field='+field, 'Pick', 'height=400,width=400,scrollbars=1');
+    objWindow.focus();
+}
+
+% $m->abort;
\ No newline at end of file

Modified: rt/branches/3.5-TESTING/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/3.5-TESTING/lib/RT/CustomField_Overlay.pm	Thu Aug 18 17:46:36 2005
@@ -1139,10 +1139,16 @@
     }
 
 
-    # check ot make sure we found it
+    # check to make sure we found it
     unless ($oldval->Id) {
         return(0, $self->loc("Custom field value [_1] could not be found for custom field [_2]", $args{'Content'}, $self->Name));
     }
+
+    # for single-value fields, we need to validate that empty string is a valid value for it
+    if ( $self->SingleValue and not $self->MatchPattern( '' ) ) {
+        return ( 0, $self->loc('Input must match [_1]', $self->FriendlyPattern) );
+    }
+
     # delete it
 
     my $ret = $oldval->Delete();

Modified: rt/branches/3.5-TESTING/lib/t/regression/15cf_pattern.t
==============================================================================
--- rt/branches/3.5-TESTING/lib/t/regression/15cf_pattern.t	(original)
+++ rt/branches/3.5-TESTING/lib/t/regression/15cf_pattern.t	Thu Aug 18 17:46:36 2005
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 13;
+use Test::More tests => 17;
 
 use RT;
 RT::LoadConfig();
@@ -19,7 +19,7 @@
 works($q->Create(Name => "CF-Pattern-".$$));
 
 my $cf = new(RT::CustomField);
-my @cf_args = (Name => $q->Name, Type => 'Freeform', Queue => $q->id);
+my @cf_args = (Name => $q->Name, Type => 'Freeform', Queue => $q->id, MaxValues => 1);
 
 fails($cf->Create(@cf_args, Pattern => ')))bad!regex((('));
 works($cf->Create(@cf_args, Pattern => 'good regex'));
@@ -31,12 +31,20 @@
 # OK, I'm thoroughly brain washed by HOP at this point now...
 sub cnt { $t->CustomFieldValues($cf->id)->Count };
 sub add { $t->AddCustomFieldValue(Field => $cf->id, Value => $_[0]) };
+sub del { $t->DeleteCustomFieldValue(Field => $cf->id, Value => $_[0]) };
 
 is(cnt(), 0, "No values yet");
 fails(add('not going to match'));
 is(cnt(), 0, "No values yet");
 works(add('here is a good regex'));
 is(cnt(), 1, "Value filled");
+fails(del('here is a good regex'));
+is(cnt(), 1, "Single CF - Value _not_ deleted");
+
+$cf->SetMaxValues(0);   # Unlimited MaxValues
+
+works(del('here is a good regex'));
+is(cnt(), 0, "Multiple CF - Value deleted");
 
 fails($cf->SetPattern('(?{ "insert evil code here" })'));
 works($cf->SetPattern('(?!)')); # reject everything

Modified: rt/branches/3.5-TESTING/sbin/rt-test-dependencies.in
==============================================================================
--- rt/branches/3.5-TESTING/sbin/rt-test-dependencies.in	(original)
+++ rt/branches/3.5-TESTING/sbin/rt-test-dependencies.in	Thu Aug 18 17:46:36 2005
@@ -182,6 +182,7 @@
 Module::Versions::Report
 Cache::Simple::TimedExpiry
 XML::Simple
+Calendar::Simple
 .
 
 $deps{'MASON'} = [ _( << '.') ];


More information about the Rt-commit mailing list