7
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2008 Gena Batyan <bgeradz@mediatomb.cc>,
10
Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
11
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
12
Leonhard Wimmer <leo@mediatomb.cc>
24
24
version 2 along with MediaTomb; if not, write to the Free Software
25
25
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
27
$Id: items.js 1698 2008-02-23 20:48:30Z lww $
27
$Id: items.js 2010 2009-01-11 19:10:43Z lww $
149
151
var isVirtual = (items.getAttribute("virtual") == '1');
150
var autoscanType = items.getAttribute("autoscanType");
151
var autoscanMode = items.getAttribute("autoscanMode");
152
var autoscanType = items.getAttribute("autoscan_type");
153
var autoscanMode = items.getAttribute("autoscan_mode");
152
154
var path = items.getAttribute("location");
153
155
var loadItemId = (useFiles ? 'f' : 'd') + ofId;
154
var totalMatches = parseInt(items.getAttribute("totalMatches"));
155
var isProtected = (items.getAttribute("protectContainer") == '1');
156
var itemsProtected = (items.getAttribute("protectItems") == '1');
156
var totalMatches = parseInt(items.getAttribute("total_matches"));
157
var isProtected = (items.getAttribute("protect_container") == '1');
158
var itemsProtected = (items.getAttribute("protect_items") == '1');
157
159
var totalPages = Math.ceil(totalMatches / viewItems);
158
160
var start = parseInt(items.getAttribute("start"));
159
161
var thisPage = Math.abs(start / viewItems);
363
365
var iconSrc = iconContainer;
364
if (autoscanType == '1')
366
if (autoscanType == 'ui')
366
if (autoscanMode == '2')
368
if (autoscanMode == 'inotify')
367
369
iconSrc = iconContainerAutoscanInotify;
369
371
iconSrc = iconContainerAutoscanTimed;
372
if (autoscanType == '2')
374
if (autoscanType == 'persistent')
374
if (autoscanMode == '2')
376
if (autoscanMode == 'inotify')
375
377
iconSrc = iconContainerAutoscanInotifyConfig;
377
379
iconSrc = iconContainerAutoscanTimedConfig;
676
678
var currentTypeOption;
677
679
var form = rightDocument.forms['addEditItem'];
678
var selectEl = form.elements['objType'];
680
var selectEl = form.elements['obj_type'];
679
681
var submitEl = form.elements['submit'];
682
684
selectEl.disabled = false;
683
685
submitEl.value = 'Add item...';
684
686
currentTypeOption = selectEl.value;
685
if (!currentTypeOption) currentTypeOption = '1';
687
if (!currentTypeOption) currentTypeOption = 'container';
686
688
form.action = 'javascript:parent.itemAddEditSubmit();';
690
692
selectEl.disabled = true;
691
693
submitEl.value = 'Update item...';
692
currentTypeOption = xmlGetElementText(editItem, 'objType');
694
currentTypeOption = xmlGetElementText(editItem, 'obj_type');
693
695
var objectId = editItem.getAttribute('object_id');
694
696
selectEl.value = currentTypeOption;
695
697
form.action = 'javascript:parent.itemAddEditSubmit('+objectId+');';
700
702
// ATTENTION: These values need to be changed in src/cds_objects.h too.
701
703
// Note: 'Active Item', 'External Link (URL)', 'Internal Link (Local URL)'
702
704
// are also 'Items', so they have the item flag set too.
703
var objTypeOptions = new Array('Container', 'Item', 'Active Item', 'External Link (URL)', 'Internal Link (Local URL)');
704
var objTypeOptionsIds = new Array('1', '2', '6', '10', '26');
705
var objTypeOptionsText = new Array('Container', 'Item', 'Active Item', 'External Link (URL)', 'Internal Link (Local URL)');
706
var objTypeOptionsValue = new Array('container', 'item', 'active_item', 'external_url', 'internal_url');
706
for (var i = 0; i < objTypeOptions.length; ++i)
708
for (var i = 0; i < objTypeOptionsValue.length; ++i)
707
709
selectEl.options[i] = new Option(
709
objTypeOptionsIds[i],
710
objTypeOptionsText[i],
711
objTypeOptionsValue[i],
711
(currentTypeOption && objTypeOptionsIds[i] == currentTypeOption)
713
(currentTypeOption && objTypeOptionsValue[i] == currentTypeOption)
719
721
// using "if" instead of "switch" for compatibility reasons...
720
if (currentTypeOption == '1')
722
if (currentTypeOption == 'container')
722
724
fieldAr = new Array('Title', 'Class');
723
725
fieldNameAr = new Array('title', 'class');
724
726
defaultsAr = new Array('', 'object.container');
726
else if (currentTypeOption == '2')
728
else if (currentTypeOption == 'item')
728
730
fieldAr = new Array('Title', 'Location', 'Class', 'Description', 'Mimetype');
729
731
fieldNameAr = new Array('title', 'location', 'class', 'description', 'mime-type');
730
732
defaultsAr = new Array('', '', 'object.item', '', '');
732
else if (currentTypeOption == '6')
734
else if (currentTypeOption == 'active_item')
734
736
fieldAr = new Array('Title', 'Location', 'Class', 'Description', 'Mimetype', 'Action Script', 'State');
735
737
fieldNameAr = new Array('title', 'location', 'class', 'description', 'mime-type', 'action', 'state');
736
738
defaultsAr = new Array('', '', 'object.item.activeItem', '', '', '', '');
738
else if (currentTypeOption == '10')
740
else if (currentTypeOption == 'external_url')
740
742
fieldAr = new Array('Title', 'URL', 'Protocol', 'Class', 'Description', 'Mimetype');
741
743
fieldNameAr = new Array('title', 'location', 'protocol', 'class', 'description', 'mime-type');
742
744
defaultsAr = new Array('', '', 'http-get', 'object.item', '', '');
744
else if (currentTypeOption == '26')
746
else if (currentTypeOption == 'internal_url')
746
748
fieldAr = new Array('Title', 'URL', 'Class', 'Description', 'Mimetype');
747
749
fieldNameAr = new Array('title', 'location', 'class', 'description', 'mime-type');