Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodesettingschanges #53

Merged
merged 6 commits into from
May 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions globals/language/greek.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
'services_categories' => "Κατηγορίες υπηρεσίων",
'services_categories_add' => "Προσθήκη κατηγορίας υπηρεσίων",
'services_categories_edit' => "Επεξεργασία κατηγορίας υπηρεσίων",

'nodesettingschanges_add' => "Προσθήκη αλλαγής στο αρχείο καταγραφής για τον κόμβο αυτό",
'nodesettingschanges' => "Αρχείο αλλαγών",
'user_add' => "Εγγραφή νέου χρήστη",
'user_edit' => "Προφίλ χρήστη",
'node' => "Κόμβος",
Expand Down Expand Up @@ -380,6 +381,15 @@
'nodes_services__protocol-udp' => 'UDP',
'nodes_services__port' => 'Πόρτα',

'nodesettingschanges__entryid' => 'entry',
'nodesettingschanges__nodeid' => 'nodeid',
'nodesettingschanges__uid' => 'uid',
'nodesettingschanges__changemenu' => 'Τομέας αλλαγής',
'nodesettingschanges__changemade' => 'Τελευταία αλλαγή',
'nodesettingschanges__reason' => 'Αιτιολογία τροποποίησης',
'nodesettingschanges__comment' => 'Σχόλιο',
'nodesettingschanges__dateline' => 'Ημερομηνία ώρα',

'photos__date_in' => 'Ημερομηνία',
'photos__view_point' => 'Κατεύθυνση',
'photos__view_point-N' => 'Βόρεια',
Expand Down Expand Up @@ -685,7 +695,18 @@
'title' => 'Επεξεργασία υπηρεσίας',
'body' => 'Στη σελίδα αυτή μπορείτε να επεξεργαστείτε μία υπηρεσία του κόμβου σας. Το πεδίο Διεύθυνση IP περιέχει όλες τις διευθύνσεις που έχετε δηλώσει και πρέπει να καθορίζει την IP στην οποία τρέχει (ακούει) η υπηρεσία. Το πεδίο URL, πρέπει να περιέχει το link για την υπηρεσία ή το link για κάποια σελίδα που αναφέρεται στην υπηρεσία. Τέλος τα πεδία Πρωτόκολλο και Πόρτα, πρέπει να αναφέρονται στο πρωτόκολλο που χρησιμοποιεί η υπηρεσία (π.χ. tcp, udp) και στην πόρτα που ακούει.'
),

