mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 05:31:42 +00:00
add printSelectPresetButton[Html|Js]()
button for preseting options is a select box
This commit is contained in:
parent
bdf4741186
commit
8daa5dadea
|
@ -1612,6 +1612,45 @@ $(function() {
|
||||||
return '';
|
return '';
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output left-arrow with link which takes over a number of ids into
|
||||||
|
* a select box.
|
||||||
|
*
|
||||||
|
* Clicking in the button will preset the comma seperated list of ids
|
||||||
|
* in data-ref as options in the select box with name $name
|
||||||
|
*
|
||||||
|
* @param string $name id of select box
|
||||||
|
* @param array $ids list of option values
|
||||||
|
*/
|
||||||
|
function printSelectPresetButtonHtml($name, $ids) { /* {{{ */
|
||||||
|
?>
|
||||||
|
<span id="<?php echo $name; ?>_btn" class="selectpreset_btn" style="cursor: pointer;" title="<?php printMLText("takeOver".$name); ?>" data-ref="<?php echo $name; ?>" data-ids="<?php echo implode(",", $ids);?>"><i class="icon-arrow-left"></i></span>
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Javascript code for select preset button
|
||||||
|
*/
|
||||||
|
function printSelectPresetButtonJs() { /* {{{ */
|
||||||
|
?>
|
||||||
|
$(document).ready( function() {
|
||||||
|
$('.selectpreset_btn').click(function(ev){
|
||||||
|
ev.preventDefault();
|
||||||
|
if (typeof $(ev.currentTarget).data('ids') != 'undefined') {
|
||||||
|
target = $(ev.currentTarget).data('ref');
|
||||||
|
// Use attr() instead of data() because data() converts to int which cannot be split
|
||||||
|
items = $(ev.currentTarget).attr('data-ids');
|
||||||
|
arr = items.split(",");
|
||||||
|
for(var i in arr) {
|
||||||
|
$("#"+target+" option[value='"+arr[i]+"']").attr("selected", "selected");
|
||||||
|
}
|
||||||
|
$("#"+target).trigger("chosen:updated");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML of a single row in the document list table
|
* Return HTML of a single row in the document list table
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,30 +31,12 @@ require_once("class.Bootstrap.php");
|
||||||
*/
|
*/
|
||||||
class SeedDMS_View_UpdateDocument extends SeedDMS_Bootstrap_Style {
|
class SeedDMS_View_UpdateDocument extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
function __takeOverButton($name, $users) { /* {{{ */
|
|
||||||
?>
|
|
||||||
<span id="<?php echo $name; ?>_btn" style="cursor: pointer;" title="<?php printMLText("takeOver".$name); ?>"><i class="icon-arrow-left"></i></span>
|
|
||||||
<script>
|
|
||||||
$(document).ready( function() {
|
|
||||||
$('#<?php echo $name; ?>_btn').click(function(ev){
|
|
||||||
ev.preventDefault();
|
|
||||||
<?php
|
|
||||||
foreach($users as $_id) {
|
|
||||||
echo "$(\"#".$name." option[value='".$_id."']\").attr(\"selected\", \"selected\");\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
$("#<?php echo $name; ?>").trigger("chosen:updated");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
function js() { /* {{{ */
|
function js() { /* {{{ */
|
||||||
$strictformcheck = $this->params['strictformcheck'];
|
$strictformcheck = $this->params['strictformcheck'];
|
||||||
$dropfolderdir = $this->params['dropfolderdir'];
|
$dropfolderdir = $this->params['dropfolderdir'];
|
||||||
header('Content-Type: application/javascript');
|
header('Content-Type: application/javascript');
|
||||||
$this->printDropFolderChooserJs("form1");
|
$this->printDropFolderChooserJs("form1");
|
||||||
|
$this->printSelectPresetButtonJs();
|
||||||
?>
|
?>
|
||||||
function checkForm()
|
function checkForm()
|
||||||
{
|
{
|
||||||
|
@ -263,7 +245,7 @@ $(document).ready( function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($tmp) {
|
if($tmp) {
|
||||||
$this->__takeOverButton("IndReviewer", $tmp);
|
$this->printSelectPresetButtonHtml("IndReviewer", $tmp);
|
||||||
}
|
}
|
||||||
/* List all mandatory reviewers */
|
/* List all mandatory reviewers */
|
||||||
if($res) {
|
if($res) {
|
||||||
|
@ -332,7 +314,7 @@ $(document).ready( function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($tmp) {
|
if($tmp) {
|
||||||
$this->__takeOverButton("GrpReviewer", $tmp);
|
$this->printSelectPresetButtonHtml("GrpReviewer", $tmp);
|
||||||
}
|
}
|
||||||
/* List all mandatory groups of reviewers */
|
/* List all mandatory groups of reviewers */
|
||||||
if($res) {
|
if($res) {
|
||||||
|
@ -410,7 +392,7 @@ $(document).ready( function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($tmp) {
|
if($tmp) {
|
||||||
$this->__takeOverButton("IndApprover", $tmp);
|
$this->printSelectPresetButtonHtml("IndApprover", $tmp);
|
||||||
}
|
}
|
||||||
/* List all mandatory approvers */
|
/* List all mandatory approvers */
|
||||||
if($res) {
|
if($res) {
|
||||||
|
@ -480,7 +462,7 @@ $(document).ready( function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($tmp) {
|
if($tmp) {
|
||||||
$this->__takeOverButton("GrpApprover", $tmp);
|
$this->printSelectPresetButtonHtml("GrpApprover", $tmp);
|
||||||
}
|
}
|
||||||
/* List all mandatory groups of approvers */
|
/* List all mandatory groups of approvers */
|
||||||
if($res) {
|
if($res) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user