Fix print.

This commit is contained in:
Paulo Gustavo Veiga 2012-05-19 00:13:06 -03:00
parent 4546aaad98
commit 6a6efd58f4
2 changed files with 56 additions and 103 deletions

View File

@ -71,12 +71,12 @@ jQuery.fn.dialogForm = function(options) {
var containerId = this[0].id; var containerId = this[0].id;
var url = options.url; var url = options.url;
var acceptButtonLabel = options.acceptButtonLabel;
// Clean previous dialog content ... // Clean previous dialog content ...
$("#" + containerId + " div[id='errorMessage']").text("").removeClass("ui-state-highlight"); $("#" + containerId + " div[id='errorMessage']").text("").removeClass("ui-state-highlight");
$('#' + containerId + ' .btn-accept').click(function() { var acceptBtn = $('#' + containerId + ' .btn-accept');
acceptBtn.click(function() {
var formData = {}; var formData = {};
$('#' + containerId + ' input').each(function(index, elem) { $('#' + containerId + ' input').each(function(index, elem) {
formData[elem.name] = elem.value; formData[elem.name] = elem.value;
@ -93,12 +93,14 @@ jQuery.fn.dialogForm = function(options) {
var resourceId = jqXHR.getResponseHeader("ResourceId"); var resourceId = jqXHR.getResponseHeader("ResourceId");
var redirectUrl = options.redirect; var redirectUrl = options.redirect;
redirectUrl = redirectUrl.replace("{header.resourceId}", resourceId); redirectUrl = redirectUrl.replace("{header.resourceId}", resourceId);
$(acceptBtn).button('loading');
$("#" + containerId).modal('hide');
window.location = redirectUrl; window.location = redirectUrl;
} else if (options.postUpdate) { } else if (options.postUpdate) {
options.postUpdate(formData); options.postUpdate(formData);
} }
$(this).dialog("close");
}, },
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 400) { if (jqXHR.status == 400) {

View File

@ -129,52 +129,11 @@
<!--Buttons--> <!--Buttons-->
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
$(function() { $(function() {
$("#actionButtons .show-tags").button({
icons: { primary: "ui-icon-folder-open" }
}).click(function() {
if ($("#tags").css("opacity") == 0) {
$("#tags").css("opacity", 1);
$("#mindmapListTable").animate({
width: "77%"
}, 1000);
} else {
$("#mindmapListTable").animate({
width: "100%"
}, 1000, function() {
$("#tags").css("opacity", 0);
});
}
});
$("#actionButtons .share").button({
icons: { primary: "ui-icon-transferthick-e-w" }
}).click(function() {
var selectedMaps = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
var html2 = $('#share-dialog-modal p span').html(selectedMaps.toString());
if (selectedMaps.length > 0) {
$("#share-dialog-modal").dialog({
height: 140,
modal: true,
buttons: {
"Delete": function() {
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
}
});
// Creation buttons actions ... // Creation buttons actions ...
$("#newBtn").click( $("#newBtn").click(
function() { function() {
$("#new-dialog-modal").dialogForm({ $("#new-dialog-modal").dialogForm({
modal: true, modal: true,
acceptButtonLabel : "Create",
cancelButtonLabel : "Cancel",
redirect: "c/map/{header.resourceId}/edit.htm", redirect: "c/map/{header.resourceId}/edit.htm",
url : "../service/maps" url : "../service/maps"
}); });
@ -184,7 +143,6 @@
window.open('c/map/import.htm'); window.open('c/map/import.htm');
}); });
$("#duplicateBtn").click(function() { $("#duplicateBtn").click(function() {
// Map to be cloned ... // Map to be cloned ...
var tableElem = $('#mindmapListTable'); var tableElem = $('#mindmapListTable');
@ -201,8 +159,6 @@
// Initialize dialog ... // Initialize dialog ...
$("#duplicate-dialog-modal").dialogForm({ $("#duplicate-dialog-modal").dialogForm({
modal: true, modal: true,
acceptButtonLabel : "Duplicate",
cancelButtonLabel : "Cancel",
redirect: "c/map/{header.resourceId}/edit.htm", redirect: "c/map/{header.resourceId}/edit.htm",
url : "../service/maps/" + mapId url : "../service/maps/" + mapId
}); });
@ -224,17 +180,13 @@
$("#rename-dialog-modal input[name='title']").attr('value', rowData.title); $("#rename-dialog-modal input[name='title']").attr('value', rowData.title);
$("#rename-dialog-modal input[name='description']").attr('value', rowData.description); $("#rename-dialog-modal input[name='description']").attr('value', rowData.description);
// Set title ... // Set title ...
$('#renameDialogTitle').text("Rename '" + rowData.title + "'"); $('#renameDialogTitle').text("Rename '" + rowData.title + "'");
// Initialize dialog ... // Initialize dialog ...
$("#rename-dialog-modal").dialogForm({ $("#rename-dialog-modal").dialogForm({
modal: true, modal: true,
type: 'PUT', type: 'PUT',
acceptButtonLabel : "Rename",
cancelButtonLabel : "Cancel",
postUpdate: function(reqBodyData) { postUpdate: function(reqBodyData) {
// Remove old entry ... // Remove old entry ...
dataTable.fnDeleteRow(rowData); dataTable.fnDeleteRow(rowData);
@ -244,12 +196,11 @@
rowData.description = reqBodyData.description; rowData.description = reqBodyData.description;
dataTable.fnAddData(rowData); dataTable.fnAddData(rowData);
}, },
url : "../service/maps/" + mapId url : "../service/maps/" + mapId + "/title"
}); });
} }
}); });
$("#deleteBtn").click(function() { $("#deleteBtn").click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) { if (mapIds.length > 0) {
@ -270,29 +221,28 @@
} }
}); });
$("#actionButtons .printMap").button({ $("#printBtn").click(function() {
icons: { primary: "ui-icon-print" }
}).click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) { if (mapIds.length > 0) {
window.open('c/map/' + mapIds[0] + '/print.htm'); window.open('c/map/' + mapIds[0] + '/print.htm');
} }
}); });
$("#actionButtons .publishMap").button({ $("#actionButtons .publishMap").click(function() {
icons: { primary: "ui-icon-print" }
}).click(function() {
}); });
$("#actionButtons .shareMap").button({ $("#actionButtons .shareMap").click(function() {
icons: { primary: "ui-icon-print" }
}).click(function() {
}); });
$("#actionButtons .tagMap").button({ $("#actionButtons .tagMap").click(function() {
icons: { primary: "ui-icon-print" }
}).click(function() {
}); });
$("#actionButtons .share").click(function() {
});
$("#actionButtons .tags").click(function() {
});
}); });
// Register time update functions .... // Register time update functions ....
@ -329,9 +279,10 @@
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li id="duplicateBtn"><a href="#" onclick="return false"><i class="icon-plus-sign"></i> Duplicate</a></li> <li id="duplicateBtn"><a href="#" onclick="return false"><i class="icon-plus-sign"></i>
Duplicate</a></li>
<li id="renameBtn"><a href="#" onclick="return false"><i class="icon-edit"></i> Rename</a></li> <li id="renameBtn"><a href="#" onclick="return false"><i class="icon-edit"></i> Rename</a></li>
<li id="printMap"><a href="#" onclick="return false"><i class="icon-print"></i> Print</a></li> <li id="printBtn"><a href="#" onclick="return false"><i class="icon-print"></i> Print</a></li>
<li id="publishMap"><a href="#" onclick="return false"><i class="icon-globe"></i>Publish</a></li> <li id="publishMap"><a href="#" onclick="return false"><i class="icon-globe"></i>Publish</a></li>
<li id="exportMap"><a href="#" onclick="return false"><i class="icon-download-alt"></i> Export</a> <li id="exportMap"><a href="#" onclick="return false"><i class="icon-download-alt"></i> Export</a>
</li> </li>
@ -370,7 +321,7 @@
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-primary btn-accept">Create</button> <button class="btn btn-primary btn-accept" data-loading-text="Creating ...">Create</button>
<button class="btn btn-cancel">Close</button> <button class="btn btn-cancel">Close</button>
</div> </div>
</div> </div>