Inclusi sprite e css icone
Modifiche all'helper di datatables per permettere la creazione al volo dei bottoni nell'area superiore della tabella
@@ -60,7 +60,31 @@ class DatatablesHelper {
|
||||
}
|
||||
|
||||
public static function generateTable($backendPage, array $columns, array $htmlOpts = array()){
|
||||
$tabId = "datatable_".self::$instCount++;
|
||||
$tabId = "datatable_".self::$instCount;
|
||||
$toolbarClass = "toolbar_".self::$instCount++;
|
||||
|
||||
$buttonDiv = "";
|
||||
$buttonJS = "";
|
||||
$useButtons = false;
|
||||
if (array_key_exists("buttons",$htmlOpts) && is_array($htmlOpts["buttons"]) && sizeof($htmlOpts["buttons"])>0){
|
||||
$useButtons = true;
|
||||
$i = 0;
|
||||
foreach ($htmlOpts["buttons"] as $buttonData){
|
||||
$buttonDiv.='<span id="'.$tabId."btn".$i.'" class="'.$buttonData["icon"].'" > </span>';
|
||||
$buttonJs.='$("#'.$tabId."btn".$i.'").click(function(){'.
|
||||
'if ($("tr.selected").length>0){'.
|
||||
'var useForm = $("div.' . $toolbarClass . ' form");'.
|
||||
'useForm.attr("action","'.$buttonData["page"].'").find("input").val($("tr.selected td:last-child").html());'.
|
||||
'useForm.submit();'.
|
||||
'}'.
|
||||
'});';
|
||||
}
|
||||
$buttonDiv.='<form action="" style="display:none;"><input type="hidden" name="id" value=""/></form>';
|
||||
}
|
||||
|
||||
|
||||
$columns[] = array("label"=>"id","data"=>"id");
|
||||
|
||||
$colLabels = "<tr>";
|
||||
$jsCols = array();
|
||||
foreach ($columns as $col){
|
||||
@@ -70,23 +94,46 @@ class DatatablesHelper {
|
||||
}
|
||||
$colLabels.= '</tr>';
|
||||
|
||||
echo '<table id="'.$tabId.'"><thead>'.$colLabels.'</thead><tfoot>'.$colLabels.'</tfoot></table>';
|
||||
echo '<table id="'.$tabId.'"><thead>'.$colLabels.'</thead><tfoot>'.$colLabels.'</tfoot><tbody></tbody></table>';
|
||||
|
||||
echo '<script type="text/javascript">'."\n".
|
||||
'$(document).ready(function(){$("#'.$tabId.'").DataTable({'."\n".
|
||||
'"language": {"url": "'.GUIHandler::getJavascriptsUrl().'datatables.ita.lang"},'."\n".
|
||||
'"processing": true,'."\n".
|
||||
'"serverSide": true,'."\n".
|
||||
'"ajax": {'."\n".
|
||||
'"url": "'.GUIHandler::getBaseUrl().'admin/tablesBackends/'.$backendPage.'",'."\n".
|
||||
'"type": "POST"'."\n".
|
||||
'},'."\n".
|
||||
'"columns": ['. implode(",", $jsCols) . ']});'."\n".
|
||||
'});'."\n".
|
||||
'</script>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var dTab = $("#<?php echo $tabId;?>").DataTable({
|
||||
<?php echo ($useButtons)?'"dom":"<\''.$toolbarClass.'\'>frtip",'."\n":"";?>
|
||||
"language": {"url": "<?php echo GUIHandler::getJavascriptsUrl();?>datatables.ita.lang"},
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"ajax": {
|
||||
"url": "<?php echo GUIHandler::getBaseUrl();?>admin/tablesBackends/<?php echo $backendPage; ?>",
|
||||
"type": "POST"
|
||||
},
|
||||
"columns": [ <?php echo implode(",", $jsCols);?> ],
|
||||
"initComplete": function () {
|
||||
$("div.<?php echo $toolbarClass;?>").html('<?php echo $buttonDiv;?>');
|
||||
<?php echo $buttonJs;?>
|
||||
},
|
||||
"columnDefs": [
|
||||
{"className":"hidden","targets":[<?php echo sizeof($columns)-1;?>]}
|
||||
]
|
||||
});
|
||||
$('#<?php echo $tabId;?> tbody').on( 'click', 'tr', function () {
|
||||
if ( $(this).hasClass('selected') ) {
|
||||
$(this).removeClass('selected');
|
||||
}
|
||||
else {
|
||||
dTab.$('tr.selected').removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$details = array();
|
||||
$details["toolbarClass"] = $toolbarClass;
|
||||
$details["tableId"] = $tabId;
|
||||
return $details;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ GUIHandler::addStylesheet(GUIHandler::STYLESHEET_ADMIN, "admin.css");
|
||||
|
||||
GUIHandler::addStylesheet(GUIHandler::STYLESHEET_ADMIN, "datatables.css");
|
||||
|
||||
GUIHandler::addStylesheet(GUIHandler::STYLESHEET_ADMIN, "icons.css");
|
||||
|
||||
|
||||
GUIHandler::addJavascriptLib(GUIHandler::JAVASCRIPT_ADMIN, "jquery.js");
|
||||
|
||||
|
||||
@@ -60,4 +60,14 @@ echo '<body class="white">';
|
||||
</div>
|
||||
</div>
|
||||
<div class="pageClosure"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#pass_fld').keypress(function(event) {
|
||||
if (event.which==13){
|
||||
$('#loginformdiv form').submit();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -19,15 +19,24 @@ MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Sottotitolo","data"=>"sottotitolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
array("label"=>"Data","data"=>"about.data")
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Sottotitolo","data"=>"sottotitolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
array("label"=>"Data","data"=>"about.data")
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-big-blue icon-edit","page"=>"editNotizia.php")
|
||||
);
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
DatatablesHelper::generateTable("notiziaTableBackend.php",$columns);
|
||||
$details = DatatablesHelper::generateTable("notiziaTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("div.<?php echo $details["toolbarClass"];?>").html('<b>Custom tool bar! Text/images etc.</b>');
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -41,7 +41,8 @@ $permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR;
|
||||
$exposedFields = array(
|
||||
"titolo"=>null,
|
||||
"sottotitolo"=>null,
|
||||
"about"=>null
|
||||
"about"=>null,
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields);
|
||||
|
||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -1,5 +1,7 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
.hidden{display:none;}
|
||||
|
||||
#admin_menu{position:fixed; left:0; top:0; bottom:0; width:300px; background-color:#393939; display:inline-block;}
|
||||
|
||||
#admin_menu ul{list-style: none; width:100%; border:0; margin:0; padding:0;}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
.icon-small-blue{display:block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_blue.png");background-repeat:no-repeat;}
|
||||
.icon-small-grey{display:block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_grey.png");background-repeat:no-repeat;}
|
||||
.icon-small-white{display:block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_white.png");background-repeat:no-repeat;}
|
||||
|
||||
.icon-medium-blue{display:block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_blue.png");background-repeat:no-repeat;}
|
||||
.icon-medium-grey{display:block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_grey.png");background-repeat:no-repeat;}
|
||||
.icon-medium-white{display:block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_white.png");background-repeat:no-repeat;}
|
||||
|
||||
.icon-big-blue{display:block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_blue.png");background-repeat:no-repeat;}
|
||||
.icon-big-grey{display:block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_grey.png");background-repeat:no-repeat;}
|
||||
.icon-big-white{display:block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_white.png");background-repeat:no-repeat;}
|
||||
|
||||
/* BIG */
|
||||
.icon-view{background-position:0px 0px;}
|
||||
.icon-edit{background-position:-50px 0px;}
|
||||
.icon-delete{background-position:-100px 0px;}
|
||||
.icon-prevbig{background-position:-150px 0px;}
|
||||
.icon-nextbig{background-position:-200px 0px;}
|
||||
.icon-emailbig{background-position:-250px 0px;}
|
||||
.icon-exportbig{background-position:-300px 0px;}
|
||||
.icon-formhome{background-position:-350px 0px;}
|
||||
|
||||
|
||||
.icon-profile{background-position:0px -50px;}
|
||||
.icon-editprofile{background-position:-50px -50px;}
|
||||
.icon-uploadphoto{background-position:-100px -50px;}
|
||||
.icon-password{background-position:-150px -50px;}
|
||||
.icon-changeemail{background-position:-200px -50px;}
|
||||
.icon-sendemail{background-position:-250px -50px;}
|
||||
.icon-options{background-position:-300px -50px;}
|
||||
.icon-editform{background-position:-350px -50px;}
|
||||
|
||||
|
||||
.icon-antennabig{background-position:0px -100px;}
|
||||
.icon-picturebig{background-position:-50px -100px;}
|
||||
.icon-badgebig{background-position:-100px -100px;}
|
||||
.icon-webcambig{background-position:-150px -100px;}
|
||||
.icon-doorbig{background-position:-200px -100px;}
|
||||
.icon-mirinobig{background-position:-250px -100px;}
|
||||
.icon-doorfrecciabig{background-position:-300px -100px;}
|
||||
.icon-evets{background-position:-350px -100px;}
|
||||
|
||||
.icon-emailevent{background-position:0px -150px;}
|
||||
.icon-lockbig{background-position:-50px -150px;}
|
||||
.icon-profilelockbig{background-position:-100px -150px;}
|
||||
.icon-linkbig{background-position:-150px -150px;}
|
||||
|
||||
|
||||
/* MEDIUM */
|
||||
.icon-camera{background-position:0px 0px;}
|
||||
.icon-list{background-position:-38px 0px;}
|
||||
.icon-add{background-position:-76px 0px;}
|
||||
.icon-filters{background-position:-114px 0px;}
|
||||
.icon-export{background-position:-152px 0px;}
|
||||
.icon-search{background-position:-190px 0px;}
|
||||
.icon-home{background-position:-227px 0px;}
|
||||
.icon-editmed{background-position:-266px 0px;}
|
||||
|
||||
.icon-prevcol{background-position:0px -38px;}
|
||||
.icon-nextcol{background-position:-38px -38px;}
|
||||
.icon-firstcol{background-position:-76px -38px;}
|
||||
.icon-lastcol{background-position:-114px -38px;}
|
||||
.icon-return{background-position:-152px -38px;}
|
||||
.icon-emailmed{background-position:-190px -38px;}
|
||||
.icon-exportmed{background-position:-228px -38px;}
|
||||
.icon-antenna{background-position:-266px -38px;}
|
||||
|
||||
.icon-prev{background-position:0px -76px;}
|
||||
.icon-next{background-position:-38px -76px;}
|
||||
.icon-up{background-position:-76px -76px;}
|
||||
.icon-down{background-position:-114px -76px;}
|
||||
.icon-bigfont{background-position:-152px -76px;}
|
||||
.icon-image{background-position:-190px -76px;}
|
||||
.icon-badge{background-position:-228px -76px;}
|
||||
.icon-webcam{background-position:-266px -76px;}
|
||||
|
||||
.icon-doormed{background-position:0px -114px;}
|
||||
.icon-mirinomed{background-position:-38px -114px;}
|
||||
.icon-doorfrecciamed{background-position:-76px -114px;}
|
||||
.icon-remove{background-position:-114px -114px;}
|
||||
.icon-profilelockmed{background-position:-152px -114px;}
|
||||
.icon-viewmed{background-position:-190px -114px;}
|
||||
.icon-emaileventmed{background-position:-228px -114px;}
|
||||
.icon-linkmed{background-position:-266px -114px;}
|
||||
|
||||
.icon-lockmed{background-position:0px -152px;}
|
||||
.icon-statsmed{background-position:-38px -152px;}
|
||||
|
||||
|
||||
/* SMALL */
|
||||
.icon-smallfont{background-position:0px 0px;}
|
||||
.icon-readall{background-position:-33px -6px;height:15px;width:15px;}
|
||||
.icon-close{background-position:-54px 0px;}
|
||||
.icon-voce{background-position:-81px 0px;}
|
||||
.icon-sottovoce{background-position:-108px 0px;}
|
||||
.icon-editcelle{background-position:-135px 0px;}
|
||||
.icon-addsmall{background-position:-162px 0px;}
|
||||
.icon-removesmall{background-position:-189px 0px;}
|
||||
|
||||
.icon-more{background-position:0px -27px;}
|
||||
.icon-moresel{background-position:-27px -27px;}
|
||||
.icon-top{background-position:-54px -27px;}
|
||||
.icon-first{background-position:-81px -27px;}
|
||||
.icon-last{background-position:-108px -27px;}
|
||||
.icon-prevsmall{background-position:-135px -27px;}
|
||||
.icon-nextsmall{background-position:-162px -27px;}
|
||||
.icon-open{background-position:-189px -27px;}
|
||||