bug 289797: remove the Info tab from the bookmarks properties dialog

patch by Alfred Kayser <alfredkayser@nl.ibm.com>, r=vladmir, a=shaver
This commit is contained in:
db48x%yahoo.com 2005-06-14 10:01:33 +00:00
Родитель 76214adc9c
Коммит 8db2ce5692
3 изменённых файлов: 45 добавлений и 448 удалений

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

@ -97,79 +97,6 @@ function Init()
var nameNode = document.getElementById("name");
document.title = document.title.replace(/\*\*bm_title\*\*/gi, nameNode.value);
// check bookmark schedule
var scheduleArc = RDF.GetResource(gWEB_NS+"Schedule");
value = BMDS.GetTarget(gResource, scheduleArc, true);
if (value) {
value = value.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
if (value) {
var values = value.split("|");
if (values.length == 4) {
// get day range
var days = values[0];
var dayNode = document.getElementById("dayRange");
var dayItems = dayNode.childNodes[0].childNodes;
for (x=0; x < dayItems.length; ++x) {
if (dayItems[x].getAttribute("value") == days) {
dayNode.selectedItem = dayItems[x];
break;
}
}
// get hour range
var hours = values[1].split("-");
var startHour = "";
var endHour = "";
if (hours.length == 2) {
startHour = hours[0];
endHour = hours[1];
}
// set start hour
var startHourNode = document.getElementById("startHourRange");
var startHourItems = startHourNode.childNodes[0].childNodes;
for (x=0; x < startHourItems.length; ++x) {
if (startHourItems[x].getAttribute("value") == startHour) {
startHourNode.selectedItem = startHourItems[x];
break;
}
}
// set end hour
var endHourNode = document.getElementById("endHourRange");
var endHourItems = endHourNode.childNodes[0].childNodes;
for (x=0; x < endHourItems.length; ++x) {
if (endHourItems[x].getAttribute("value") == endHour) {
endHourNode.selectedItem = endHourItems[x];
break;
}
}
// get duration
var duration = values[2];
var durationNode = document.getElementById("duration");
durationNode.value = duration;
// get notification method
var method = values[3];
if (method.indexOf("icon") >= 0)
document.getElementById("bookmarkIcon").checked = true;
if (method.indexOf("sound") >= 0)
document.getElementById("playSound").checked = true;
if (method.indexOf("alert") >= 0)
document.getElementById("showAlert").checked = true;
if (method.indexOf("open") >= 0)
document.getElementById("openWindow").checked = true;
}
}
}
// if its a container, disable some things
var isContainerFlag = RDFCU.IsContainer(BMDS, gResource);
if (!isContainerFlag) {
@ -202,29 +129,8 @@ function Init()
document.getElementById("feedurlrow").hidden = true;
}
var showScheduling = false;
var url = BMDS.GetTarget(gResource, gProperties[1], true);
if (url) {
url = url.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
if (!url ||
url.substr(0,7).toLowerCase() == "http://" ||
url.substr(0,8).toLowerCase() == "https://")
showScheduling = true;
}
// always hide the scheduling/notification tabs;
// we're diabling scheduling for 1.0 (bug 253478)
//if (!showScheduling || isLivemark) {
// only allow scheduling of http/https URLs that are not livemarks
document.getElementById("ScheduleTab").setAttribute("hidden", "true");
document.getElementById("NotifyTab").setAttribute("hidden", "true");
//}
sizeToContent();
// Set up the enabled of controls on the scheduling panels
dayRangeChange(document.getElementById("dayRange"));
// set initial focus
nameNode.focus();
nameNode.select();
@ -276,61 +182,6 @@ function Commit()
}
}
// Update bookmark schedule if necessary;
// if the tab was removed, just skip it
var scheduleTab = document.getElementById("ScheduleTab");
if (scheduleTab) {
var scheduleArc = RDF.GetResource(gWEB_NS+"Schedule");
oldValue = BMDS.GetTarget(gResource, scheduleArc, true);
newValue = null;
var dayRangeNode = document.getElementById("dayRange");
var dayRange = dayRangeNode.selectedItem.getAttribute("value");
if (dayRange) {
var startHourRangeNode = document.getElementById("startHourRange");
var startHourRange = startHourRangeNode.selectedItem.getAttribute("value");
var endHourRangeNode = document.getElementById("endHourRange");
var endHourRange = endHourRangeNode.selectedItem.getAttribute("value");
if (parseInt(startHourRange) > parseInt(endHourRange)) {
var temp = startHourRange;
startHourRange = endHourRange;
endHourRange = temp;
}
var duration = document.getElementById("duration").value;
if (!duration) {
alert(BookmarksUtils.getLocaleString("pleaseEnterADuration"));
return false;
}
var methods = [];
if (document.getElementById("bookmarkIcon").checked)
methods.push("icon");
if (document.getElementById("playSound").checked)
methods.push("sound");
if (document.getElementById("showAlert").checked)
methods.push("alert");
if (document.getElementById("openWindow").checked)
methods.push("open");
if (methods.length == 0) {
alert(BookmarksUtils.getLocaleString("pleaseSelectANotification"));
return false;
}
var method = methods.join(); // join string in array with ","
newValue = dayRange + "|" + startHourRange + "-" + endHourRange + "|" + duration + "|" + method;
}
if (newValue)
newValue = RDF.GetLiteral(newValue);
changed |= updateAttribute(scheduleArc, oldValue, newValue);
}
if (changed) {
var remote = BMDS.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
if (remote)
@ -355,44 +206,3 @@ function updateAttribute(aProperty, aOldValue, aNewValue)
}
return false;
}
function setEndHourRange()
{
// Get the values of the start-time and end-time as ints
var startHourRangeNode = document.getElementById("startHourRange");
var startHourRange = startHourRangeNode.selectedItem.getAttribute("value");
var startHourRangeInt = parseInt(startHourRange);
var endHourRangeNode = document.getElementById("endHourRange");
var endHourRange = endHourRangeNode.selectedItem.getAttribute("value");
var endHourRangeInt = parseInt(endHourRange);
var endHourItemNode = endHourRangeNode.firstChild.firstChild;
// disable all those end-times before the start-time
for (var index=0; index<startHourRangeInt; ++index) {
endHourItemNode.setAttribute("disabled", "true");
endHourItemNode = endHourItemNode.nextSibling;
}
// update the selected value if it's out of the allowed range
if (startHourRangeInt >= endHourRangeInt)
endHourRangeNode.selectedItem = endHourItemNode;
// make sure all the end-times after the start-time are enabled
for (; index < 24; ++index) {
endHourItemNode.removeAttribute("disabled");
endHourItemNode = endHourItemNode.nextSibling;
}
}
function dayRangeChange (aMenuList)
{
var controls = ["startHourRange", "endHourRange", "duration", "bookmarkIcon",
"showAlert", "openWindow", "playSound", "durationSubLabel",
"durationLabel", "startHourRangeLabel", "endHourRangeLabel"];
for (var i=0; i<controls.length; ++i)
document.getElementById(controls[i]).disabled = !aMenuList.value;
}

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

