~vanvugt/ubuntu/oneiric/mediatomb/fix-770964-784431

« back to all changes in this revision

Viewing changes to web/js/items.js

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2009-04-22 21:39:19 UTC
  • mto: (4.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090422213919-52m015y6gcpv1m1g
Tags: upstream-0.12.0~svn2018
ImportĀ upstreamĀ versionĀ 0.12.0~svn2018

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
    Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
                       Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
9
9
    
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>
13
13
    
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.
26
26
    
27
 
    $Id: items.js 1698 2008-02-23 20:48:30Z lww $
 
27
    $Id: items.js 2010 2009-01-11 19:10:43Z lww $
28
28
*/
29
29
 
30
30
var itemRoot;
126
126
        childrenTag = "file";
127
127
    }
128
128
    
129
 
    var ofId = items.getAttribute("ofId");
130
 
    var success = items.getAttribute("success");
 
129
    var ofId = items.getAttribute("parent_id");
 
130
    var success = xmlGetElement(xml, 'root').getAttribute("success");
 
131
    //alert(success);
 
132
    //alert(xml);
131
133
    if (! success || success != "1")
132
134
    {
133
135
        if (ofId == '0')
147
149
    }
148
150
    
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);
361
363
    else
362
364
    {
363
365
        var iconSrc = iconContainer;
364
 
        if (autoscanType == '1')
 
366
        if (autoscanType == 'ui')
365
367
        {
366
 
            if (autoscanMode == '2')
 
368
            if (autoscanMode == 'inotify')
367
369
                iconSrc = iconContainerAutoscanInotify;
368
370
            else
369
371
                iconSrc = iconContainerAutoscanTimed;
370
372
        }
371
373
        
372
 
        if (autoscanType == '2')
 
374
        if (autoscanType == 'persistent')
373
375
        {
374
 
            if (autoscanMode == '2')
 
376
            if (autoscanMode == 'inotify')
375
377
                iconSrc = iconContainerAutoscanInotifyConfig;
376
378
            else
377
379
                iconSrc = iconContainerAutoscanTimedConfig;
421
423
            }
422
424
        }
423
425
        
424
 
        if (autoscanType > 0)
 
426
        if (autoscanType != 'none')
425
427
            autoscanLink = true;
426
428
        
427
429
        if (addLink)
675
677
{
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'];
680
682
    if (!editItem)
681
683
    {
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();';
687
689
    }
688
690
    else
689
691
    {
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');
705
707
        
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(
708
 
                objTypeOptions[i],
709
 
                objTypeOptionsIds[i],
 
710
                objTypeOptionsText[i],
 
711
                objTypeOptionsValue[i],
710
712
                false, 
711
 
                (currentTypeOption && objTypeOptionsIds[i] == currentTypeOption)
 
713
                (currentTypeOption && objTypeOptionsValue[i] == currentTypeOption)
712
714
                );
713
715
    }
714
716
    
717
719
    var defaultsAr;
718
720
    
719
721
    // using "if" instead of "switch" for compatibility reasons...
720
 
    if (currentTypeOption == '1')
 
722
    if (currentTypeOption == 'container')
721
723
    {
722
724
        fieldAr = new Array('Title', 'Class');
723
725
        fieldNameAr = new Array('title', 'class');
724
726
        defaultsAr = new Array('', 'object.container');
725
727
    }
726
 
    else if (currentTypeOption == '2')
 
728
    else if (currentTypeOption == 'item')
727
729
    {
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', '', '');
731
733
    }
732
 
    else if (currentTypeOption == '6')
 
734
    else if (currentTypeOption == 'active_item')
733
735
    {
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', '', '', '', '');
737
739
    }
738
 
    else if (currentTypeOption == '10')
 
740
    else if (currentTypeOption == 'external_url')
739
741
    {
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', '', '');
743
745
    }
744
 
    else if (currentTypeOption == '26')
 
746
    else if (currentTypeOption == 'internal_url')
745
747
    {
746
748
        fieldAr = new Array('Title', 'URL', 'Class', 'Description', 'Mimetype');
747
749
        fieldNameAr = new Array('title', 'location', 'class', 'description', 'mime-type');