Permalink
Browse files

add act,menu,jira fixes ;

  • Loading branch information...
1 parent da0d10d commit a4c08f28298b79bb642ff6af0ebafc70e7ae374f Hmayak Tigranyan committed Oct 2, 2013
Showing with 12,294 additions and 484 deletions.
  1. +78 −0 data/StringTranslations.php
  2. +1 −1 inc/lib_config.inc
  3. +292 −14 inc/lib_util.inc
  4. +2 −1 inst/install.inc
  5. +132 −5 mod/admin/adminModule.class.php
  6. +1 −0 mod/admin/lib_form_customization.inc
  7. +3 −3 mod/admin/lib_mt_customization.inc
  8. +251 −141 mod/admin/tpls/act_menu.php
  9. +75 −0 mod/admin/tpls/act_mt_translate.php
  10. +1 −1 mod/admin/tpls/act_new_mt.php
  11. +1 −1 mod/admin/tpls/mt_customization_label.php
  12. +1 −0 mod/admin/tpls/sec_mod_sidebar.php
  13. +2 −2 mod/analysis/analysisModule.class.php
  14. +2 −2 mod/docu/docuModule.class.php
  15. +23 −5 mod/events/eventsModule.class.php
  16. +20 −0 mod/events/tpls/act_add_act_full.php
  17. +1 −0 mod/events/tpls/act_add_perpetrator.php
  18. +6 −1 mod/events/tpls/new_perpetrator.php
  19. +9 −5 mod/events/tpls/search_perpetrator.php
  20. +9 −0 schema/upgrade-2.1-2.2.sql
  21. +1 −0 tpls/html_responce.php
  22. +313 −140 tpls/sec_menu.php
  23. +97 −31 tpls/sec_mod_menu.php
  24. +1,203 −0 www/res/font-awesome/css/font-awesome-ie7.css
  25. +384 −0 www/res/font-awesome/css/font-awesome-ie7.min.css
  26. +1,479 −0 www/res/font-awesome/css/font-awesome.css
  27. +403 −0 www/res/font-awesome/css/font-awesome.min.css
  28. BIN www/res/font-awesome/font/FontAwesome.otf
  29. BIN www/res/font-awesome/font/fontawesome-webfont.eot
  30. +399 −0 www/res/font-awesome/font/fontawesome-webfont.svg
  31. BIN www/res/font-awesome/font/fontawesome-webfont.ttf
  32. BIN www/res/font-awesome/font/fontawesome-webfont.woff
  33. +84 −0 www/res/font-awesome/less/bootstrap.less
  34. +129 −0 www/res/font-awesome/less/core.less
  35. +93 −0 www/res/font-awesome/less/extras.less
  36. +1,953 −0 www/res/font-awesome/less/font-awesome-ie7.less
  37. +33 −0 www/res/font-awesome/less/font-awesome.less
  38. +381 −0 www/res/font-awesome/less/icons.less
  39. +48 −0 www/res/font-awesome/less/mixins.less
  40. +14 −0 www/res/font-awesome/less/path.less
  41. +735 −0 www/res/font-awesome/less/variables.less
  42. +84 −0 www/res/font-awesome/scss/_bootstrap.scss
  43. +129 −0 www/res/font-awesome/scss/_core.scss
  44. +93 −0 www/res/font-awesome/scss/_extras.scss
  45. +381 −0 www/res/font-awesome/scss/_icons.scss
  46. +48 −0 www/res/font-awesome/scss/_mixins.scss
  47. +14 −0 www/res/font-awesome/scss/_path.scss
  48. +734 −0 www/res/font-awesome/scss/_variables.scss
  49. +1,953 −0 www/res/font-awesome/scss/font-awesome-ie7.scss
  50. +33 −0 www/res/font-awesome/scss/font-awesome.scss
  51. +166 −131 www/theme/default/screen.css
