* UI/WebServerResources/SchedulerUI.js (onMenuRawEvent, onMenuRawTask):

New callback to show the event/task content from the menu

  * UI/Scheduler/UIxComponentEditor.m (rawAction):
  New method that returns the object's raw content in a WOResponse.

  * UI/Templates/SchedulerUI/UIxCal{Day,Month,Main,Week}View.wox:
  New contextual menu item: Show Raw Source

  * UI/WebServerResources/ContactsUI.js (onMenuRawContact):
  Rework to use calendar/ics/raw

  * UI/Contacts/UIxContactFolderActions.m (rawAction):
  Removed / moved to UI/Contacts/UIxContactActions.m

  * UI/Contacts/UIxContactActions.m (rawAction):
  New method that returns the object's raw content in a WOResponse.

  * UI/Templates/ContactsUI/UIxContactFoldersView.wox:
  Show vCard content -> Show Raw Source

Monotone-Parent: e853157abbabf35bc95273da8bc10b2d3b142627
Monotone-Revision: 4e287287380938e20234ac951c09158c324b84b4

Monotone-Author: jraby@inverse.ca
Monotone-Date: 2012-07-09T14:17:07
maint-2.0.2
Jean Raby 2012-07-09 14:17:07 +00:00
parent c4d11cd916
commit 71121914cf
17 changed files with 145 additions and 69 deletions

View File

@ -1,3 +1,27 @@
2012-07-09 Jean Raby <jraby@inverse.ca>
* UI/WebServerResources/SchedulerUI.js (onMenuRawEvent, onMenuRawTask):
New callback to show the event/task content from the menu
* UI/Scheduler/UIxComponentEditor.m (rawAction):
New method that returns the object's raw content in a WOResponse.
* UI/Templates/SchedulerUI/UIxCal{Day,Month,Main,Week}View.wox:
New contextual menu item: Show Raw Source
* UI/WebServerResources/ContactsUI.js (onMenuRawContact):
Rework to use calendar/ics/raw
* UI/Contacts/UIxContactFolderActions.m (rawAction):
Removed / moved to UI/Contacts/UIxContactActions.m
* UI/Contacts/UIxContactActions.m (rawAction):
New method that returns the object's raw content in a WOResponse.
* UI/Templates/ContactsUI/UIxContactFoldersView.wox:
Show vCard content -> Show Raw Source
2012-07-05 Jean Raby <jraby@inverse.ca>
* UI/WebServerResources/generic.js (openGenericWindow):

2
NEWS
View File

@ -1,7 +1,7 @@
1.3.17 (2012-MM-DD)
-------------------
New Features
-
- New contextual menu to view the raw content of events, tasks and contacts
Enhancements
- updated Czech translation

View File

@ -195,7 +195,7 @@
"Lists can't be moved or copied." = "Lists can't be moved or copied.";
"Export" = "Export";
"Export Address Book..." = "Export Address Book...";
"Show vCard content" = "Show vCard content";
"View Raw Source" = "View Raw Source";
"Import Cards" = "Import Cards";
"Select a vCard or LDIF file." = "Select a vCard or LDIF file.";
"Upload" = "Upload";

View File

@ -195,7 +195,6 @@
"Lists can't be moved or copied." = "Les listes ne peuvent pas être déplacées ou copiées.";
"Export" = "Exporter";
"Export Address Book..." = "Exporter le carnet d'adresses...";
"Show vCard content" = "Afficher le contenu vCard";
"Import Cards" = "Importer des contacts";
"Select a vCard or LDIF file." = "Sélectionner un fichier. LDIF ou vCard.";
"Upload" = "Ajouter";

View File

@ -130,4 +130,21 @@
return [self _setOrUnsetCategoryAction: NO];
}
// returns the raw content of the object
- (WOResponse *) rawAction
{
NSMutableString *content;
WOResponse *response;
content = [NSMutableString string];
response = [context response];
[content appendFormat: [[self clientObject] contentAsString]];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: content];
return response;
}
@end

View File

