Changeset 11744
- Timestamp:
- 08/27/07 16:39:26 (1 year ago)
- Files:
-
- branches/branch-2_6/src/cc.kaktus.query/config/config.inc (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/config/mgdschema.sql (modified) (3 diffs)
- branches/branch-2_6/src/cc.kaktus.query/config/mgdschema.xml (modified) (3 diffs)
- branches/branch-2_6/src/cc.kaktus.query/config/schemadb_question_default.inc (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/dba_classes/group.php (modified) (5 diffs)
- branches/branch-2_6/src/cc.kaktus.query/dba_classes/question.php (modified) (2 diffs)
- branches/branch-2_6/src/cc.kaktus.query/handler/ajax.php (added)
- branches/branch-2_6/src/cc.kaktus.query/handler/create (deleted)
- branches/branch-2_6/src/cc.kaktus.query/handler/create.php (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/handler/edit.php (added)
- branches/branch-2_6/src/cc.kaktus.query/handler/view.php (modified) (4 diffs)
- branches/branch-2_6/src/cc.kaktus.query/locale/default.en.txt (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/locale/default.fi.txt (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/navigation.php (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/static/creation.js (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-ajax-create-failed.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-edit-footer.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-edit-group-footer.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-edit-group-header.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-edit-group-question.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-edit-header.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-footer.php (modified) (1 diff)
- branches/branch-2_6/src/cc.kaktus.query/style/query-group-footer.php (added)
- branches/branch-2_6/src/cc.kaktus.query/style/query-group-header.php (added)
- branches/branch-2_6/src/cc.kaktus.query/viewer.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/branch-2_6/src/cc.kaktus.query/config/config.inc
r11698 r11744 13 13 // Order and navigation 14 14 'sort_order' => 'created DESC', 15 'display_in_navigation' => 0,15 'display_in_navigation' => 10, 16 16 'show_empty_groups' => false, 17 18 'enable_ajax_editing' => true, branches/branch-2_6/src/cc.kaktus.query/config/mgdschema.sql
r11699 r11744 9 9 end INT(8) NOT NULL DEFAULT 0, 10 10 score INT(8) NOT NULL DEFAULT 0, 11 creator INT(8) NOT NULL DEFAULT 0, 12 created INT(8) NOT NULL DEFAULT 0, 13 revisor INT(8) NOT NULL DEFAULT 0, 14 revised INT(8) NOT NULL DEFAULT 0, 15 sitegroup INT(8) NOT NULL DEFAULT 0, 11 16 PRIMARY KEY (id) 12 17 ); … … 20 25 end INT(8) NOT NULL DEFAULT 0, 21 26 score INT(8) NOT NULL DEFAULT 0, 27 creator INT(8) NOT NULL DEFAULT 0, 28 created INT(8) NOT NULL DEFAULT 0, 29 revisor INT(8) NOT NULL DEFAULT 0, 30 revised INT(8) NOT NULL DEFAULT 0, 31 sitegroup INT(8) NOT NULL DEFAULT 0, 22 32 PRIMARY KEY (id) 23 33 ); … … 29 39 answer LONGTEXT NOT NULL DEFAULT '', 30 40 identificator VARCHAR(255) NOT NULL DEFAULT '', 41 creator INT(8) NOT NULL DEFAULT 0, 42 created INT(8) NOT NULL DEFAULT 0, 43 revisor INT(8) NOT NULL DEFAULT 0, 44 revised INT(8) NOT NULL DEFAULT 0, 45 sitegroup INT(8) NOT NULL DEFAULT 0, 31 46 PRIMARY KEY (id) 32 47 ); 48 49 ALTER TABLE cc_kaktus_query_group ADD COLUMN creator INT(8) NOT NULL DEFAULT 0; 50 ALTER TABLE cc_kaktus_query_group ADD COLUMN created INT(8) NOT NULL DEFAULT 0; 51 ALTER TABLE cc_kaktus_query_group ADD COLUMN revisor INT(8) NOT NULL DEFAULT 0; 52 ALTER TABLE cc_kaktus_query_group ADD COLUMN revised INT(8) NOT NULL DEFAULT 0; 53 ALTER TABLE cc_kaktus_query_group ADD COLUMN sitegroup INT(8) NOT NULL DEFAULT 0; 54 55 ALTER TABLE cc_kaktus_query_question ADD COLUMN creator INT(8) NOT NULL DEFAULT 0; 56 ALTER TABLE cc_kaktus_query_question ADD COLUMN created INT(8) NOT NULL DEFAULT 0; 57 ALTER TABLE cc_kaktus_query_question ADD COLUMN revisor INT(8) NOT NULL DEFAULT 0; 58 ALTER TABLE cc_kaktus_query_question ADD COLUMN revised INT(8) NOT NULL DEFAULT 0; 59 ALTER TABLE cc_kaktus_query_question ADD COLUMN sitequestion INT(8) NOT NULL DEFAULT 0; 60 61 ALTER TABLE cc_kaktus_query_answer ADD COLUMN creator INT(8) NOT NULL DEFAULT 0; 62 ALTER TABLE cc_kaktus_query_answer ADD COLUMN created INT(8) NOT NULL DEFAULT 0; 63 ALTER TABLE cc_kaktus_query_answer ADD COLUMN revisor INT(8) NOT NULL DEFAULT 0; 64 ALTER TABLE cc_kaktus_query_answer ADD COLUMN revised INT(8) NOT NULL DEFAULT 0; 65 ALTER TABLE cc_kaktus_query_answer ADD COLUMN siteanswer INT(8) NOT NULL DEFAULT 0; branches/branch-2_6/src/cc.kaktus.query/config/mgdschema.xml
r11699 r11744 10 10 <property name="end" type="integer" /> 11 11 <property name="score" type="integer" /> 12 <property name="creator" link="midgard_person:id" reverse="no" type="integer"/> 13 <property name="created" type="integer" /> 14 <property name="revisor" link="midgard_person:id" reverse="no" type="integer"/> 15 <property name="revised" type="integer" /> 12 16 </type> 13 17 … … 19 23 <property name="end" type="integer" /> 20 24 <property name="score" type="integer" /> 25 <property name="creator" link="midgard_person:id" reverse="no" type="integer"/> 26 <property name="created" type="integer" /> 27 <property name="revisor" link="midgard_person:id" reverse="no" type="integer"/> 28 <property name="revised" type="integer" /> 21 29 </type> 22 30 … … 26 34 <property name="answer" type="text" /> 27 35 <property name="identificator" type="text" /> 36 <property name="creator" link="midgard_person:id" reverse="no" type="integer"/> 37 <property name="created" type="integer" /> 38 <property name="revisor" link="midgard_person:id" reverse="no" type="integer"/> 39 <property name="revised" type="integer" /> 28 40 </type> 29 41 </Schema> branches/branch-2_6/src/cc.kaktus.query/config/schemadb_question_default.inc
r11699 r11744 8 8 // COMPONENT-REQUIRED 9 9 'title' => 'title', 10 'storage' => ' title',10 'storage' => 'question', 11 11 'required' => true, 12 12 'type' => 'text', branches/branch-2_6/src/cc.kaktus.query/dba_classes/group.php
r11699 r11744 55 55 } 56 56 57 // Prevent saving duplicate names 58 if (cc_kaktus_query_group_dba::get_by_name($this->name)) 59 { 60 return false; 61 } 62 57 63 return true; 58 64 } … … 67 73 { 68 74 if ( !$this->node 69 && !$this-> query)75 && !$this->up) 70 76 { 71 77 return false; … … 74 80 // Check that the node exists 75 81 if ( !$this->up 76 && $this-> node)82 && $this->up) 77 83 { 78 84 $node = new midcom_db_topic($this->node); … … 84 90 return false; 85 91 } 92 } 93 94 // Prevent saving duplicate names 95 if (cc_kaktus_query_group_dba::get_by_name($this->name)) 96 { 97 return false; 86 98 } 87 99 … … 96 108 * @return cc_kaktus_query_group_dba object or false on failure 97 109 */ 98 function get_by_name($name )110 function get_by_name($name, $topic = null) 99 111 { 100 112 $qb = cc_kaktus_query_group_dba::new_query_builder(); 101 113 $qb->add_constraint('name', '=', $name); 102 114 103 // Get the current topic 104 $topic = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_CONTENTTOPIC); 115 // Get the content topic 116 if (is_null($topic)) 117 { 118 // Get the current topic 119 $topic = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_CONTENTTOPIC); 120 } 105 121 106 $qb->add_constraint('node', '=', $topic->id); 122 if (is_object($topic)) 123 { 124 $id = (int) $topic->id; 125 } 126 else 127 { 128 $id = (int) $topic; 129 } 130 131 $qb->add_constraint('node', '=', $id); 107 132 $qb->set_limit(1); 108 133 branches/branch-2_6/src/cc.kaktus.query/dba_classes/question.php
r11699 r11744 35 35 function _on_creating() 36 36 { 37 if (!$this-> group)37 if (!$this->up) 38 38 { 39 39 return false; … … 51 51 function _on_updating() 52 52 { 53 if (!$this-> group)53 if (!$this->up) 54 54 { 55 55 return false; branches/branch-2_6/src/cc.kaktus.query/handler/create.php
r11699 r11744 67 67 $this->_group = new cc_kaktus_query_group_dba(); 68 68 $this->_group->node = $this->_topic->id; 69 $this->_group->up = 0; 69 70 70 if (! $this->_group->create())71 if (!$this->_group->create()) 71 72 { 72 73 debug_push_class(__CLASS__, __FUNCTION__); branches/branch-2_6/src/cc.kaktus.query/handler/view.php
r11698 r11744 22 22 23 23 /** 24 * Queries stored in an array 25 * 26 * @access private 27 * @var array $_queries Array of cc_kaktus_query_dba objects 28 */ 29 var $_queries = array(); 24 * Query group 25 * 26 * @access private 27 * @var cc_kaktus_query_group $_group 28 */ 29 var $_group; 30 31 /** 32 * Order of queries 33 * 34 * @access private 35 * @var array $_order 36 */ 37 var $_order = array 38 ( 39 'key' => 'created', 40 'order' => 'ASC', 41 ); 42 43 /** 44 * Store AJAX controller enabled HTML 45 * 46 * @access private 47 * @var Array $_view_html 48 */ 49 var $_view_html = array(); 50 51 /** 52 * Load datamanagers 53 * 54 * @access private 55 * @return boolean Indicating success 56 */ 57 function _load_datamanagers() 58 { 59 $this->_datamanager = new midcom_helper_datamanager2_datamanager($this->_request_data['schemadb_group']); 60 $this->_datamanager_question = new midcom_helper_datamanager2_datamanager($this->_request_data['schemadb_question']); 61 62 // Try to initialize the datamanagers 63 if ( $this->_datamanager->initialize() 64 || $this->_datamanager_question->initialize()) 65 { 66 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 'Failed to load datamanagers'); 67 // This will exit 68 } 69 70 if ($this->_config->get('enable_ajax_editing')) 71 { 72 $this->_controller = midcom_helper_datamanager2_controller::create('ajax'); 73 $this->_controller->schemadb =& $this->_request_data['schemadb_group']; 74 $this->_controller->set_storage($this->_group); 75 $this->_controller->process_ajax(); 76 } 77 } 30 78 31 79 /** … … 46 94 function _load_datamanager() 47 95 { 48 $this->_datamanager = new midcom_helper_datamanager2_datamanager($this->_request_data['schemadb']); 49 50 if (!$this->_datamanager) 51 { 96 $this->_datamanager = new midcom_helper_datamanager2_datamanager($this->_request_data['schemadb_group']); 97 98 if (!$this->_datamanager) { 52 99 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to create a DM2 instance"); 53 100 // This will exit. 54 101 } 55 102 } 103 104 /** 105 * Set the toolbar items and bind to metadata 106 * 107 * @access private 108 */ 109 function _process_group() 110 { 111 // Set the active page 112 $this->_component_data['active_leaf'] = $this->_group->guid; 113 $_MIDCOM->set_pagetitle($this->_group->title); 114 115 // Set the toolbar items 116 $this->_view_toolbar->add_item 117 ( 118 array 119 ( 120 MIDCOM_TOOLBAR_URL => "edit/{$this->_group->name}/", 121 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), 122 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', 123 ) 124 ); 125 126 // Bind to metadata 127 $_MIDCOM->bind_view_to_object($this->_group); 128 $_MIDCOM->set_26_request_metadata($this->_group->revised, $this->_group->guid); 129 } 130 131 /** 132 * Prevent URL hijacking 133 * 134 * @access public 135 * @return boolean True if this handler is allowed to process the request, false if another topic should try its luck 136 */ 137 function _can_handle_view($handler_id, $args) 138 { 139 if (!isset($args[0])) 140 { 141 $qb = cc_kaktus_query_group_dba::new_query_builder(); 142 $qb->add_constraint('node', '=', $this->_topic->id); 143 $qb->add_order('created', 'DESC'); 144 $qb->set_limit(1); 145 146 $results = $qb->execute(); 147 148 $this->_group =& $results[0]; 149 $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX); 150 151 $_MIDCOM->relocate("{$prefix}{$this->_topic->name}/{$results[0]->name}/"); 152 // This will exit 153 } 154 155 // Get the group 156 $this->_group = cc_kaktus_query_group_dba::get_by_name($args[0], $this->_topic->id); 157 158 if ( empty($this->_group) 159 || !isset($this->_group->guid) 160 || !$this->_group->guid) 161 { 162 return false; 163 } 164 165 return true; 166 } 56 167 57 168 /** … … 62 173 function _handler_view($handler_id, $args, &$data) 63 174 { 175 $this->_order = cc_kaktus_query_navigation::get_order($this->_config->get('sort_order')); 176 177 // Set the toolbar items and process metadata 178 $this->_process_group(); 179 180 // Load the DM2 instance 181 $this->_load_datamanager(); 182 183 // Get AJAXed HTML and controllers 184 if ($this->_config->get('enable_ajax_editing')) 185 { 186 $ajax_data = array(); 187 cc_kaktus_query_viewer::get_ajax_html($this->_config, $this->_group->id, &$ajax_data); 188 $this->_view_html = $ajax_data['view_html']; 189 } 190 64 191 return true; 65 192 } … … 72 199 function _show_view($handler_id, &$data) 73 200 { 201 $data['datamanager'] =& $this->_datamanager; 74 202 midcom_show_style('query-header'); 75 203 76 // Show every query item 77 foreach ($this->_queries as $query) 78 { 79 $data['query'] =& $query; 80 $data['datamanager']->autoset_storage($query); 81 82 // Check if the current user has answered to the question 83 if (cc_kaktus_query_dba::has_answered()) 204 $this->_show_query_group($this->_group, &$data); 205 206 midcom_show_style('query-footer'); 207 } 208 209 /** 210 * Show a query group and subsequent child groups 211 * 212 * @access private 213 * @param cc_kaktus_query_group $group 214 */ 215 function _show_query_group($group, &$data) 216 { 217 $data['group'] =& $group; 218 $this->_datamanager->autoset_storage($group); 219 220 if ($this->_config->get('enable_ajax_editing')) 221 { 222 $data['view'] = $this->_view_html[$group->guid]; 223 } 224 else 225 { 226 $data['view'] = $this->_datamanager->get_content_html(); 227 } 228 229 // Show the group header 230 midcom_show_style('query-group-header'); 231 232 // Get the subgroups with a query builder 233 $qb = cc_kaktus_query_group_dba::new_query_builder(); 234 $qb->add_constraint('up', '=', $group->id); 235 $qb->add_order($this->_order['key'], $this->_order['order']); 236 237 // Show the subgroups 238 foreach ($qb->execute() as $subgroup) 239 { 240 $this->_show_query_group($subgroup, &$data); 241 } 242 243 // Get the questions with a query builder 244 $qb = cc_kaktus_query_question_dba::new_query_builder(); 245 $qb->add_constraint('up', '=', $group->id); 246 $qb->add_order('score', 'DESC'); 247 248 foreach ($qb->execute() as $question) 249 { 250 if ($this->_config->get('enable_ajax_editing')) 84 251 { 85 midcom_show_style('query-item-answered');252 $data['view'] = $this->_view_html[$question->guid]; 86 253 } 87 254 else 88 255 { 89 midcom_show_style('query-item'); 256 $this->_datamanager_question->autoset_storage($question); 257 $data['view'] = $this->_datamanager_question->get_content_html(); 90 258 } 91 } 92 midcom_show_style('query-footer'); 93 echo "<pre>\n"; 94 $group = new cc_kaktus_query_group_dba(); 95 print_r($group); 96 97 $question = new cc_kaktus_query_question_dba(); 98 print_r($question); 99 100 $answer = new cc_kaktus_query_answer_dba(); 101 print_r($answer); 102 echo "</pre>\n"; 259 260 midcom_show_style('query-question'); 261 } 262 263 midcom_show_style('query-group-footer'); 103 264 } 104 265 } branches/branch-2_6/src/cc.kaktus.query/locale/default.en.txt
r11698 r11744 4 4 ---LANGUAGE en 5 5 6 ---STRING Only show approved articles7 Only show approved articles6 ---STRING queries 7 Queries 8 8 ---STRINGEND 9 9 10 ---STRING activate autoindex11 Automatically create an index page for this topic? 10 ---STRING query 11 Query 12 12 ---STRINGEND 13 13 14 ---STRING approve15 Approve14 ---STRING score 15 Score 16 16 ---STRINGEND 17 17 18 ---STRING article19 Article 18 ---STRING oldest first 19 Oldest first 20 20 ---STRINGEND 21 21 22 ---STRING auto_approved23 Approve new articles by default22 ---STRING newest first 23 Newest first 24 24 ---STRINGEND 25 25 26 ---STRING autoindex-notes27 The index page replaces the article with the URL name index and consists of a list of all articles and attachments of the current topic. 26 ---STRING new query 27 New query 28 28 ---STRINGEND 29 29 30 ---STRING back to overview31 Back to overview 30 ---STRING sort order 31 Sort order 32 32 ---STRINGEND 33 33 34 ---STRING content35 Content 34 ---STRING amount of items to display in navigation 35 Amount of items to display in navigation 36 36 ---STRINGEND 37 37 38 ---STRING create article39 Create Article 38 ---STRING question group created 39 Question group created 40 40 ---STRINGEND 41 41 42 ---STRING default_schema43 Default schema for new articles 42 ---STRING create a question group 43 Create a question group 44 44 ---STRINGEND 45 45 46 ---STRING delete article47 Delete Article 46 ---STRING create a new question group 47 Create a new question group 48 48 ---STRINGEND 49 50 ---STRING directory index for %s51 Directory index for %s52 ---STRINGEND53 54 ---STRING display settings55 Article display configuration56 ---STRINGEND57 58 ---STRING edit article59 Edit Article60 ---STRINGEND61 62 ---STRING file lastmodified63 Last modified date64 ---STRINGEND65 66 ---STRING filedescription67 File Description68 ---STRINGEND69 70 ---STRING filename71 File Name72 ---STRINGEND73 74 ---STRING filesize75 File Size76 ---STRINGEND77 78 ---STRING filetype79 File Type80 ---STRINGEND81 82 ---STRING indexinnav83 Show the index article in navigation?84 ---STRINGEND85 86 ---STRING net.nehmer.static87 Regular content88 ---STRINGEND89 90 ---STRING no files in this directory91 There are no files in this directory92 ---STRINGEND93 94 ---STRING no index article95 This folder does not have an <strong>index</strong> article. Please create an article with URL name <strong>index</strong> or activate the autoindex mode to get started.96 ---STRINGEND97 98 ---STRING no schemas available99 No Schemas available100 ---STRINGEND101 102 ---STRING schema settings103 Data schema settings104 ---STRINGEND105 106 ---STRING schemadb107 Schema database to use for this topic108 ---STRINGEND109 110 ---STRING select schema111 Select Schema112 ---STRINGEND113 114 ---STRING settings115 Settings116 ---STRINGEND117 118 ---STRING symlink_topic119 Get content from another topic ("symlink")120 ---STRINGEND121 122 ---STRING symlink_topic disabled123 No topic selected124 ---STRINGEND125 126 ---STRING taviewer127 Static Content128 ---STRINGEND129 130 ---STRING unapprove131 Unapprove132 ---STRINGEND133 134 ---STRING view article135 View Article136 ---STRINGEND137 138 ---STRING visible139 Should the topic be visible140 ---STRINGEND141 142 ---STRING ajax_enable143 Enable AJAX on-site editing144 ---STRINGEND145 branches/branch-2_6/src/cc.kaktus.query/locale/default.fi.txt
r11698 r11744 3 3 ---CVS $Id: default.fi.txt 3903 2006-08-28 09:51:25Z bergie $ 4 4 ---LANGUAGE fi 5 6 ---STRING Only show approved articles7 NÀytÀ vain hyvÀksytyt artikkelit8 ---STRINGEND9 10 ---STRING activate autoindex11 Luo automaattinen sisÀllysluettelo kansiolle?12 ---STRINGEND13 14 ---STRING approve15 HyvÀksy16 ---STRINGEND17 18 ---STRING article19 Artikkeli20 ---STRINGEND21 22 ---STRING auto_approved23 HyvÀksy uudet artikkelit oletuksena24 ---STRINGEND25 26 ---STRING autoindex-notes27 SisÀllysluettelo korvaa index-artikkelin ja sisÀltÀÀ listan kaikista kansiossa olevista artikkeleista ja liitteistÀ.28 ---STRINGEND29 30 ---STRING back to overview31 Takaisin etusivulle32 ---STRINGEND33 34 ---STRING content35 SisÀltö36 ---STRINGEND37 38 ---STRING create article39 Luo artikkeli40 ---STRINGEND41 42 ---STRING default_schema43 Oletus-tietokantakuvaus uusille artikkeleille44 ---STRINGEND45 46 ---STRING delete article47 Poista artikkeli48 ---STRINGEND49 50 ---STRING directory index for %s51 Kansion %s sisÀllysluettelo52 ---STRINGEND53 54 ---STRING display settings55 Artikkelien nÀkyvyysasetukset56 ---STRINGEND57 58 ---STRING edit article59 Muokkaa artikkelia60 ---STRINGEND61 62 ---STRING file lastmodified63 Viimeksi muokattu64 ---STRINGEND65 66 ---STRING filedescription67 Kuvaus68 ---STRINGEND69 70 ---STRING filename71 Tiedostonimi72 ---STRINGEND73 74 ---STRING filesize75 Koko76 ---STRINGEND77 78 ---STRING filetype79 Tyyppi80 ---STRINGEND81 82 ---STRING indexinnav83 NÀytetÀÀnkö index-artikkeli navigaatiossa?84 ---STRINGEND85 86 ---STRING net.nehmer.static87 Normaali sisÀltö88 ---STRINGEND89 90 ---STRING no files in this directory91 Ei tiedostoja kansiossa92 ---STRINGEND93 94 ---STRING no index article95 Kansiosta puuttuu <strong>index</strong>-artikkeli. Luo artikkeli jonka tiedostonimenÀ on <strong>index</strong> tai laita automaattinen sisÀllysluettelo pÀÀlle.96 ---STRINGEND97 98 ---STRING no schemas available99 Tietokantakuvausta (schema) ei löydy100 ---STRINGEND101 102 ---STRING schema settings103 Tietokantakuvauksen asetukset104 ---STRINGEND105 106 ---STRING schemadb107 TÀssÀ kansiossa kÀytettÀvÀ tietokantakuvaus108 ---STRINGEND109 110 ---STRING select schema111 Valitse tyyppi112 ---STRINGEND113 114 ---STRING settings115 Asetukset116 ---STRINGEND117 118 ---STRING symlink_topic119 Hae sisÀllöt toisesta kansiosta ("symlink")120 ---STRINGEND121 122 ---STRING symlink_topic disabled123 Ei kansiota124 ---STRINGEND125 126 ---STRING taviewer127 Staattinen sisÀltö128 ---STRINGEND129 130 ---STRING unapprove131 Poista hyvÀksyntÀ132 ---STRINGEND133 134 ---STRING view article135 NÀytÀ artikkeli136 ---STRINGEND137 138 ---STRING visible139 Onko kansio nÀkyvissÀ140 ---STRINGEND141 142 ---STRING ajax_enable143 Salli sisÀllön muokkaaminen AJAXilla suoraan sivulla144 ---STRINGEND145 branches/branch-2_6/src/cc.kaktus.query/navigation.php
r11698 r11744 32 32 function get_leaves() 33 33 { 34 return array(); 34 // Return empty result set if configured 35 if ($this->_config->get('display_in_navigation') == 0) 36 { 37 return array(); 38 } 35 39 36 /* 37 // Prepare everything 38 $leaves = array (); 39 40 foreach ($result as $article) 40 $qb = cc_kaktus_query_group_dba::new_query_builder(); 41 $qb->add_constraint('node', '=', $this->_topic->id); 42 43 $order = cc_kaktus_query_navigation::get_order($this->_config->get('sort_order')); 44 45 $qb->add_order($order['key'], $order['order']); 46 $qb->set_limit($this->_config->get('display_in_navigation')); 47 48 foreach ($qb->execute() as $group) 41 49 { 42 $leaves[$ article->id] = array50 $leaves[$group->guid] = array 43 51 ( 44 MIDCOM_NAV_SITE => Array52 MIDCOM_NAV_SITE => array 45 53 ( 46 MIDCOM_NAV_URL => "{$ article->name}.html",47 MIDCOM_NAV_NAME => ($article->title != '') ? $article->title : $article->name54 MIDCOM_NAV_URL => "{$group->name}/", 55 MIDCOM_NAV_NAME => $group->title, 48 56 ), 49 57 MIDCOM_NAV_ADMIN => null, 50 MIDCOM_NAV_GUID => $ article->guid,51 MIDCOM_NAV_OBJECT => $ article,52 MIDCOM_META_CREATOR => $ article->creator,53 MIDCOM_META_EDITOR => $ article->revisor,54 MIDCOM_META_CREATED => $ article->created,55 MIDCOM_META_EDITED => $ article->revised58 MIDCOM_NAV_GUID => $group->guid, 59 MIDCOM_NAV_OBJECT => $group, 60 MIDCOM_META_CREATOR => $group->creator, 61 MIDCOM_META_EDITOR => $group->revisor, 62 MIDCOM_META_CREATED => $group->created, 63 MIDCOM_META_EDITED => $group->revised, 56 64 ); 57 58 65 } 66 59 67 return $leaves; 60 /* */ 68 } 69 70 /** 71 * Get the navigation order as an array 72 * 73 * @access static public 74 */ 75 function get_order($order) 76 { 77 $orders = array 78 ( 79 'key' => 'created', 80 'order' => 'ASC', 81 ); 82 83 if (preg_match('/\sDESC$/i', $order)) 84 { 85 $orders['order'] = 'DESC'; 86 } 87 88 if (preg_match('/([^\s])/', $order, $regs)) 89 { 90 switch (strtolower($regs[1])) 91 { 92 case 'score': 93 case 'start': 94 case 'created': 95 case 'revised': 96 case 'metadata.created': 97 case 'metadata.revised': 98 $orders['key'] = $regs[1]; 99 break; 100 } 101 } 102 103 return $orders; 61 104 } 62 105 } branches/branch-2_6/src/cc.kaktus.query/style/query-footer.php
r11698 r11744 1 1 </div> 2 <?php 3 // TODO: tÀnne kerÀilijÀ, jolla haetaan kaikki edellisen divin sisÀllÀ olevat sortablet 4 ?> branches/branch-2_6/src/cc.kaktus.query/viewer.php
r11698 r11744 35 35 36 36 // Show the latest configured amount of queries 37 // Match /latest/ 37 38 $this->_request_switch['latest_list'] = array 38 39 ( … … 46 47 'handler' => array('cc_kaktus_query_handler_view', 'view'), 47 48 'fixed_args' => array('latest'), 49 'variable_args' => 1, 50 ); 51 52 // AJAX creation wizard 53 // Match /ajax/create/<type> 54 $this->_request_switch['ajax_create'] = array 55 ( 56 'handler' => array('cc_kaktus_query_handler_ajax', 'create'), 57 'fixed_args' => array('ajax', 'create'), 48 58 'variable_args' => 1, 49 59 ); … … 71 81 'handler' => array('cc_kaktus_query_handler_edit', 'edit'), 72 82 'fixed_args' => array('edit'), 83 'variable_args' => 1, 84 ); 85 86 // View a question group 87 // Match /<question group guid>/ 88 $this->_request_switch['view_group'] = array 89 ( 90 'handler' => array('cc_kaktus_query_handler_view', 'view'), 73 91 'variable_args' => 1, 74 92 ); … … 98 116 MIDCOM_TOOLBAR_URL => "create/", 99 117 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('new query'), 100 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock -new.png',118 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new.png', 101 119 ) 102 120 ); … … 111 129 { 112 130 $this->_request_data['schemadb_group'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_group')); 113 //$this->_request_data['schemadb_question'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_question'));131 $this->_request_data['schemadb_question'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_question')); 114 132 115 133 // Not needed everywhere, only when answering … … 130 148 return true; 131 149 } 150 151 /** 152 * Get AJAXed HTML for miscellaneous purposes 153 * 154 * @param midcom_helper_configuration $config Component configuration 155 * @param int $id ID of the question group root 156 * @access static public 157 * @return Array 158 */ 159 function get_ajax_html($config, $id, &$ajax_data) 160 { 161 if (!$config->get('enable_ajax_editing')) 162 { 163 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 'Method <i>get_ajax_html</i> may be used only when AJAX editing is enabled'); 164 // This will exit 165 } 166 167 // Get the controllers if they haven't yet been defined 168 if (!isset($ajax_data['controller_group'])) 169 { 170 // Get the schemas 171 $schemadb_group = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_group')); 172 173 // Get the controller 174 $controller_group = midcom_helper_datamanager2_controller::create('ajax'); 175 $controller_group->schemadb =& $schemadb_group; 176 177 $ajax_data['controller_group'] =& $controller_group; 178 } 179 180 // Get the controllers if they haven't yet been defined 181 if (!isset($ajax_data['controller_question'])) 182 { 183 // Get the schemas 184