@@ -0,0 +1,78 @@
+<?php
+/**
+ * DataObject For TranslateStrings of OpenEvSys.
+ *
+ * This file is part of OpenEvsys.
+ *
+ * Copyright (C) 2009 Human Rights Information and Documentation Systems,
+ * HURIDOCS), http://www.huridocs.org/, info@huridocs.org
+ *
+ * OpenEvsys is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenEvsys 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+
+ */
+
+class StringTranslations extends ADODB_Active_Record{
+
+
+ protected $pkey = array('context','name','language' );
+
+
+ public function __construct($table = false, $pkeyarr=false, $db=false, $options=array() ){
+ parent::__construct('string_translations', $pkey ,$db , $options);
+ }
+
+
+ public static function getMtTranslations($mt = null, $lang = null) {
+ global $global,$conf;
+
+
+ $sql = "SELECT
+ language,
+ context,
+ name,
+ value,
+ status,
+ no,term
+ FROM string_translations st
+ LEFT JOIN mt_index as mt ON st.name = CONCAT('mt-', mt.no, '-label' )
+ ";
+
+ $where = array();
+ if (is_numeric($mt)) {
+ $where[] = "no='".(int)$mt."'";
+ }
+ if ($lang) {
+ $where[] = "language='".$lang."'";
+ }
+ if($where){
+ $sql .= " where ".implode(" and ",$where);
+ }
+
+ /* if ($langorder && is_array($langorder)) {
+ $sql .= " ORDER BY FIELD(l.language,'" . implode("','", $langorder) . "')";
+ }*/
+ $res = $global['db']->GetAll($sql);
+
+
+ $results = array();
+ foreach ($res as $record) {
+ $results[$record["no"]][$record["language"]] = $record;
+
+ }
+
+ return $results;
+ }
+
+}
View
@@ -3,7 +3,7 @@
// update a conf key/value pair in the database
function shn_config_database_update($key, $value)
{
- global $global;
+ global $global,$conf;
$sql = "SELECT confkey, value FROM config
WHERE confkey = '$key'";
$value = $global['db']->qstr($value);
View
Oops, something went wrong.
View
@@ -19,11 +19,12 @@ if (!is_writable(APPROOT . 'media')) {
$media = '<span class="red">not writable</span>';
$file_check = true;
}
+/*
if (!is_writable(WWWWROOT . "images" . DS . "uploads")) {
$continue = false;
$imagesuploads = '<span class="red">not writable</span>';
$file_check = true;
-}
+}*/
//check for password match
@@ -148,6 +148,7 @@ public function act_new_mt() {
}
public function act_new_field() {
+ global $conf;
include_once APPROOT . 'mod/admin/lib_form_customization.inc';
$entity_select_options = array(
@@ -180,12 +181,20 @@ public function act_new_field() {
'mt_select' => _t('SELECT'),
'mt_select_multi' => _t('Multivalue Select')
);
+
+ $translations = StringTranslations::getMtTranslations(null, $conf['locale']);
+
$mtIndex = new MtIndex();
$index_terms = $mtIndex->Find('');
$taxonomies = array();
$taxonomies[''] = '';
foreach ($index_terms as $index_term) {
- $taxonomies[$index_term->no] = $index_term->no . ' - ' . $index_term->term;
+ $label = $index_term->no . ' - ' . $index_term->term;
+
+ if ($translations[$index_term->no][$conf['locale']]) {
+ $label = $translations[$index_term->no][$conf['locale']]['value'];
+ }
+ $taxonomies[$index_term->no] = $label;
}
$this->taxonomies = $taxonomies;
@@ -487,14 +496,20 @@ public function act_mt_customization() {
include_once(APPROOT . 'inc/i18n/lib_l10n.inc');
$this->locales = l10n_get_locals();
+ $translations = StringTranslations::getMtTranslations(null, $conf['locale']);
//display the mt select from
$mtIndex = new MtIndex();
$index_terms = $mtIndex->Find('');
$options = array();
$options[''] = '';
foreach ($index_terms as $index_term) {
- $options[$index_term->no] = $index_term->no . ' - ' . $index_term->term;
+ $label = $index_term->no . ' - ' . $index_term->term;
+
+ if ($translations[$index_term->no][$conf['locale']]) {
+ $label = $translations[$index_term->no][$conf['locale']]['value'];
+ }
+ $options[$index_term->no] = $label;
}
$this->mt_select = $_GET['mt_select'];
@@ -550,10 +565,122 @@ public function act_mt_customization() {
}
}
- public function act_menu(){
-
-
+ public function act_mt_translate() {
+ global $conf, $global;
+ include_once APPROOT . 'inc/lib_form.inc';
+ include_once APPROOT . 'inc/lib_form_util.inc';
+ //if the locale is changed need to display extra column in label customization
+ $this->locale = $conf['locale'];
+
+ include_once(APPROOT . 'inc/i18n/lib_l10n.inc');
+ $locales = l10n_get_locals();
+ $this->locales = $locales;
+ $mtIndex = new MtIndex();
+ $index_terms = $mtIndex->Find('');
+ $mts = array();
+ foreach ($index_terms as $index_term) {
+ $mts[$index_term->no] = $index_term->term;
+ }
+ $this->mts = $mts;
+ if ($_POST['save']) {
+ foreach ($index_terms as $index_term) {
+
+ $no = $index_term->no;
+ $term = $index_term->term;
+ if (isset($_POST['label_' . $no]) && is_array($_POST['label_' . $no])) {
+ $labels = $_POST['label_' . $no];
+ foreach ($locales as $code => $loc) {
+ if (!trim($labels[$code])) {
+ continue;
+ }
+ $l10nValues = array();
+ $l10nValues['value'] = $global['db']->qstr($labels[$code]);
+ $l10nValues['name'] = "'mt-" . $no . "-label'";
+ $l10nValues['context'] = "'mt'";
+ $l10nValues['language'] = "'{$code}'";
+ $l10nValues['status'] = "1";
+ $global['db']->Replace('string_translations', $l10nValues, array('context', 'name', 'language'));
+ }
+ }
+ }
+ }
+
+
+
+ $this->translations = StringTranslations::getMtTranslations();
}
+
+ private function normalise_menu_order($itemorders, &$newresult, $parent = 0, $term_level = 0, &$term_order = 0) {
+ if (is_array($itemorders)) {
+ foreach ($itemorders as &$itemorder) {
+ $id = $itemorder['id'];
+ $slug = $itemorder['slug'];
+ $title = $itemorder['title'];
+ $itemorder['title'] = $_POST['menu-item-title'][$id];
+
+ $term_order++;
+ $itemorder['order'] = (int) $term_order;
+ $itemorder['level'] = (int) $term_level;
+ $itemorder['parent'] = $parent;
+ $children = $itemorder["children"];
+ unset($itemorder["children"]);
+ $newresult[$id] = $itemorder;
+ if (is_array($children)) {
+ $term_order = $this->normalise_menu_order($children, $newresult, $itemorder['id'], $term_level + 1, $term_order);
+ }
+ }
+ }
+ }
+
+ public function act_menu() {
+ global $conf;
+ $activemenu = $_REQUEST['activemenu'];
+
+ $defaultMenuItems = getDefaultMenuItems();
+ $menuNames = getMenus();
+
+ if (!$activemenu || !isset($menuNames[$activemenu])) {
+ $activemenu = "top_menu";
+ }
+ $this->activemenu = $activemenu;
+ $this->menuNames = $menuNames;
+
+
+
+ $defaulMenuItemsOrdered = array();
+ $order = 0;
+ $slugToID = array();
+
+ foreach ($defaultMenuItems as $key => $value) {
+ $value['slug'] = $key;
+ $defaulMenuItemsOrdered[] = $value;
+ }
+
+ $activeMenuItems = getMenu($activemenu);
+
+ if (isset($_POST["save"])) {
+ $itemorders = @json_decode(stripslashes($_POST['itemsorder']), true);
+ if (is_array($itemorders)) {
+ $newresult = array();
+ $this->normalise_menu_order($itemorders, $newresult);
+ //var_dump($newresult,'<br/><br/><br/><br/><br/>',$itemorders);exit;
+
+ shn_config_database_update($activemenu, serialize($newresult));
+ $conf[$activemenu] = serialize($newresult);
+ shnMessageQueue::addInformation(_t('Menu was saved successfully.'));
+ }
+ }
+ $this->activeMenuItems = $activeMenuItems;
+ if ($conf[$activemenu]) {
+ $acMenu = @unserialize($conf[$activemenu]);
+ if ($acMenu) {
+ $this->activeMenuItems = $acMenu;
+ }
+ }
+ $this->defaultMenuItems = $defaultMenuItems;
+ $this->defaulMenuItemsOrdered = $defaulMenuItemsOrdered;
+ }
+
/* }}} */
/* {{{ Acl functions */
@@ -288,6 +288,7 @@ function form_customization_add_field($field_type_options) {
$v = trim($v);
$fieldValues[$k] = $v;
}
+ $fieldValues['field_name'] = str_replace(" ", "", $fieldValues['field_name']);
$fieldValues['field_name'] = str_replace("-", "_", $fieldValues['field_name']);
switch ($fieldValues['field_type']) {
@@ -138,7 +138,7 @@ function mt_customization_add_terms($mt_term) {
$vocab_number = get_next_vocab_number();
$huri_term = trim($_POST['new_term_label']['en'][$index]);
- if ($vocab_number == '' || $huri_term == '') {
+ if ($vocab_number == '') {
continue;
}
@@ -267,10 +267,10 @@ function mt_customization_validate_mtterm($list_code, $vocab_number, $huri_term,
global $global;
//check if right length and if it is a number
//check if the huri term is empty
- if (isset($huri_term) && $huri_term == '') {
+ /* if (isset($huri_term) && $huri_term == '') {
shnMessageQueue::addError(_t('HURITERM_CAN_NOT_BE_EMPTY_') . " [ $vocab_number : $huri_term ]");
return false;
- }
+ }*/
//check if already exist
$sql = "SELECT vocab_number FROM mt_vocab WHERE vocab_number='$vocab_number' ";
$vocab_number = $global['db']->GetOne($sql);
Oops, something went wrong.

0 comments on commit a4c08f2

Please sign in to comment.