@ -287,51 +287,4 @@
return rc;
}
- (id <WOActionResults>) rawAction
{
WORequest *request;
WOResponse *response;
NSArray *contactsId;
NSEnumerator *uids;
NSString *uid;
id currentChild;
SOGoContactGCSFolder *sourceFolder;
NSMutableString *content;
content = [NSMutableString string];
request = [context request];
response = [context response];
sourceFolder = [self clientObject];
contactsId = [request formValuesForKey: @"uid"];
if ((uids = [contactsId objectEnumerator]))
{
while ((uid = [uids nextObject]))
{
currentChild = [sourceFolder lookupName: uid
inContext: [self context]
acquire: NO];
if([currentChild isKindOfClass: [NSException class]])
continue;
[content appendFormat: [currentChild contentAsString]];
[content appendString: @"\n"];
}
}
if (![content length])
{
response = [self responseWithStatus: 404
andString: @"Contact does not exist"];
}
else
{
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: content];
}
return response;
}
@end /* UIxContactsListView */

View File

@ -99,11 +99,6 @@
actionClass = "UIxContactFolderActions";
actionName = "export";
};
raw = {
protectedBy = "View";
actionClass = "UIxContactFolderActions";
actionName = "raw";
};
exportFolder = {
protectedBy = "View";
actionClass = "UIxContactFolderActions";
@ -206,6 +201,11 @@
actionClass = "UIxContactActions";
actionName = "unsetCategory";
};
raw = {
protectedBy = "View";
actionClass = "UIxContactActions";
actionName = "raw";
};
};
};
@ -238,6 +238,11 @@
pageName = "UIxListEditor";
actionName = "save";
};
raw = {
protectedBy = "View";
actionClass = "UIxContactActions";
actionName = "raw";
};
};
};

View File

@ -565,6 +565,7 @@ vtodo_class2 = "(Confidential task)";
"Delete Task" = "Delete Task";
"Delete Event" = "Delete Event";
"Copy event to my calendar" = "Copy event to my calendar";
"View Raw Source" = "View Raw Source";
"Subscribe to a web calendar..." = "Subscribe to a web calendar...";
"URL of the Calendar" = "URL of the Calendar";

View File

@ -2526,4 +2526,21 @@ RANGE(2);
return [[self clientObject] ownerInContext: context];
}
// returns the raw content of the object
- (WOResponse *) rawAction
{
NSMutableString *content;
WOResponse *response;
content = [NSMutableString string];
response = [context response];
[content appendFormat: [[self clientObject] contentAsString]];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: content];
return response;
}
@end

View File

@ -235,6 +235,11 @@
actionClass = "UIxAppointmentActions";
actionName = "copy";
};
raw = {
protectedBy = "ViewAllComponent";
actionClass = "UIxComponentEditor";
actionName = "raw";
};
accept = {
protectedBy = "RespondToComponent";
pageName = "UIxAppointmentEditor";
@ -304,6 +309,11 @@
pageName = "UIxTaskEditor";
actionName = "changeStatus";
};
raw = {
protectedBy = "ViewAllComponent";
pageName = "UIxComponentEditor";
actionName = "raw";
};
};
};

View File

@ -84,7 +84,7 @@
<li><var:string label:value="Move To" /></li>
<li><var:string label:value="Copy To" /></li>
<li><var:string label:value="Export" /></li>
<li><var:string label:value="Show vCard content" /></li>
<li><var:string label:value="View Raw Source" /></li>
</ul>
</div>

View File

@ -17,6 +17,7 @@
<li><!-- separator --></li>
<li><var:string label:value="Delete Event"/></li>
<li><var:string label:value="Copy event to my calendar"/></li>
<li><var:string label:value="View Raw Source"/></li>
</ul>
</div>
<a href="#"

View File

@ -72,6 +72,8 @@
<li><!-- separator --></li>
<li><var:string label:value="Mark Completed"/></li>
<li><var:string label:value="Delete Task"/></li>
<li><!-- separator --></li>
<li><var:string label:value="View Raw Source"/></li>
</ul>
</div>

View File

@ -17,6 +17,7 @@
<li><!-- separator --></li>
<li><var:string label:value="Delete Event"/></li>
<li><var:string label:value="Copy event to my calendar"/></li>
<li><var:string label:value="View Raw Source"/></li>
</ul>
</div>
<a href="#"

View File

