3
MediaTomb - http://www.mediatomb.cc/
5
items.js - this file is part of MediaTomb.
7
Copyright (C) 2007-2008 Jan Habermann <jan.habermann@gmail.com>
9
MediaTomb is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License version 2
11
as published by the Free Software Foundation.
13
MediaTomb is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
version 2 along with MediaTomb; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
22
$Id: items.js 1698 2008-02-23 20:48:30Z lww $
25
MT.items.addItems = function(itemIds) {
26
if(itemIds && itemIds.length > 0) {
27
for(var i = 0, len = itemIds.length; i < len; i++) {
28
MT.items.addItem(itemIds[i]);
33
MT.items.addItem = function(itemId) {
36
url: MT.tools.generateURL('add'),
37
success: MT.items.onAddItemSuccess,
38
failure: MT.items.onAddItemFailure,
39
params: { object_id: itemId }
43
MT.items.onAddItemSuccess = function(response) {
44
var xml = response.responseXML;
45
if(!MT.tools.xmlErrorCheck(xml)) {
49
Ext.MessageBox.alert('Item Added', 'The item has been successfully added.');
52
MT.items.onAddItemFailure = function(response) {
53
Ext.MessageBox.alert('Error', 'Could not add item. :-(');
56
MT.items.removeItems = function(itemIds, all) {
57
if(itemIds && itemIds.length > 0) {
58
for(var i = 0, len = itemIds.length; i < len; i++) {
59
MT.items.removeItem(itemIds[i], all);
64
MT.items.removeItem = function(itemId, all) {
66
Ext.MessageBox.alert("Root container cannot be removed!");
78
url: MT.tools.generateURL('remove', {object_id: itemId, all: all_send}, true),
79
success: MT.items.onRemoveItemSuccess,
80
failure: MT.items.onRemoveItemFailure
84
MT.items.onRemoveItemSuccess = function(response) {
85
MT.layout.DataGrid.loadData();
86
MT.layout.GridToolbar.disableButtons();
89
MT.items.onRemoveItemFailure = function(response) {
90
Ext.MessageBox.alert('Error', 'Could not remove item. :-(');