1 | //Copyright (C) 2009 Stefan Nerlich | stefan.nerlich@hotmail.com |
---|
2 | // |
---|
3 | //This file is part of ARInside. |
---|
4 | // |
---|
5 | // ARInside is free software: you can redistribute it and/or modify |
---|
6 | // it under the terms of the GNU General Public License as published by |
---|
7 | // the Free Software Foundation, version 2 of the License. |
---|
8 | // |
---|
9 | // ARInside is distributed in the hope that it will be useful, |
---|
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | // GNU General Public License for more details. |
---|
13 | // |
---|
14 | // You should have received a copy of the GNU General Public License |
---|
15 | // along with Foobar. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | |
---|
17 | #include "stdafx.h" |
---|
18 | #include "DocCharMenuDetails.h" |
---|
19 | #include "../output/ContainerTable.h" |
---|
20 | #include "DocOverlayHelper.h" |
---|
21 | |
---|
22 | const char* MenuDefinitionText = "Menu Definition"; |
---|
23 | |
---|
24 | CDocCharMenuDetails::CDocCharMenuDetails(unsigned int menuInsideId) |
---|
25 | : menu(menuInsideId) |
---|
26 | { |
---|
27 | CPageParams file(PAGE_DETAILS, &menu); |
---|
28 | |
---|
29 | this->path = file->GetPath(); |
---|
30 | this->rootLevel = file->GetRootLevel(); |
---|
31 | } |
---|
32 | |
---|
33 | CDocCharMenuDetails::~CDocCharMenuDetails(void) |
---|
34 | { |
---|
35 | } |
---|
36 | |
---|
37 | void CDocCharMenuDetails::Documentation() |
---|
38 | { |
---|
39 | CPageParams file(PAGE_DETAILS, &menu); |
---|
40 | |
---|
41 | try |
---|
42 | { |
---|
43 | FileSystemUtil fsUtil(this->pInside->appConfig); |
---|
44 | if(fsUtil.CreateSubDirectory(this->path)>=0) |
---|
45 | { |
---|
46 | CWebPage webPage(file->GetFileName(), this->menu.GetName(), this->rootLevel, this->pInside->appConfig); |
---|
47 | CDocOverlayHelper overlayHelper(menu, rootLevel); |
---|
48 | |
---|
49 | const ARCharMenuStruct& menuDef = menu.GetDefinition(); |
---|
50 | //ContentHead informations |
---|
51 | stringstream strmHead; |
---|
52 | strmHead.str(""); |
---|
53 | int overlayType = this->menu.GetOverlayType(); |
---|
54 | |
---|
55 | strmHead << CWebUtil::LinkToMenuIndex(this->rootLevel) << MenuSeparator << CWebUtil::ObjName(this->menu.GetName()) |
---|
56 | << " (" << CAREnum::MenuType(menuDef.menuType) << ")" << CAREnum::GetOverlayTypeString(overlayType); |
---|
57 | |
---|
58 | if(!this->menu.GetAppRefName().empty()) |
---|
59 | strmHead << MenuSeparator << " Application " << this->pInside->LinkToContainer(this->menu.GetAppRefName(), this->rootLevel); |
---|
60 | |
---|
61 | webPage.AddContentHead(strmHead.str(), overlayHelper.PlaceOverlayLink()); |
---|
62 | webPage.AddContent(overlayHelper.PlaceOverlaidNotice()); |
---|
63 | |
---|
64 | //ActiveLink Properties |
---|
65 | stringstream strmTmp; |
---|
66 | CTable tblObjProp("objProperties", "TblObjectList"); |
---|
67 | tblObjProp.AddColumn(30, "Property"); |
---|
68 | tblObjProp.AddColumn(70, "Value"); |
---|
69 | |
---|
70 | //Status |
---|
71 | CTableRow row("cssStdRow"); |
---|
72 | CTableCell cellProp("Refresh", ""); |
---|
73 | CTableCell cellPropValue(CAREnum::MenuRefresh(this->menu.GetRefreshCode()), ""); |
---|
74 | row.AddCell(cellProp); |
---|
75 | row.AddCell(cellPropValue); |
---|
76 | tblObjProp.AddRow(row); |
---|
77 | |
---|
78 | //Menuspecific |
---|
79 | switch (menuDef.menuType) |
---|
80 | { |
---|
81 | case AR_CHAR_MENU_LIST: |
---|
82 | CharMenuDetails(tblObjProp); |
---|
83 | break; |
---|
84 | case AR_CHAR_MENU_QUERY: |
---|
85 | SearchMenuDetails(tblObjProp); |
---|
86 | break; |
---|
87 | case AR_CHAR_MENU_FILE: |
---|
88 | FileMenuDetails(tblObjProp); |
---|
89 | break; |
---|
90 | case AR_CHAR_MENU_SQL: |
---|
91 | SqlMenuDetails(tblObjProp); |
---|
92 | break; |
---|
93 | case AR_CHAR_MENU_DATA_DICTIONARY: |
---|
94 | DataDictMenuDetails(tblObjProp); |
---|
95 | break; |
---|
96 | default: |
---|
97 | row.ClearCells(); |
---|
98 | row.AddCell(MenuDefinitionText); |
---|
99 | row.AddCell(EnumDefault); |
---|
100 | tblObjProp.AddRow(row); |
---|
101 | break; |
---|
102 | } |
---|
103 | |
---|
104 | //RelatedFields |
---|
105 | row.ClearCells(); |
---|
106 | cellProp.content = "Related Fields"; |
---|
107 | cellPropValue.content = this->RelatedFields(); |
---|
108 | row.AddCell(cellProp); |
---|
109 | row.AddCell(cellPropValue); |
---|
110 | tblObjProp.AddRow(row); |
---|
111 | |
---|
112 | //RelatedActiveLinks |
---|
113 | row.ClearCells(); |
---|
114 | cellProp.content = "Related ActiveLinks (Change Field)"; |
---|
115 | cellPropValue.content = this->RelatedActiveLinks(); |
---|
116 | row.AddCell(cellProp); |
---|
117 | row.AddCell(cellPropValue); |
---|
118 | tblObjProp.AddRow(row); |
---|
119 | |
---|
120 | //used in container? |
---|
121 | row.ClearCells(); |
---|
122 | cellProp.content = "Container References"; |
---|
123 | cellPropValue.content = this->ContainerReferences(); |
---|
124 | row.AddCell(cellProp); |
---|
125 | row.AddCell(cellPropValue); |
---|
126 | tblObjProp.AddRow(row); |
---|
127 | |
---|
128 | //Add table to page |
---|
129 | webPage.AddContent(tblObjProp.ToXHtml()); |
---|
130 | tblObjProp.Clear(); |
---|
131 | |
---|
132 | //Properties |
---|
133 | webPage.AddContent(CARProplistHelper::GetList(this->menu.GetPropList())); |
---|
134 | |
---|
135 | //History |
---|
136 | webPage.AddContent(this->pInside->ServerObjectHistory(&menu, this->rootLevel)); |
---|
137 | |
---|
138 | webPage.SaveInFolder(this->path); |
---|
139 | } |
---|
140 | } |
---|
141 | catch(exception& e) |
---|
142 | { |
---|
143 | cout << "EXCEPTION Menu doc of '" << this->menu.GetName() << "': " << e.what() << endl; |
---|
144 | } |
---|
145 | } |
---|
146 | |
---|
147 | void CDocCharMenuDetails::CharMenuDetails(CTable& table) |
---|
148 | { |
---|
149 | try |
---|
150 | { |
---|
151 | CTable tbl("menuItems", "TblObjectList"); |
---|
152 | tbl.AddColumn(20, "Type"); |
---|
153 | tbl.AddColumn(40, "Label"); |
---|
154 | tbl.AddColumn(40, "Value"); |
---|
155 | |
---|
156 | const ARCharMenuList& menu = this->menu.GetDefinition().u.menuList; |
---|
157 | for(unsigned int i=0; i< menu.numItems; i++) |
---|
158 | { |
---|
159 | CTableRow row("cssStdRow"); |
---|
160 | CTableCell cellItemType(CAREnum::MenuItemType(menu.charMenuList[i].menuType), ""); |
---|
161 | CTableCell cellItemLabel(menu.charMenuList[i].menuLabel, ""); |
---|
162 | |
---|
163 | string mValue = ""; |
---|
164 | if(menu.charMenuList[i].menuType == AR_MENU_TYPE_VALUE) |
---|
165 | mValue = menu.charMenuList[i].u.menuValue; |
---|
166 | CTableCell cellItemValue(mValue, ""); |
---|
167 | |
---|
168 | row.AddCell(cellItemType); |
---|
169 | row.AddCell(cellItemLabel); |
---|
170 | row.AddCell(cellItemValue); |
---|
171 | tbl.AddRow(row); |
---|
172 | } |
---|
173 | |
---|
174 | CTableRow row; |
---|
175 | row.AddCell(MenuDefinitionText); |
---|
176 | row.AddCell(tbl.ToXHtml()); |
---|
177 | table.AddRow(row); |
---|
178 | } |
---|
179 | catch(exception& e) |
---|
180 | { |
---|
181 | cout << "EXCEPTION Menu details doc of '" << this->menu.GetName() << "': " << e.what() << endl; |
---|
182 | } |
---|
183 | } |
---|
184 | |
---|
185 | void CDocCharMenuDetails::FileMenuDetails(CTable& table) |
---|
186 | { |
---|
187 | try |
---|
188 | { |
---|
189 | stringstream strm; |
---|
190 | |
---|
191 | const ARCharMenuFileStruct& menu = this->menu.GetDefinition().u.menuFile; |
---|
192 | strm << "File Name: " << menu.filename << "<br/>"; |
---|
193 | strm << "Location: " << CAREnum::MenuFileLocation(menu.fileLocation) << endl; |
---|
194 | |
---|
195 | CTableRow row; |
---|
196 | row.AddCell(MenuDefinitionText); |
---|
197 | row.AddCell(strm.str()); |
---|
198 | table.AddRow(row); |
---|
199 | } |
---|
200 | catch(exception& e) |
---|
201 | { |
---|
202 | cout << "EXCEPTION in FieldMenuDetails: " << e.what() << endl; |
---|
203 | } |
---|
204 | } |
---|
205 | |
---|
206 | void CDocCharMenuDetails::SqlMenuDetails(CTable& table) |
---|
207 | { |
---|
208 | |
---|
209 | try |
---|
210 | { |
---|
211 | vector<int> attachedToSchemaList; |
---|
212 | BuildUniqueSchemaList(attachedToSchemaList); |
---|
213 | |
---|
214 | // if the menu isnt attached to any form, add a dummy to the list, so the definition is generated at least once |
---|
215 | if (attachedToSchemaList.empty()) attachedToSchemaList.push_back(-1); |
---|
216 | |
---|
217 | vector<int>::iterator curIt = attachedToSchemaList.begin(); |
---|
218 | vector<int>::iterator endIt = attachedToSchemaList.end(); |
---|
219 | |
---|
220 | for (; curIt != endIt; ++curIt) |
---|
221 | { |
---|
222 | CARSchema schema(*curIt); |
---|
223 | |
---|
224 | stringstream strm; |
---|
225 | const ARCharMenuSQLStruct& menu = this->menu.GetDefinition().u.menuSQL; |
---|
226 | |
---|
227 | // in case a field in placed within the SQL command |
---|
228 | CRefItem refItem(this->menu, REFM_CHARMENU_SQL); |
---|
229 | |
---|
230 | strm << "Server: " << this->pInside->LinkToServerInfo(menu.server, rootLevel) << "<br/>" << endl; |
---|
231 | strm << "Label Index List: " << GetSQLLabelList(&menu) << "<br/>" << endl; |
---|
232 | strm << "Value Index: " << menu.valueIndex << "<br/><br/>" << endl; |
---|
233 | strm << "SQL Command: " << pInside->TextFindFields(menu.sqlCommand, "$", *curIt, rootLevel, true, &refItem) << endl; |
---|
234 | |
---|
235 | // add the table row now |
---|
236 | CTableRow row; |
---|
237 | row.AddCell( (schema.Exists() ? schema.GetURL(rootLevel) : MenuDefinitionText) ); |
---|
238 | row.AddCell( strm.str() ); |
---|
239 | table.AddRow(row); |
---|
240 | } |
---|
241 | } |
---|
242 | catch(exception& e) |
---|
243 | { |
---|
244 | cout << "EXCEPTION in SqlMenuDetails: " << e.what() << endl; |
---|
245 | } |
---|
246 | } |
---|
247 | |
---|
248 | string CDocCharMenuDetails::GetFieldTypes(unsigned int fieldMask) |
---|
249 | { |
---|
250 | stringstream strm; |
---|
251 | strm.str(""); |
---|
252 | |
---|
253 | try |
---|
254 | { |
---|
255 | unsigned int bitmask[9] = { 1, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, 1<<8 }; |
---|
256 | char fieldType[9][30] = { "Data", "Trim", "Control", "Page", "Page Holder", "Table", "Column", "Attachment", "Attachment Pool" }; |
---|
257 | |
---|
258 | for (unsigned int k= 0; k < 9; k++) |
---|
259 | { |
---|
260 | if ( (fieldMask & bitmask[k]) != 0) |
---|
261 | { |
---|
262 | strm << fieldType[k] << "<br/>" << endl; |
---|
263 | } |
---|
264 | } |
---|
265 | } |
---|
266 | catch(exception& e) |
---|
267 | { |
---|
268 | cout << "EXCEPTION in DDCharMenu GetFieldType(): " << e.what() << endl; |
---|
269 | } |
---|
270 | return strm.str(); |
---|
271 | } |
---|
272 | |
---|
273 | void CDocCharMenuDetails::DataDictMenuDetails(CTable& table) |
---|
274 | { |
---|
275 | try |
---|
276 | { |
---|
277 | vector<int> attachedToSchemaList; |
---|
278 | BuildUniqueSchemaList(attachedToSchemaList); |
---|
279 | |
---|
280 | // if the menu isnt attached to any form, add a dummy to the list, so the definition is generated at least once |
---|
281 | if (attachedToSchemaList.empty()) attachedToSchemaList.push_back(-1); |
---|
282 | |
---|
283 | vector<int>::iterator curIt = attachedToSchemaList.begin(); |
---|
284 | vector<int>::iterator endIt = attachedToSchemaList.end(); |
---|
285 | |
---|
286 | for (; curIt != endIt; ++curIt) |
---|
287 | { |
---|
288 | CARSchema schema(*curIt); |
---|
289 | |
---|
290 | stringstream strm; |
---|
291 | const ARCharMenuDDStruct& menu = this->menu.GetDefinition().u.menuDD; |
---|
292 | |
---|
293 | CRefItem refItemServer(this->menu, REFM_CHARMENU_SERVER); |
---|
294 | |
---|
295 | strm << "Server: " << ( menu.server[0] == '$' ? pInside->TextFindFields(menu.server, "$", *curIt, rootLevel, true, &refItemServer) : this->pInside->LinkToServerInfo(menu.server, rootLevel)) << "<br/>" << endl; |
---|
296 | strm << "Label Format: " << CAREnum::MenuDDLabelFormat(menu.nameType) << "<br/>" << endl; |
---|
297 | strm << "Value Format: " << CAREnum::MenuDDValueFormat(menu.valueFormat) << "<br/>" << endl; |
---|
298 | |
---|
299 | switch(menu.structType) |
---|
300 | { |
---|
301 | case AR_CHAR_MENU_DD_FORM: |
---|
302 | { |
---|
303 | strm << "Object Type: Form<br/>" << endl; |
---|
304 | |
---|
305 | string schemaType = "All"; |
---|
306 | if(menu.u.formDefn.schemaType > 0) |
---|
307 | schemaType = CAREnum::SchemaType(menu.u.formDefn.schemaType); |
---|
308 | |
---|
309 | strm << "Form Type: " << schemaType << "<br/>" << endl; |
---|
310 | |
---|
311 | string showHiddenForms = "Yes"; |
---|
312 | if(!menu.u.formDefn.includeHidden) |
---|
313 | showHiddenForms = "No"; |
---|
314 | |
---|
315 | strm << "Show Hidden Forms: " << showHiddenForms << "<br/>" << endl; |
---|
316 | } |
---|
317 | break; |
---|
318 | case AR_CHAR_MENU_DD_FIELD: |
---|
319 | { |
---|
320 | CRefItem refItemForm(this->menu, REFM_CHARMENU_FORM); |
---|
321 | |
---|
322 | strm << "Object Type: Field<br/>" << endl; |
---|
323 | strm << "Form Name: " << (menu.u.fieldDefn.schema[0] == '$' ? pInside->TextFindFields(menu.u.fieldDefn.schema, "$", *curIt, rootLevel, true, &refItemForm) : CWebUtil::Validate(menu.u.fieldDefn.schema)) << "<br/><br/>" << endl; |
---|
324 | strm << "Field Type:<br/>" << GetFieldTypes(menu.u.fieldDefn.fieldType) << "<br/>" << endl; |
---|
325 | } |
---|
326 | break; |
---|
327 | } |
---|
328 | |
---|
329 | // add the table row |
---|
330 | CTableRow row; |
---|
331 | row.AddCell((schema.Exists() ? schema.GetURL(rootLevel) : MenuDefinitionText)); |
---|
332 | row.AddCell(strm.str()); |
---|
333 | table.AddRow(row); |
---|
334 | } |
---|
335 | } |
---|
336 | catch(exception& e) |
---|
337 | { |
---|
338 | cout << "EXCEPTION in DDMenuDetails: " << e.what() << endl; |
---|
339 | } |
---|
340 | } |
---|
341 | |
---|
342 | void CDocCharMenuDetails::SearchMenuDetails(CTable& table) |
---|
343 | { |
---|
344 | try |
---|
345 | { |
---|
346 | vector<int> attachedToSchemaList; |
---|
347 | BuildUniqueSchemaList(attachedToSchemaList); |
---|
348 | |
---|
349 | // if the menu isnt attached to any form, add a dummy to the list, so the definition is generated at least once |
---|
350 | if (attachedToSchemaList.empty()) attachedToSchemaList.push_back(-1); |
---|
351 | |
---|
352 | vector<int>::iterator curIt = attachedToSchemaList.begin(); |
---|
353 | vector<int>::iterator endIt = attachedToSchemaList.end(); |
---|
354 | |
---|
355 | for(; curIt != endIt; ++curIt) |
---|
356 | { |
---|
357 | stringstream strm; |
---|
358 | CARSchema schema(*curIt); |
---|
359 | |
---|
360 | const ARCharMenuQueryStruct& menu = this->menu.GetDefinition().u.menuQuery; |
---|
361 | CARSchema querySchema(menu.schema); |
---|
362 | |
---|
363 | strm << "Server: " << this->pInside->LinkToServerInfo(menu.server, rootLevel) << "<br/>" << endl; |
---|
364 | strm << "Schema: " << this->pInside->LinkToSchema(querySchema.GetInsideId(), menu.schema, rootLevel) << "<br/>" << endl; |
---|
365 | |
---|
366 | //Label Fields |
---|
367 | for(int i=0; i< 5; i++) |
---|
368 | { |
---|
369 | if(menu.labelField[i] != 0) |
---|
370 | { |
---|
371 | strm << "Label Field (" << i << ") : " << this->pInside->LinkToField(menu.schema, menu.labelField[i], rootLevel); |
---|
372 | strm << " (FieldId: " << menu.labelField[i] << ")<br/>" << endl; |
---|
373 | |
---|
374 | CRefItem refItem(this->menu, REFM_CHARMENU_LABELFIELD); |
---|
375 | pInside->AddFieldReference(querySchema.GetInsideId(), menu.labelField[i], refItem); |
---|
376 | } |
---|
377 | } |
---|
378 | |
---|
379 | //Sort On Label |
---|
380 | string sortOnLabel = "Yes"; |
---|
381 | if(!menu.sortOnLabel) |
---|
382 | sortOnLabel = "No"; |
---|
383 | strm << "Sort On Label: " << sortOnLabel << "<br/>" << endl; |
---|
384 | |
---|
385 | |
---|
386 | //Value Field |
---|
387 | strm << "Value Field: " << this->pInside->LinkToField(querySchema.GetInsideId(), menu.valueField, rootLevel) << "<br/>"; |
---|
388 | CRefItem refItemValue(this->menu, REFM_CHARMENU_VALUE); |
---|
389 | pInside->AddFieldReference(querySchema.GetInsideId(), menu.valueField, refItemValue); |
---|
390 | |
---|
391 | //Query |
---|
392 | stringstream strmQuery; |
---|
393 | strmQuery.str(""); |
---|
394 | |
---|
395 | CRefItem refItemQuery(this->menu, REFM_CHARMENU_QUALIFICATION); |
---|
396 | |
---|
397 | CARQualification arQual(*this->pInside); |
---|
398 | arQual.arsStructItemType = AR_STRUCT_ITEM_XML_CHAR_MENU; |
---|
399 | arQual.CheckQuery(&menu.qualifier, refItemQuery, 0, schema.GetInsideId(), querySchema.GetInsideId(), strmQuery, rootLevel); |
---|
400 | |
---|
401 | if(strmQuery.str().length() > 0) |
---|
402 | { |
---|
403 | strm << "Qualification:<br/>" << strmQuery.str() << endl; |
---|
404 | } |
---|
405 | else |
---|
406 | { |
---|
407 | strm << "Qualification: " << EmptyValue << "<br/>" << endl; |
---|
408 | } |
---|
409 | |
---|
410 | // now add the row to the table |
---|
411 | CTableRow row; |
---|
412 | row.AddCell((schema.Exists() ? schema.GetURL(rootLevel) : MenuDefinitionText)); |
---|
413 | row.AddCell(strm.str()); |
---|
414 | table.AddRow(row); |
---|
415 | } |
---|
416 | } |
---|
417 | catch(exception& e) |
---|
418 | { |
---|
419 | cout << "EXCEPTION in SearchMenuDetails: " << e.what() << endl; |
---|
420 | } |
---|
421 | } |
---|
422 | |
---|
423 | string CDocCharMenuDetails::RelatedFields() |
---|
424 | { |
---|
425 | CTable tbl("relatedFields", "TblObjectList"); |
---|
426 | tbl.AddColumn(40, "Field Name"); |
---|
427 | tbl.AddColumn(20, "Field Id"); |
---|
428 | tbl.AddColumn(40, "Form"); |
---|
429 | |
---|
430 | try |
---|
431 | { |
---|
432 | const CARCharMenu::ReferenceList& refs = this->menu.GetReferences(); |
---|
433 | CARCharMenu::ReferenceList::const_iterator curIt = refs.begin(); |
---|
434 | CARCharMenu::ReferenceList::const_iterator endIt = refs.end(); |
---|
435 | |
---|
436 | for (; curIt != endIt; ++curIt) |
---|
437 | { |
---|
438 | if (curIt->GetObjectType() == AR_STRUCT_ITEM_XML_FIELD && curIt->GetMessageId() == REFM_FIELD_CHARMENU) |
---|
439 | { |
---|
440 | CARField field(curIt->GetObjectId(), curIt->GetSubObjectId()); |
---|
441 | |
---|
442 | CTableRow row("cssStdRow"); |
---|
443 | row.AddCell(field.GetURL(rootLevel)); |
---|
444 | row.AddCell(CTableCell(field.GetInsideId())); |
---|
445 | row.AddCell(field.GetSchema().GetURL(rootLevel)); |
---|
446 | tbl.AddRow(row); |
---|
447 | } |
---|
448 | } |
---|
449 | } |
---|
450 | catch(exception& e) |
---|
451 | { |
---|
452 | cout << "EXCEPTION in CharMenu related fields: " << e.what() << endl; |
---|
453 | } |
---|
454 | |
---|
455 | return tbl.ToXHtml(); |
---|
456 | } |
---|
457 | |
---|
458 | string CDocCharMenuDetails::RelatedActiveLinks() |
---|
459 | { |
---|
460 | CTable tbl("relatedActiveLinks", "TblObjectList"); |
---|
461 | tbl.AddColumn(100, "Active Link"); |
---|
462 | |
---|
463 | try |
---|
464 | { |
---|
465 | const CARCharMenu::ReferenceList& refs = this->menu.GetReferences(); |
---|
466 | CARCharMenu::ReferenceList::const_iterator curIt = refs.begin(); |
---|
467 | CARCharMenu::ReferenceList::const_iterator endIt = refs.end(); |
---|
468 | |
---|
469 | for (; curIt != endIt; ++curIt) |
---|
470 | { |
---|
471 | if (curIt->GetObjectType() == AR_STRUCT_ITEM_XML_ACTIVE_LINK) |
---|
472 | { |
---|
473 | CARActiveLink al(curIt->GetObjectId()); |
---|
474 | |
---|
475 | CTableRow row("cssStdRow"); |
---|
476 | |
---|
477 | stringstream tmp; |
---|
478 | tmp << curIt->IfElse() << "-Action " << curIt->ActionIndex() << " " << al.GetURL(rootLevel); |
---|
479 | |
---|
480 | CTableCell cellActiveLink(tmp.str(), ""); |
---|
481 | row.AddCell(cellActiveLink); |
---|
482 | tbl.AddRow(row); |
---|
483 | } |
---|
484 | } |
---|
485 | } |
---|
486 | catch(exception& e) |
---|
487 | { |
---|
488 | cout << "EXCEPTION in CharMenu related active links: " << e.what() << endl; |
---|
489 | } |
---|
490 | |
---|
491 | return tbl.ToXHtml(); |
---|
492 | } |
---|
493 | |
---|
494 | string CDocCharMenuDetails::ContainerReferences() |
---|
495 | { |
---|
496 | stringstream strm; |
---|
497 | strm.str(""); |
---|
498 | try |
---|
499 | { |
---|
500 | CContainerTable contTable(*this->pInside); |
---|
501 | unsigned int cntCount = this->pInside->containerList.GetCount(); |
---|
502 | for ( unsigned int cntIndex = 0; cntIndex < cntCount; ++cntIndex ) |
---|
503 | { |
---|
504 | CARContainer cont(cntIndex); |
---|
505 | |
---|
506 | if (pInside->appConfig.bOverlaySupport && !IsVisibleObject(cont)) |
---|
507 | continue; |
---|
508 | |
---|
509 | if(cont.GetType() != ARCON_APP) |
---|
510 | { |
---|
511 | const ARReferenceList& refs = cont.GetReferences(); |
---|
512 | for(unsigned int nCnt = 0; nCnt < refs.numItems; nCnt++) |
---|
513 | { |
---|
514 | if(refs.referenceList[nCnt].type == ARREF_CHAR_MENU) |
---|
515 | { |
---|
516 | if(refs.referenceList[nCnt].reference.u.name[0] != 0 && |
---|
517 | strcmp(this->menu.GetARName(), refs.referenceList[nCnt].reference.u.name) == 0) |
---|
518 | { |
---|
519 | contTable.AddRow(cont, rootLevel); |
---|
520 | } |
---|
521 | } |
---|
522 | } |
---|
523 | } |
---|
524 | } |
---|
525 | |
---|
526 | strm << contTable; |
---|
527 | } |
---|
528 | catch(exception& e) |
---|
529 | { |
---|
530 | cout << "EXCEPTION enumerating char menu container references of '" << this->menu.GetARName() << "': " << e.what() << endl; |
---|
531 | } |
---|
532 | |
---|
533 | return strm.str(); |
---|
534 | } |
---|
535 | |
---|
536 | string CDocCharMenuDetails::GetSQLLabelList(const ARCharMenuSQLStruct *sqlMenu) |
---|
537 | { |
---|
538 | stringstream strm; |
---|
539 | char buffer[16]; |
---|
540 | |
---|
541 | if (sqlMenu == NULL) return ""; |
---|
542 | |
---|
543 | for (int k=0; k<5; ++k) |
---|
544 | { |
---|
545 | if (sqlMenu->labelIndex[k] == 0) break; |
---|
546 | |
---|
547 | if (k > 0) strm << ","; |
---|
548 | sprintf(buffer, "%d", sqlMenu->labelIndex[k]); |
---|
549 | //_itoa(sqlMenu->labelIndex[k], buffer, 16); |
---|
550 | strm << buffer; |
---|
551 | } |
---|
552 | |
---|
553 | return strm.str(); |
---|
554 | } |
---|
555 | |
---|
556 | void CDocCharMenuDetails::BuildUniqueSchemaList(std::vector<int>& schemaList) |
---|
557 | { |
---|
558 | const CARCharMenu::ReferenceList& refs = this->menu.GetReferences(); |
---|
559 | CARCharMenu::ReferenceList::const_iterator curIt = refs.begin(); |
---|
560 | CARCharMenu::ReferenceList::const_iterator endIt = refs.end(); |
---|
561 | |
---|
562 | for (; curIt != endIt; ++curIt) |
---|
563 | { |
---|
564 | switch (curIt->GetObjectType()) |
---|
565 | { |
---|
566 | case AR_STRUCT_ITEM_XML_FIELD: |
---|
567 | { |
---|
568 | // the objectId of a field reference contains the schema id ... add it |
---|
569 | schemaList.push_back(curIt->GetObjectId()); |
---|
570 | } |
---|
571 | break; |
---|
572 | case AR_STRUCT_ITEM_XML_ACTIVE_LINK: |
---|
573 | { |
---|
574 | CARActiveLink al(curIt->GetObjectId()); |
---|
575 | const ARWorkflowConnectStruct& conStruct = al.GetSchemaList(); |
---|
576 | if (conStruct.type == AR_WORKFLOW_CONN_SCHEMA_LIST) |
---|
577 | { |
---|
578 | int conCount = conStruct.u.schemaList->numItems; |
---|
579 | for (int conIdx = 0; conIdx < conCount; ++conIdx) |
---|
580 | { |
---|
581 | CARSchema schema(conStruct.u.schemaList->nameList[conIdx]); |
---|
582 | |
---|
583 | if (schema.Exists()) |
---|
584 | { |
---|
585 | // each schema the referenced active link is attached to, is a candidate... add it |
---|
586 | schemaList.push_back(schema.GetInsideId()); |
---|
587 | } |
---|
588 | } |
---|
589 | } |
---|
590 | } |
---|
591 | break; |
---|
592 | } |
---|
593 | } |
---|
594 | |
---|
595 | SortAndRemoveDuplicates(schemaList); |
---|
596 | } |
---|