Subversion Repositories tpanel

Rev

Rev 78 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 78 Rev 84
Line 147... Line 147...
147
    mSetup.setupPagesProject = xml.getElementInt("setupPagesProject", depth);
147
    mSetup.setupPagesProject = xml.getElementInt("setupPagesProject", depth);
148
    mSetup.voipCommandPort = xml.getElementInt("voipCommandPort", depth);
148
    mSetup.voipCommandPort = xml.getElementInt("voipCommandPort", depth);
149
 
149
 
150
    if ((index = xml.getElementIndex("resourceList", &depth)) == TExpat::npos)
150
    if ((index = xml.getElementIndex("resourceList", &depth)) == TExpat::npos)
151
    {
151
    {
152
        MSG_ERROR("Missing element \"resourceList\" in file!");
152
        MSG_WARNING("Missing element \"resourceList\" in file!");
153
        TError::setError();
153
//        TError::setError();
154
        return false;
154
//        return false;
155
    }
155
    }
156
 
156
 
157
    string name, content;
157
    string name, content;
158
    vector<ATTRIBUTE_t> attrs;
158
    vector<ATTRIBUTE_t> attrs;
159
    depth++;
-
 
160
    size_t oldIndex = 0;
-
 
161
    MSG_DEBUG("Index " << index << " and depth " << depth << " and entity " << xml.getElementName());
-
 
162
 
159
 
163
    do
160
    if (index != TExpat::npos)
