-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
796 additions
and
850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,93 @@ | ||
<?php | ||
require_once( config_get_global( 'class_path' ) . 'MantisPlugin.class.php' ); | ||
|
||
class FAQPlugin extends MantisPlugin { | ||
|
||
function register() { | ||
$this->name = 'FAQ'; | ||
$this->description = 'Adds Frequently Asked Questions to your Mantis installation.'; | ||
$this->version = '0.96.4'; | ||
$this->requires = array('MantisCore' => '1.2.0rc1',); | ||
$this->author = 'Cas Nuy / based upon scripts from [email protected]'; | ||
$this->contact = 'Cas-at-nuy.info'; | ||
$this->url = 'http://www.nuy.info'; | ||
$this->page = 'config'; | ||
} | ||
|
||
|
||
/** | ||
* Default plugin configuration. | ||
*/ | ||
function config() { | ||
return array( | ||
'promote_text' => ON, | ||
'promote_threshold' => DEVELOPER, | ||
'project_text' => ON, | ||
'faq_view_window' => OFF, | ||
'faq_view_check' => OFF, | ||
'faq_view_threshold' => VIEWER, | ||
'faq_update_threshold' => DEVELOPER, | ||
); | ||
} | ||
function register() { | ||
$this->name = 'FAQ'; | ||
$this->description = 'Adds Frequently Asked Questions to your MantisBT installation.'; | ||
$this->version = '1.01'; | ||
$this->requires = array('MantisCore' => '1.2.0',); | ||
$this->author = 'Cas Nuy / based upon scripts from [email protected]'; | ||
$this->contact = 'Cas-at-nuy.info'; | ||
$this->url = 'http://www.nuy.info'; | ||
$this->page = 'config'; | ||
} | ||
|
||
/** | ||
* Default plugin configuration. | ||
*/ | ||
function config() { | ||
return array( | ||
'promote_text' => ON, | ||
'promote_threshold' => 55, | ||
'project_text' => ON, | ||
'faq_view_window' => OFF, | ||
'faq_view_check' => OFF, | ||
'faq_view_threshold' => 10, | ||
); | ||
} | ||
|
||
/** | ||
* Default hooks for main menu and issue menu | ||
*/ | ||
function hooks() { | ||
return array( | ||
'EVENT_MENU_MAIN' => 'main_menu', | ||
'EVENT_MENU_ISSUE' => 'faq_menu', | ||
); | ||
} | ||
|
||
function init() { | ||
plugin_event_hook( 'EVENT_MENU_MAIN', 'mainmenu' ); | ||
plugin_event_hook( 'EVENT_MENU_ISSUE', 'faqmenu' ); | ||
} | ||
|
||
/** | ||
* Default function generate main menu links | ||
* @return array of links | ||
*/ | ||
function main_menu() { | ||
return array('<a href="'. plugin_page( 'faq_menu_page' ) . '">' . plugin_lang_get( 'menu_link' ) . '</a>' ); | ||
} | ||
function mainmenu() { | ||
return array( '<a href="'. plugin_page( 'faq_menu_page.php' ) . '">' . lang_get( 'menu_faq_link' ) . '</a>' ); | ||
} | ||
|
||
function faqmenu() { | ||
if (ON == plugin_config_get( 'promote_text' ) ){ | ||
$bugid = gpc_get_int( 'id' ); | ||
if ( access_has_bug_level( plugin_config_get( 'promote_threshold' ), $bugid ) ){ | ||
$t_bug_p = bug_get( $bugid, true ); | ||
if ( OFF == plugin_config_get( 'project_text' ) ) { | ||
$proj_id = 0; | ||
} else { | ||
$proj_id = $t_bug_p->project_id; | ||
} | ||
|
||
/** | ||
* Default function generate issue menu links | ||
* @return array of links | ||
*/ | ||
function faq_menu() { | ||
if (ON == plugin_config_get( 'promote_text' ) ){ | ||
$bugid = gpc_get_int( 'id' ); | ||
if ( access_has_bug_level( plugin_config_get( 'promote_threshold' ), $bugid ) ){ | ||
$t_bug_p = bug_get( $bugid, true ); | ||
if ( OFF == plugin_config_get( 'project_text')) { | ||
$proj_id = 0 ; | ||
} else{ | ||
$proj_id = $t_bug_p->project_id ; | ||
} | ||
if (ON == plugin_config_get('faq_view_check') ){ | ||
$import_page ='faq_add_page2.php'; | ||
} else { | ||
$import_page ='faq_add.php'; | ||
} | ||
$import_page .='&id='; | ||
$import_page .= $bugid ; | ||
$import_page .='&project_id='; | ||
$import_page .= $proj_id; | ||
|
||
if (ON == plugin_config_get('faq_view_check') ){ | ||
return array( plugin_lang_get( 'import_faq' )=>plugin_page( $import_page ). '" target="_new' ); | ||
} else { | ||
return array( plugin_lang_get( 'import_faq' )=>plugin_page( $import_page ) ); | ||
$answer = urlencode( $t_bug_p->description ); | ||
$answer .= " "; | ||
$answer .= urlencode( $t_bug_p->additional_information ); | ||
|
||
} | ||
} | ||
else | ||
{ | ||
return array( ); | ||
} | ||
} | ||
else | ||
{ | ||
return array (); | ||
} | ||
} | ||
$question = category_full_name( $t_bug_p->category_id ); | ||
$question .= " -> "; | ||
$question .= urlencode( $t_bug_p->summary ); | ||
|
||
if ( ON == plugin_config_get( 'faq_view_check') ){ | ||
$import_page = 'faq_add_page2.php'; | ||
} else { | ||
$import_page = 'faq_add.php'; | ||
} | ||
$import_page .= '&question='; | ||
$import_page .= $question; | ||
$import_page .= '&answere='; | ||
$import_page .= $answer; | ||
$import_page .= '&project_id='; | ||
$import_page .= $proj_id; | ||
|
||
function schema() { | ||
return array( | ||
array( 'CreateTableSQL', array( plugin_table( 'results' ), " | ||
id I NOTNULL UNSIGNED ZEROFILL AUTOINCREMENT PRIMARY, | ||
project_id I NOTNULL UNSIGNED ZEROFILL , | ||
poster_id I NOTNULL UNSIGNED ZEROFILL , | ||
date_posted T NOTNULL, | ||
last_modified T NOTNULL, | ||
question C(250) DEFAULT \" '' \", | ||
answere XL NOTNULL DEFAULT \" '' \", | ||
view_access I NOTNULL UNSIGNED ZEROFILL DEFAULT \" '10' \" | ||
" ) ), | ||
); | ||
} | ||
if (ON == plugin_config_get('faq_view_check') ){ | ||
return array( plugin_lang_get( 'import_faq' ) => plugin_page( $import_page ). '" target=_new>' ); | ||
} else { | ||
return array( plugin_lang_get( 'import_faq' ) => plugin_page( $import_page ) ); | ||
} | ||
} | ||
} | ||
} | ||
|
||
function schema() { | ||
return array( | ||
array( 'CreateTableSQL', array( plugin_table( 'results' ), " | ||
id I NOTNULL UNSIGNED ZEROFILL AUTOINCREMENT PRIMARY, | ||
project_id I NOTNULL UNSIGNED ZEROFILL , | ||
poster_id I NOTNULL UNSIGNED ZEROFILL , | ||
date_posted T NOTNULL, | ||
last_modified T NOTNULL, | ||
question C(250) DEFAULT \" '' \", | ||
answere XL NOTNULL DEFAULT \" '' \", | ||
view_access I NOTNULL UNSIGNED ZEROFILL DEFAULT \" '10' \" | ||
" ) | ||
), | ||
); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
<?php | ||
$s_plugin_FAQ_menu_link = "FAQ"; | ||
$s_plugin_FAQ_add_faq = "Add a new FAQ"; | ||
$s_plugin_FAQ_add_faq_title = "New FAQ"; | ||
$s_plugin_FAQ_post_faq_button = "Post FAQ"; | ||
$s_plugin_FAQ_question = "Question"; | ||
$s_plugin_FAQ_answere = "Answer"; | ||
$s_plugin_FAQ_delete_faq_sure_msg = "Are you sure you wish to delete this FAQ item? "; | ||
$s_plugin_FAQ_delete_faq_item_button = "Delete FAQ item"; | ||
$s_plugin_FAQ_edit_faq_title = "Edit FAQ"; | ||
$s_plugin_FAQ_update_faq_button = "Update FAQ"; | ||
$s_plugin_FAQ_import_faq = "Promote to FAQ"; | ||
$s_plugin_FAQ_search_string = "Search whole String"; | ||
$s_plugin_FAQ_close_window = "Close Window"; | ||
// config section | ||
$s_plugin_FAQ_title = "Mantis FAQ"; | ||
$s_plugin_FAQ_config = "Configuration"; | ||
$s_plugin_FAQ_promote_text = "Promote Issue to FAQ"; | ||
$s_plugin_FAQ_project_text = "Store FAQ project related"; | ||
$s_plugin_FAQ_threshold_text = "Threshold to promote to FAQ"; | ||
$s_plugin_FAQ_view_check = "Use Minimum level for viewing FAQ"; | ||
$s_plugin_FAQ_view_threshold = "Minimum level for viewing FAQ"; | ||
$s_plugin_FAQ_view_window = "Present FAQ's in new window"; | ||
<?php | ||
$s_menu_faq_link = "FAQ"; | ||
$s_plugin_FAQ_add_faq = "Add FAQ"; | ||
$s_plugin_FAQ_add_faq_title = "New FAQ"; | ||
$s_plugin_FAQ_post_faq_button = "Promote to FAQ"; | ||
$s_plugin_FAQ_question = "Question"; | ||
$s_plugin_FAQ_answere = "Answer"; | ||
$s_plugin_FAQ_delete_faq_sure_msg = "Really delete this FAQ? "; | ||
$s_plugin_FAQ_delete_faq_item_button = "Deletee FAQ"; | ||
$s_plugin_FAQ_edit_faq_title = "Edit FAQ"; | ||
$s_plugin_FAQ_update_faq_button = "Update FAQ"; | ||
$s_plugin_FAQ_import_faq = "Promote to FAQ"; | ||
$s_plugin_FAQ_search_string = "Search whole string"; | ||
$s_plugin_FAQ_close_window = "Close Window"; | ||
// config section | ||
$s_plugin_FAQ_plugin_format_title = "Mantis FAQ"; | ||
$s_plugin_FAQ_plugin_format_config = "Configuration"; | ||
$s_plugin_FAQ_plugin_format_promote_text = "Issues can be promoted to FAQ's"; | ||
$s_plugin_FAQ_plugin_format_project_text = "Save FAQ by project"; | ||
$s_plugin_FAQ_plugin_format_threshold_text = "Minimum treshold to create FAQ"; | ||
$s_plugin_FAQ_faq_view_check = "Maintain FAQ before promoting"; | ||
$s_plugin_FAQ_faq_view_threshold = "Minimum treshold for viewing FAQ's"; | ||
$s_plugin_FAQ_faq_view_window = "Open FAQ's in new window"; | ||
$s_plugin_FAQ_plugin_format_enabled = "On"; | ||
$s_plugin_FAQ_plugin_format_disabled = "Off"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
<?php | ||
$s_plugin_FAQ_menu_link = "FAQ"; | ||
$s_plugin_FAQ_add_faq = "Neue FAQ hinzufügen"; | ||
$s_plugin_FAQ_add_faq_title = "Neue FAQ"; | ||
$s_plugin_FAQ_post_faq_button = "FAQ veröffentlichen"; | ||
$s_plugin_FAQ_question = "Frage"; | ||
$s_plugin_FAQ_answere = "Antwort"; | ||
$s_plugin_FAQ_delete_faq_sure_msg = "Soll diese FAQ wirklich gelöscht werden? "; | ||
$s_plugin_FAQ_delete_faq_item_button = "Lösche FAQ"; | ||
$s_plugin_FAQ_edit_faq_title = "Bearbeite FAQ"; | ||
$s_plugin_FAQ_update_faq_button = "Aktualisiere FAQ"; | ||
$s_plugin_FAQ_import_faq = "In FAQ veröffentlichen"; | ||
$s_plugin_FAQ_search_string = "Den gesamten Text durchsuchen"; | ||
$s_plugin_FAQ_close_window = "Fenster schließen"; | ||
// config section | ||
$s_plugin_FAQ_title = "Mantis FAQ"; | ||
$s_plugin_FAQ_config = "Konfiguration"; | ||
$s_plugin_FAQ_promote_text = "Probleme können in FAQ veröffentlicht werden"; | ||
$s_plugin_FAQ_project_text = "FAQ projektspezifisch abspeichern"; | ||
$s_plugin_FAQ_threshold_text = "Minimale Zugangsberechtigung um FAQ zu erstellen"; | ||
$s_plugin_FAQ_view_check = "Zugangsberechtigung zum Ansehen der FAQ verwenden"; | ||
$s_plugin_FAQ_view_threshold = "Minimale Zugangsberechtigung um FAQ anzusehen"; | ||
$s_plugin_FAQ_view_window = "FAQs in neuem Fenster öffnen"; | ||
<?php | ||
$s_menu_faq_link = "FAQ"; | ||
$s_plugin_FAQ_add_faq = "Neue FAQ hinzufügen"; | ||
$s_plugin_FAQ_add_faq_title = "Neue FAQ"; | ||
$s_plugin_FAQ_post_faq_button = "FAQ veröffentlichen"; | ||
$s_plugin_FAQ_question = "Frage"; | ||
$s_plugin_FAQ_answere = "Antwort"; | ||
$s_plugin_FAQ_delete_faq_sure_msg = "Soll diese FAQ wirklich gelöscht werden? "; | ||
$s_plugin_FAQ_delete_faq_item_button = "Lösche FAQ"; | ||
$s_plugin_FAQ_edit_faq_title = "Bearbeite FAQ"; | ||
$s_plugin_FAQ_update_faq_button = "Aktualisiere FAQ"; | ||
$s_plugin_FAQ_import_faq = "In FAQ veröffentlichen"; | ||
$s_plugin_FAQ_search_string = "Den gesamten Text durchsuchen"; | ||
$s_plugin_FAQ_close_window = "Fenster schließen"; | ||
// config section | ||
$s_plugin_FAQ_plugin_format_title = "Mantis FAQ"; | ||
$s_plugin_FAQ_plugin_format_config = "Konfiguration"; | ||
$s_plugin_FAQ_plugin_format_promote_text = "Probleme können in FAQ veröffentlicht werden"; | ||
$s_plugin_FAQ_plugin_format_project_text = "FAQ projektspezifisch abspeichern"; | ||
$s_plugin_FAQ_plugin_format_threshold_text = "Minimale Zugangsberechtigung um FAQ zu erstellen"; | ||
$s_plugin_FAQ_faq_view_check = "Wenn ein problem zum FAQ veröffentlicht wird, erst bearbeiten"; | ||
$s_plugin_FAQ_faq_view_threshold = "Minimale Zugangsberechtigung um FAQ anzusehen"; | ||
$s_plugin_FAQ_faq_view_window = "FAQs in neuem Fenster öffnen"; | ||
$s_plugin_FAQ_plugin_format_enabled = "An"; | ||
$s_plugin_FAQ_plugin_format_disabled = "Aus"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.