зеркало из https://github.com/mozilla/pjs.git
Fix bug 426153 - Add link to event page in event editing dialog. r=berend,ui-r=christian
This commit is contained in:
Родитель
a5e5210c7f
Коммит
1970607cae
|
@ -782,3 +782,52 @@ function commonUpdateReminder() {
|
||||||
|
|
||||||
updateReminderDetails();
|
updateReminderDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateLink() {
|
||||||
|
var itemUrlString = (window.calendarItem || window.item).getProperty("URL");
|
||||||
|
var linkCommand = document.getElementById("cmd_toggle_link");
|
||||||
|
|
||||||
|
function hideOrShow(aBool, aDisable) {
|
||||||
|
setElementValue("event-grid-link-row", !aBool && "true", "hidden");
|
||||||
|
var separator = document.getElementById("event-grid-link-separator");
|
||||||
|
if (separator) {
|
||||||
|
// The separator is not there in the summary dialog
|
||||||
|
setElementValue("event-grid-link-separator", !aBool && "true", "hidden");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linkCommand) {
|
||||||
|
setElementValue(linkCommand, aDisable && "true", "disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linkCommand && linkCommand.getAttribute("checked") != "true") {
|
||||||
|
hideOrShow(false, false);
|
||||||
|
} else if (itemUrlString && itemUrlString.length) {
|
||||||
|
var handler, uri;
|
||||||
|
try {
|
||||||
|
uri = makeURL(itemUrlString);
|
||||||
|
handler = getIOService().getProtocolHandler(uri.scheme);
|
||||||
|
} catch (e) {
|
||||||
|
// No protocol handler for the given protocol, or invalid uri
|
||||||
|
hideOrShow(false, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handler && handler instanceof Components.interfaces.nsIExternalProtocolHandler) {
|
||||||
|
// Only show if there is an external app for this scheme
|
||||||
|
hideOrShow(handler.externalAppExistsForScheme(uri.scheme));
|
||||||
|
} else {
|
||||||
|
// Internal protocol handler, show it
|
||||||
|
hideOrShow(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
// HACK the url-link doesn't crop when setting the value in onLoad
|
||||||
|
setElementValue("url-link", itemUrlString);
|
||||||
|
setElementValue("url-link", itemUrlString, "href");
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
hideOrShow(false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ function onLoad() {
|
||||||
|
|
||||||
updateRepeatDetails();
|
updateRepeatDetails();
|
||||||
updateAttendees();
|
updateAttendees();
|
||||||
|
updateLink();
|
||||||
|
|
||||||
var location = item.getProperty("LOCATION");
|
var location = item.getProperty("LOCATION");
|
||||||
if (location && location.length) {
|
if (location && location.length) {
|
||||||
|
@ -154,14 +155,6 @@ function onLoad() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.hasProperty("URL")) {
|
|
||||||
var url = item.getProperty("URL");
|
|
||||||
if (url && url.length) {
|
|
||||||
document.getElementById("item-link-box").removeAttribute("hidden");
|
|
||||||
document.getElementById("item-link").value = url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.title = item.title;
|
document.title = item.title;
|
||||||
|
|
||||||
// If this item is read only we remove the 'cancel' button as users
|
// If this item is read only we remove the 'cancel' button as users
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
src="chrome://calendar/content/calendar-dialog-utils.js"/>
|
src="chrome://calendar/content/calendar-dialog-utils.js"/>
|
||||||
<script type="application/x-javascript"
|
<script type="application/x-javascript"
|
||||||
src="chrome://calendar/content/calUtils.js"/>
|
src="chrome://calendar/content/calUtils.js"/>
|
||||||
|
<script type="application/x-javascript"
|
||||||
|
src="chrome://calendar/content/calendar-ui-utils.js"/>
|
||||||
<script type="application/x-javascript"
|
<script type="application/x-javascript"
|
||||||
src="chrome://calendar/content/calApplicationUtils.js"/>
|
src="chrome://calendar/content/calApplicationUtils.js"/>
|
||||||
|
|
||||||
|
@ -261,18 +263,15 @@
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
<!-- Documents -->
|
<!-- URL link -->
|
||||||
<box id="item-link-box" hidden="true" orient="vertical">
|
<box id="event-grid-link-row" hidden="true" orient="vertical">
|
||||||
<spacer class="default-spacer"/>
|
<spacer class="default-spacer"/>
|
||||||
<calendar-caption label="&read.only.documents.label;"
|
<calendar-caption label="&read.only.link.label;"
|
||||||
control="item-link"/>
|
control="url-link"/>
|
||||||
<box orient="horizontal">
|
<label id="url-link"
|
||||||
<spacer class="default-spacer"/>
|
class="text-link default-indent"
|
||||||
<label id="item-link"
|
value=" "
|
||||||
class="text-link"
|
crop="end"/>
|
||||||
crop="right"
|
|
||||||
onclick="browseDocument()"/>
|
|
||||||
</box>
|
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
|
@ -56,6 +56,10 @@ listbox[disabled="true"] {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.default-indent {
|
||||||
|
-moz-margin-start: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
.status-icon {
|
.status-icon {
|
||||||
margin: 0 3px;
|
margin: 0 3px;
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -56,6 +56,10 @@ listbox[disabled="true"] {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.default-indent {
|
||||||
|
-moz-margin-start: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
.status-icon {
|
.status-icon {
|
||||||
margin: 0 3px;
|
margin: 0 3px;
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -84,6 +84,8 @@
|
||||||
<!ENTITY event.menu.view.toolbars.event.accesskey "E">
|
<!ENTITY event.menu.view.toolbars.event.accesskey "E">
|
||||||
<!ENTITY event.menu.view.toolbars.customize.label "Customize…">
|
<!ENTITY event.menu.view.toolbars.customize.label "Customize…">
|
||||||
<!ENTITY event.menu.view.toolbars.customize.accesskey "C">
|
<!ENTITY event.menu.view.toolbars.customize.accesskey "C">
|
||||||
|
<!ENTITY event.menu.view.showlink.label "Show Related Link">
|
||||||
|
<!ENTITY event.menu.view.showlink.accesskey "R">
|
||||||
|
|
||||||
<!ENTITY event.menu.options.label "Options">
|
<!ENTITY event.menu.options.label "Options">
|
||||||
<!ENTITY event.menu.options.accesskey "O">
|
<!ENTITY event.menu.options.accesskey "O">
|
||||||
|
@ -186,6 +188,7 @@
|
||||||
<!ENTITY event.attachments.popup.removeAll.accesskey "A" >
|
<!ENTITY event.attachments.popup.removeAll.accesskey "A" >
|
||||||
<!ENTITY event.attachments.popup.attachPage.label "Attach Webpage…" >
|
<!ENTITY event.attachments.popup.attachPage.label "Attach Webpage…" >
|
||||||
<!ENTITY event.attachments.popup.attachPage.accesskey "W" >
|
<!ENTITY event.attachments.popup.attachPage.accesskey "W" >
|
||||||
|
<!ENTITY event.url.label "Related Link:" >
|
||||||
<!ENTITY event.priority2.label "Priority:">
|
<!ENTITY event.priority2.label "Priority:">
|
||||||
|
|
||||||
<!ENTITY event.reminder.none.label "No reminder " >
|
<!ENTITY event.reminder.none.label "No reminder " >
|
||||||
|
@ -353,5 +356,6 @@
|
||||||
<!ENTITY read.only.attendees.label "Attendees">
|
<!ENTITY read.only.attendees.label "Attendees">
|
||||||
<!ENTITY read.only.description.label "Description">
|
<!ENTITY read.only.description.label "Description">
|
||||||
<!ENTITY read.only.documents.label "Documents">
|
<!ENTITY read.only.documents.label "Documents">
|
||||||
|
<!ENTITY read.only.link.label "Related Link">
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -290,6 +290,9 @@ function loadDialog(item) {
|
||||||
updateAttachment();
|
updateAttachment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// URL link
|
||||||
|
updateLink();
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
setElementValue("item-description", item.getProperty("DESCRIPTION"));
|
setElementValue("item-description", item.getProperty("DESCRIPTION"));
|
||||||
|
|
||||||
|
@ -2335,6 +2338,20 @@ function updateAttachment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleLink() {
|
||||||
|
var linkCommand = document.getElementById("cmd_toggle_link");
|
||||||
|
var row = document.getElementById("event-grid-link-row");
|
||||||
|
var separator = document.getElementById("event-grid-link-separator");
|
||||||
|
|
||||||
|
var isHidden = row.hidden;
|
||||||
|
row.hidden = !isHidden;
|
||||||
|
separator.hidden = !isHidden;
|
||||||
|
|
||||||
|
linkCommand.setAttribute("checked", isHidden ? "true" : "false");
|
||||||
|
|
||||||
|
updateLink();
|
||||||
|
}
|
||||||
|
|
||||||
function updateAttendees() {
|
function updateAttendees() {
|
||||||
var attendeeRow = document.getElementById("event-grid-attendee-row");
|
var attendeeRow = document.getElementById("event-grid-attendee-row");
|
||||||
var attendeeRow2 = document.getElementById("event-grid-attendee-row-2");
|
var attendeeRow2 = document.getElementById("event-grid-attendee-row-2");
|
||||||
|
|
|
@ -152,6 +152,9 @@
|
||||||
'view-toolbars-event-menuitem')"/>
|
'view-toolbars-event-menuitem')"/>
|
||||||
<command id="cmd_customize"
|
<command id="cmd_customize"
|
||||||
oncommand="onCommandCustomize()"/>
|
oncommand="onCommandCustomize()"/>
|
||||||
|
<command id="cmd_toggle_link"
|
||||||
|
persist="checked"
|
||||||
|
oncommand="toggleLink()"/>
|
||||||
|
|
||||||
<!-- Toolbar commands -->
|
<!-- Toolbar commands -->
|
||||||
<command id="cmd_accept"
|
<command id="cmd_accept"
|
||||||
|
@ -402,6 +405,13 @@
|
||||||
command="cmd_customize"/>
|
command="cmd_customize"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
|
<menuseparator id="view-menu-toolbars-separator"/>
|
||||||
|
<menuitem id="view-show-link-menuitem"
|
||||||
|
label="&event.menu.view.showlink.label;"
|
||||||
|
accesskey="&event.menu.view.showlink.accesskey;"
|
||||||
|
type="checkbox"
|
||||||
|
command="cmd_toggle_link"
|
||||||
|
observes="cmd_toggle_link"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
@ -1035,6 +1045,19 @@
|
||||||
onclick="attachmentLinkClicked(event);"/>
|
onclick="attachmentLinkClicked(event);"/>
|
||||||
|
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
<separator id="event-grid-link-separator"
|
||||||
|
class="groove"
|
||||||
|
hidden="true"/>
|
||||||
|
<row id="event-grid-link-row"
|
||||||
|
align="center"
|
||||||
|
hidden="true">
|
||||||
|
<label value="&event.url.label;"
|
||||||
|
control="url-link"/>
|
||||||
|
<label id="url-link"
|
||||||
|
class="text-link"
|
||||||
|
crop="end"/>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
|
||||||
|
|
|
@ -756,7 +756,7 @@ function XMLEntryToItem(aXMLEntry, aTimezone, aCalendar, aReferenceItem) {
|
||||||
// id
|
// id
|
||||||
item.id = getIdFromEntry(aXMLEntry);
|
item.id = getIdFromEntry(aXMLEntry);
|
||||||
|
|
||||||
// link
|
// link (edit url)
|
||||||
// Since Google doesn't set the edit url to be https if the request is
|
// Since Google doesn't set the edit url to be https if the request is
|
||||||
// https, we need to work around this here.
|
// https, we need to work around this here.
|
||||||
var editUrl = aXMLEntry.link.(@rel == 'edit').@href.toString();
|
var editUrl = aXMLEntry.link.(@rel == 'edit').@href.toString();
|
||||||
|
@ -765,6 +765,13 @@ function XMLEntryToItem(aXMLEntry, aTimezone, aCalendar, aReferenceItem) {
|
||||||
}
|
}
|
||||||
item.setProperty("X-GOOGLE-EDITURL", editUrl);
|
item.setProperty("X-GOOGLE-EDITURL", editUrl);
|
||||||
|
|
||||||
|
// link (alternative representation, html)
|
||||||
|
var htmlUrl = aXMLEntry.link.(@rel == 'alternate').@href.toString();
|
||||||
|
if (aCalendar.uri.schemeIs("https")) {
|
||||||
|
htmlUrl = htmlUrl.replace(/^http:/, "https:");
|
||||||
|
}
|
||||||
|
item.setProperty("URL", htmlUrl);
|
||||||
|
|
||||||
// title
|
// title
|
||||||
item.title = aXMLEntry.title.(@type == 'text');
|
item.title = aXMLEntry.title.(@type == 'text');
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче