Ignore:
Timestamp:
2017-08-21T13:39:49+12:00 (7 years ago)
Author:
kjdon
Message:

implementing 'add all metadata' button. only add if enable_add_all_metadata_button is true, and if our metadata selector is a fixed list or autocomplete. will add a new row to the table for each metadata field in hte list. TODO, don't add if they are already in the list??

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts.js

    r31770 r31909  
    2020*/
    2121var new_metadata_field_input_type = "plain";
     22/* add all metadata button? only valid with fixedlist or autocomplete metadata element selection */
     23var enable_add_all_metadata_button = true;
     24
    2225/* Metadata elements to be used in the fixedlist/autocomplete options above */
    2326var availableMetadataElements = ["dc.Title", "dc.Subject"];
     
    3033*/
    3134
    32 
    3335/************************
    3436* METADATA EDIT SCRIPTS *
     
    4042    var id = cell.attr("id").substring(6);
    4143    var metaTable = gs.jqGet("meta" + id);
    42 
    4344    var row = cell.parent();
    4445    var newCell = $("<td>", {"style": "font-size:0.7em; padding:0px 10px", "class": "editMetadataButton"});
     
    6869            metaTable.css("display", "block");
    6970            metaTable.metaNameField.css("display", "inline");
    70             metaTable.addRowButton.css("display", "inline");
     71            metaTable.addRowButton.css("display", "inline");
     72            if (enable_add_all_metadata_button == true) {
     73            metaTable.addAllButton.css("display", "inline");
     74            }
    7175        }
    7276        else
     
    7680            metaTable.css("display", "none");
    7781            metaTable.metaNameField.css("display", "none");
    78             metaTable.addRowButton.css("display", "none");
     82            metaTable.addRowButton.css("display", "none");
     83            if (enable_add_all_metadata_button == true) {
     84            metaTable.addAllButton.css("display", "none");
     85            }
    7986        }
    8087    });
     
    8794    addFunctionalityToTable(metaTable);
    8895    metaTable.metaNameField.css("display", "none");
    89     metaTable.addRowButton.css("display", "none");
     96    metaTable.addRowButton.css("display", "none");
     97    if (enable_add_all_metadata_button == true) {
     98    metaTable.addAllButton.css("display", "none");
     99    }
    90100}
    91101
     
    120130            $(this).css("display", "none");
    121131            $(this.metaNameField).css("display", "none");
    122             $(this.addRowButton).css("display", "none");
     132            $(this.addRowButton).css("display", "none");
     133            if (enable_add_all_metadata_button == true) {
     134            $(this.addAllButton).css("display", "none");
     135            }
    123136        }
    124137    });
     
    137150    addCKEEditableState(evt,editableInitStates);
    138151    });
    139 
    140152    if($("#metadataSetList").length)
    141153    {
     
    378390   
    379391    }
    380     return true;
    381 }
    382 
     392    // if get here, this must be a new node, as wasn't in init states
     393    // make sure its not empty - we won't add empty nodes.
     394    if (StateToCheck.initHTML == "") {
     395    return false;
     396    }
     397    return true;
     398   
     399}
     400
Note: See TracChangeset for help on using the changeset viewer.