зеркало из 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();
|
||||
}
|
||||
|
||||
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();
|
||||
updateAttendees();
|
||||
updateLink();
|
||||
|
||||
var location = item.getProperty("LOCATION");
|
||||
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;
|
||||
|
||||
// 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"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://calendar/content/calUtils.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://calendar/content/calendar-ui-utils.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://calendar/content/calApplicationUtils.js"/>
|
||||
|
||||
|
@ -261,18 +263,15 @@
|
|||
</box>
|
||||
</box>
|
||||
|
||||
<!-- Documents -->
|
||||
<box id="item-link-box" hidden="true" orient="vertical">
|
||||
<!-- URL link -->
|
||||
<box id="event-grid-link-row" hidden="true" orient="vertical">
|
||||
<spacer class="default-spacer"/>
|
||||
<calendar-caption label="&read.only.documents.label;"
|
||||
control="item-link"/>
|
||||
<box orient="horizontal">
|
||||
<spacer class="default-spacer"/>
|
||||
<label id="item-link"
|
||||
class="text-link"
|
||||
crop="right"
|
||||
onclick="browseDocument()"/>
|
||||
</box>
|
||||
<calendar-caption label="&read.only.link.label;"
|
||||
control="url-link"/>
|
||||
<label id="url-link"
|
||||
class="text-link default-indent"
|
||||
value=" "
|
||||
crop="end"/>
|
||||
</box>
|
||||
|
||||
</dialog>
|
||||
|
|
|
@ -56,6 +56,10 @@ listbox[disabled="true"] {
|
|||
height: 1em;
|
||||
}
|
||||
|
||||
.default-indent {
|
||||
-moz-margin-start: 1.5em;
|
||||
}
|
||||
|
||||
.status-icon {
|
||||
margin: 0 3px;
|
||||
display: none;
|
||||
|
|
|
@ -56,6 +56,10 @@ listbox[disabled="true"] {
|
|||
height: 1em;
|
||||
}
|
||||
|
||||
.default-indent {
|
||||
-moz-margin-start: 1.5em;
|
||||
}
|
||||
|
||||
.status-icon {
|
||||
margin: 0 3px;
|
||||
display: none;
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
<!ENTITY event.menu.view.toolbars.event.accesskey "E">
|
||||
<!ENTITY event.menu.view.toolbars.customize.label "Customize…">
|
||||
<!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.accesskey "O">
|
||||
|
@ -186,6 +188,7 @@
|
|||
<!ENTITY event.attachments.popup.removeAll.accesskey "A" >
|
||||
<!ENTITY event.attachments.popup.attachPage.label "Attach Webpage…" >
|
||||
<!ENTITY event.attachments.popup.attachPage.accesskey "W" >
|
||||
<!ENTITY event.url.label "Related Link:" >
|
||||
<!ENTITY event.priority2.label "Priority:">
|
||||
|
||||
<!ENTITY event.reminder.none.label "No reminder " >
|
||||
|
@ -353,5 +356,6 @@
|
|||
<!ENTITY read.only.attendees.label "Attendees">
|
||||
<!ENTITY read.only.description.label "Description">
|
||||
<!ENTITY read.only.documents.label "Documents">
|
||||
<!ENTITY read.only.link.label "Related Link">
|
||||
|
||||
|
||||
|
|
|
@ -290,6 +290,9 @@ function loadDialog(item) {
|
|||
updateAttachment();
|
||||
}
|
||||
|
||||
// URL link
|
||||
updateLink();
|
||||
|
||||
// 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() {
|
||||
var attendeeRow = document.getElementById("event-grid-attendee-row");
|
||||
var attendeeRow2 = document.getElementById("event-grid-attendee-row-2");
|
||||
|
|
|
@ -152,6 +152,9 @@
|
|||
'view-toolbars-event-menuitem')"/>
|
||||
<command id="cmd_customize"
|
||||
oncommand="onCommandCustomize()"/>
|
||||
<command id="cmd_toggle_link"
|
||||
persist="checked"
|
||||
oncommand="toggleLink()"/>
|
||||
|
||||
<!-- Toolbar commands -->
|
||||
<command id="cmd_accept"
|
||||
|
@ -402,6 +405,13 @@
|
|||
command="cmd_customize"/>
|
||||
</menupopup>
|
||||
</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>
|
||||
</menu>
|
||||
|
||||
|
@ -1035,6 +1045,19 @@
|
|||
onclick="attachmentLinkClicked(event);"/>
|
||||
|
||||
</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>
|
||||
</grid>
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ function XMLEntryToItem(aXMLEntry, aTimezone, aCalendar, aReferenceItem) {
|
|||
// id
|
||||
item.id = getIdFromEntry(aXMLEntry);
|
||||
|
||||
// link
|
||||
// link (edit url)
|
||||
// Since Google doesn't set the edit url to be https if the request is
|
||||
// https, we need to work around this here.
|
||||
var editUrl = aXMLEntry.link.(@rel == 'edit').@href.toString();
|
||||
|
@ -765,6 +765,13 @@ function XMLEntryToItem(aXMLEntry, aTimezone, aCalendar, aReferenceItem) {
|
|||
}
|
||||
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
|
||||
item.title = aXMLEntry.title.(@type == 'text');
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче