diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index 1ccf9295a..da51874ed 100644 --- a/views/bootstrap/class.AttributeMgr.php +++ b/views/bootstrap/class.AttributeMgr.php @@ -53,6 +53,7 @@ $(document).ready( function() { printDeleteFolderButtonJs(); $this->printDeleteDocumentButtonJs(); + $this->printDeleteAttributeValueButtonJs(); } /* }}} */ function info() { /* {{{ */ @@ -79,11 +80,12 @@ $(document).ready( function() { $content .= "".getMLText("attribute_count")."\n"; $content .= "\n"; $content .= "\n\n"; + $separator = $selattrdef->getValueSetSeparator(); foreach($res['frequencies'][$type] as $entry) { $value = $selattrdef->parseValue($entry['value']); $content .= ""; - $content .= "".implode(';', $value).""; - $content .= "getID()."]=".$entry['value']."\">".urlencode($entry['c']).""; + $content .= "".htmlspecialchars(implode(''.($separator ? ' '.$separator.' ' : ' ; ').'', $value)).""; + $content .= "getID()."]=".urlencode($entry['value'])."\">".urlencode($entry['c']).""; $content .= ""; /* various checks, if the value is valid */ if(!$selattrdef->validate($entry['value'])) { @@ -99,6 +101,15 @@ $(document).ready( function() { } */ $content .= ""; + $content .= ""; + $content .= "
"; + if($user->isAdmin()) { + $content .= $this->printDeleteAttributeValueButton($selattrdef, implode(';', $value), 'splash_rm_attr_value', true); + } else { + $content .= ''; + } + $content .= "
"; + $content .= ""; $content .= ""; } $content .= ""; diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 41aa60f32..814bbc988 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1842,6 +1842,86 @@ $(document).ready( function() { getID().'" msg="'.getMLText($msg).'" attrvalue="'.htmlspecialchars($value, ENT_QUOTES).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_attr_value", array ("attrdefname" => $attrdef->getName())), ENT_QUOTES).'">'; + if($return) + return $content; + else + echo $content; + return ''; + } /* }}} */ + + function printDeleteAttributeValueButtonJs(){ /* {{{ */ + echo " + $(document).ready(function () { +// $('.delete-attribute-value-btn').click(function(ev) { + $('body').on('click', 'a.delete-attribute-value-btn', function(ev){ + id = $(ev.currentTarget).attr('rel'); + confirmmsg = $(ev.currentTarget).attr('confirmmsg'); + attrvalue = $(ev.currentTarget).attr('attrvalue'); + msg = $(ev.currentTarget).attr('msg'); + formtoken = '".createFormKey('removeattrvalue')."'; + bootbox.dialog(confirmmsg, [{ + \"label\" : \" ".getMLText("rm_attr_value")."\", + \"class\" : \"btn-danger\", + \"callback\": function() { + $.post('../op/op.AttributeMgr.php', + { action: 'removeattrvalue', attrdefid: id, attrvalue: attrvalue, formtoken: formtoken }, + function(data) { + if(data.success) { + $('#table-row-attrvalue-'+id).hide('slow'); + noty({ + text: msg, + type: 'success', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + } else { + noty({ + text: data.message, + type: 'error', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 3500, + }); + } + }, + 'json' + ); + } + }, { + \"label\" : \"".getMLText("cancel")."\", + \"class\" : \"btn-cancel\", + \"callback\": function() { + } + }]); + }); + }); + "; + } /* }}} */ + /** * Return HTML of a single row in the document list table *