@ -48,206 +48,54 @@
title="&bookmarks.windowtitle.label;"
onload="Init()" style="width: 30em;"
ondialogaccept="return Commit();">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksProperties.js"/>
<tabbox id="bmPropsTabbox">
<tabs id="bmPropsTabs">
<tab id="GeneralTab" label="&generalInfo.label;" accesskey="&generalInfo.accesskey;"/>
<tab id="ScheduleTab" label="&schedule.label;" accesskey="&schedule.accesskey;"/>
<tab id="NotifyTab" label="&notification.label;" accesskey="&notification.accesskey;"/>
</tabs>
<tabpanels id="bmPropsTabpanel">
<vbox>
<vbox id="description-box" hidden="true">
<separator class="thin"/>
<hbox align="start">
<image class="message-icon"/>
<separator class="thin" orient="vertical"/>
<description id="bookmarkDescription" flex="1"/>
</hbox>
<separator class="thin"/>
</vbox>
<vbox class="box-padded">
<grid>
<columns>
<column />
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&bookmarks.name.label;" control="name"/>
<textbox id="name"/>
</row>
<row id="locationrow" align="center">
<label value="&bookmarks.location.label;" control="url"/>
<textbox id="url" />
</row>
<row id="feedurlrow" align="center">
<label value="&bookmarks.feedurl.label;" control="feedurl"/>
<textbox id="feedurl" />
</row>
<row id="shortcutrow" align="center">
<label value="&bookmarks.shortcut.label;" control="shortcut"/>
<textbox id="shortcut" />
</row>
<row id="descriptionrow">
<label value="&bookmarks.description.label;" control="description"/>
<textbox multiline="true" wrap="virtual" id="description" flex="1"/>
</row>
<checkbox id="webpanel" label="&bookmarks.webpanels.label;"/>
</rows>
</grid>
<separator/>
</vbox>
</vbox>
<vbox>
<separator class="thin"/>
<hbox align="center">
<image id="schedule-icon"/>
<separator class="thin" orient="vertical"/>
<description flex="1">&schedule.description;</description>
</hbox>
<separator class="thin"/>
<hbox class="box-padded">
<spacer flex="1"/>
<groupbox>
<caption label="&checkforupdates.legend.label;"/>
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&when.label;" control="dayRange"/>
<hbox>
<menulist id="dayRange" oncommand="dayRangeChange(this);">
<menupopup>
<menuitem value="" label="&checknever.label;"/>
<menuseparator />
<menuitem value="0123456" label="&checkeveryday.label;"/>
<menuitem value="12345" label="&checkweekdays.label;"/>
<menuitem value="06" label="&checkweekends.label;"/>
<menuitem value="1" label="&checkmondays.label;"/>
<menuitem value="2" label="&checktuesdays.label;"/>
<menuitem value="3" label="&checkwednesdays.label;"/>
<menuitem value="4" label="&checkthursdays.label;"/>
<menuitem value="5" label="&checkfridays.label;"/>
<menuitem value="6" label="&checksaturdays.label;"/>
<menuitem value="0" label="&checksundays.label;"/>
</menupopup>
</menulist>
</hbox>
</row>
<row align="center">
<label id="startHourRangeLabel"
value="&from.label;" control="startHourRange"/>
<hbox align="center">
<menulist id="startHourRange" oncommand="setEndHourRange()">
<menupopup>
<menuitem value="0" label="&midnight.label;"/>
<menuitem value="1" label="&AMone.label;"/>
<menuitem value="2" label="&AMtwo.label;"/>
<menuitem value="3" label="&AMthree.label;"/>
<menuitem value="4" label="&AMfour.label;"/>
<menuitem value="5" label="&AMfive.label;"/>
<menuitem value="6" label="&AMsix.label;"/>
<menuitem value="7" label="&AMseven.label;"/>
<menuitem value="8" label="&AMeight.label;"/>
<menuitem value="9" label="&AMnine.label;"/>
<menuitem value="10" label="&AMten.label;"/>
<menuitem value="11" label="&AMeleven.label;"/>
<menuitem value="12" label="&noon.label;"/>
<menuitem value="13" label="&PMone.label;"/>
<menuitem value="14" label="&PMtwo.label;"/>
<menuitem value="15" label="&PMthree.label;"/>
<menuitem value="16" label="&PMfour.label;"/>
<menuitem value="17" label="&PMfive.label;"/>
<menuitem value="18" label="&PMsix.label;"/>
<menuitem value="19" label="&PMseven.label;"/>
<menuitem value="20" label="&PMeight.label;"/>
<menuitem value="21" label="&PMnine.label;"/>
<menuitem value="22" label="&PMten.label;"/>
<menuitem value="23" label="&PMeleven.label;"/>
</menupopup>
</menulist>
<label id="endHourRangeLabel"
value="&to.label;" control="endHourRange"/>
<menulist id="endHourRange">
<menupopup onpopupshowing="setEndHourRange()">
<menuitem value="1" label="&AMone.label;"/>
<menuitem value="2" label="&AMtwo.label;"/>
<menuitem value="3" label="&AMthree.label;"/>
<menuitem value="4" label="&AMfour.label;"/>
<menuitem value="5" label="&AMfive.label;"/>
<menuitem value="6" label="&AMsix.label;"/>
<menuitem value="7" label="&AMseven.label;"/>
<menuitem value="8" label="&AMeight.label;"/>
<menuitem value="9" label="&AMnine.label;"/>
<menuitem value="10" label="&AMten.label;"/>
<menuitem value="11" label="&AMeleven.label;"/>
<menuitem value="12" label="&noon.label;"/>
<menuitem value="13" label="&PMone.label;"/>
<menuitem value="14" label="&PMtwo.label;"/>
<menuitem value="15" label="&PMthree.label;"/>
<menuitem value="16" label="&PMfour.label;"/>
<menuitem value="17" label="&PMfive.label;"/>
<menuitem value="18" label="&PMsix.label;"/>
<menuitem value="19" label="&PMseven.label;"/>
<menuitem value="20" label="&PMeight.label;"/>
<menuitem value="21" label="&PMnine.label;"/>
<menuitem value="22" label="&PMten.label;"/>
<menuitem value="23" label="&PMeleven.label;"/>
<menuitem value="24" label="&midnight.label;"/>
</menupopup>
</menulist>
</hbox>
</row>
<row align="center">
<label id="durationLabel"
value="&every.label;" control="duration"/>
<hbox align="center">
<textbox id="duration" size="4" value="60" />
<label id="durationSubLabel" value="&minutes.label;" />
</hbox>
</row>
</rows>
</grid>
<separator class="thin"/>
</groupbox>
<spacer flex="1"/>
</hbox>
</vbox>
<vbox>
<separator class="thin"/>
<hbox align="start">
<image id="notification-icon"/>
<separator class="thin" orient="vertical"/>
<description flex="1">&notification.description;</description>
</hbox>
<separator class="thin"/>
<hbox class="box-padded">
<spacer flex="1"/>
<groupbox>
<caption label="&notifications.legend.label;" />
<vbox align="start">
<checkbox id="bookmarkIcon" label="&notification.icon.label;" />
<checkbox id="showAlert" label="&notification.alert.label;" />
<checkbox id="openWindow" label="&notification.window.label;" />
<checkbox id="playSound" label="&notification.sound.label;" />
</vbox>
</groupbox>
<spacer flex="1"/>
</hbox>
</vbox>
</tabpanels>
</tabbox>
<!-- By calling this inline, we guarantee the description text node
<vbox id="description-box" hidden="true">
<separator class="thin"/>
<hbox align="start">
<image class="message-icon"/>
<separator class="thin" orient="vertical"/>
<description id="bookmarkDescription" flex="1"/>
</hbox>
<separator class="thin"/>
</vbox>
<vbox class="box-padded">
<grid>
<columns>
<column />
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&bookmarks.name.label;" control="name"/>
<textbox id="name"/>
</row>
<row id="locationrow" align="center">
<label value="&bookmarks.location.label;" control="url"/>
<textbox id="url" />
</row>
<row id="feedurlrow" align="center">
<label value="&bookmarks.feedurl.label;" control="feedurl"/>
<textbox id="feedurl" />
</row>
<row id="shortcutrow" align="center">
<label value="&bookmarks.shortcut.label;" control="shortcut"/>
<textbox id="shortcut" />
</row>
<row id="descriptionrow">
<label value="&bookmarks.description.label;" control="description"/>
<textbox multiline="true" wrap="virtual" id="description" flex="1"/>
</row>
<checkbox id="webpanel" label="&bookmarks.webpanels.label;"/>
</rows>
</grid>
<separator/>
</vbox>
<!-- By calling this inline, we guarantee the description text node
will have its bindings before Init() is called, and the
dialog will be intrinsically sized correctly. -->
<script type="application/x-javascript">showDescription();</script>

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

