Files
crm.e5.pl/modules/EcmDocuments/DirsOrder.php
2024-04-27 09:23:34 +02:00

117 lines
3.0 KiB
PHP
Executable File

<?
$z="select id from ecmdocuments where iddir='".$_REQUEST['record']."' and deleted='0'";
$w=mysql_query($z);
$ile=mysql_num_rows($w);
?>
<script type="text/javascript">
function SendBoxes()
{
var boxes = new Array();
var child = document.getElementById("container").childNodes; // tablica elementów w kontenerze
for(var i = 0; i < child.length; i++) {
boxes.push(child[i].id); // dodajemy numer kolejnego box-u do tablicy "boxes"
}
var req = mint.Request();
//req.AddParam("boxes", boxes.toString()); // funkcja toString() zwraca liste elementów w tablicy(czyli w tym przypadku numerów) oddzielonych przecinkami, parametr "boxes" bedzie wiec zawieral wartosci typu 0,2,5,3,... itd
req.Send("modules/EcmDocuments/SaveDirsOrder.php?record=<?print $_REQUEST['record'];?>&boxes="+boxes.toString(),"boxy");
return true;
}
function OnLoadMint()
{
<?
$z="select id from ecmdocuments where iddir='".$_REQUEST['record']."' and deleted='0' order by no asc";
$w=mysql_query($z);
while($r=mysql_fetch_array($w))
{
print 'var box =mint.gui.RegisterDragObject("'.$r['id'].'");
box.SetBBox("container");';
}
?>
var zone = mint.gui.RegisterDropZone("container");
}
</script>
<style type="text/css">
.box
{
width: 375px;
height: 15px;
clear: none;
float: left;
cursor: move;
margin: 2px;
font: 10px Verdana;
text-align: center;
border: 1px solid Black;
background-color: #E6E6E6;
}
#container
{
width: 380px;
height: <?print 15*$ile+6*($ile);?>px;
clear: none;
float: left;
margin: 2px;
padding: 4px;
}
</style>
<body onLoad="OnLoadMint();">
<table width='100%' cellpadding='0' cellspacing='0' border='0' class='moduleTitle'><tr><td valign='top'>
</td><td width='100%'><h2>Set Dirs Order:
<?
$z="select name from ecmdocuments where id='".$_REQUEST['record']."'";
$w=mysql_query($z);
$r=mysql_fetch_array($w);
print "&nbsp;".$r['name'];
?>
</h2></td>
</tr></table>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="padding-bottom: 2px;">
<input type="button" onClick="if(SendBoxes()){document.location.href='index.php?module=EcmDocuments&action=DirsOrder&record=<?print $_REQUEST['record'];?>';}" value="Save" class="button">
</td>
</tr>
</table>
<br>
<div id="boxy"></div>
<p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td class="dataLabel">
<div id="container">
<?
$z="select id,name,no from ecmdocuments where iddir='".$_REQUEST['record']."' and deleted='0' order by no asc";
$w=mysql_query($z);
while($r=mysql_fetch_array($w))
{
print '<div id="'.$r['id'].'" class="box" style="width: 375px;
height: 15px;
clear: none;
float: left;
cursor: move;
margin: 2px;
font: 10px Verdana;
text-align: center;
border: 1px solid Black;
background-color: #E6E6E6;">'.$r['no'].'.'.$r['name'].'</div>';
}
?>
</div>
</td>
</tr>
</table>
</body>