164
    {
161
    {
165
        attrs = xml.getAttributes();
162
        depth++;
166
        string type = xml.getAttribute("type", attrs);
163
        size_t oldIndex = 0;
167
        RESOURCE_LIST_T list = findResourceType(type);
-
 
168
        MSG_DEBUG("resource type: " << type);
164
        MSG_DEBUG("Index " << index << " and depth " << depth << " and entity " << xml.getElementName());
169
 
165
 
170
        if (mResourceLists.size() == 0 || list.type.empty())
166
        do
171
        {
167
        {
172
            list.type = type;
168
            attrs = xml.getAttributes();
173
            list.ressource.clear();
169
            string type = xml.getAttribute("type", attrs);
174
            mResourceLists.push_back(list);
170
            RESOURCE_LIST_T list = findResourceType(type);
175
        }
-
 
176
 
-
 
177
        RESOURCE_T resource;
171
            MSG_DEBUG("resource type: " << type);
178
 
172
 
179
        while ((index = xml.getNextElementIndex("resource", depth)) != TExpat::npos)
173
            if (mResourceLists.size() == 0 || list.type.empty())
180
        {
-
 
181
            while ((index = xml.getNextElementFromIndex(index, &name, &content, &attrs)) != TExpat::npos)
-
 
182
            {
174
            {
183
                string e = name;
175
                list.type = type;
-
 
176
                list.ressource.clear();
-
 
177
                mResourceLists.push_back(list);
-
 
178
            }
-
 
179
 
-
 
180
            RESOURCE_T resource;
184
 
181
 
185
                if (e.compare("name") == 0)
-
 
186
                    resource.name = content;
-
 
187
                else if (e.compare("protocol") == 0)
182
            while ((index = xml.getNextElementIndex("resource", depth)) != TExpat::npos)
188
                    resource.protocol = content;
-
 
189
                else if (e.compare("host") == 0)
-
 
190
                    resource.host = content;
-
 
191
                else if (e.compare("file") == 0)
-
 
192
                    resource.file = content;
183
            {
193
                else if (e.compare("password") == 0)
184
                while ((index = xml.getNextElementFromIndex(index, &name, &content, &attrs)) != TExpat::npos)
194
                {
185
                {
195
                    resource.password = content;
186
                    string e = name;
196
                    int enc = xml.getAttributeInt("encrypted", attrs);
-
 
197
 
187
 
-
 
188
                    if (e.compare("name") == 0)
-
 
189
                        resource.name = content;
-
 
190
                    else if (e.compare("protocol") == 0)
-
 
191
                        resource.protocol = content;
-
 
192
                    else if (e.compare("host") == 0)
-
 
193
                        resource.host = content;
-
 
194
                    else if (e.compare("file") == 0)
-
 
195
                        resource.file = content;
-
 
196
                    else if (e.compare("password") == 0)
-
 
197
                    {
-
 
198
                        resource.password = content;
-
 
199
                        int enc = xml.getAttributeInt("encrypted", attrs);
-
 
200
 
198
                    if (enc != 0)
201
                        if (enc != 0)
199
                        resource.encrypted = true;
202
                            resource.encrypted = true;
200
                    else
203
                        else
201
                        resource.encrypted = false;
204
                            resource.encrypted = false;
202
                }
205
                    }
203
                else if (e.compare("user") == 0)
206
                    else if (e.compare("user") == 0)
204
                    resource.user = content;
207
                        resource.user = content;
205
                else if (e.compare("path") == 0)
208
                    else if (e.compare("path") == 0)
206
                    resource.path = content;
209
                        resource.path = content;
207
                else if (e.compare("refresh") == 0)
210
                    else if (e.compare("refresh") == 0)
208
                    resource.refresh = xml.convertElementToInt(content);
211
                        resource.refresh = xml.convertElementToInt(content);
209
                else if (e.compare("dynamo") == 0)
212
                    else if (e.compare("dynamo") == 0)
210
                    resource.dynamo = ((xml.convertElementToInt(content) == 0) ? false : true);
213
                        resource.dynamo = ((xml.convertElementToInt(content) == 0) ? false : true);
211
                else if (e.compare("preserve") == 0)
214
                    else if (e.compare("preserve") == 0)
212
                    resource.preserve = ((xml.convertElementToInt(content) == 0) ? false : true);
215
                        resource.preserve = ((xml.convertElementToInt(content) == 0) ? false : true);
213
 
216
 
214
                oldIndex = index;
217
                    oldIndex = index;
215
            }
218
                }
216
 
219
 
217
            list.ressource.push_back(resource);
220
                list.ressource.push_back(resource);
218
            MSG_DEBUG("Scheme: " << resource.protocol << ", Host: " << resource.host << ", Path: " << resource.path << ", File: " << resource.file << ", Name: " << resource.name);
221
                MSG_DEBUG("Scheme: " << resource.protocol << ", Host: " << resource.host << ", Path: " << resource.path << ", File: " << resource.file << ", Name: " << resource.name);
219
            resource.clear();
222
                resource.clear();
220
 
223
 
221
            if (index == TExpat::npos)
224
                if (index == TExpat::npos)
222
                index = oldIndex + 2;
225
                    index = oldIndex + 2;
223
        }
226
            }
224
 
227
 
225
        vector<RESOURCE_LIST_T>::iterator itResList;
228
            vector<RESOURCE_LIST_T>::iterator itResList;
226
 
229
 
227
        for (itResList = mResourceLists.begin(); itResList != mResourceLists.end(); itResList++)
230
            for (itResList = mResourceLists.begin(); itResList != mResourceLists.end(); itResList++)
228
        {
-
 
229
            if (itResList->type.compare(type) == 0)
-
 
230
            {
231
            {
-
 
232
                if (itResList->type.compare(type) == 0)
-
 
233
                {
231
                mResourceLists.erase(itResList);
234
                    mResourceLists.erase(itResList);
232
                mResourceLists.push_back(list);
235
                    mResourceLists.push_back(list);
233
                break;
236
                    break;
-
 
237
                }
234
            }
238
            }
235
        }
239
        }
-
 
240
        while ((index = xml.getNextElementIndex("resourceList", depth)) != TExpat::npos);
236
    }
241
    }
237
    while ((index = xml.getNextElementIndex("resourceList", depth)) != TExpat::npos);
-
 
238
 
242
 
239
    if ((index = xml.getElementIndex("paletteList", &depth)) == TExpat::npos)
243
    if ((index = xml.getElementIndex("paletteList", &depth)) == TExpat::npos)
240
    {
244
    {
241
        MSG_WARNING("There exists no color palette! There will be only the system colors available.");
245
        MSG_WARNING("There exists no color palette! There will be only the system colors available.");
242
        return true;
246
        return true;