07dfd09f77feb685e3fe3d39fe0d1ba4132155ff
[Packages/TYPO3.CMS.git] / t3lib / js / extjs / components / pagetree / javascript / actions.js
1 /***************************************************************
2 * Copyright notice
3 *
4 * (c) 2010-2011 Stefan Galinski <stefan.galinski@gmail.com>
5 * All rights reserved
6 *
7 * This script is part of the TYPO3 project. The TYPO3 project is
8 * free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * The GNU General Public License can be found at
14 * http://www.gnu.org/copyleft/gpl.html.
15 * A copy is found in the textfile GPL.txt and important notices to the license
16 * from the author is found in LICENSE.txt distributed with these scripts.
17 *
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26 Ext.namespace('TYPO3.Components.PageTree');
27
28 /**
29 * @class TYPO3.Components.PageTree.Actions
30 *
31 * Actions dedicated for the page tree
32 *
33 * @namespace TYPO3.Components.PageTree
34 * @author Stefan Galinski <stefan.galinski@gmail.com>
35 */
36 TYPO3.Components.PageTree.Actions = {
37 /**
38 * Evaluates a response from an ext direct call and shows a flash message
39 * if it was an exceptional result
40 *
41 * @param {Object} response
42 * @return {Boolean}
43 */
44 evaluateResponse: function(response) {
45 if (response.success === false) {
46 TYPO3.Flashmessage.display(4, 'Exception', response.message);
47 return false;
48 }
49
50 return true;
51 },
52
53 /**
54 * Releases the cut and copy mode from the context menu
55 *
56 * @param {TYPO3.Components.PageTree.Tree} tree
57 * @return {void}
58 */
59 releaseCutAndCopyModes: function(tree) {
60 tree.t3ContextInfo.inCutMode = false;
61 tree.t3ContextInfo.inCopyMode = false;
62
63 if (tree.t3ContextNode) {
64 tree.t3ContextNode.attributes.nodeData.t3InCutMode = false;
65 tree.t3ContextNode.attributes.nodeData.t3InCopyMode = false;
66 tree.t3ContextNode = null;
67 }
68 },
69
70 /**
71 * Updates an existing node with the given alternative. The new tree node
72 * is returned afterwards.
73 *
74 * @param {Ext.tree.TreeNode} node
75 * @param {Boolean} isExpanded
76 * @param {Object} updatedNode
77 * @param {Function} callback
78 * @return {Ext.tree.TreeNode}
79 */
80 updateNode: function(node, isExpanded, updatedNode, callback) {
81 if (!updatedNode) {
82 return null;
83 }
84
85 updatedNode.uiProvider = node.ownerTree.uiProvider;
86 var newTreeNode = new Ext.tree.TreeNode(updatedNode);
87
88 var refreshCallback = this.restoreNodeStateAfterRefresh;
89 if (callback) {
90 refreshCallback = refreshCallback.createSequence(callback);
91 }
92
93 node.parentNode.replaceChild(newTreeNode, node);
94 newTreeNode.ownerTree.refreshNode(newTreeNode, refreshCallback);
95
96 return newTreeNode;
97 },
98
99 /**
100 * Restores the node state
101 *
102 * @param {Ext.tree.TreeNode} node
103 * @param {Boolean} isExpanded
104 * @return {void}
105 */
106 restoreNodeStateAfterRefresh: function(node, isExpanded) {
107 node.parentNode.expand(false, false);
108 if (isExpanded) {
109 node.expand(false, false);
110 } else {
111 node.collapse(false, false);
112 }
113 },
114
115 /**
116 * Shows deletion confirmation window
117 *
118 * @param {Ext.tree.TreeNode} node
119 * @param {TYPO3.Components.PageTree.Tree} tree
120 * @param {Function} callback
121 * @param {Boolean} recursiveDelete
122 * @return {void}
123 */
124 confirmDelete: function(node, tree, callback, recursiveDelete) {
125 callback = callback || null;
126
127 var title = TYPO3.Components.PageTree.LLL.deleteDialogTitle,
128 message = TYPO3.Components.PageTree.LLL.deleteDialogMessage;
129 if (recursiveDelete) {
130 message = TYPO3.Components.PageTree.LLL.recursiveDeleteDialogMessage;
131 }
132
133 Ext.Msg.show({
134 title: title,
135 msg: message,
136 buttons: Ext.Msg.YESNO,
137 fn: function (answer) {
138 if (answer === 'yes') {
139 TYPO3.Components.PageTree.Actions.deleteNode(node, tree, callback);
140 return true;
141 }
142 return false;
143 },
144 animEl: 'elId'
145 });
146 },
147
148 /**
149 * Deletes a node directly
150 *
151 * @param {Ext.tree.TreeNode} node
152 * @param {TYPO3.Components.PageTree.Tree} tree
153 * @param {Function} callback
154 * @return {void}
155 */
156 deleteNode: function(node, tree, callback) {
157 TYPO3.Components.PageTree.Commands.deleteNode(
158 node.attributes.nodeData,
159 function(response) {
160 var succeeded = this.evaluateResponse(response);
161 if (Ext.isFunction(callback)) {
162 callback(node, tree, succeeded);
163 }
164
165 if (succeeded) {
166 // the node may not be removed in workspace mode
167 if (top.TYPO3.configuration.inWorkspace && response.id) {
168 this.updateNode(node, node.isExpanded(), response);
169 } else {
170 node.remove();
171 }
172 }
173 },
174 this
175 );
176 },
177
178 /**
179 * Removes a node either directly or first shows deletion popup
180 *
181 * @param {Ext.tree.TreeNode} node
182 * @param {TYPO3.Components.PageTree.Tree} tree
183 * @return {void}
184 */
185 removeNode: function(node, tree) {
186 if (TYPO3.Components.PageTree.Configuration.displayDeleteConfirmation) {
187 this.confirmDelete(node);
188 } else {
189 this.deleteNode(node, tree);
190 }
191 },
192
193 /**
194 * Restores a given node and moves it to the given destination inside the tree. Use this
195 * method if you want to add it as the first child of the destination.
196 *
197 * @param {Ext.tree.TreeNode} node
198 * @param {TYPO3.Components.PageTree.Tree} tree
199 * @param {Ext.tree.TreeNode} destination
200 * @return {void}
201 */
202 restoreNodeToFirstChildOfDestination: function(node, tree, destination) {
203 TYPO3.Components.PageTree.Commands.restoreNode(
204 node.attributes.nodeData,
205 destination.attributes.nodeData.id,
206 function(updatedNode) {
207 if (this.evaluateResponse(updatedNode)) {
208 var newTreeNode = new Ext.tree.TreeNode(
209 Ext.apply(node.attributes, updatedNode)
210 );
211 destination.insertBefore(newTreeNode, destination.firstChild);
212 }
213 },
214 this
215 );
216 },
217
218 /**
219 * Restores a given node and moves it to the given destination inside the tree. Use this
220 * method if you want to add the node after the destination node.
221 *
222 * @param {Ext.tree.TreeNode} node
223 * @param {TYPO3.Components.PageTree.Tree} tree
224 * @param {Ext.tree.TreeNode} destination
225 * @return {void}
226 */
227 restoreNodeAfterDestination: function(node, tree, destination) {
228 TYPO3.Components.PageTree.Commands.restoreNode(
229 node.attributes.nodeData,
230 -destination.attributes.nodeData.id,
231 function(updatedNode) {
232 if (this.evaluateResponse(updatedNode)) {
233 var newTreeNode = new Ext.tree.TreeNode(
234 Ext.apply(node.attributes, updatedNode)
235 );
236 destination.parentNode.insertBefore(newTreeNode, destination.nextSibling);
237 }
238 },
239 this
240 );
241 },
242
243 /**
244 * Collapses a whole tree branch
245 *
246 * @param {Ext.tree.TreeNode} node
247 * @return {void}
248 */
249 collapseBranch: function(node) {
250 node.collapse(true);
251 },
252
253 /**
254 * Expands a whole tree branch
255 *
256 * @param {Ext.tree.TreeNode} node
257 * @return {void}
258 */
259 expandBranch: function(node) {
260 node.expand(true);
261 },
262
263 /**
264 * Opens a popup windows for previewing the given node/page
265 *
266 * @param {Ext.tree.TreeNode} node
267 * @return {void}
268 */
269 viewPage: function(node) {
270 var frontendWindow = window.open('', 'newTYPO3frontendWindow');
271 TYPO3.Components.PageTree.Commands.getViewLink(
272 node.attributes.nodeData,
273 function(result) {
274 frontendWindow.location = result;
275 frontendWindow.focus();
276 }
277 );
278 },
279
280 /**
281 * Creates a temporary tree mount point
282 *
283 * @param {Ext.tree.TreeNode} node
284 * @param {TYPO3.Components.PageTree.Tree} tree
285 * @return {void}
286 */
287 mountAsTreeRoot: function(node, tree) {
288 TYPO3.Components.PageTree.Commands.setTemporaryMountPoint(
289 node.attributes.nodeData,
290 function(response) {
291 if (TYPO3.Components.PageTree.Configuration.temporaryMountPoint) {
292 TYPO3.Backend.NavigationContainer.PageTree.removeIndicator(
293 TYPO3.Backend.NavigationContainer.PageTree.temporaryMountPointInfoIndicator
294 );
295 }
296
297 TYPO3.Components.PageTree.Configuration.temporaryMountPoint = response;
298 TYPO3.Backend.NavigationContainer.PageTree.addTemporaryMountPointIndicator();
299
300 var selectedNode = TYPO3.Backend.NavigationContainer.PageTree.getSelected();
301 tree.stateId = 'Pagetree' + TYPO3.Components.PageTree.Configuration.temporaryMountPoint;
302 tree.refreshTree(function() {
303 var nodeIsSelected = false;
304 if (selectedNode) {
305 nodeIsSelected = TYPO3.Backend.NavigationContainer.PageTree.select(
306 selectedNode.attributes.nodeData.id
307 );
308 }
309
310 var node = (nodeIsSelected ? TYPO3.Backend.NavigationContainer.PageTree.getSelected() : null);
311 if (node) {
312 this.singleClick(node, tree);
313 } else {
314 this.singleClick(tree.getRootNode().firstChild, tree);
315 }
316 }, this);
317 },
318 this
319 );
320 },
321
322 /**
323 * Opens the edit page properties dialog
324 *
325 * @param {Ext.tree.TreeNode} node
326 * @return {void}
327 */
328 editPageProperties: function(node) {
329 node.select();
330 var returnUrl = TYPO3.Backend.ContentContainer.src;
331 if (returnUrl.indexOf('returnUrl') !== -1) {
332 returnUrl = TYPO3.Utility.getParameterFromUrl(returnUrl, 'returnUrl');
333 } else {
334 returnUrl = encodeURIComponent(returnUrl);
335 }
336
337 TYPO3.Backend.ContentContainer.setUrl(
338 'alt_doc.php?edit[pages][' + node.attributes.nodeData.id + ']=edit&returnUrl=' + returnUrl
339 );
340 },
341
342 /**
343 * Opens the new page wizard
344 *
345 * @param {Ext.tree.TreeNode} node
346 * @return {void}
347 */
348 newPageWizard: function(node) {
349 node.select();
350 TYPO3.Backend.ContentContainer.setUrl(
351 'db_new.php?id=' + node.attributes.nodeData.id + '&pagesOnly=1'
352 );
353 },
354
355 /**
356 * Opens the info popup
357 *
358 * @param {Ext.tree.TreeNode} node
359 * @return {void}
360 */
361 openInfoPopUp: function(node) {
362 launchView('pages', node.attributes.nodeData.id);
363 },
364
365 /**
366 * Opens the history popup
367 *
368 * @param {Ext.tree.TreeNode} node
369 * @return {void}
370 */
371 openHistoryPopUp: function(node) {
372 node.select();
373 TYPO3.Backend.ContentContainer.setUrl(
374 'show_rechis.php?element=pages:' + node.attributes.nodeData.id
375 );
376 },
377
378 /**
379 * Opens the export .t3d file dialog
380 *
381 * @param {Ext.tree.TreeNode} node
382 * @return {void}
383 */
384 exportT3d: function(node) {
385 node.select();
386 TYPO3.Backend.ContentContainer.setUrl(
387 'sysext/impexp/app/index.php?tx_impexp[action]=export&' +
388 'id=0&tx_impexp[pagetree][id]=' + node.attributes.nodeData.id +
389 '&tx_impexp[pagetree][levels]=0' +
390 '&tx_impexp[pagetree][tables][]=_ALL'
391 );
392 },
393
394 /**
395 * Opens the import .t3d file dialog
396 *
397 * @param {Ext.tree.TreeNode} node
398 * @return {void}
399 */
400 importT3d: function(node) {
401 node.select();
402 TYPO3.Backend.ContentContainer.setUrl(
403 'sysext/impexp/app/index.php?id=' + node.attributes.nodeData.id +
404 '&table=pages&tx_impexp[action]=import'
405 );
406 },
407
408 /**
409 * Enables the cut mode of a node
410 *
411 * @param {Ext.tree.TreeNode} node
412 * @param {TYPO3.Components.PageTree.Tree} tree
413 * @return {void}
414 */
415 enableCutMode: function(node, tree) {
416 this.disableCopyMode(node, tree);
417 node.attributes.nodeData.t3InCutMode = true;
418 tree.t3ContextInfo.inCutMode = true;
419 tree.t3ContextNode = node;
420 },
421
422 /**
423 * Disables the cut mode of a node
424 *
425 * @param {Ext.tree.TreeNode} node
426 * @param {TYPO3.Components.PageTree.Tree} tree
427 * @return {void}
428 */
429 disableCutMode: function(node, tree) {
430 this.releaseCutAndCopyModes(tree);
431 node.attributes.nodeData.t3InCutMode = false;
432 },
433
434 /**
435 * Enables the copy mode of a node
436 *
437 * @param {Ext.tree.TreeNode} node
438 * @param {TYPO3.Components.PageTree.Tree} tree
439 * @return {void}
440 */
441 enableCopyMode: function(node, tree) {
442 this.disableCutMode(node, tree);
443 node.attributes.nodeData.t3InCopyMode = true;
444 tree.t3ContextInfo.inCopyMode = true;
445 tree.t3ContextNode = node;
446 },
447
448 /**
449 * Disables the copy mode of a node
450 *
451 * @param {Ext.tree.TreeNode} node
452 * @param {TYPO3.Components.PageTree.Tree} tree
453 * @return {void}
454 */
455 disableCopyMode: function(node, tree) {
456 this.releaseCutAndCopyModes(tree);
457 node.attributes.nodeData.t3InCopyMode = false;
458 },
459
460 /**
461 * Pastes the cut/copy context node into the given node
462 *
463 * @param {Ext.tree.TreeNode} node
464 * @param {TYPO3.Components.PageTree.Tree} tree
465 * @return {void}
466 */
467 pasteIntoNode: function(node, tree) {
468 if (!tree.t3ContextNode) {
469 return;
470 }
471
472 if (tree.t3ContextInfo.inCopyMode) {
473 var newNode = tree.t3ContextNode = new Ext.tree.TreeNode(tree.t3ContextNode.attributes);
474 newNode.id = 'fakeNode';
475 node.insertBefore(newNode, node.childNodes[0]);
476 node.attributes.nodeData.t3InCopyMode = false;
477 this.copyNodeToFirstChildOfDestination(newNode, tree);
478
479 } else if (tree.t3ContextInfo.inCutMode) {
480 if (node.getPath().indexOf(tree.t3ContextNode.id) !== -1) {
481 return;
482 }
483
484 node.appendChild(tree.t3ContextNode);
485 node.attributes.nodeData.t3InCutMode = false;
486 this.moveNodeToFirstChildOfDestination(node, tree);
487 }
488 },
489
490 /**
491 * Pastes a cut/copy context node after the given node
492 *
493 * @param {Ext.tree.TreeNode} node
494 * @param {TYPO3.Components.PageTree.Tree} tree
495 * @return {void}
496 */
497 pasteAfterNode: function(node, tree) {
498 if (!tree.t3ContextNode) {
499 return;
500 }
501
502 if (tree.t3ContextInfo.inCopyMode) {
503 var newNode = tree.t3ContextNode = new Ext.tree.TreeNode(tree.t3ContextNode.attributes);
504 newNode.id = 'fakeNode';
505 node.parentNode.insertBefore(newNode, node.nextSibling);
506 node.attributes.nodeData.t3InCopyMode = false;
507 this.copyNodeAfterDestination(newNode, tree);
508
509 } else if (tree.t3ContextInfo.inCutMode) {
510 if (node.getPath().indexOf(tree.t3ContextNode.id) !== -1) {
511 return;
512 }
513
514 node.parentNode.insertBefore(tree.t3ContextNode, node.nextSibling);
515 node.attributes.nodeData.t3InCutMode = false;
516 this.moveNodeAfterDestination(node, tree);
517 }
518 },
519
520 /**
521 * Moves the current tree context node after the given node
522 *
523 * @param {Ext.tree.TreeNode} node
524 * @param {TYPO3.Components.PageTree.Tree} tree
525 * @return {void}
526 */
527 moveNodeAfterDestination: function(node, tree) {
528 TYPO3.Components.PageTree.Commands.moveNodeAfterDestination(
529 tree.t3ContextNode.attributes.nodeData,
530 node.attributes.nodeData.id,
531 function(response) {
532 if (this.evaluateResponse(response) && tree.t3ContextNode) {
533 this.updateNode(tree.t3ContextNode, tree.t3ContextNode.isExpanded(), response);
534 }
535 this.releaseCutAndCopyModes(tree);
536 },
537 this
538 );
539 },
540
541 /**
542 * Moves the current tree context node as the first child of the given node
543 *
544 * @param {Ext.tree.TreeNode} node
545 * @param {TYPO3.Components.PageTree.Tree} tree
546 * @return {void}
547 */
548 moveNodeToFirstChildOfDestination: function(node, tree) {
549 TYPO3.Components.PageTree.Commands.moveNodeToFirstChildOfDestination(
550 tree.t3ContextNode.attributes.nodeData,
551 node.attributes.nodeData.id,
552 function(response) {
553 if (this.evaluateResponse(response) && tree.t3ContextNode) {
554 this.updateNode(tree.t3ContextNode, tree.t3ContextNode.isExpanded(), response);
555 }
556 this.releaseCutAndCopyModes(tree);
557 },
558 this
559 );
560 },
561
562 /**
563 * Inserts a new node after the given node
564 *
565 * @param {Ext.tree.TreeNode} node
566 * @param {TYPO3.Components.PageTree.Tree} tree
567 * @return {void}
568 */
569 insertNodeAfterDestination: function(node, tree) {
570 TYPO3.Components.PageTree.Commands.insertNodeAfterDestination(
571 tree.t3ContextNode.attributes.nodeData,
572 node.previousSibling.attributes.nodeData.id,
573 tree.t3ContextInfo.serverNodeType,
574 function(response) {
575 if (this.evaluateResponse(response)) {
576 this.updateNode(node, node.isExpanded(), response, function(node) {
577 tree.triggerEdit(node);
578 });
579 }
580 this.releaseCutAndCopyModes(tree);
581 },
582 this
583 );
584 },
585
586 /**
587 * Inserts a new node as the first child of the given node
588 *
589 * @param {Ext.tree.TreeNode} node
590 * @param {TYPO3.Components.PageTree.Tree} tree
591 * @return {void}
592 */
593 insertNodeToFirstChildOfDestination: function(node, tree) {
594 TYPO3.Components.PageTree.Commands.insertNodeToFirstChildOfDestination(
595 tree.t3ContextNode.attributes.nodeData,
596 tree.t3ContextInfo.serverNodeType,
597 function(response) {
598 if (this.evaluateResponse(response)) {
599 this.updateNode(node, true, response, function(node) {
600 tree.triggerEdit(node);
601 });
602 }
603 this.releaseCutAndCopyModes(tree);
604 },
605 this
606 );
607 },
608
609 /**
610 * Copies the current tree context node after the given node
611 *
612 * @param {Ext.tree.TreeNode} node
613 * @param {TYPO3.Components.PageTree.Tree} tree
614 * @return {void}
615 */
616 copyNodeAfterDestination: function(node, tree) {
617 TYPO3.Components.PageTree.Commands.copyNodeAfterDestination(
618 tree.t3ContextNode.attributes.nodeData,
619 node.previousSibling.attributes.nodeData.id,
620 function(response) {
621 if (this.evaluateResponse(response)) {
622 this.updateNode(node, true, response, function(node) {
623 tree.triggerEdit(node);
624 });
625 }
626 this.releaseCutAndCopyModes(tree);
627 },
628 this
629 );
630 },
631
632 /**
633 * Copies the current tree context node as the first child of the given node
634 *
635 * @param {Ext.tree.TreeNode} node
636 * @param {TYPO3.Components.PageTree.Tree} tree
637 * @return {void}
638 */
639 copyNodeToFirstChildOfDestination: function(node, tree) {
640 TYPO3.Components.PageTree.Commands.copyNodeToFirstChildOfDestination(
641 tree.t3ContextNode.attributes.nodeData,
642 node.parentNode.attributes.nodeData.id,
643 function(response) {
644 if (this.evaluateResponse(response)) {
645 this.updateNode(node, true, response, function(node) {
646 tree.triggerEdit(node);
647 });
648 }
649 this.releaseCutAndCopyModes(tree);
650 },
651 this
652 );
653 },
654
655 /**
656 * Visibilizes a page
657 *
658 * @param {Ext.tree.TreeNode} node
659 * @return {void}
660 */
661 enablePage: function(node) {
662 TYPO3.Components.PageTree.Commands.visiblyNode(
663 node.attributes.nodeData,
664 function(response) {
665 if (this.evaluateResponse(response)) {
666 this.updateNode(node, node.isExpanded(), response);
667 }
668 },
669 this
670 );
671 },
672
673 /**
674 * Disables a page
675 *
676 * @param {Ext.tree.TreeNode} node
677 * @return {void}
678 */
679 disablePage: function(node) {
680 TYPO3.Components.PageTree.Commands.disableNode(
681 node.attributes.nodeData,
682 function(response) {
683 if (this.evaluateResponse(response)) {
684 this.updateNode(node, node.isExpanded(), response);
685 }
686 },
687 this
688 );
689 },
690
691 /**
692 * Reloads the content frame with the current module and node id
693 *
694 * @param {Ext.tree.TreeNode} node
695 * @param {TYPO3.Components.PageTree.Tree} tree
696 * @return {void}
697 */
698 singleClick: function(node, tree) {
699 tree.currentSelectedNode = node;
700
701 var separator = '?';
702 if (currentSubScript.indexOf('?') !== -1) {
703 separator = '&';
704 }
705
706 node.select();
707 if (tree.stateHash) {
708 tree.stateHash.lastSelectedNode = node.id;
709 } else {
710 TYPO3.Components.PageTree.Commands.addRootlineOfNodeToStateHash(
711 TYPO3.Backend.NavigationContainer.PageTree.mainTree.stateId,
712 node.attributes.nodeData.id, function(stateHash) {
713 TYPO3.Backend.NavigationContainer.PageTree.mainTree.stateHash = stateHash;
714 TYPO3.Backend.NavigationContainer.PageTree.mainTree.refreshTree();
715 }
716 );
717 }
718
719 fsMod.recentIds['web'] = node.attributes.nodeData.id;
720
721 TYPO3.Backend.ContentContainer.setUrl(
722 TS.PATH_typo3 + currentSubScript + separator + 'id=' + node.attributes.nodeData.id
723 );
724 },
725
726 /**
727 * Opens a configured url inside the content frame
728 *
729 * @param {Ext.tree.TreeNode} node
730 * @param {TYPO3.Components.PageTree.Tree} tree
731 * @param {Object} contextItem
732 * @return {void}
733 */
734 openCustomUrlInContentFrame: function(node, tree, contextItem) {
735 if (!contextItem.customAttributes || !contextItem.customAttributes.contentUrl) {
736 return;
737 }
738
739 node.select();
740 TYPO3.Backend.ContentContainer.setUrl(
741 contextItem.customAttributes.contentUrl.replace('###ID###', node.attributes.nodeData.id)
742 );
743 },
744
745 /**
746 * Updates the title of a node
747 *
748 * @param {Ext.tree.TreeNode} node
749 * @param {String} newText
750 * @param {String} oldText
751 * @param {TYPO3.Components.PageTree.TreeEditor} treeEditor
752 * @return {void}
753 */
754 saveTitle: function(node, newText, oldText, treeEditor) {
755 this.singleClick(node.editNode, node.editNode.ownerTree);
756 if (newText === oldText || newText == '') {
757 treeEditor.updateNodeText(
758 node,
759 node.editNode.attributes.nodeData.editableText,
760 Ext.util.Format.htmlEncode(oldText)
761 );
762 return;
763 }
764
765 TYPO3.Components.PageTree.Commands.updateLabel(
766 node.editNode.attributes.nodeData,
767 newText,
768 function(response) {
769 if (this.evaluateResponse(response)) {
770 treeEditor.updateNodeText(node, response.editableText, response.updatedText);
771 } else {
772 treeEditor.updateNodeText(
773 node,
774 node.editNode.attributes.nodeData.editableText,
775 Ext.util.Format.htmlEncode(oldText)
776 );
777 }
778 },
779 this
780 );
781 }
782 };