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

« back to all changes in this revision

Viewing changes to src/web/containers.cc

  • 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: containers.cc 1709 2008-03-01 15:35:51Z lww $
 
27
    $Id: containers.cc 2010 2009-01-11 19:10:43Z lww $
28
28
*/
29
29
 
30
30
/// \file containers.cc
58
58
 
59
59
        
60
60
    Ref<Element> containers (new Element(_("containers")));
61
 
    containers->setAttribute(_("ofId"), String::from(parentID));
62
 
    containers->setAttribute(_("type"), _("d"));
 
61
    containers->setArrayName(_("container"));
 
62
    containers->setAttribute(_("parent_id"), String::from(parentID), mxml_int_type);
 
63
    containers->setAttribute(_("type"), _("database"));
63
64
 
64
65
    if (string_ok(param(_("select_it"))))
65
66
        containers->setAttribute(_("select_it"), param(_("select_it")));
67
68
    
68
69
    Ref<BrowseParam> param(new BrowseParam(parentID, BROWSE_DIRECT_CHILDREN | BROWSE_CONTAINERS));
69
70
    Ref<Array<CdsObject> > arr;
70
 
    try
71
 
    {
72
 
        arr = storage->browse(param);
73
 
    }
74
 
    catch (Exception e)
75
 
    {
76
 
        containers->setAttribute(_("success"), _("0"));
77
 
        return;
78
 
    }
79
 
    containers->setAttribute(_("success"), _("1"));
 
71
    arr = storage->browse(param);
80
72
    
81
73
    for (int i = 0; i < arr->size(); i++)
82
74
    {
85
77
        //{
86
78
        Ref<CdsContainer> cont = RefCast(obj, CdsContainer);
87
79
        Ref<Element> ce(new Element(_("container")));
88
 
        ce->setAttribute(_("id"), String::from(cont->getID()));
 
80
        ce->setAttribute(_("id"), String::from(cont->getID()), mxml_int_type);
89
81
        int childCount = cont->getChildCount();
90
 
        if (childCount)
91
 
            ce->setAttribute(_("childCount"), String::from(childCount));
 
82
        ce->setAttribute(_("child_count"), String::from(childCount), mxml_int_type);
92
83
        int autoscanType = cont->getAutoscanType();
93
 
        ce->setAttribute(_("autoscanType"), String::from(autoscanType));
 
84
        ce->setAttribute(_("autoscan_type"), mapAutoscanType(autoscanType));
94
85
        
95
 
        int autoscanMode = 0;
 
86
        String autoscanMode = _("none");
96
87
        if (autoscanType > 0)
97
88
        {
98
 
            autoscanMode = 1;
 
89
            autoscanMode = _("timed");
99
90
#ifdef HAVE_INOTIFY
100
91
            if (ConfigManager::getInstance()->getBoolOption(CFG_IMPORT_AUTOSCAN_USE_INOTIFY))
101
92
            {
102
93
                Ref<AutoscanDirectory> adir = storage->getAutoscanDirectory(cont->getID());
103
94
                if ((adir != nil) && (adir->getScanMode() == InotifyScanMode))
104
 
                    autoscanMode = 2;
 
95
                    autoscanMode = _("inotify");
105
96
            }
106
97
#endif
107
98
        }
108
 
        ce->setAttribute(_("autoscanMode"), String::from(autoscanMode));
 
99
        ce->setAttribute(_("autoscan_mode"), autoscanMode);
 
100
        ce->setTextKey(_("title"));
109
101
        ce->setText(cont->getTitle());
110
102
        containers->appendElementChild(ce);
111
103
        //}