Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.
Open
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/media/*
/media/filemanager/*
/conf/sysconf.php
/www/images/uploads
/www/images/uploads
/usr
/etc
1 change: 1 addition & 0 deletions data/SupportingDocsMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SupportingDocsMeta extends DomainEntity{
public $type;
public $language;
public $subject;
public $url;



Expand Down
64 changes: 32 additions & 32 deletions inc/lib_form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
*
*
*
* @package moduleAPI
* @subpackage form
* @subpackage form
* @author Chamindra de Silva (chamindra@opensource.lk>
* @author Janaka Wickramasinghe <janaka@opensource.lk>
* @author Ravindra De Silva <ravindra@opensource.lk><http://r4vi.org>
Expand Down Expand Up @@ -223,11 +223,11 @@ function shn_form_text($label, $name, $extra_opts) {
if (get_magic_quotes_gpc())
$value = stripslashes($value);
if ($extra_opts['no_label'] !== true && isset($label)) {
?>
?>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<?php
}
?>
?>
<div class="controls">
<input title="<?php echo $name ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" <?php echo $readonly ?> value="<?php echo htmlentities($value,ENT_QUOTES, "UTF-8") ?>" tabindex="<?php echo++$shn_tabindex ?>" <?php echo $text_options ?> />
<?php
Expand Down Expand Up @@ -533,7 +533,7 @@ function shn_form_user_select_mlt($label, $name, $extra_opts) {

$data_array = Browse::getUserListAll();
$size = count($data_array);

for ($i = 0; $i < $size; $i++) {
$fullname = $data_array[$i]['first_name'] . " " . $data_array[$i]['last_name'];
$fullname = trim($fullname);
Expand Down Expand Up @@ -663,11 +663,11 @@ function shn_form_mt_select_mlt($label, $name, $extra_opts) {
}

/**
* shn_form_radio print out radio options
*
* @param mixed $label
* @param mixed $name
* @param mixed $extra_opts
* shn_form_radio print out radio options
*
* @param mixed $label
* @param mixed $name
* @param mixed $extra_opts
* @access public
* @return void
*/
Expand Down Expand Up @@ -749,8 +749,8 @@ function _shn_form_mt_tree($label, $name, $extra_opts, $multiple = false) {
$width = 400;
}
?>
<select class="mt-tree input-large" title="<?php echo $name ?>" <?php if ($width) echo 'data-width="' . $width . '"'; ?>
onchange="<?php echo $extra_opts['onchange'] ?>"
<select class="mt-tree input-large" title="<?php echo $name ?>" <?php if ($width) echo 'data-width="' . $width . '"'; ?>
onchange="<?php echo $extra_opts['onchange'] ?>"
name="<?php echo $name ?><?php if ($multiple) echo'[]'; ?>" id="<?php echo $name ?>"
<?php echo $select_opts ?> tabindex="<?php echo++$shn_tabindex ?>"
<?php if ($multiple) echo ' multiple="multiple"'; ?> >
Expand Down Expand Up @@ -799,15 +799,15 @@ function _shn_form_mt_tree($label, $name, $extra_opts, $multiple = false) {
}
}
?>
$("#<?php echo $name ?>").on("change", function(event) {
$("#<?php echo $name ?>").on("change", function(event) {
var visibility_fields = <?php echo json_encode($visibility_field) ?>;
val = $(this).val()
values = val;
if(!$.isArray(val)){
values = new Array(val);
}
for(val2 in visibility_fields){

if($.inArray(val2,values)<0){
for(i in visibility_fields[val2]){
$("#"+visibility_fields[val2][i]+"_group").show();
Expand All @@ -816,7 +816,7 @@ function _shn_form_mt_tree($label, $name, $extra_opts, $multiple = false) {
}
for(j in values){
val = values[j]

if(visibility_fields.hasOwnProperty(val)){
for(i in visibility_fields[val]){
$("#"+visibility_fields[val][i]+"_group").hide();
Expand Down Expand Up @@ -1004,11 +1004,11 @@ function shn_form_related_victim($label, $name, $extra_opts) {
if (get_magic_quotes_gpc())
$value = stripslashes($value);
if ($extra_opts['no_label'] !== true && isset($label)) {
?>
?>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<?php
}
?>
?>
<div class="controls">
<input type="text" readonly="readonly" value="<?php echo $person_name ?>"/>
<input type="hidden" name="<?php echo $name ?>" id="<?php echo $name ?>" readonly="true" value="<?php echo $value ?>"/>
Expand Down Expand Up @@ -1073,9 +1073,9 @@ function shn_form_related_event($label, $name, $extra_opts) {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
?>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<div class="controls">
?>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<div class="controls">
<input type="text" readonly="readonly" value="<?php echo $event_name ?>"/>
<input type="hidden" name="<?php echo $name ?>" id="<?php echo $name ?>" readonly="true" value="<?php echo $value ?>"/>

Expand Down Expand Up @@ -1150,11 +1150,11 @@ function shn_form_password($label, $name, $extra_opts) {
$text_options .= " class='$class'";

if ($extra_opts['no_label'] !== true && isset($label)) {
?>
?>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<?php
}
?>
?>
<div class="controls">
<input type="password" name="<?php echo $name ?>" id="<?php echo $name ?>" tabindex="<?php echo++$shn_tabindex ?>" <?php echo $text_options ?> />
<?php
Expand Down Expand Up @@ -1216,9 +1216,9 @@ function shn_form_document($label, $name, $extra_opts) {
}
}
}
?>
?>
<a name='document_field'></a>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<div class="controls">
<?php
if (isset($_POST['search']) || $_GET['request_page'] != null || isset($_POST['new_doc'])) {
Expand Down Expand Up @@ -1283,13 +1283,13 @@ function shn_form_document($label, $name, $extra_opts) {

function shn_form_address($label, $name, $extra_opts) {
?>
<a name='address_field'></a>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<a name='address_field'></a>
<label class="control-label" for="<?php echo $name ?>"><?php echo $label ?></label>
<div class="controls">
<a id="show_address_frm" href="#address_field"><?php echo _t('SHOW_ADDRESS_FORM'); ?></a>
<a id="hide_address_frm" href="#address_field"><?php echo _t('HIDE_ADDRESS_FORM'); ?></a>
<br />
<br />
<br />
<fieldset id='address_frm' >
<div class="box" style="margin-top:10px">
<h4 class="box-header round-top"><?php echo _t('ADDRESS') ?> </h4>
Expand Down Expand Up @@ -1321,7 +1321,7 @@ function shn_form_address($label, $name, $extra_opts) {
<th><?php echo _t('WEBSITE') ?></th>
<th><?php echo _t('START_DATE') ?></th>
<th><?php echo _t('END_DATE') ?></th>
<th><?php echo _t('ACTION') ?></th>
<th><?php echo _t('ACTION') ?></th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -1376,7 +1376,7 @@ function shn_form_address($label, $name, $extra_opts) {
}
unset($_POST['person_address']);
}
?>
?>
</tbody>
</table>
</div></div></div></fieldset>
Expand All @@ -1401,7 +1401,7 @@ function shn_form_address($label, $name, $extra_opts) {
<th><?php echo _t('WEB') ?></th>
<th><?php echo _t('START_DATE') ?></th>
<th><?php echo _t('END_DATE') ?></th>
<th><?php echo _t('ACTION') ?></th>
<th><?php echo _t('ACTION') ?></th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -1438,7 +1438,7 @@ function shn_form_location($label, $name, $extra_opts) {
<input type="hidden" name="<?php echo $name ?>_latitude" id="<?php echo $name ?>_latitude" value="<?php if ($value['latitude']) echo $value['latitude'] ?>">
<input type="hidden" name="<?php echo $name ?>_longitude" id="<?php echo $name ?>_longitude" value="<?php if ($value['longitude']) echo $value['longitude'] ?>">
<input type="hidden" name="<?php echo $name ?>_country_name" id="<?php echo $name ?>_country_name" value="Armenia" />
<input type="hidden" name="<?php echo $name ?>_incident_zoom" id="<?php echo $name ?>_incident_zoom" value="" />
<input type="hidden" name="<?php echo $name ?>_location_name" id="<?php echo $name ?>_location_name" value="" />

<div id="<?php echo $name ?>_mapContainer" class="mapContainer"></div>
<div class="findLocation">
Expand All @@ -1451,7 +1451,7 @@ function shn_form_location($label, $name, $extra_opts) {
</ul>
</div>
<div style="clear:both;"></div>
<input type="text" id="<?php echo $name ?>_locationFind" name="<?php echo $name ?>_location_find" value="" title="City, State and/or Country" class="findtext" />
<input type="text" id="<?php echo $name ?>_locationFind" name="<?php echo $name ?>_location_find" value="" title="City, State and/or Country" class="findtext" />
<div style="float:left;margin:9px 0 0 5px;">
<input type="button" name="button" id="button" value="Find Location" class="<?php echo $name ?>_buttonFind" />
</div>
Expand Down
28 changes: 14 additions & 14 deletions mod/docu/docuModule.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ function __construct() {
public function createArgumentEncoder() {
$whiteList = Array(
'request_page', 'rpp', 'doc_id', 'title',
'datecreated', 'datesubmitted', 'type', 'format',
'datecreated', 'datesubmitted', 'type', 'format',
'filter', 'sort', 'sortorder'
);

$this->argumentEncoder = new ArgumentEncoder($whiteList);
}

Expand Down Expand Up @@ -132,7 +132,7 @@ public function act_browse() {

$this->result_pager = Browse::getExecuteSql($sqlStatement);
$this->result_pager->setArgumentEncoder($this->argumentEncoder);

$this->columnValues = $this->result_pager->get_page_data();

$this->columnValues = set_links_in_recordset($this->columnValues, 'supporting_docs_meta');
Expand Down Expand Up @@ -194,7 +194,7 @@ public function act_view_document() {
$this->supporting_docs_meta = new SupportingDocsMeta();
$this->supporting_docs_meta->LoadfromRecordNumber($_GET['doc_id']);
$this->supporting_docs_meta->LoadRelationships();

$this->supporting_docs = new SupportingDocs();
$this->supporting_docs->LoadfromRecordNumber($_GET['doc_id']);

Expand All @@ -204,8 +204,8 @@ public function act_view_document() {
}

/**
* act_edit_document Action to edit document details
*
* act_edit_document Action to edit document details
*
* @access public
* @return void
*/
Expand All @@ -231,14 +231,14 @@ public function act_edit_document() {
$this->supporting_docs->Save();
shnMessageQueue::addInformation(_t('THE_OLD_FILE_ATTACHMENT_WAS_UPDATED_WITH_THE_NEW_FILE_ATTACHMENT_'));
} else if (isset($_POST['no'])) {

} else if ($this->supporting_docs->uri != null && $uri != '') {
$this->fileExist = true;
$_SESSION['uri'] = $uri;
$_SESSION['type'] = $type;
return;
} else if ($this->supporting_docs->uri != null && $uri == '') {

} else {
$this->supporting_docs->uri = $uri;
$this->supporting_docs->Save();
Expand All @@ -262,7 +262,7 @@ public function act_delete_document() {
set_redirect_header('docu', 'view_document', null);
}
if (isset($_POST['delete'])) {
$this->supporting_docs_meta->Delete();
$this->supporting_docs_meta->DeleteFromRecordNumber($this->supporting_docs_meta->doc_id);

unlink($this->supporting_docs->uri);
$this->supporting_docs->Delete();
Expand All @@ -275,8 +275,8 @@ public function act_delete_document() {
}

/**
* act_link
*
* act_link
*
* @access public
* @return void
*/
Expand All @@ -290,8 +290,8 @@ public function act_link() {
}

/**
* act_audit
*
* act_audit
*
* @access public
* @return void
*/
Expand All @@ -316,7 +316,7 @@ public function act_download() {
$supporting_docs_meta = new SupportingDocsMeta();
$supporting_docs_meta->LoadfromRecordNumber($_GET['doc_id']);
$supporting_docs_meta->LoadRelationships();

$supporting_docs = new SupportingDocs();
$supporting_docs->LoadfromRecordNumber($_GET['doc_id']);
//set headers
Expand Down
49 changes: 49 additions & 0 deletions schema/change-the-collation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/*
Usage: php change-the-collation.php HOST USERNAME PASS DBA
Source: http://www.holisticsystems.co.uk/blog/?p=931
*/

if($argc != 5)
print_usage($argv);

$server = $argv[1];
$username = $argv[2];
$password = $argv[3];
$database = $argv[4];

$new_charset = 'utf8';
$new_collation = 'utf8_general_ci';

// Connect to database
$db = mysql_connect($server, $username, $password); if(!$db) die("Cannot connect to database server -".mysql_error());
$select_db = mysql_select_db($database); if (!$select_db) die("could not select $database: ".mysql_error());

// Change database collation
mysql_query("ALTER DATABASE $database DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");

// Loop through all tables changing collation
$result=mysql_query('show tables');
while($tables = mysql_fetch_array($result)) {
$table = $tables[0];
mysql_query("ALTER TABLE $table DEFAULT CHARACTER SET $new_charset COLLATE $new_collation");

// Loop through each column changing collation
$columns = mysql_query("SHOW FULL COLUMNS FROM $table where collation is not null");
while($cols = mysql_fetch_array($columns)) {
$column = $cols[0];
$type = $cols[1];
mysql_query("SET FOREIGN_KEY_CHECKS=0;");
mysql_query("ALTER TABLE $table MODIFY $column $type CHARACTER SET $new_charset COLLATE $new_collation;");
mysql_query("SET FOREIGN_KEY_CHECKS=1;");
}

print "changed collation of $table to $new_collation\n";
}
print "\n\nThe collation of your database has been successfully changed!";

function print_usage($argv)
{
echo "Usage: php " . $argv[0] . " HOST USERNAME PASS DBA\n";
exit;
}
1 change: 1 addition & 0 deletions schema/mysql-dbcreate.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ CREATE TABLE IF NOT EXISTS supporting_docs_meta(
type varchar(14),
language varchar(64),
subject varchar(64),
url varchar(255),
PRIMARY KEY (doc_id),
FOREIGN KEY (doc_id) REFERENCES supporting_docs(doc_id)
ON DELETE CASCADE
Expand Down
1 change: 1 addition & 0 deletions schema/mysql-dbpopulate-datadict.sql
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ INSERT INTO `data_dict` (`field_number`, `field_label`, `field_type`, `datatype`
('9008', 'Language', 'text', NULL, '9008', '0', 'n', 'n', 'language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'supporting_docs_meta', NULL, 'n', 'y', 'y', 'y', 'y', 'y', 'y', '', 'y', '', 'n', 'y', 'n'),
('9009', 'Choose File Upload', 'upload', NULL, '9009', '0', 'n', 'n', 'choose_file_upload', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'supporting_docs_meta', NULL, 'n', 'y', 'y', 'y', 'y', 'N', 'N', 'n', 'n', '', 'n', 'n', 'n'),
('9010', 'Format', 'hidden', NULL, '9010', '0', 'n', 'n', 'format', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'supporting_docs_meta', NULL, 'n', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', '', 'n', 'y', 'n'),
('9011', 'URL', 'text', NULL, '9011', '0', 'n', 'n', 'url', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'supporting_docs_meta', NULL, 'n', 'y', 'y', 'y', 'y', 'y', 'y', '', 'y', '', 'n', 'y', 'n'),
('911_1', 'Date of Birth Type', 'mt_select', NULL, '911_1', '48', 'N', 'n', 'date_of_birth_type', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'person', NULL, 'n', 'y', 'y', '', 'y', 'n', 'n', '', 'y', '', 'n', 'y', 'n'),
('928_1', 'Date Deceased Type', 'mt_select', NULL, '928_1', '48', 'N', 'n', 'date_deceased_type', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'person', NULL, 'n', 'y', 'y', '', 'y', 'n', 'n', '', 'y', '', 'n', 'y', 'n');

Expand Down
2 changes: 1 addition & 1 deletion www/res/locale/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"Map": "خارطة",
"Charts": "رسم بياني",
"Results": "النتائج",
"Filters": "مرشح ـ فلتر",
"Filters": "مرشح ـ فلتر"
}
Loading