@ -16,6 +16,7 @@
<li><!-- separator --></li>
<li><var:string label:value="Delete Event"/></li>
<li><var:string label:value="Copy event to my calendar"/></li>
<li><var:string label:value="View Raw Source"/></li>
</ul>
</div>
<a href="#"

View File

@ -291,17 +291,12 @@ function onMenuExportContact (event) {
}
function onMenuRawContact (event) {
var selectedFolders = $("contactFolders").getSelectedNodes();
var canExport = (selectedFolders[0].getAttribute("owner") != "nobody");
if (canExport) {
var selectedFolderId = $(selectedFolders[0]).readAttribute("id");
var contactIds = document.menuTarget.collect(function(row) {
return row.readAttribute("id");
});
var url = ApplicationBaseURL + selectedFolderId + "/raw"
+ "?uid=" + contactIds.join("&uid=");
openGenericWindow(url);
}
var cname = document.menuTarget.collect(function(row) {
return row.readAttribute("id");
});
openGenericWindow(URLForFolderID(Contact.currentAddressBook)
+ "/" + cname + "/raw");
}
function actionContactCallback(http) {

View File

@ -414,6 +414,18 @@ function copyEventCallback(http) {
}
}
function onMenuRawEvent(event) {
if (selectedCalendarCell.length != 1) {
return;
}
var calendar = selectedCalendarCell[0].calendar;
var cname = selectedCalendarCell[0].cname;
var url = ApplicationBaseURL + calendar + "/" + cname + "/raw"
openGenericWindow(url);
}
function modifyEvent(sender, modification, parameters) {
var currentLocation = '' + window.location;
var arr = currentLocation.split("/");
@ -1898,7 +1910,9 @@ function calendarDisplayCallback(http) {
loadNextView,
"-",
deleteEvent,
copyEventToPersonalCalendar);
copyEventToPersonalCalendar,
onMenuRawEvent
);
var observer;
if (currentView == 'dayview') {
observer = $("daysView");
@ -2539,9 +2553,11 @@ function onMenuCurrentViewPrepareVisibility() {
var options = $(this).down("ul");
var deleteOption = options.down("li", 6);
var copyOption = options.down("li", 7);
var rawOption = options.down("li", 8);
if (!selectedCalendarCell) {
deleteOption.addClassName("disabled");
copyOption.addClassName("disabled");
rawOption.addClassName("disabled");
}
else {
deleteOption.removeClassName("disabled");
@ -2550,11 +2566,29 @@ function onMenuCurrentViewPrepareVisibility() {
copyOption.addClassName("disabled");
else
copyOption.removeClassName("disabled");
if (selectedCalendarCell.length == 1) {
// show raw content is only allowed for single event
rawOption.removeClassName("disabled");
}
else
rawOption.addClassName("disabled");
}
return true;
}
function onTasksListMenuPrepareVisibility() {
var options = $(this).down("ul");
var rawOption = options.down("li", 6);
var selectedTasks = $$("UL#tasksList LI._selected");
if (selectedTasks.length == 1)
rawOption.removeClassName("disabled");
else
rawOption.addClassName("disabled");
return true;
}
function getMenus() {
var menus = {};
@ -2581,12 +2615,17 @@ function getMenus() {
menus["searchMenu"] = new Array(setSearchCriteria);
menus["tasksListMenu"] = new Array (editEvent, newTask, "-",
marksTasksAsCompleted, deleteEvent);
marksTasksAsCompleted, deleteEvent, "-",
onMenuRawTask);
var calendarsMenu = $("calendarsMenu");
if (calendarsMenu)
calendarsMenu.prepareVisibility = onCalendarsMenuPrepareVisibility;
var tasksListMenu = $("tasksListMenu");
if (tasksListMenu)
tasksListMenu.prepareVisibility = onTasksListMenuPrepareVisibility;
return menus;
}
@ -2612,6 +2651,17 @@ function _updateTaskCompletion (task, value) {
return false;
}
function onMenuRawTask(event) {
var selectedTasks = $$("UL#tasksList LI._selected");
if (selectedTasks.length != 1) {
return;
}
var url = ApplicationBaseURL + selectedTasks[0].calendar + "/" + selectedTasks[0].cname + "/raw"
openGenericWindow(url);
}
function onMenuSharing(event) {
if ($(this).hasClassName("disabled"))
return;