Skip to content

Commit 2153fa0

Browse files
committed
DAGS-389 - updating documentation
1 parent 3e9edac commit 2153fa0

File tree

16 files changed

+233
-51
lines changed

16 files changed

+233
-51
lines changed

public_html/profiles/os2dagsorden/modules/os2dagsorden/os2dagsorden_annotator/includes/os2dagsorden_annotator.common.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ function os2dagsorden_annotator_update_notes_attachment($old_attachment_nid, $ne
214214
}
215215
}
216216

217+
/**
218+
* Returns the right DOM path for the certain text, is used recursively
219+
*
220+
* @param DOMNode $domNode
221+
* @param $first_word
222+
* @param string $current_path
223+
* @return string
224+
*/
217225
function _os2dagsorden_annotator_find_path(DOMNode $domNode, $first_word, $current_path= ''){
218226
foreach ($domNode->childNodes as $node) {
219227
if ($node->nodeName == 'style') {

public_html/profiles/os2dagsorden/modules/os2dagsorden/os2dagsorden_content_modify/includes/os2dagsorden_content_modify.user.batch.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ function os2dagsorden_content_modify_user_batch_edit_form($form, $form_state, $u
6666
return $form;
6767
}
6868

69+
/**
70+
* Renders the drag and drop controls for add/remove committee functionality
71+
* @param $form
72+
*/
6973
function _os2dagsorden_content_modify_render_drag_and_drop_remove_committees_controls(&$form) {
7074
$form[] = array(
7175
'#markup' => '<div class="remove-committee">',

public_html/profiles/os2dagsorden/modules/os2dagsorden/os2dagsorden_importer/os2dagsorden_importer.module

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ function os2dagsorden_importer_import_user_committees() {
115115
_os2dagsorden_importer_process_user_committees($userCommittees);
116116
}
117117

118+
/**
119+
* Reads and returns the data from a local XML file, or loads it from a remote location.
120+
* Optionally uses the proxy details from the settings.
121+
*
122+
* @return bool|SimpleXMLElement
123+
*/
118124
function os2dagsorden_importer_load_user_committees_from_xml(){
119125
if (!variable_get('os2dagsorden_pws_use_local_copy')) {
120126
$url = curl_init(variable_get('os2dagsorden_pws_v_meetinggroups_url'));
@@ -201,12 +207,23 @@ function os2dagsorden_importer_import_meetings() {
201207
_os2dagsorden_importer_process_meetings($meetings);
202208
}
203209

210+
/**
211+
* Wrapper function to processing user committees,
212+
* if the XML file is provided internally calls _os2dagsorden_importer_process_user_committees_update.
213+
* @param $xml_file
214+
*/
204215
function _os2dagsorden_importer_process_user_committees($xml_file){
205216
if ($xml_file) {
206217
_os2dagsorden_importer_process_user_committees_update($xml_file);
207218
}
208219
}
209220

221+
/**
222+
* Wra[[er function to processing user commitees,
223+
* if the file is provided internally calls _os2dagsorden_importer_process_user_committees_update and
224+
* _os2dagsorden_importer_process_user_committees_delete.
225+
* @param $xml_file
226+
*/
210227
function _os2dagsorden_importer_process_user_committees_improved($xml_file){
211228
if ($xml_file) {
212229
_os2dagsorden_importer_process_user_committees_update($xml_file);
@@ -799,7 +816,7 @@ function _os2dagsorden_importer_add_user_follows_committee_plus($tid, $user) {
799816
}
800817

801818
/**
802-
* Helper function. Unsets the follows+ committee to the user
819+
* Helper function. Unsets the follows+ committee from the user
803820
*
804821
* @param int $tid role id
805822
* @param mixed $user user object
@@ -822,6 +839,7 @@ function _os2dagsorden_importer_unset_user_follows_committee_plus($tid, $user) {
822839

823840
user_save($user, $edit);
824841
}
842+
825843
/**
826844
* Helper function. Adds the follows++ committee to the user
827845
*
@@ -1143,8 +1161,15 @@ function os2dagsorden_importer_requirements($phase) {
11431161
}
11441162
return $requirements;
11451163
}
1146-
/*
1147-
* check if webservice URL is avaible
1164+
1165+
1166+
/**
1167+
* Checks if the provided URL is exists and accessible by checking the http requires headers.
1168+
* If http request will return >= 200 and 300, URL is considered as valid and TRUE is returned.
1169+
* Otherwise FALSE.
1170+
*
1171+
* @param null $url
1172+
* @return bool
11481173
*/
11491174
function _os2dagsorden_importer_webservice_url_exists($url=NULL) {
11501175
if($url == NULL) return false;

public_html/profiles/os2dagsorden/modules/os2dagsorden/os2dagsorden_logging/os2dagsorden_logging.module

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,48 +24,50 @@ function os2dagsorden_logging_monolog_channel_info() {
2424
*/
2525
function os2dagsorden_logging_menu() {
2626
$items['admin/config/development/monolog/os2dagsorden_logging_settings'] = array(
27-
'title' => 'Os2dagsorden Logging',
28-
'description' => t('Configure watchlist for specific watchdog log messages.'),
29-
'page callback' => 'drupal_get_form',
30-
'page arguments' => array('os2dagsorden_logging_settings_settings_form'),
27+
'title' => 'Os2dagsorden Logging',
28+
'description' => t('Configure watchlist for specific watchdog log messages.'),
29+
'page callback' => 'drupal_get_form',
30+
'page arguments' => array('os2dagsorden_logging_settings_settings_form'),
3131
'access arguments' => array('administer os2web'),
3232
'file' => 'os2dagsorden_logging.admin.inc',
3333
'type' => MENU_LOCAL_TASK,
3434
);
35-
35+
3636
return $items;
3737
}
3838

3939
/**
4040
* Implements hook_watchdog().
41+
* Makes sure that watchdog commands end up rerouted to monolog.
4142
*
4243
* @param array $log_entry
4344
*/
4445
function os2dagsorden_logging_watchdog(array $log_entry) {
4546
try {
46-
47-
if (in_array($log_entry['type'], variable_get('os2dagsorden_logging_message_type', array("acadre MM"=> "acadre MM", "esdh provider" => "esdh provider")))){
48-
47+
if (in_array($log_entry['type'], variable_get('os2dagsorden_logging_message_type', array(
48+
"acadre MM" => "acadre MM",
49+
"esdh provider" => "esdh provider"
50+
)))
51+
) {
52+
4953
// Perform a partial bootstrap if watchdog is called prior to the
5054
// DRUPAL_BOOTSTRAP_FULL phase.
5155
if (!function_exists('monolog')) {
5256
os2dagsorden_logging_bootstrap();
5357
}
5458

5559
$logger = monolog('os2dagsorden_watchdog_logging');
56-
60+
5761
$enabled_contexts = os2dagsorden_logging_get_contexts();
5862
$context = array_intersect_key($log_entry, $enabled_contexts);
5963
if (isset($enabled_contexts['request_id'])) {
6064
$context['request_id'] = monolog_request_id();
6165
}
6266
$message = strip_tags(!isset($log_entry['variables']) ? $log_entry['message'] : strtr($log_entry['message'], $log_entry['variables']));
6367
$level = os2dagsorden_logging_map_severity_level($log_entry['severity']);
64-
$logger->log($level, $message, $context);
65-
}
66-
}
67-
catch (Exception $e) {
68-
68+
$logger->log($level, $message, $context);
69+
}
70+
} catch (Exception $e) {
6971
// Fail silently since we cannot log any messages or do anything that would
7072
// trigger another watchdog call.
7173
}
@@ -107,6 +109,7 @@ function os2dagsorden_logging_bootstrap() {
107109
// file_get_stream_wrappers() is called during the normal application flow.
108110
}
109111
}
112+
110113
/**
111114
* Returns the selected event contexts.
112115
*
@@ -149,25 +152,39 @@ function os2dagsorden_logging_map_severity_level($level) {
149152
return isset($levels[$level]) ? $levels[$level] : Logger::NOTICE;
150153
}
151154

152-
function os2dagsorden_logging_database_log_clear() {
153-
$time_limit = strtotime('-'.variable_get('os2dagsorden_logging_day_limit', 100).' days');
154-
var_dump ($time_limit);
155+
/**
156+
* Deletes entries from the database table os2web_print_send_to_friend_log, which are older than the certain number
157+
* of days - 100 days is default.
158+
*/
159+
function os2dagsorden_logging_database_log_clear() {
160+
$time_limit = strtotime('-' . variable_get('os2dagsorden_logging_day_limit', 100) . ' days');
155161
if (db_table_exists('os2web_print_send_to_friend_log')) {
156-
db_delete('os2web_print_send_to_friend_log')
157-
->condition('time', $time_limit, '<')
158-
->execute();
162+
db_delete('os2web_print_send_to_friend_log')
163+
->condition('time', $time_limit, '<')
164+
->execute();
159165
}
160-
}
161-
162-
function os2dagsorden_logging_cron() {
163-
os2dagsorden_logging_database_log_clear();
164-
}
165-
function os2dagsorden_logging_cronapi($op, $job = NULL) {
166+
}
167+
168+
/**
169+
* Implement hook_cron().
170+
*/
171+
function os2dagsorden_logging_cron() {
172+
os2dagsorden_logging_database_log_clear();
173+
}
174+
175+
/**
176+
* Implements hook_cronapi().
177+
*
178+
* @param $op
179+
* @param null $job
180+
* @return array
181+
*/
182+
function os2dagsorden_logging_cronapi($op, $job = NULL) {
166183
switch ($op) {
167184
case 'list':
168185
return array('os2dagsorden_logging_cron' => t('Remove expired log messages and flood control events'));
169186
}
170-
}
187+
}
171188

172189
/**
173190
* Implements hook_requirements().
@@ -176,15 +193,15 @@ function os2dagsorden_logging_requirements($phase) {
176193
if ($phase !== 'runtime') {
177194
return array();
178195
}
179-
$t = get_t();
180-
$channel_info = monolog_channel_info_load_all();
181-
foreach ($channel_info as $channel_name => $info) {
182-
$profile_info = (monolog_profile_load($info['default profile']));
183-
foreach ($profile_info->options['handlers'] as $handler_name => $options){
184-
if ($handler_name == 'rotating_file_handler') {
196+
$t = get_t();
197+
$channel_info = monolog_channel_info_load_all();
198+
foreach ($channel_info as $channel_name => $info) {
199+
$profile_info = (monolog_profile_load($info['default profile']));
200+
foreach ($profile_info->options['handlers'] as $handler_name => $options) {
201+
if ($handler_name == 'rotating_file_handler') {
185202
$requirements['os2dagsorden_logging_log_dir_' . $channel_name] = array(
186-
'title' => $t('OS2Dagsorden Logging'),
187-
'value' => $t('Log file directory')
203+
'title' => $t('OS2Dagsorden Logging'),
204+
'value' => $t('Log file directory')
188205
);
189206
if (!(is_dir(drupal_realpath(dirname($options['filepath']))) && is_writable(drupal_realpath(dirname($options['filepath']))))) {
190207
$requirements['os2dagsorden_logging_log_dir_' . $channel_name]['severity'] = REQUIREMENT_ERROR;
@@ -195,9 +212,9 @@ function os2dagsorden_logging_requirements($phase) {
195212
$requirements['os2dagsorden_logging_log_dir_' . $channel_name]['severity'] = REQUIREMENT_OK;
196213
$requirements['os2dagsorden_logging_log_dir_' . $channel_name]['description'] = t('Channel: %channel. Directory for log files <b>%path</b> is exists and writable.',
197214
array('%channel' => $channel_name, '%path' => dirname($options['filepath'])));
198-
}
199-
}
200-
}
201-
}
215+
}
216+
}
217+
}
218+
}
202219
return $requirements;
203220
}

public_html/profiles/os2dagsorden/modules/os2dagsorden/os2dagsorden_pdf2htmlex/os2dagsorden_pdf2htmlex.module

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function os2dagsorden_pdf2htmlex_menu() {
4040
}
4141

4242
/**
43-
* Report page
43+
* Renders and returns the reports page.
4444
*
4545
* @return mixed
4646
*/
@@ -582,6 +582,8 @@ function os2dagsorden_pdf2htmlex_schedule_if_bpa($fid){
582582
}
583583

584584
/**
585+
* Implements hook_file_delete().
586+
*
585587
* Hook to file delete, deletes the corresponding row in the table.
586588
*/
587589
function os2dagsorden_pdf2htmlex_file_delete($file) {
@@ -591,6 +593,8 @@ function os2dagsorden_pdf2htmlex_file_delete($file) {
591593
}
592594

593595
/**
596+
* Implements hook_node_delete().
597+
*
594598
* Hook to node delete, deletes the corresponding row in the table.
595599
*/
596600
function os2dagsorden_pdf2htmlex_node_delete($node) {

public_html/profiles/os2dagsorden/modules/os2dagsorden/os2dagsorden_settings/os2dagsorden_settings.admin.inc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,12 @@ function os2dagsorden_settings_settings_form($form, $form_state) {
12451245
return system_settings_form($form);
12461246
}
12471247

1248+
/**
1249+
* Validates pdf2htmlEX installation by checking if which commands returns anything.
1250+
*
1251+
* @param $element
1252+
* @param $form_state
1253+
*/
12481254
function _os2dagsorden_pdf2htmlEX_validate($element, &$form_state){
12491255
$value = $element['#value'];
12501256
if(!empty($value)) {
@@ -1256,6 +1262,13 @@ function _os2dagsorden_pdf2htmlEX_validate($element, &$form_state){
12561262
}
12571263
}
12581264

1265+
/**
1266+
* Validates URL responce.
1267+
* if response code not 200, form error is set.
1268+
*
1269+
* @param $element
1270+
* @param $form_state
1271+
*/
12591272
function _os2dagsorden_url_responce_validate($element, &$form_state){
12601273
$value = $element['#value'];
12611274

@@ -1274,6 +1287,15 @@ function _os2dagsorden_url_responce_validate($element, &$form_state){
12741287
}
12751288
}
12761289

1290+
/**
1291+
* Checks that files for SOFD are presen.
1292+
* File paths are: "public://acadre_views/V_web_MeetingGroups.xml",
1293+
* "public://acadre_views/V_web_AcadreGroups.xml",
1294+
* "public://acadre_views/V_web_Meetings.xml",
1295+
*
1296+
* @param $element
1297+
* @param $form_state
1298+
*/
12771299
function _os2dagsorden_sofd_local_copy_validate($element, &$form_state){
12781300
$value = $element['#value'];
12791301
//if checked
@@ -1300,6 +1322,12 @@ function _os2dagsorden_sofd_local_copy_validate($element, &$form_state){
13001322
}
13011323
}
13021324

1325+
/**
1326+
* Validates that the pdf rendering path is present and writable.
1327+
*
1328+
* @param $element
1329+
* @param $form_state
1330+
*/
13031331
function _os2dagsorden_pdf2html_rendering_path_validate($element, &$form_state){
13041332
$value = $element['#value'];
13051333
if ($value != "") {
@@ -1314,6 +1342,12 @@ function _os2dagsorden_pdf2html_rendering_path_validate($element, &$form_state){
13141342
}
13151343
}
13161344

1345+
/**
1346+
* Validates that the os2web conversion path is present and writable.
1347+
*
1348+
* @param $element
1349+
* @param $form_state
1350+
*/
13171351
function _os2dagsorden_os2web_convertion_dir_validate($element, &$form_state){
13181352
$value = $element['#value'];
13191353
if(file_exists($value)){

0 commit comments

Comments
 (0)