![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: addedit.php 168 2008-05-20 11:22:15Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/forums/addedit.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 // Add / Edit forum 7 8 $forum_id = intval(w2PgetParam($_GET, 'forum_id', 0)); 9 10 // check permissions for this record 11 $perms = &$AppUI->acl(); 12 $canAuthor = $perms->checkModule('forums', 'add'); 13 $canEdit = $perms->checkModuleItem('forums', 'edit', $forum_id); 14 15 // check permissions 16 if (!$canAuthor || !$canEdit) { 17 $AppUI->redirect('m=public&a=access_denied'); 18 } 19 20 // load the companies class to retrieved denied projects 21 require_once ($AppUI->getModuleClass('projects')); 22 23 $forum_id = intval(w2PgetParam($_GET, 'forum_id', 0)); 24 25 //Pull forum information 26 $q = &new DBQuery; 27 $q->addTable('forums'); 28 $q->addWhere('forums.forum_id = ' . (int)$forum_id); 29 $res = $q->exec(ADODB_FETCH_ASSOC); 30 echo db_error(); 31 $forum_info = $q->fetchRow(); 32 33 $status = isset($forum_info['forum_status']) ? $forum_info['forum_status'] : -1; 34 35 // get any project records denied from viewing 36 $projObj = new CProject(); 37 38 //Pull project Information 39 $q = &new DBQuery; 40 $q->addTable('projects', 'pr'); 41 $q->addQuery('pr.project_id, project_name'); 42 $q->addWhere('project_active = 1'); 43 $q->addOrder('project_name'); 44 $projObj->setAllowedSQL($AppUI->user_id, $q, null, 'pr'); 45 if (isset($company_id)) { 46 $q->addWhere('project_company = ' . (int)$company_id); 47 } 48 $projects = array('0' => '') + $q->loadHashList(); 49 echo db_error(); 50 51 $perms = &$AppUI->acl(); 52 $permittedUsers = &$perms->getPermittedUsers(); 53 if(count($permittedUsers)){ 54 $users = array(0 => '') + $permittedUsers; 55 } else { 56 $users = array(0 => ''); 57 } 58 // setup the title block 59 $ttl = $forum_id > 0 ? 'Edit Forum' : 'Add Forum'; 60 $titleBlock = new CTitleBlock($ttl, 'support.png', $m, $m . '.' . $a); 61 $titleBlock->addCrumb('?m=forums', 'forums list'); 62 if ($canDelete) { 63 $titleBlock->addCrumbRight('<table cellspacing="0" cellpadding="0" border="0"?<tr><td><a class="delete" href="javascript:delIt()"><span>' . $AppUI->_('delete forum') . '</span></a></td></tr></table>'); 64 } 65 $titleBlock->show(); 66 ?> 67 <script language="javascript"> 68 function submitIt(){ 69 var form = document.changeforum; 70 if(form.forum_name.value.search(/^\s*$/) >= 0 ) { 71 alert("<?php echo $AppUI->_('forumName', UI_OUTPUT_JS); ?>"); 72 form.forum_name.focus(); 73 } else if(form.forum_project.selectedIndex < 1) { 74 alert("<?php echo $AppUI->_('forumSelectProject', UI_OUTPUT_JS); ?>"); 75 form.forum_project.focus(); 76 } else if(form.forum_owner.selectedIndex < 1) { 77 alert("<?php echo $AppUI->_('forumSelectOwner', UI_OUTPUT_JS); ?>"); 78 form.forum_owner.focus(); 79 } else { 80 form.submit(); 81 } 82 } 83 84 function delIt(){ 85 var form = document.changeforum; 86 if (confirm( "<?php echo $AppUI->_('forumDeleteForum', UI_OUTPUT_JS); ?>" )) { 87 form.del.value="<?php echo $forum_id; ?>"; 88 form.submit(); 89 } 90 } 91 </script> 92 93 <form name="changeforum" action="?m=forums" method="post"> 94 <input type="hidden" name="dosql" value="do_forum_aed" /> 95 <input type="hidden" name="del" value="0" /> 96 <input type="hidden" name="forum_unique_update" value="<?php echo uniqid(''); ?>" /> 97 <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>" /> 98 <table cellspacing="0" cellpadding="4" border="0" width="100%" class="std"> 99 <tr> 100 <th valign="top" colspan="3"> 101 <strong><?php 102 echo $AppUI->_($forum_id ? 'Edit' : 'Add') . ' ' . $AppUI->_('Forum'); 103 ?></strong> 104 </th> 105 </tr> 106 <tr> 107 <td valign="top" width="50%"> 108 <strong><?php echo $AppUI->_('Details'); ?></strong> 109 <table cellspacing="1" cellpadding="2" width="100%"> 110 <tr> 111 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Forum Name'); ?>:</td> 112 <td> 113 <input type="text" class="text" size="25" name="forum_name" value="<?php echo $forum_info['forum_name']; ?>" maxlength="50" style="width:200px;" /> 114 </td> 115 </tr> 116 <tr> 117 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Related Project'); ?></td> 118 <td> 119 <?php 120 echo arraySelect($projects, 'forum_project', 'size="1" class="text"', $forum_info['forum_project']); 121 ?> 122 </td> 123 </tr> 124 <tr> 125 <td align="right"><?php echo $AppUI->_('Owner'); ?>:</td> 126 <td> 127 <?php 128 echo arraySelect($users, 'forum_owner', 'size="1" class="text"', $forum_info['forum_owner'] ? $forum_info['forum_owner'] : $AppUI->user_id); 129 ?> 130 </td> 131 </tr> 132 <tr> 133 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Moderator'); ?>:</td> 134 <td> 135 <?php 136 echo arraySelect($users, 'forum_moderated', 'size="1" class="text"', $forum_info['forum_moderated']); 137 ?> 138 </td> 139 </tr> 140 <?php if ($forum_id) { ?> 141 <tr> 142 <td align="right"><?php echo $AppUI->_('Created On'); ?></td> 143 <td bgcolor="#ffffff"><?php echo $forum_info['forum_create_date']; ?></td> 144 </tr> 145 <tr> 146 <td align="right"><?php echo $AppUI->_('Last Post'); ?>:</td> 147 <td bgcolor="#ffffff"><?php echo $forum_info['forum_last_date']; ?></td> 148 </tr> 149 <tr> 150 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Message Count'); ?>:</td> 151 <td bgcolor="#ffffff"><?php echo $forum_info['forum_message_count']; ?></td> 152 </tr> 153 <?php } ?> 154 </table> 155 </td> 156 <td valign="top" width="50%"> 157 <strong><?php echo $AppUI->_('Description'); ?></strong><br /> 158 <textarea class="textarea" cols="50" rows="7" name="forum_description"><?php echo $forum_info['forum_description']; ?></textarea> 159 </td> 160 </tr> 161 162 163 <tr> 164 <td align="left"> 165 <input type="button" value="<?php echo $AppUI->_('back'); ?>" class="button" onclick="javascript:window.location='./index.php?m=forums';" /> 166 </td> 167 <td align="right" colspan="2"><?php 168 if ($AppUI->user_id == $forum_info['forum_owner'] || $forum_id == 0) { 169 echo '<input type="button" value="' . $AppUI->_('submit') . '" class=button onclick="submitIt()" />'; 170 } ?></td> 171 </tr> 172 </form> 173 </table>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |