Fixing bug with publish showing up when no events are selected, and start of trying to force user to type a valid URL for publish dialog.

This commit is contained in:
mikep%oeone.com 2003-02-12 15:39:08 +00:00
Родитель 32df2c754b
Коммит c0bd10861d
4 изменённых файлов: 29 добавлений и 64 удалений

Просмотреть файл

@ -83,13 +83,13 @@
<commandset id="calendar_commands">
<command id="new_command" oncommand="newEventCommand( event )"/>
<command id="delete_command" oncommand="deleteEventCommand( )" disabled="true"/>
<command id="delete_command_no_confirm" oncommand="deleteEventCommand( true )" disabled="true"/>
<command id="modify_command" oncommand="editEventCommand()" disabled="true"/>
<command id="send_event_command" oncommand="sendEvent()" disabled="true"/>
<command id="print_command" oncommand="print()" disabled="true" collapsed="true"/>
<command id="cut_command" oncommand="cutToClipboard()" disabled="true"/>
<command id="copy_command" oncommand="copyToClipboard()" disabled="true"/>
<command id="delete_command" oncommand="deleteEventCommand( )" disabled="true" disabledwhennoeventsselected="true"/>
<command id="delete_command_no_confirm" oncommand="deleteEventCommand( true )" disabled="true" disabledwhennoeventsselected="true"/>
<command id="modify_command" oncommand="editEventCommand()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="send_event_command" oncommand="sendEvent()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="print_command" oncommand="print()" disabled="true" collapsed="true" disabledwhennoeventsselected="true"/>
<command id="cut_command" oncommand="cutToClipboard()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="copy_command" oncommand="copyToClipboard()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="paste_command" oncommand="pasteFromClipboard()"/>
<command id="select_all_command" oncommand="selectAllEvents()"/>
@ -117,7 +117,7 @@
<command id="refresh_remote_calendars" oncommand="gCalendarWindow.calendarManager.refreshAllRemoteCalendars()"/>
<command id="publish_calendar" oncommand="publishEntireCalendar()"/>
<command id="publish_events_command" oncommand="publishCalendarData()"/>
<command id="publish_events_command" oncommand="publishCalendarData()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="close_calendar_command" key="key_close" oncommand="closeCalendar()"/>

Просмотреть файл

@ -139,39 +139,26 @@ CalendarEventSelection.prototype.onSelectionChanged = function calSel_onSelectio
{
if( this.selectedEvents.length > 0 )
{
document.getElementById( "cut_command" ).removeAttribute( "disabled" );
var ArrayOfElements = document.getElementsByAttribute( "disabledwhennoeventsselected", "true" );
for( var i = 0; i < ArrayOfElements.length; i++ )
ArrayOfElements[i].removeAttribute( "disabled" );
document.getElementById( "copy_command" ).removeAttribute( "disabled" );
document.getElementById( "delete_command" ).removeAttribute( "disabled" );
document.getElementById( "delete_command_no_confirm" ).removeAttribute( "disabled" );
if( this.selectedEvents.length == 1 )
document.getElementById( "modify_command" ).removeAttribute( "disabled" );
else
if( this.selectedEvents.length != 1 )
document.getElementById( "modify_command" ).setAttribute( "disabled", "true" );
if (gMailAccounts)
{
document.getElementById("send_event_command").removeAttribute("disabled");
}
document.getElementById( "print_command" ).removeAttribute( "disabled" );
}
else
{
document.getElementById( "cut_command" ).setAttribute( "disabled", "true" );
document.getElementById( "copy_command" ).setAttribute( "disabled", "true" );
var ArrayOfElements = document.getElementsByAttribute( "disabledwhennoeventsselected", "true" );
document.getElementById( "delete_command" ).setAttribute( "disabled", "true" );
document.getElementById( "delete_command_no_confirm" ).setAttribute( "disabled", "true" );
for( var i = 0; i < ArrayOfElements.length; i++ )
ArrayOfElements[i].setAttribute( "disabled", "true" );
document.getElementById( "modify_command" ).setAttribute( "disabled", "true" );
document.getElementById("send_event_command").setAttribute("disabled", "true");
document.getElementById("print_command").setAttribute("disabled", "true");
}
for( var index in this.observerList )

Просмотреть файл

@ -40,40 +40,6 @@
/***** calendar/calendarEventDialog.js
* AUTHOR
* Garth Smedley
* REQUIRED INCLUDES
* <script type="application/x-javascript" src="chrome://calendar/content/dateUtils.js"/>
* <script type="application/x-javascript" src="chrome://calendar/content/calendarEvent.js"/>
*
* NOTES
* Code for the calendar's new/edit event dialog.
*
* Invoke this dialog to create a new event as follows:
var args = new Object();
args.mode = "new"; // "new" or "edit"
args.onOk = <function>; // funtion to call when OK is clicked
args.calendarEvent = calendarEvent; // newly creatd calendar event to be editted
calendar.openDialog("caNewEvent", "chrome://calendar/content/eventDialog.xul", true, args );
*
* Invoke this dialog to edit an existing event as follows:
*
var args = new Object();
args.mode = "edit"; // "new" or "edit"
args.onOk = <function>; // funtion to call when OK is clicked
args.calendarEvent = calendarEvent; // javascript object containin the event to be editted
* When the user clicks OK the onOk function will be called with a calendar event object.
*
*
* IMPLEMENTATION NOTES
**********
*/
/*-----------------------------------------------------------------
* W I N D O W V A R I A B L E S
*/
@ -111,6 +77,9 @@ function loadCalendarPublishDialog()
document.getElementById( "publish-password-textbox" ).value = opener.getCharPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "publish.password", "" );
}
document.getElementById( "calendar-publishwindow" ).getButton( "accept" ).setAttribute( "label", "Publish" );
checkURLField( );
var firstFocus = document.getElementById( "publish-remotePath-textbox" );
firstFocus.focus();
}
@ -138,6 +107,15 @@ function onOKCommand()
return( false );
}
function checkURLField( )
{
if( document.getElementById( "publish-remotePath-textbox" ).value.length == 0 )
document.getElementById( "calendar-publishwindow" ).getButton( "accept" ).setAttribute( "disabled", "true" );
else
document.getElementById( "calendar-publishwindow" ).getButton( "accept" ).removeAttribute( "disabled" );
}
function closeDialog( )
{
self.close( );

Просмотреть файл

@ -89,7 +89,7 @@
<hbox class="field-label-box-class" pack="end">
<description>&calendar.publish.url.label;</description>
</hbox>
<textbox flex="1" id="publish-remotePath-textbox"/>
<textbox flex="1" id="publish-remotePath-textbox" onkeypress="checkURLField()"/>
</row>
<row align="center">
<hbox class="field-label-box-class" pack="end"/>