@ -41,17 +41,6 @@
<!ENTITY bookmarks.windowtitle.label "Properties for &quot;**bm_title**&quot;">
<!ENTITY generalInfo.label "Info">
<!ENTITY generalInfo.accesskey "i">
<!ENTITY schedule.label "Schedule">
<!ENTITY schedule.accesskey "s">
<!ENTITY schedule.description "&brandShortName; can check this site for updates and notify you when one occurs. Use these settings to customize the schedule for this Bookmark.">
<!ENTITY notification.label "Notify">
<!ENTITY notification.accesskey "n">
<!-- ICK. fix me -->
<!ENTITY notification.description "&brandShortName; will notify you when this site changes. Use these settings to customize notification.">
<!ENTITY bookmarks.information.label "Information:">
<!ENTITY bookmarks.name.label "Name:">
<!ENTITY bookmarks.location.label "Location:">
@ -59,53 +48,3 @@
<!ENTITY bookmarks.shortcut.label "Keyword:">
<!ENTITY bookmarks.description.label "Description:">
<!ENTITY bookmarks.webpanels.label "Load this bookmark in the sidebar">
<!ENTITY checkforupdates.legend.label "Check this location for updates:">
<!ENTITY when.label "When:">
<!ENTITY from.label "from:">
<!ENTITY to.label "to: ">
<!ENTITY every.label "every">
<!ENTITY minutes.label "minute(s)">
<!ENTITY notifications.legend.label "Notification:">
<!ENTITY checknever.label "Never">
<!ENTITY checkeveryday.label "Every day">
<!ENTITY checkweekdays.label "Weekdays">
<!ENTITY checkweekends.label "Weekends">
<!ENTITY checkmondays.label "Mondays">
<!ENTITY checktuesdays.label "Tuesdays">
<!ENTITY checkwednesdays.label "Wednesdays">
<!ENTITY checkthursdays.label "Thursdays">
<!ENTITY checkfridays.label "Fridays">
<!ENTITY checksaturdays.label "Saturdays">
<!ENTITY checksundays.label "Sundays">
<!ENTITY midnight.label "Midnight">
<!ENTITY AMone.label "1 AM">
<!ENTITY AMtwo.label "2 AM">
<!ENTITY AMthree.label "3 AM">
<!ENTITY AMfour.label "4 AM">
<!ENTITY AMfive.label "5 AM">
<!ENTITY AMsix.label "6 AM">
<!ENTITY AMseven.label "7 AM">
<!ENTITY AMeight.label "8 AM">
<!ENTITY AMnine.label "9 AM">
<!ENTITY AMten.label "10 AM">
<!ENTITY AMeleven.label "11 AM">
<!ENTITY noon.label "Noon">
<!ENTITY PMone.label "1 PM">
<!ENTITY PMtwo.label "2 PM">
<!ENTITY PMthree.label "3 PM">
<!ENTITY PMfour.label "4 PM">
<!ENTITY PMfive.label "5 PM">
<!ENTITY PMsix.label "6 PM">
<!ENTITY PMseven.label "7 PM">
<!ENTITY PMeight.label "8 PM">
<!ENTITY PMnine.label "9 PM">
<!ENTITY PMten.label "10 PM">
<!ENTITY PMeleven.label "11 PM">
<!ENTITY notification.icon.label "Change the bookmark's icon">
<!ENTITY notification.sound.label "Play a sound">
<!ENTITY notification.alert.label "Display an alert">
<!ENTITY notification.window.label "Open web page in a new window">