Changeset 73 for trunk/src/ajax


Ignore:
Timestamp:
06/28/09 16:35:36 (16 years ago)
Author:
lgiessmann
Message:

ajax-client: fixed a bug with disabling the datatype frames; fixed a style-bug with disabling frames; added css stylesheets

Location:
trunk/src/ajax
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/ajax/css/frame.css

    r71 r73  
    1212ul.fragmentFrame {
    1313    list-style-type: none;
    14 }
    15 
    16 caption {
     14    padding-left: 0px;
     15}
     16
     17ul.fragmentFrame table > caption {
    1718    font-size: 1.5em;
    1819    font-weight: bold;
     
    2122td.controlColumn {
    2223    background-color: #eaeaee;
     24    width: 13px;
    2325}
    2426
     
    3234}
    3335
     36li.instanceOfFrame > div {
     37    margin-left: 10px;
     38}
     39
     40li.instanceOfFrame > div > input[type="button"]{
     41    margin-left: 24px;
     42}
     43
    3444input[value="generate fragment"] {
    3545    margin-top: 10px;
     
    3747}
    3848
     49input[value="validate fragment"] {
     50    float: right;
     51}
     52
    3953input[value="commit fragment"] {
     54    margin-left: 5px;
    4055    float: right;
    4156}
     57
     58
     59/* === remove/add buttons in any kind of rows =============================== */
     60div.textrowWithoutRemoveButton span{
     61    display: inline-block;
     62    width: 20px;
     63    margin-left: 2px;
     64    margin-right: 2px;
     65    text-align: center;
     66}
     67
     68div.textrowWithRemoveButton span{
     69    display: inline-block;
     70    width: 20px;
     71    margin-left: 2px;
     72    margin-right: 2px;
     73    text-align: center;
     74}
     75
     76div.selectrowWithoutRemoveButton span{
     77    display: inline-block;
     78    width: 20px;
     79    margin-left: 2px;
     80    margin-right: 2px;
     81    text-align: center;
     82}
     83
     84div.selectrowWithRemoveButton span{
     85    display: inline-block;
     86    width: 20px;
     87    margin-left: 2px;
     88    margin-right: 2px;
     89    text-align: center;
     90}
     91
     92input[type="text"] {
     93    background-color: #white;
     94    border: 1px solid darkgray;
     95    margin-bottom: 1px;
     96    margin-top: 1px;
     97}
     98
     99input[type="text"][readonly="readonly"] {
     100    background-color: #eaeaee;
     101    border: 1px solid darkgray;
     102    margin-bottom: 1px;
     103    margin-top: 1px;
     104}
     105
     106
     107div.textrowWithRemoveButton > input[type="text"]{
     108    margin-left: 0px;
     109    font-weight: normal;
     110}
     111
     112div.textrowWithoutRemoveButton > input[type="text"]{
     113    margin-left: 24px;
     114    font-weight: normal;
     115}
     116
     117div.selectrowWithRemoveButton > select {
     118    margin-left: 0px;
     119    font-weight: normal;
     120}
     121
     122div.selectrowWithoutRemoveButton > select {
     123    margin-left: 24px;
     124    font-weight: normal;
     125}
     126
     127textarea {
     128    margin-left: 24px;
     129    background-color: white;
     130    border: 1px solid darkgray;
     131    margin-bottom: 1px;
     132    margin-top: 1px;
     133}
     134
     135textarea[readonly="readonly"] {
     136    margin-left: 24px;
     137    background-color: #eaeaee;
     138    border: 1px solid darkgray;
     139    margin-bottom: 1px;
     140    margin-top: 1px;
     141}
     142
     143
     144/* === topic frame ========================================================== */
     145table.topicFrame {
     146    width: 1022px;
     147    border-collapse: collapse;
     148    border: 1px solid #d1d1d3;
     149}
     150
     151table.topicFrame > tr > td.description {
     152    width: 163px;
     153}
     154
     155table.topicFrame > tr > td.content {
     156    width: 854px;
     157}
     158
     159table.topicFrame > tr.topicIdFrame {
     160    background-color: #f6f7f9;
     161}
     162
     163table.topicFrame > tr.subjectLocatorFrame {
     164    background-color: #f6f7f9;
     165}
     166
     167table.topicFrame > tr.nameContainer {
     168    background-color: #f6f7f9;
     169}
     170
     171table.topicFrame:hover {
     172    border: 1px solid #ff7f00;
     173}
     174
     175
     176/* === name frame =========================================================== */
     177table.topicFrame table.nameFrame {
     178    width: 851px;
     179    margin-top: 2px;
     180    margin-bottom: 2px;
     181    margin-left: 1px;
     182    border-collapse: collapse;
     183    border: 1px solid #d1d1d3;
     184}
     185
     186table.topicFrame table.nameFrame td.description {
     187    width: 142px;
     188}
     189
     190table.topicFrame table.nameFrame td.content {
     191    width: 689px;
     192}
     193
     194table.topicFrame table.nameFrame > tr.typeFrame {
     195    background-color: white;
     196}
     197
     198table.topicFrame table.nameFrame > tr.valueFrame {
     199    background-color: white;
     200}
     201
     202table.topicFrame table.nameFrame:hover {
     203    border: 1px solid #ff7f00;
     204}
     205
     206
     207/* === variant frame ======================================================== */
     208table.nameFrame div.variantFrame {
     209    margin-left: 24px;
     210}
     211
     212table.nameFrame table.variantFrame {
     213    width: 667px;
     214    margin-top: 2px;
     215    margin-bottom: 2px;
     216    border-collapse: collapse;
     217    border: 1px solid #d1d1d3;
     218}
     219
     220table.nameFrame table.variantFrame > tr > td.description {
     221    width: 142px;
     222}
     223
     224table.nameFrame table.variantFrame > tr > td.content {
     225    width: 505px;
     226}
     227
     228table.nameFrame table.variantFrame tr.scopeContainer {
     229    background-color: white;
     230}
     231
     232table.nameFrame table.variantFrame tr.datatypeFrame {
     233    background-color: white;
     234}
     235
     236table.nameFrame table.variantFrame:hover {
     237    border: 1px solid #ff7f00;
     238}
     239
     240
     241/* === occurrence frame ===================================================== */
     242table.topicFrame table.occurrenceFrame {
     243    width: 851px;
     244    margin-top: 2px;
     245    margin-bottom: 2px;
     246    margin-left: 1px;
     247    border-collapse: collapse;
     248    border: 1px solid #d1d1d3;
     249}
     250
     251table.topicFrame table.occurrenceFrame td.description {
     252    width: 142px;
     253}
     254
     255table.topicFrame table.occurrenceFrame td.content {
     256    width: 689px;
     257}
     258
     259table.topicFrame table.occurrenceFrame > tr.typeFrame {
     260    background-color: #f6f7f9;
     261}
     262
     263table.topicFrame table.occurrenceFrame > tr.valueFrame {
     264    background-color: #f6f7f9;
     265}
     266
     267table.topicFrame table.occurrenceFrame:hover {
     268    border: 1px solid #ff7f00;
     269}
     270
     271
     272/* === association container / association frame ============================ */
     273div.associationContainer {
     274    margin-top: 30px;
     275}
     276
     277table.associationContainer {
     278    border-collapse: collapse;
     279    width: 1022px;
     280    border: 1px solid #d1d1d3;
     281}
     282
     283table.associationContainer:hover {
     284    border: 1px solid #ff7f00;
     285}
     286
     287table.associationFrame {
     288    border-collapse: collapse;
     289    margin-left: 1px;
     290    margin-top: 1px;
     291    margin-bottom: 1px;
     292    border: 1px solid #d1d1d3;
     293    width: 1018px;
     294}
     295
     296table.associationFrame:hover {
     297    border: 1px solid #ff7f00;
     298}
     299
     300table.associationFrame > tr > td.description {
     301    width: 142px;
     302}
     303
     304table.associationFrame > tr > td.content {
     305    width: 853px;
     306}
     307
     308table.associationFrame > tr.itemIdentityFrame {
     309    background-color: #f6f7f9;
     310}
     311
     312table.associationFrame > tr.scopeContainer {
     313    background-color: #f6f7f9;
     314}
     315
     316
     317
     318
     319/* === associationrole frame ================================================ */
     320table.associationFrame table.roleFrame {
     321    width: 853px;
     322    margin-left: 1px;
     323    margin-top: 2px;
     324    margin-bottom: 2px;
     325    border-collapse: collapse;
     326    border: 1px solid #d1d1d3;
     327}
     328
     329table.associationFrame table.roleFrame:hover {
     330    border: 1px solid #ff7f00;
     331}
     332
     333table.associationFrame table.roleFrame > tr > td.description {
     334    width: 142px;
     335}
     336
     337table.associationFrame table.roleFrame > tr > td.content {
     338    width: 692px;
     339}
     340
     341table.roleFrame > tr.typeFrame {
     342    background-color: #f6f7f9;
     343}
     344
     345
     346
     347/* === tmId frame  ========================================================== */
     348div.tmIdFrame {
     349    margin-top: 30px;
     350}
     351
     352table.tmIdFrame {
     353    width: 1023px;
     354    border-collapse: collapse;
     355    border: 1px solid #d1d1d3;
     356    background-color: #f6f7f9;
     357}
     358
     359table.tmIdFrame:hover {
     360    border: 1px solid #ff7f00;
     361}
     362
     363li.tmIdFrame {
     364    margin-bottom: 10px;
     365}
     366
     367table.tmIdFrame input[type="text"] {
     368    margin-left: 12px;
     369}
  • TabularUnified trunk/src/ajax/css/main.css

    r71 r73  
    2828
    2929h1 {
     30    clear: left;
    3031    margin-left: 10px;
    3132    padding-top: 20px;
     
    6263img.ajaxLoader {
    6364    display: none;
    64     margin-left: 412px; /* the image has a width of 100px */
     65    margin-left: 412px; /* the image has a width of 100px --> 1024/2 - 100 = 412*/
    6566}
  • TabularUnified trunk/src/ajax/javascripts/constants.js

    r70 r73  
    1313// --- Some constants fot the http connections via the XMLHttpRequest-Object
    1414var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
    15 var HOST_PREF = "http://143.93.190.237:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
     15var HOST_PREF = "http://192.168.178.29:8000/"; //"http://localhost:8000/"; // of the form "http://(.+)/"
    1616var GET_PREFIX = HOST_PREF + "json/get/";
    1717var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
     
    3838var MMAX_INT = "*";
    3939
     40
     41// --- some css-styles
     42var DISABLED_BACKGROUND_COLOR = {"backgroundColor" : "#eaeaee"};
     43
     44
    4045// --- Contains most css classes used in this project
    4146// --- There should be called only the function to be sure to don't override
    4247// --- the original values.
    43 var CLASSES = {"__divPage__" : "page",
    44                "__divSubPage__" : "subPage",
    45                "__divContent__" : "content",
    46                "__divTextrowWithRemoveButton__" : "textrowWithRemoveButton",
    47                "__divTextrowWithoutRemoveButton__" : "textrowWithoutRemoveButton",
    48                "__divSelectrowWithRemoveButton__" : "selectrowWithRemoveButton",
    49                "__divSelectrowWithoutRemoveButton__" : "selectrowWithoutRemoveButton",
    50                "__spanClickable__" : "clickable",
    51                "__notVisible__" : "notvisible",
    52                "__divError__" : "errorMessage",
    53                "__ulFragmentFrame__" : "fragmentFrame",
    54                "__tableTopicFrame__" : "topicFrame",
    55                "__trTopicIdFrame__" : "topicIdFrame",
    56                "__tdContent__" : "content",
    57                "__tdDescription__" : "description",
    58                "__divInstanceOfFrame__" : "instanceOfFrame",
    59                "__divItemIdentityFrame__" : "itemIdentityFrame",
    60                "__divSubjectLocatorFrame__" : "subjectLocatorFrame",
    61                "__divSubjectIdentifierFrame__" : "subjectIdentifierFrame",
    62                "__divNameContainer__" : "nameContainer",
    63                "__divNameFrame__" : "nameFrame",
    64                "__trControlColumn__" : "controlColumn",
    65                "__trShowHiddenRows__" : "showHiddenRows",
    66                "__trTypeFrame__" : "typeFrame",
    67                "__divScopeFrame__" : "scopeFrame",
    68                "__divScopeContainer__" : "scopeContainer",
    69                "__divValueFrame__" : "valueFrame",
    70                "__divVariantFrame__" : "variantFrame",
    71                "__divVariantContainer__" : "variantContainer",
    72                "__divDatatypeFrame__" : "datatypeFrame",
    73                "__divOccurrenceContainer__" : "occurrenceContainer",
    74                "__divOccurrenceFrame__" : "occurrenceFrame",
    75                "__divAssociationContainer__" : "associationContainer",
    76                "__divAssociationFrame__" : "associationFrame",
    77                "__divRoleContainer__" : "roleContainer",
    78                "__divRoleFrame__" : "roleFrame",
    79                "__divPlayerFrame__" : "playerFrame",
    80                "__spanDeselect__" : "deselect",
    81                "__divFog__" : "fog",
    82                "__inputCommitButton__" : "commitButton",
    83                "__divTmIdFrame__" : "tmIdFrame",
    84                "__divLoad__" : "loadFrame",
    85                "__imgAjaxLoader__" : "ajaxLoader",
    86                "__divEditFrame__" : "editFrame",
    87 
    88                "page" : function(){ return this.__divPage__; },
    89                "subPage" : function(){ return this.__divSubPage__; },
    90                "content" : function(){ return this.__divContent__; },
    91                "textrowWithRemoveButton" : function(){ return this.__divTextrowWithRemoveButton__; },
    92                "textrowWithoutRemoveButton" : function(){ return this.__divTextrowWithoutRemoveButton__; },
    93                "selectrowWithRemoveButton" : function(){ return this.__divSelectrowWithRemoveButton__; },
    94                "selectrowWithoutRemoveButton" : function(){ return this.__divSelectrowWithoutRemoveButton__; },
    95                "clickable" : function(){ return this.__spanClickable__; },
    96                "notVisible" : function(){ return this.__notVisible__; },
    97                "error" : function(){ return this.__divError__; },              "fragmentFrame" : function(){ return this.__ulFragmentFrame__; },
    98                "topicFrame" : function(){ return this.__tableTopicFrame__; },
    99                "topicIdFrame" : function(){ return this.__trTopicIdFrame__; },
    100                "content" : function(){ return this.__tdContent__; },
    101                "description" : function(){ return this.__tdDescription__; },
    102                "instanceOfFrame" : function(){ return this.__divInstanceOfFrame__; },
    103                "itemIdentityFrame" : function(){ return this.__divItemIdentityFrame__; },
    104                "subjectLocatorFrame" : function(){ return this.__divSubjectLocatorFrame__; },
    105                "subjectIdentifierFrame" : function(){ return this.__divSubjectIdentifierFrame__; },
    106                "nameContainer" : function(){ return this.__divNameContainer__; },
    107                "nameFrame" : function(){ return this.__divNameFrame__; },
    108                "controlColumn" : function(){ return this.__trControlColumn__; },
    109                "showHiddenRows" : function(){ return this.__trShowHiddenRows__; },
    110                "typeFrame" : function(){ return this.__trTypeFrame__; },
    111                "scopeFrame" : function(){ return this.__divScopeFrame__; },
    112                "scopeContainer" : function(){ return this.__divScopeContainer__; },
    113                "valueFrame" : function(){ return this.__divValueFrame__; },
    114                "variantFrame" : function(){ return this.__divVariantFrame__; },
    115                "variantContainer" : function(){ return this.__divVariantContainer__; },
    116                "datatypeFrame" : function(){ return this.__divDatatypeFrame__; },
    117                "occurrenceContainer" : function(){ return this.__divOccurrenceContainer__; },
    118                "occurrenceFrame" : function(){ return this.__divOccurrenceFrame__; },
    119                "associationContainer" : function(){ return this.__divAssociationContainer__; },
    120                "associationFrame" : function(){ return this.__divAssociationFrame__; },
    121                "roleContainer" : function(){ return this.__divRoleContainer__; },
    122                "roleFrame" : function(){ return this.__divRoleFrame__; },
    123                "playerFrame" : function(){ return this.__divPlayerFrame__; },
    124                "deselect" : function(){ return this.__spanDeselect__; },
    125                "fog" : function(){ return this.__divFog__; },
    126                "commitButton" : function(){ return this.__inputCommitButton__; },
    127                "tmIdFrame" : function(){ return this.__divTmIdFrame__; },
    128                "load" : function(){ return this.__divLoad__; },
    129                "ajaxLoader" : function(){ return this.__imgAjaxLoader__; },
    130                "editFrame" : function(){ return this.__divEditFrame__; }
     48var CLASSES = {"page" : function(){ return "page"; },
     49               "subPage" : function(){ return "subPage"; },
     50               "content" : function(){ return "content"; },
     51               "textrowWithRemoveButton" : function(){ return "textrowWithRemoveButton"; },
     52               "textrowWithoutRemoveButton" : function(){ return "textrowWithoutRemoveButton"; },
     53               "selectrowWithRemoveButton" : function(){ return "selectrowWithRemoveButton"; },
     54               "selectrowWithoutRemoveButton" : function(){ return "selectrowWithoutRemoveButton"; },
     55               "clickable" : function(){ return "clickable"; },
     56               "error" : function(){ return "errorMessage" },
     57               "fragmentFrame" : function(){ return "fragmentFrame"; },
     58               "topicFrame" : function(){ return "topicFrame"; },
     59               "topicIdFrame" : function(){ return "topicIdFrame"; },
     60               "content" : function(){ return "content"; },
     61               "description" : function(){ return "description"; },
     62               "instanceOfFrame" : function(){ return "instanceOfFrame"; },
     63               "itemIdentityFrame" : function(){ return "itemIdentityFrame"; },
     64               "subjectLocatorFrame" : function(){ return "subjectLocatorFrame"; },
     65               "subjectIdentifierFrame" : function(){ return "subjectIdentifierFrame"; },
     66               "nameContainer" : function(){ return "nameContainer"; },
     67               "nameFrame" : function(){ return "nameFrame"; },
     68               "controlColumn" : function(){ return "controlColumn"; },
     69               "showHiddenRows" : function(){ return "showHiddenRows"; },
     70               "typeFrame" : function(){ return "typeFrame"; },
     71               "scopeFrame" : function(){ return "scopeFrame"; },
     72               "scopeContainer" : function(){ return "scopeContainer"; },
     73               "valueFrame" : function(){ return "valueFrame"; },
     74               "variantFrame" : function(){ return "variantFrame"; },
     75               "variantContainer" : function(){ return "variantContainer"; },
     76               "datatypeFrame" : function(){ return "datatypeFrame"; },
     77               "occurrenceContainer" : function(){ return "occurrenceContainer"; },
     78               "occurrenceFrame" : function(){ return "occurrenceFrame"; },
     79               "associationContainer" : function(){ return "associationContainer"; },
     80               "associationFrame" : function(){ return "associationFrame"; },
     81               "roleContainer" : function(){ return "roleContainer"; },
     82               "roleFrame" : function(){ return "roleFrame"; },
     83               "playerFrame" : function(){ return "playerFrame"; },
     84               "commitButton" : function(){ return "commitButton"; },
     85               "tmIdFrame" : function(){ return "tmIdFrame"; },
     86               "load" : function(){ return "loadFrame"; },
     87               "ajaxLoader" : function(){ return "ajaxLoader"; },
     88               "editFrame" : function(){ return "editFrame"; }
    13189              };
  • TabularUnified trunk/src/ajax/javascripts/create.js

    r71 r73  
    102102    }
    103103
     104    var validateButton = new Element("input", {"type" : "button", "value" : "validate fragment"});
     105    validateButton.observe("click", function(event){
     106        var ret = true;
     107        if(topic.isValid() === false) ret = false;
     108        if(associations && associations.isValid() === false) ret = false;
     109        if(tmId.isValid() === false) ret = false;
     110
     111        if(ret === true) alert("Fragment is valid!");
     112        else alert("Fragment is not valid!");
     113    });
     114
    104115    var commitButton = new Element("input", {"type" : "button", "value" : "commit fragment"})
    105116    commitButton.observe("click", function(event){
     
    147158
    148159    var liCB = new Element("li", {"class" : CLASSES.commitButton()});
    149     liCB.update(commitButton);
     160    liCB.insert({"top" : validateButton});
     161    liCB.insert({"top" : commitButton});
    150162    liTm.insert({"after" : liCB});
    151163}
  • TabularUnified trunk/src/ajax/javascripts/datamodel.js

    r72 r73  
    9696                                         this.__frame__.writeAttribute({"class" : CLASSES.textrowWithRemoveButton()});
    9797                                         this.__content__.remove();
    98                                          this.__content__ = new Element("input", {"type" : "text", "value" : content});
     98                                         this.__content__ = new Element("input", {"type" : "text", "value" : content, "size" : 40});
    9999                                         this.__dblClickHandler__ = dblClickHandler;
    100100                                         if(cssTitle && cssTitle.length){
     
    11571157                                                 
    11581158                                                 // --- resource value and datatype
    1159                                                  makeResource(this, contents, null, null, null);
     1159                                                 makeResource(this, contents, null, null, null, {"rows" : 3, "cols" : 40});
    11601160                                                 
    11611161                                                 this.getFrame().observe("dblclick", function(event){
     
    12261226                                         "disable" : function(){
    12271227                                             this.hideError();
    1228                                              this.__itemIdentity__.disable();
     1228                                             disableItemIdentity(this);
    12291229                                             // TODO: scope
    1230                                              this.__value__.writeAttribute({"readonly" : "readonly"});
    1231                                              this.__datatype__.__frames__[0].disable();
     1230                                             this.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     1231                                             disableValue(this);
     1232                                             disableDatatype(this);
    12321233                                             this.hideRemoveButton();
    12331234                                             this.hideAddButton();
    1234                                              this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
    1235                                              this.getFrame().setStyle({"border" : "1px solid darkgrey"});
     1235                                             this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
    12361236                                             this.__disabled__ = true;
    12371237                                         },
    12381238                                         "enable" : function(){
    1239                                              this.__itemIdentity__.enable();
     1239                                             enableItemIdentity(this);
    12401240                                             // TODO: scope
    1241                                              this.__value__.removeAttribute("readonly");
    1242                                              this.__datatype__.__frames__[0].enable();
     1241                                             this.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
     1242                                             enableValue(this);
     1243                                             enableDatatype(this);
    12431244                                             if(this.__owner__.__frames__.length > 1) this.showRemoveButton();
    12441245                                             this.showAddButton();
    1245                                              this.getFrame().setStyle({"backgroundColor" : "inherit"});
    1246                                              this.getFrame().setStyle({"border" : "none"});
     1246                                             this.getFrame().removeAttribute("style");
    12471247                                             this.__disabled__ = false;
    12481248                                         },
     
    13931393                                              function addSecondShowHandler(myself){
    13941394                                                  myself.__table__.select("tr")[0].observe("click", function(event){
    1395                                                       try{
    1396                                                           for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
    1397                                                               myself.__variants__.__container__.__frames__[i].minimize();
    1398                                                           }
    1399                                                       }catch(tmp){ alert(tmp);}
     1395                                                      for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
     1396                                                          myself.__variants__.__container__.__frames__[i].minimize();
     1397                                                      }
    14001398                                                  });
    14011399                                              }
     
    14511449                                      "disable" : function(){
    14521450                                          this.hideError();
    1453                                           this.__itemIdentity__.disable();
    1454                                           this.__type__.__frames__[0].disable();
    1455                                           this.__scope__.disable();
    1456                                           this.__value__.__frames__[0].disable();
    1457                                           this.__variants__.disable();
    1458                                           this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
    1459                                           this.getFrame().setStyle({"border" : "1px solid darkgrey"});
     1451                                          disableItemIdentity(this);
     1452                                          disableType(this);
     1453                                          disableScope(this);
     1454                                          disableValue(this);
     1455                                          disableVariants(this);
     1456                                          this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
    14601457                                          this.getFrame().writeAttribute({"title" : this.__cssTitle__});
    14611458                                          this.hideAddButton();
     
    14631460                                      },
    14641461                                      "enable" : function(){
    1465                                           this.__itemIdentity__.enable();
    1466                                           this.__type__.__frames__[0].enable();
    1467                                           this.__scope__.enable();
    1468                                           this.__value__.__frames__[0].enable();
    1469                                           this.__variants__.enable();
    1470                                           this.getFrame().setStyle({"backgroundColor" : "inherit"});
    1471                                           this.getFrame().setStyle({"border" : "none"});
     1462                                          enableItemIdentity(this);
     1463                                          enableType(this);
     1464                                          enableScope(this);
     1465                                          enableValue(this);
     1466                                          enableVariants(this);
     1467                                          this.getFrame().removeAttribute("style");
    14721468                                          this.getFrame().removeAttribute("title");
    14731469                                          checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
     
    17561752                                                    if(noConstraint === false) cssTitle = "min: " + _min + "   max: " + _max + "   regular expression: " + constraint.regexp;
    17571753                                                    this.__cssTitle__ = cssTitle;
    1758                                                     makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle);
     1754                                                    makeResource(this, contents, constraint, (occurrenceTypes ? occurrenceTypes[0].datatypeConstraint : null), cssTitle, {"rows" : 5, "cols" : 60});
    17591755
    17601756                                                    this.getFrame().observe("dblclick", function(event){
     
    18281824                                                }
    18291825                                            },
    1830                                             "disable" : function(){
     1826                                            "disable" : function(){try{
    18311827                                                this.hideError();
    1832                                                 this.__itemIdentity__.disable();
    1833                                                 this.__type__.__frames__[0].disable();
    1834                                                 this.__scope__.disable();
    1835                                                 this.__value__.writeAttribute({"readonly" : "readonly"});
    1836                                                 this.__datatype__.__frames__[0].disable();
    1837                                                 this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
    1838                                                 this.getFrame().setStyle({"border" : "1px solid darkgrey"});
     1828                                                disableItemIdentity(this);
     1829                                                disableType(this);;
     1830                                                disableScope(this);
     1831                                                disableValue(this);
     1832                                                disableDatatype(this);
     1833                                                this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
    18391834                                                this.getFrame().writeAttribute({"title" : this.__cssTitle__});
    18401835                                                this.hideAddButton();
    1841                                                 this.__disabled__ = true;
     1836                                                this.__disabled__ = true;}catch(err){ alert("err: " + err); }
    18421837                                            },
    18431838                                            "enable" : function(){
    1844                                                 this.__itemIdentity__.enable();
    1845                                                 this.__type__.__frames__[0].enable();
    1846                                                 this.__scope__.enable();
    1847                                                 this.__value__.removeAttribute("readonly");
    1848                                                 this.__datatype__.__frames__[0].enable();
    1849                                                 this.getFrame().setStyle({"backgroundColor" : "inherit"});
    1850                                                 this.getFrame().setStyle({"border" : "none"});
     1839                                                enableItemIdentity(this);
     1840                                                enableType(this);;
     1841                                                enableScope(this);
     1842                                                enableValue(this);
     1843                                                enableDatatype(this);
     1844                                                this.getFrame().removeAttribute("style");
    18511845                                                this.getFrame().removeAttribute("title");
    18521846                                                checkRemoveAddButtons(this.__owner__, 1, this.__max__, this);
     
    24802474                                      "disable" : function(){
    24812475                                          this.hideError();
    2482                                           this.__itemIdentity__.disable();
    2483                                           this.__type__.__frames__[0].disable();
    2484                                           this.__player__.__frames__[0].disable();
    2485                                           this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
    2486                                           this.getFrame().setStyle({"border" : "1px solid darkgrey"});
     2476                                          disableItemIdentity(this);
     2477                                          disableType(this);
     2478                                          disablePlayer(this);
     2479                                          this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
    24872480                                          this.__disabled__ = true;
    24882481                                      },
    24892482                                      "enable" : function(){
    2490                                           this.__itemIdentity__.enable();
    2491                                           this.__type__.__frames__[0].enable();
    2492                                           this.__player__.__frames__[0].enable();
    2493                                           this.getFrame().setStyle({"backgroundColor" : "inherit"});
    2494                                           this.getFrame().setStyle({"border" : "none"});
     2483                                          enableItemIdentity(this);
     2484                                          enableType(this);
     2485                                          enablePlayer(this);
     2486                                          this.getFrame().removeAttribute("style");
    24952487                                          this.__disabled__ = false;
    24962488                                      }});
     
    35703562                                             "disable" : function(){
    35713563                                                 this.hideError();
    3572                                                  this.__itemIdentity__.disable();
    3573                                                  this.__roles__.disable();
    3574                                                  this.__type__.__frames__[0].disable();
    3575                                                  this.__scope__.disable();
     3564                                                 disableItemIdentity(this);
     3565                                                 disableRole(this);
     3566                                                 disableType(this);
     3567                                                 disableScope(this);
    35763568                                                 this.hideRemoveButton();
    35773569                                                 this.hideAddButton();
    3578                                                  this.getFrame().setStyle({"backgroundColor" : "#edeceb"});
    3579                                                  this.getFrame().setStyle({"border" : "1px solid darkgrey"});
     3570                                                 this.getFrame().setStyle(DISABLED_BACKGROUND_COLOR);
    35803571                                                 this.__disabled__ = true;
    35813572                                             },
    35823573                                             "enable" : function(){
    3583                                                  this.__itemIdentity__.enable();
    3584                                                  this.__roles__.enable();
    3585                                                  this.__type__.__frames__[0].enable();
    3586                                                  this.__scope__.enable();
     3574                                                 enableItemIdentity(this);
     3575                                                 enableRole(this);
     3576                                                 enableType(this);
     3577                                                 enableScope(this);
    35873578                                                 if(this.__owner__.__frames__.length > 1 || !this.__constraints__ || this.__constraints__.length !== 0) this.showRemoveButton();
    35883579                                                 if(this.__constraints__ && this.__constraints__.length !== 0) this.showAddButton();
    3589                                                  this.getFrame().setStyle({"backgroundColor" : "inherit"});
    3590                                                  this.getFrame().setStyle({"border" : "none"});
     3580                                                 this.getFrame().removeAttribute("style");
    35913581                                                 this.__disabled__ = false;
    35923582                                             }});
     
    37133703                                              this.__table__.update(this.__caption__);
    37143704                                              var value = contents && contents.length !== 0 ? decodeURI(contents[0]) : "";
    3715                                               this.__contentrow__ = new Element("input", {"type" : "text", "value" : value});
     3705                                              this.__contentrow__ = new Element("input", {"type" : "text", "value" : value, "size" : 40});
    37163706                                              this.__tr__ = new Element("tr", {"class" : CLASSES.tmIdFrame()});
    37173707                                              var td =new Element("td", {"class" : CLASSES.content()});
     
    39693959
    39703960// --- sets the resource value and datatype of names and occurrences
    3971 function makeResource(myself, content, constraints, datatypeConstraint, cssTitle)
     3961function makeResource(myself, content, constraints, datatypeConstraint, cssTitle, size)
    39723962{
     3963    if(!size) size = {"rows" : 3, "cols" : 40};
    39733964    var value = "";
    39743965    var datatype = "";
     
    39903981        this.__datatype__ = new Object();
    39913982    }catch(err){}
    3992     myself.__value__ = new Element("textarea", {"rows" : 3}).setValue(value);
     3983    myself.__value__ = new Element("textarea", size).setValue(value);
    39933984    myself.__table__.insert({"bottom" : newRow(CLASSES.valueFrame(), "Resource Value", myself.__value__)});
    39943985    if(cssTitle && cssTitle.length !== 0) myself.__value__.writeAttribute({"title" : cssTitle});
     
    39963987    // --- datatype
    39973988    myself.__datatype__ = new Object();
    3998     if(datatypeConstraint && datatypeConstraint.length !== 0){
     3989    if((datatypeConstraint && datatypeConstraint.length !== 0) || datatype === ANY_URI){
    39993990        new TextrowC(datatypeConstraint, datatypeConstraint, myself.__datatype__, 1, 1, null);
    40003991        myself.__datatype__.__frames__[0].getFrame().select("input")[0].writeAttribute({"readonly" : "readonly"});
     3992        myself.__datatypeIsSet__ = true;
    40013993    }
    40023994    else {
    40033995        new TextrowC(datatype, ".*", myself.__datatype__, 1, 1, null);
     3996        myself.__datatypeIsSet__ = false;
    40043997    }
    40053998    myself.__table__.insert({"bottom" : newRow(CLASSES.datatypeFrame(), "Datatype", myself.__datatype__.__frames__[0].getFrame())});
     
    41554148    return types;
    41564149}
     4150
     4151// --- some helper to enable/disable some table rows
     4152
     4153function disableItemIdentity(myself)
     4154{
     4155    myself.__itemIdentity__.disable();
     4156    myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4157}
     4158function enableItemIdentity(myself)
     4159{
     4160    myself.__itemIdentity__.enable();
     4161    myself.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].removeAttribute("style");
     4162}
     4163function disableType(myself)
     4164{
     4165    myself.__type__.__frames__[0].disable();
     4166    myself.__table__.select("tr." + CLASSES.typeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4167}
     4168function enableType(myself)
     4169{
     4170    myself.__type__.__frames__[0].enable();
     4171    myself.__table__.select("tr." + CLASSES.typeFrame())[0].removeAttribute("style");
     4172}
     4173function disableScope(myself){
     4174    myself.__scope__.disable();
     4175    myself.__table__.select("tr." + CLASSES.scopeContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4176}
     4177function enableScope(myself)
     4178{
     4179    myself.__scope__.enable();
     4180    myself.__table__.select("tr." + CLASSES.scopeContainer())[0].removeAttribute("style");
     4181}
     4182function disableValue(myself)
     4183{
     4184    try{ myself.__value__.__frames__[0].disable(); } catch(err){}
     4185    try{ myself.__value__.writeAttribute({"readonly" : "readonly"}); } catch(err){}
     4186    myself.__table__.select("tr." + CLASSES.valueFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4187}
     4188function enableValue(myself)
     4189{
     4190    try{ myself.__value__.__frames__[0].enable(); } catch(err){}
     4191    try{ myself.__value__.removeAttribute("readonly"); } catch(err){}
     4192    myself.__table__.select("tr." + CLASSES.valueFrame())[0].removeAttribute("style");
     4193}
     4194function disableDatatype(myself)
     4195{
     4196    myself.__datatype__.__frames__[0].disable();
     4197    myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4198}
     4199function enableDatatype(myself)
     4200{
     4201    if(myself.__datatypeIsSet__ === false) myself.__datatype__.__frames__[0].enable();
     4202    myself.__table__.select("tr." + CLASSES.datatypeFrame())[0].removeAttribute("style");
     4203}
     4204function disableVariants(myself)
     4205{
     4206    myself.__variants__.disable();
     4207    myself.__table__.select("tr." + CLASSES.variantContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4208}
     4209function enableVariants(myself)
     4210{
     4211    myself.__variants__.enable();
     4212    myself.__table__.select("tr." + CLASSES.variantContainer())[0].removeAttribute("style");
     4213}
     4214function disableRole(myself)
     4215{
     4216    myself.__roles__.disable();
     4217    myself.__table__.select("tr." + CLASSES.roleContainer())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4218}
     4219function enableRole(myself)
     4220{
     4221    myself.__roles__.enable();
     4222    myself.__table__.select("tr." + CLASSES.roleContainer())[0].removeAttribute("style");
     4223}
     4224function disablePlayer(myself)
     4225{
     4226    myself.__player__.__frames__[0].disable();
     4227    myself.__table__.select("tr." + CLASSES.playerFrame())[0].setStyle(DISABLED_BACKGROUND_COLOR);
     4228}
     4229function enablePlayer(myself)
     4230{
     4231    myself.__player__.__frames__[0].enable();
     4232    myself.__table__.select("tr." + CLASSES.playerFrame())[0].removeAttribute("style");
     4233}
  • TabularUnified trunk/src/ajax/javascripts/requests.js

    r70 r73  
    1717    return setTimeout(function(){
    1818        alert("The AJAX request for \"" + url + "\" timed out. Please check your network connection!");
     19        hideLoad();
    1920    }, time);
    2021}
Note: See TracChangeset for help on using the changeset viewer.