'node_editor_nodesettingschanges_add' => array(
'title' => 'Προσθήκη αλλαγής στο αρχείο καταγραφής',
'body' => 'Στη σελίδα αυτή μπορείτε να προσθέσετε μία αλλαγή που κάνατε στις ρυθμίσεις του κόμβου αυτό. Οι συνδιαχειριστές σας πρέπει να είναι ενήμεροι για τις αλλαγές που γίνονται.'
),
'node_editor_nodesettingschanges' => array(
'title' => 'Προσθήκη αλλαγής στο αρχείο καταγραφής',
'body' => '1Στη σελίδα αυτή μπορείτε να προσθέσετε μία αλλαγή που κάνατε στις ρυθμίσεις του κόμβου αυτό. Οι συνδιαχειριστές σας πρέπει να είναι ενήμεροι για τις αλλαγές που γίνονται.'
),
'nodesettingschanges' => array(
'title' => 'Προσθήκη αλλαγής στο αρχείο καταγραφής',
'body' => '2Στη σελίδα αυτή μπορείτε να προσθέσετε μία αλλαγή που κάνατε στις ρυθμίσεις του κόμβου αυτό. Οι συνδιαχειριστές σας πρέπει να είναι ενήμεροι για τις αλλαγές που γίνονται.'
),
'nodes_search' => array(
'title' => 'Κόμβοι δικτύου',
'body' => 'Στη σελίδα αυτή μπορείτε να αναζητήσετε κόμβους του δικτύου με βάση τα πεδία που προσφέρονται. Τα αποτελέσματα εμφανίζονται στον παρακάτω πίνακα. Επίσης, μπορείτε να διαλέξετε κάποιον κόμβο για προβολή των στοιχείων του.'
Expand Down
781 changes: 781 additions & 0 deletions globals/language/modified/greek.php

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions includes/pages/node_editor/node_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,28 @@ function table_services() {
return $table_services;
}

function table_nodesettingschanges() {
global $construct, $db, $main;
$table_nodesettingschanges = new table(array('TABLE_NAME' => 'table_nodesettingschanges', 'FORM_NAME' => 'table_nodesettingschanges'));
$table_nodesettingschanges->db_data(
'nodesettingschanges.changemenu, nodesettingschanges.changemade, nodesettingschanges.reason, nodesettingschanges.comment, nodesettingschanges.dateline, users.username',
'nodesettingschanges
INNER JOIN users on nodesettingschanges.uid = users.id',
"nodesettingschanges.nodeid = '".get('node')."'",
'',
"nodesettingschanges.entryid DESC");

for($i=1;$i<count($table_nodesettingschanges->data);$i++) {
if (isset($table_nodesettingschanges->data[$i])) {
#$table_actionlog->data[$i]['ip_start'] = long2ip($table_actionlog->data[$i]['ip_start']);
#$table_actionlog->data[$i]['ip_end'] = long2ip($table_actionlog->data[$i]['ip_end']);
#$table_actionlog->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "actionlog", "area" => $table_actionlog->data[$i]['id']));
}
}

return $table_nodesettingschanges;
}

function table_photosview() {
global $db, $vars;
$table_photosview = new table(array('TABLE_NAME' => 'table_photosview', 'FORM_NAME' => 'table_photosview'));
Expand Down Expand Up @@ -407,6 +429,7 @@ function output() {
$this->tpl['table_subnets'] = $construct->table($this->table_subnets(), __FILE__);
$this->tpl['table_ipaddr'] = $construct->table($this->table_ipaddr(), __FILE__);
$this->tpl['table_services'] = $construct->table($this->table_services(), __FILE__);
$this->tpl['table_nodesettingschanges'] = $construct->table($this->table_nodesettingschanges(), __FILE__);
$this->tpl['table_photosview'] = $construct->table($this->table_photosview(), __FILE__);
if ($this->has_owner_access())
$this->tpl['link_node_delete'] = self_ref(array('action' => 'delete'));
Expand All @@ -420,6 +443,7 @@ function output() {
$this->tpl['link_subnet_add'] = make_ref('/node_editor/subnet', array('node' => get('node'), 'subnet' => 'add'));
$this->tpl['link_ipaddr_add'] = make_ref('node_editor/ipaddr', array('node' => get('node'), 'ipaddr' => 'add'));
$this->tpl['link_services_add'] = make_ref('/node_editor/services', array('node' => get('node'), 'service' => 'add'));
$this->tpl['link_nodesettingschanges_add'] = make_ref('/node_editor/nodesettingschanges', array('node' => get('node'), 'nodesettingschanges' => 'add'));

}
$this->tpl['link_map_pickup'] = make_ref('/pickup/map', array("object_lat" => "form_node.elements['nodes__latitude']", "object_lon" => "form_node.elements['nodes__longitude']"));
Expand Down
79 changes: 79 additions & 0 deletions includes/pages/node_editor/node_editor_nodesettingschanges.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/*
* WiND - Wireless Nodes Database
*
* Copyright (C) 2012 Leonidas Papadopoulos <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have stopped using per-user Copyrights.
You should put your name in AUTHORS.txt and for each new file that you make you should add

 * Copyright (C) 2005-2014  by WiND Contributors (see AUTHORS.txt)

*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 dated June, 1991.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using GPLv3 not v2 license. Check another existing file and copy/paste


class node_editor_nodesettingschanges {

var $tpl;
function __construct() {

}

function node_editor_nodesettingschanges() {

}

function form_nodesettingschanges() {
global $main, $db, $vars, $lang;
$form_nodesettingschanges = new form(array('FORM_NAME' => 'form_nodesettingschanges'));

$form_nodesettingschanges->db_data('nodesettingschanges.uid, nodesettingschanges.nodeid, nodesettingschanges.dateline,
nodesettingschanges.changemade, nodesettingschanges.changemenu, nodesettingschanges.reason, nodesettingschanges.comment');
$form_nodesettingschanges->data[1]['value']= intval(get('node'));
$uid=$main->userdata->user;
$form_nodesettingschanges->data[0]['value']= $uid;
$form_nodesettingschanges->data[2]['value']= date("Y-m-d H:i:s");

return $form_nodesettingschanges;
}

function output() {
if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_'.$_POST['form_name'])) return call_user_func(array($this, 'output_onpost_'.$_POST['form_name']));
global $construct;
$this->tpl['nodesettingschanges_method'] = (get('nodesettingschange') == 'add' ? 'add' : 'edit' );
$this->tpl['form_nodesettingschanges'] = $construct->form($this->form_nodesettingschanges(), __FILE__);
return template($this->tpl, __FILE__);
}

function output_onpost_form_nodesettingschanges() {
global $construct, $main, $db;
$form_nodesettingschanges = $this->form_nodesettingschanges();
#$nameserver = get('nameserver');
#if (get('nameserver') == 'add') {
# $_POST['dns_nameservers__ip'] = ip2long($_POST['dns_nameservers__ip']);
#}
$f['node_id'] = intval(get('node'));
$ret = TRUE;
$ret = $form_nodesettingschanges->db_set(array(),
"nodesettingschanges", "entryid", $nodesettingschanges);
#$ret = $form_nameserver->db_set($f,
# "dns_nameservers", "id", $nameserver);

if ($ret) {
$main->message->set_fromlang('info', 'insert_success', make_ref('/node_editor', array("node" => $_POST['nodes_nodesetttingschanges__node_id'])));
#log_admin_action($nodes,"#nodesetttingschange#".get('node'),get('entryid'), "nodesetttingschanges", "insert_success");#@#
} else {
$main->message->set_fromlang('error', 'generic');
}
}

}

?>
2 changes: 1 addition & 1 deletion includes/pages/node_editor/node_editor_services.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function output_onpost_form_services() {
"nodes_services", "id", $service);

if ($ret) {
$main->message->set_fromlang('info', 'insert_success', make_ref('/node_editor', array("node" => $_POST['nodes_services__node_id'])));
$main->message->set_fromlang('info', 'insert_success', make_ref('/node_editor', array("node" => $_POST['nodes__node_id'])));
} else {
$main->message->set_fromlang('error', 'generic');
}
Expand Down
86 changes: 86 additions & 0 deletions includes/pages/nodechangeslog/nodechangeslog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/*
* WiND - Wireless Nodes Database
*
* Copyright (C) 2012 Leonidas Papadopoulos <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also replace this copyright

*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 dated June, 1991.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/

#if (get('log') != '') include_once(ROOT_PATH."includes/pages/admin/admin_nodechangeslog_log.php");

class nodechangeslog {

var $tpl;
var $page;

function admin_nodechangeslog() {
if (get('log') != '') {
$p = "nodechangeslog_log";
$this->page = new $p;
}
}

function table_nodechangeslog() {
global $construct, $db, $main;
$table_nodechangeslog = new table(array('FORM_NAME' => 'table_nodechangeslog', 'TABLE_NAME' => 'table_nodechangeslog'));
$table_nodechangeslog->db_data(
'nodesettingschanges.dateline, nodes.name, nodesettingschanges.changemenu, nodesettingschanges.changemade, users.username, nodesettingschanges.comment',
'nodesettingschanges INNER JOIN `users` ON `users`.`id` = `nodesettingschanges`.`uid` INNER JOIN `nodes` ON `nodes`.`id` = `nodesettingschanges`.`nodeid` ',
"",
"",
"nodesettingschanges.entryid DESC");
for($i=1;$i<count($table_nodechangeslog->data);$i++) {
if (isset($table_nodechangeslog->data[$i])) {
#$table_nodechangeslog->data[$i]['ip_start'] = long2ip($table_nodechangeslog->data[$i]['ip_start']);
#$table_nodechangeslog->data[$i]['ip_end'] = long2ip($table_nodechangeslog->data[$i]['ip_end']);
#$table_nodechangeslog->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "nodechangeslog", "area" => $table_nodechangeslog->data[$i]['id']));
}
}
#$table_nodechangeslog->info['EDIT_COLUMN'] = 'nodechangeslog__name';
$table_nodechangeslog->db_data_multichoice('dateline');
$table_nodechangeslog->info['MULTICHOICE_LABEL'] = '';
#$table_nodechangeslog->db_data_remove('id', 'uid');
return $table_nodechangeslog;
}

function output() {
if (get('log') != '') {
return $this->page->output();
} else {
if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_'.$_POST['form_name'])) return call_user_func(array($this, 'output_onpost_'.$_POST['form_name']));
global $construct;
#$this->tpl['link_area_add'] = makelink(array('page' => 'admin', 'subpage' => 'nodechangeslog', 'area' => 'add'));
$this->tpl['table_nodechangeslog'] = $construct->table($this->table_nodechangeslog(), __FILE__);
return template($this->tpl, __FILE__);
}
}

function output_onpost_table_nodechangeslog() {
global $db, $main;
$ret = TRUE;
foreach( (array) $_POST['id'] as $key => $value) {
$ret = $ret && $db->del("nodechangeslog", "id = '".$value."'");
}
if ($ret) {
#$main->message->set_fromlang('info', 'delete_success', makelink("",TRUE));
} else {
$main->message->set_fromlang('error', 'generic');
}
}

}

?>
15 changes: 15 additions & 0 deletions install/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,18 @@ CREATE TABLE IF NOT EXISTS `users_nodes` (
UNIQUE KEY `unique_keys` (`node_id`,`user_id`),
KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `nodesettingschanges` (
`entryid` int(10) NOT NULL AUTO_INCREMENT,
`nodeid` int(10) NOT NULL DEFAULT '0',
`uid` int(10) NOT NULL,
`dateline` varchar(30) DEFAULT NULL,
`changemade` text NOT NULL,
`changemenu` enum('routerOS version upgrade/downgrade','groups','users','other','script','ip firewall other','ip firewall nat','ip firewall filter','wireless','snmp','radius','partitions','ipv6','ppp','INTERFACE','driver','led','user','system','special-login','routing','queue','port','mpls','log','ip','file','HARDWARE','certificate') NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list should not be enum. This is something that can change often and should be easy configurable. This looks more like an application level predefined values.

`reason` enum('other','bug fix','critical-problem','imporovement','termination') NOT NULL,
`comment` text,
PRIMARY KEY (`entryid`,`nodeid`),
KEY `uid` (`uid`),
KEY `changemenu` (`changemenu`),
FULLTEXT KEY `changemade` (`changemade`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
7 changes: 7 additions & 0 deletions templates/basic/includes/pages/node_editor/node_editor.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<li><a href="#tab-network" data-toggle="tab">{$lang.network}</a></li>
<li><a href="#tab-services" data-toggle="tab">{$lang.services}</a></li>
<li><a href="#tab-myview" data-toggle="tab">{$lang.myview}</a></li>
<li><a href="#tab-nodesettingschanges" data-toggle="tab">{$lang.nodesettingschanges}</a></li>
{/if}
</ul>

Expand Down Expand Up @@ -96,6 +97,12 @@
<div class="tab-pane" id="tab-myview">
{include file=generic/section-level3.tpl title="`$lang.myview`" content=$table_photosview}
</div>
<div class="tab-pane" id="tab-nodesettingschanges">
{include assign="btn_add" file="generic/button.tpl" href=$link_nodesettingschanges_add content="`$lang.nodesettingschanges_add`"
class="btn-success btn-sm" glyph="plus-sign"}
{include file=generic/section-level3.tpl title="`$lang.nodesettingschanges`" buttons="`$btn_add`" content=$table_nodesettingschanges}
</div>

{/if}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{*
* WiND - Wireless Nodes Database
* Basic HTML Template
*
* Copyright (C) 2005 Konstantinos Papadimitriou <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 dated June, 1991.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*}

{include assign=help file=generic/help.tpl help="node_editor_nodesettingschanges_`$nodesettingschanges_method`"}
{assign var=t value="nodesettingschanges_`$nodesettingschanges_method`"}
{include file=generic/page-title.tpl title="`$lang.$t`" right="$help"}
{$form_nodesettingschanges}
Loading