Changeset 321


Ignore:
Timestamp:
11/02/12 07:56:25 (7 years ago)
Author:
jls17
Message:
  • added simple-filter-section to forms field list; you can filter by field name or field id; the field table is currently stored as both, json and html structure; this makes sure the page is displayed even with disabled javascript; but the html-table might get removed later on to reduce page size .. then javascript is required;
Location:
branches/work_304
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/work_304/ARInside.rc

    r320 r321  
    7979ID_JQUERY_UI_IMAGE_BGGLASS_E6     RCDATA        "thirdparty/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png" 
    8080ID_JQUERY_UI_IMAGE_BGGLASS_FF     RCDATA        "thirdparty/jquery/images/ui-bg_glass_65_ffffff_1x400.png" 
     81ID_ARSHELPER_JS         RCDATA                  "res/arshelper.js" 
    8182 
    8283///////////////////////////////////////////////////////////////////////////// 
  • branches/work_304/ARInsideLib.vcproj

    r320 r321  
    12931293                                        /> 
    12941294                                </FileConfiguration> 
     1295                        </File> 
     1296                        <File 
     1297                                RelativePath=".\res\arshelper.js" 
     1298                                > 
    12951299                        </File> 
    12961300                        <File 
  • branches/work_304/CMakeLists.txt

    r320 r321  
    137137 res/up.gif res/user.gif res/visible.gif res/webservice.gif 
    138138) 
    139 SET (ARINSIDE_SRC_JS res/script.js res/sortscript.js res/tabscript.js res/schema_page.js) 
     139SET (ARINSIDE_SRC_JS res/script.js res/sortscript.js res/tabscript.js res/schema_page.js res/arshelper.js) 
    140140SET (ARINSIDE_SRC_CSS res/style.css) 
    141141SET (ARINSIDE_JQUERY_RES  
  • branches/work_304/FileSystemUtil.cpp

    r320 r321  
    7979        LoadFromResource(ID_JQUERY_ADDRESS_JS, "jquery.address.js", strm.str()); 
    8080        LoadFromResource(ID_JQUERY_TIMER_JS, "jquery.timer.js", strm.str()); 
     81        LoadFromResource(ID_ARSHELPER_JS, "arshelper.js", strm.str()); 
    8182 
    8283        // specical subfolder "image" for jquery-ui 
     
    153154                case ID_JQUERY_UI_IMAGE_BGGLASS_E6: data = _binary_thirdparty_jquery_images_ui_bg_glass_75_e6e6e6_1x400_png_start; len = _binary_thirdparty_jquery_images_ui_bg_glass_75_e6e6e6_1x400_png_size; break; 
    154155                case ID_JQUERY_UI_IMAGE_BGGLASS_FF: data = _binary_thirdparty_jquery_images_ui_bg_glass_65_ffffff_1x400_png_start; len = _binary_thirdparty_jquery_images_ui_bg_glass_65_ffffff_1x400_png_size; break; 
     156                case ID_ARSHELPER_JS: data = _binary_res_arshelper_js_start; len = _binary_res_arshelper_js_size; break; 
    155157        } 
    156158#endif 
  • branches/work_304/FileSystemUtil.h

    r320 r321  
    8989        extern unsigned char _binary_thirdparty_jquery_images_ui_bg_glass_75_e6e6e6_1x400_png_start[]; extern unsigned int _binary_thirdparty_jquery_images_ui_bg_glass_75_e6e6e6_1x400_png_size; 
    9090        extern unsigned char _binary_thirdparty_jquery_images_ui_bg_glass_65_ffffff_1x400_png_start[]; extern unsigned int _binary_thirdparty_jquery_images_ui_bg_glass_65_ffffff_1x400_png_size; 
     91        extern unsigned char _binary_res_arshelper_js_start[]; extern unsigned int _binary_res_arshelper_js_size; 
    9192#endif 
  • branches/work_304/RapidJSONTests.cpp

    r314 r321  
    6060        ASSERT_EQ("[\"Test1\",\"Test2\",{\"Id\":1,\"Name\":\"ARInside\"}]", result); 
    6161} 
     62 
     63string generateRapidJsonValueString(int num) 
     64{ 
     65        stringstream strm; 
     66        strm << "Value" << num; 
     67        return strm.str(); 
     68} 
     69 
     70TEST(RapidJSONTests, AllocatorTest) 
     71{ 
     72        Document document; 
     73        Document::AllocatorType& allocator = document.GetAllocator(); 
     74 
     75        document.SetArray(); 
     76        ASSERT_TRUE(document.IsArray()); 
     77 
     78        for (int i = 0; i < 3; i++) 
     79        { 
     80                string value = generateRapidJsonValueString(i); 
     81                Value item(value.c_str(), value.size(), allocator); 
     82                document.PushBack(item, allocator); 
     83        } 
     84 
     85        stringstream strm; 
     86        GenericWriteStream output(strm); 
     87        Writer<GenericWriteStream> writer(output); 
     88        document.Accept(writer); 
     89 
     90        string result = strm.str(); 
     91        ASSERT_EQ("[\"Value0\",\"Value1\",\"Value2\"]",result); 
     92} 
     93 
  • branches/work_304/doc/DocSchemaDetails.cpp

    r312 r321  
    2525#include "DocOverlayHelper.h" 
    2626 
     27#include "rapidjson/document.h" 
     28#include "rapidjson/genericwritestream.h" 
     29#include "rapidjson/writer.h" 
     30 
     31using namespace rapidjson; 
     32 
    2733CDocSchemaDetails::CDocSchemaDetails(unsigned int schemaInsideId, int rootLevel) 
    2834: schema(schemaInsideId) 
     
    8692 
    8793                        // add the javascript we need for this page to display correctly 
    88                         webPage.GetReferenceManager().AddScriptReference("img/schema_page.js"); 
     94                        webPage.GetReferenceManager() 
     95                                .AddScriptReference("img/schema_page.js") 
     96                                .AddScriptReference("img/jquery.timers.js"); 
    8997 
    9098                        // now the content 
     
    269277                } 
    270278 
    271                 stringstream tblDesc; 
    272                 tblDesc << CWebUtil::ImageTag("doc.gif", rootLevel) << tbl.NumRows() << " fields (" << CWebUtil::Link("data", CPageParams(PAGE_SCHEMA_FIELDS_CSV, &this->schema), "", rootLevel) << ")" << endl; 
    273                 tbl.description = tblDesc.str(); 
     279                stringstream outputStrm; 
     280                AllFieldsJson(outputStrm); 
     281                outputStrm << "<div><input type=\"text\" id=\"fieldNameFilter\"/><button id=\"execFieldFilter\">Filter</button></div>" << endl; 
     282                outputStrm << CWebUtil::ImageTag("doc.gif", rootLevel) << "<span id='fieldListFilterResultCount'></span>" << tbl.NumRows() << " fields (" << CWebUtil::Link("data", CPageParams(PAGE_SCHEMA_FIELDS_CSV, &this->schema), "", rootLevel) << ")" << endl; 
     283                outputStrm << "<div id=\"result\"></div>"; 
     284                tbl.description = outputStrm.str(); 
    274285 
    275286                AllFieldsCsv(); 
     
    330341} 
    331342 
     343void CDocSchemaDetails::AllFieldsJson(std::ostream &out) 
     344{ 
     345        try 
     346        { 
     347                Document document; 
     348                Document::AllocatorType &alloc = document.GetAllocator(); 
     349                document.SetArray(); 
     350 
     351                CARFieldList* fields = schema.GetFields(); 
     352                unsigned int fieldCount = fields->GetCount(); 
     353                for (unsigned int fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex) 
     354                { 
     355                        CARField field(schema.GetInsideId(), 0, fieldIndex); 
     356                        CPageParams fieldLink(PAGE_DETAILS, &field); 
     357 
     358                        Value item; 
     359                        item.SetArray(); 
     360 
     361                        string strName = field.GetName(); 
     362                        string strDate = CUtil::DateTimeToString(field.GetTimestamp()); 
     363                        string strLink = CWebUtil::DocName(fieldLink->GetFileName()); 
     364 
     365                        Value name(strName.c_str(), strName.size(), alloc); 
     366                        Value modified(strDate.c_str(), strDate.size(), alloc); 
     367                        Value link(strLink.c_str(), strLink.size(), alloc); 
     368 
     369                        item.PushBack(static_cast<int>(field.GetFieldId()), alloc); 
     370                        item.PushBack(name, alloc); 
     371                        item.PushBack(field.GetDataType(), alloc); 
     372                        item.PushBack(field.GetDisplayInstances().numItems, alloc); 
     373                        item.PushBack(modified, alloc); 
     374                        item.PushBack(field.GetLastChanged(), alloc); 
     375                        item.PushBack(link, alloc); 
     376 
     377                        document.PushBack(item, alloc); 
     378                } 
     379 
     380                GenericWriteStream output(out); 
     381                Writer<GenericWriteStream> writer(output); 
     382 
     383                out << endl << "<script type=\"text/javascript\">" << endl; 
     384                out << "var schemaFieldList = "; document.Accept(writer); out << ";" << endl; 
     385                out << "</script>" << endl; 
     386        } 
     387        catch(exception& e) 
     388        { 
     389                cout << "EXCEPTION schema all fields json of '" << this->schema.GetName() << "': " << e.what() << endl; 
     390        } 
     391} 
    332392 
    333393//Create a page with all fields of a joinform 
     
    415475 
    416476                stringstream tblDesc; 
    417                 tblDesc << CWebUtil::ImageTag("doc.gif", rootLevel) << tbl.NumRows() << " fields (" << CWebUtil::Link("data", CPageParams(PAGE_SCHEMA_FIELDS_CSV, &this->schema), "", rootLevel) << ")" << endl; 
     477                tblDesc << CWebUtil::ImageTag("doc.gif", rootLevel) << "<span id='fieldListFilterResultCount'></span>" << tbl.NumRows() << " fields (" << CWebUtil::Link("data", CPageParams(PAGE_SCHEMA_FIELDS_CSV, &this->schema), "", rootLevel) << ")" << endl; 
    418478                tbl.description = tblDesc.str(); 
    419479 
  • branches/work_304/doc/DocSchemaDetails.h

    r292 r321  
    5454        string AllFields(); 
    5555        void AllFieldsCsv(); 
     56        void AllFieldsJson(std::ostream &out); 
    5657        string AllFieldsSpecial(); 
    5758        void AllFieldsSpecialCsv(); 
  • branches/work_304/output/WebPage.cpp

    r311 r321  
    227227        inst.AddScriptReference("img/jquery.js"); 
    228228        inst.AddScriptReference("img/jquery-ui.js"); 
    229         inst.AddScriptReference("img/jquery.address.min.js"); 
    230 } 
     229        inst.AddScriptReference("img/jquery.address.js"); 
     230        inst.AddScriptReference("img/arshelper.js"); 
     231} 
  • branches/work_304/res/schema_page.js

    r294 r321  
    1 $(function() {   
    2         $("#MainObjectTabCtrl").tabs();  
    3         $("#MainObjectTabCtrl div").addClass("inner-tab"); 
     1$(function() { 
     2    $("#MainObjectTabCtrl").tabs(); 
     3    $('#MainObjectTabCtrl div[id^="tab"]').addClass("inner-tab"); 
    44}); 
    5 $('document').ready(function() {  
    6         $.address.change(function(event) { 
    7                 $("#MainObjectTabCtrl").tabs( "select" , window.location.hash ); 
    8         }); 
    9         $("#MainObjectTabCtrl").bind("tabsselect", function(event, ui) { 
    10                 window.location.hash = ui.tab.hash;  
    11         }); 
     5$('document').ready(function() { 
     6    $.address.change(function(event) { 
     7        $("#MainObjectTabCtrl").tabs("select", window.location.hash); 
     8    }); 
     9    $("#MainObjectTabCtrl").bind("tabsselect", function(event, ui) { 
     10        window.location.hash = ui.tab.hash; 
     11    }); 
     12    $("#fieldNameFilter").keyup(function() { 
     13        $(this).stopTime(); 
     14        $(this).oneTime(300, function() { 
     15            $("#execFieldFilter").click(); 
     16        }); 
     17    }); 
     18 
     19    $("#execFieldFilter").click(function() { 
     20        if (schemaFieldList != null) { 
     21            var table_name = 'fieldListAll'; 
     22            var table = $('#' + table_name); 
     23            var search = $("#fieldNameFilter").val().replace(" +", " ").replace(" ", ".*"); 
     24            var numSearch = search.search("^\\d+$"); 
     25            //var table = $("<table class='TblObjectList'><th>Field Name</th><th>Field ID</th><th>Datatype</th><th>Real Field</th><th>In Views</th><th>Modified</th><th>By</th></tr></table>"); 
     26            var matches = 0; 
     27            var hasRealFieldColumn = ($('#' + table_name + ' tbody tr:eq(0) th:eq(3)').text().lastIndexOf("Real Field", 0) === 0); 
     28 
     29            $('#' + table_name + ' tbody tr:gt(0)').remove(); 
     30 
     31            $.each(schemaFieldList, function(i) { 
     32                var r = new RegExp(search, "i"); 
     33                if (schemaFieldList[i][1].match(r) || (numSearch == 0 && ("" + schemaFieldList[i][0]).match(search))) { 
     34                    matches++; 
     35                    table.append("<tr><td><a href='" + schemaFieldList[i][6] + "'>" + schemaFieldList[i][1] + "</a></td><td>" + schemaFieldList[i][0] + "</td><td>" + ARFieldDataTypeToString(schemaFieldList[i][2]) + (hasRealFieldColumn ? "<td></td>" : "") + "<td>" + schemaFieldList[i][3] + "</td><td>" + schemaFieldList[i][4] + "</td><td>" + schemaFieldList[i][5] + "</td></tr>"); 
     36                } 
     37            }); 
     38            $('#fieldListFilterResultCount').text((search != null && search.length > 0 ? "showing " + matches + " out of " : "")); 
     39        } 
     40    }); 
    1241}); 
  • branches/work_304/resource.h

    r320 r321  
    4646#define ID_JQUERY_UI_IMAGE_BGGLASS_E6   142 
    4747#define ID_JQUERY_UI_IMAGE_BGGLASS_FF   143 
     48#define ID_ARSHELPER_JS                 144 
    4849 
    4950// Next default values for new objects 
Note: See TracChangeset for help on using the changeset viewer.