7
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2007 Gena Batyan <bgeradz@mediatomb.cc>,
10
Copyright (C) 2006-2008 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: edit_load.cc 1314 2007-05-27 15:22:26Z lww $
27
$Id: edit_load.cc 1709 2008-03-01 15:35:51Z lww $
30
30
/// \file edit_load.cc
74
74
Ref<Element> title (new Element(_("title")));
75
75
title->setText(obj->getTitle());
76
title->addAttribute(_("editable"), obj->isVirtual() || objectID == CDS_ID_FS_ROOT ? _("1") : _("0"));
77
item->appendChild(title);
76
title->setAttribute(_("editable"), obj->isVirtual() || objectID == CDS_ID_FS_ROOT ? _("1") : _("0"));
77
item->appendElementChild(title);
79
79
Ref<Element> classEl (new Element(_("class")));
80
80
classEl->setText(obj->getClass());
81
classEl->addAttribute(_("editable"), _("1"));
82
item->appendChild(classEl);
81
classEl->setAttribute(_("editable"), _("1"));
82
item->appendElementChild(classEl);
84
84
int objectType = obj->getObjectType();
85
85
item->appendTextChild(_("objType"), String::from(objectType));
91
91
Ref<Element> description (new Element(_("description")));
92
92
description->setText(objItem->getMetadata(_("dc:description")));
93
description->addAttribute(_("editable"), _("1"));
94
item->appendChild(description);
93
description->setAttribute(_("editable"), _("1"));
94
item->appendElementChild(description);
96
96
Ref<Element> location (new Element(_("location")));
97
97
location->setText(objItem->getLocation());
98
98
if (IS_CDS_PURE_ITEM(objectType) || ! objItem->isVirtual())
99
location->addAttribute(_("editable"),_("0"));
99
location->setAttribute(_("editable"),_("0"));
101
location->addAttribute(_("editable"),_("1"));
102
item->appendChild(location);
101
location->setAttribute(_("editable"),_("1"));
102
item->appendElementChild(location);
104
104
Ref<Element> mimeType (new Element(_("mime-type")));
105
105
mimeType->setText(objItem->getMimeType());
106
mimeType->addAttribute(_("editable"), _("1"));
107
item->appendChild(mimeType);
106
mimeType->setAttribute(_("editable"), _("1"));
107
item->appendElementChild(mimeType);
109
109
if (IS_CDS_ITEM_EXTERNAL_URL(objectType))
111
111
Ref<Element> protocol (new Element(_("protocol")));
112
112
protocol->setText(getProtocol(objItem->getResource(0)->getAttribute(_("protocolInfo"))));
113
protocol->addAttribute(_("editable"), _("1"));
114
item->appendChild(protocol);
113
protocol->setAttribute(_("editable"), _("1"));
114
item->appendElementChild(protocol);
116
116
else if (IS_CDS_ACTIVE_ITEM(objectType))
120
120
Ref<Element> action (new Element(_("action")));
121
121
action->setText(objActiveItem->getAction());
122
action->addAttribute(_("editable"), _("1"));
123
item->appendChild(action);
122
action->setAttribute(_("editable"), _("1"));
123
item->appendElementChild(action);
125
125
Ref<Element> state (new Element(_("state")));
126
126
state->setText(objActiveItem->getState());
127
state->addAttribute(_("editable"), _("1"));
128
item->appendChild(state);
127
state->setAttribute(_("editable"), _("1"));
128
item->appendElementChild(state);
132
root->appendChild(item);
132
root->appendElementChild(item);
133
133
//log_debug("serving XML: \n%s\n", root->print().c_str());