Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Jul 19, 4:46 AM

in-portal

Index: trunk/admin/category/addcategory.php
===================================================================
--- trunk/admin/category/addcategory.php (revision 4106)
+++ trunk/admin/category/addcategory.php (revision 4107)
@@ -1,332 +1,349 @@
<?php
// new startup: begin
define('REL_PATH', 'admin/category');
$relation_level = count( explode('/', REL_PATH) );
define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
require_once FULL_PATH.'/kernel/startup.php';
// new startup: end
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
unset($objEditItems);
if($_REQUEST['item'])
{
// smulate like normal edit button pressed
$tmp_cat =& $objCatList->GetItemByField('ResourceId', $_REQUEST['item']);
$_POST['catlist'][] = $tmp_cat->UniqueId();
}
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
$objCustomFields = new clsCustomFieldList(1);
$application->SetVar('c_mode', 't');
$objCustomDataList = new clsCustomDataList();
$objRelList = new clsRelationshipList();
$objImages = new clsImageList();
//Multiedit init
if ($_GET["new"] == 1)
{
$c = new clsCategory(NULL);
$c->Set("CreatedOn", adodb_mktime());
$c->Set("EndOn", adodb_mktime());
$c->Set("ParentId",$objCatList->CurrentCategoryID());
$c->Set("NewItem",2); //auto
$c->Set("Status",2); //pending
$c->Set('AutomaticFilename', 1);
$en = 0;
$action = "m_add_category";
$objCatList->CreateEmptyEditTable("CategoryId");
$objRelList->CreateEmptyEditTable("RelationshipId");
$objCustomDataList->CreateEmptyEditTable('c');
$objImages->CreateEmptyEditTable("ResourceId");
$TitleVerb = prompt_language("la_Text_Adding");
}
else
{
if(isset($_POST["catlist"]))
{
$cats = $_POST["catlist"];
$objCatList->CopyToEditTable("CategoryId",$cats);
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
/* make a copy of the relationship records */
$ids = $objEditItems->GetResourceIDList();
$objRelList->CopyToEditTable("SourceId", $ids);
$objCustomDataList->CopyToEditTable('c', $ids);
$objImages->CopyToEditTable("ResourceId", $ids);
$c = $objEditItems->GetItemByIndex(0);
$itemcount=$objEditItems->NumItems();
$en = 0;
}
else
{
if($_GET["item"])
{
/*shortcut to edit link */
$objCatList->CopyToEditTable("ResourceId",$_GET["item"]);
$backurl = $_GET["return"];
}
//Multiedit init
$en = (int)$_GET["en"];
$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
//$ids = $objEditItems->GetResourceIDList();
//$objRelList->CopyToEditTable("SourceId", $ids);
//$objCustomDataList->CopyToEditTable("ResourceId",$ids);
//$objImages->CopyToEditTable("ResourceId", $ids);
$itemcount=$objEditItems->NumItems();
$c = $objEditItems->GetItemByIndex($en);
}
if($itemcount>1)
{
if ($en+1 == $itemcount)
$en_next = -1;
else
$en_next = $en+1;
if ($en == 0)
$en_prev = -1;
else
$en_prev = $en-1;
}
$action = "m_edit_category";
$TitleVerb = prompt_language("la_Text_Editing");
}
$envar = "env=" . BuildEnv() . "&en=$en";
$section = 'in-portal:editcategory_general';
if (strlen($c->Get("Name")))
$editing_category_title = "'".$c->Get("Name")."' ";
else
$editing_category_title = "";
$title = $TitleVerb." ".prompt_language("la_Text_Category")." $editing_category_title- ".prompt_language("la_tab_General");
//$saveURL = $admin."/browse.php";
$saveURL = $admin."/category/category_maint.php";
$cancelURL = $admin."/".$objSession->GetVariable('ReturnScript');
//Display header
$sec = $objSections->GetSection($section);
$objCatToolBar = new clsToolBar();
$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('category','CatEditStatus','$saveURL',1,'');","tool_select.gif");
$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','CatEditStatus','$cancelURL',2,'');","tool_cancel.gif");
if ( isset($en_prev) || isset($en_next) )
{
$url = $RootUrl.$admin."/category/addcategory.php";
$StatusField = "CatEditStatus";
$form = "category";
MultiEditButtons($objCatToolBar,$en_next,$en_prev,$form,$StatusField,$url,$sec->Get("OnClick"),'','la_PrevCategory','la_NextCategory');
}
int_header($objCatToolBar,NULL,$title);
$c->Data=inp_htmlize($c->Data);
if ($objSession->GetVariable("HasChanges") == 1) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
</td>
</tr>
</table>
<?php } ?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<form ID="category" name="category" action="" method=POST>
<tr <?php int_table_color(1); ?>>
<td valign="top" colspan="3"><?php echo prompt_language("la_prompt_Enable_HTML"); ?>
<input type="checkbox" name="html_enable" value="1" checked>
<br>
<?php int_hint(prompt_language("la_Warning_Enable_HTML")); ?>
</td>
</tr>
<?php int_subsection_title(prompt_language("la_Text_Category")); ?>
<?php if( $c->Get("CategoryId") > 0 ) { ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span class="text"><?php echo prompt_language("la_prompt_CategoryId"); ?></span></td>
<td valign="top"><span class="text"><?php echo $c->Get("CategoryId"); ?></span></td>
<td class="text">
<?php
if (IsDebugMode()) {
echo '<b>DBG:</b> ResourceId = '.$c->Get('ResourceId');
}
else {
echo '&nbsp;';
}
?>
</td>
</tr>
<?php } ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_cat_name" class="text"><?php echo prompt_language("la_prompt_Name"); ?></span></td>
<td>
<input type="text" name="cat_name" ValidationType="exists" tabindex="1" class="text" size="30" value="<?php echo $c->parsetag("cat_name"); ?>">
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_cat_desc" class="text"><?php echo prompt_language("la_prompt_Description"); ?></span>
<br />
<a href="#">
<img src="<?php echo $rootURL; ?>admin/icons/icon24_link_editor.gif" style="cursor:hand" border="0"
ONCLICK="document.forms[0].elements[0].checked=true; OpenEditor('&section=<?php echo $section; ?>','category','cat_desc');">
</a>
</td>
<td>
<textarea name="cat_desc" tabindex="2" ValidationType="exists" cols="60" rows="5" class="text"><?php echo inp_textarea_unescape($c->parsetag("cat_desc")); ?></textarea>
</td>
<td></td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_auto_filename" class="text"><?php echo prompt_language('la_prompt_AutomaticDirectoryName'); ?></span></td>
<td>
- <input type="checkbox" tabindex="5" name="auto_filename" id="auto_filename" class="text" value="1"<?php if( $c->Get('AutomaticFilename') == 1) echo ' checked'; ?> onchange="reflect_filename();">
+ <input type="checkbox" tabindex="3" name="auto_filename" id="auto_filename" class="text" value="1"<?php if( $c->Get('AutomaticFilename') == 1) echo ' checked'; ?> onchange="reflect_filename();">
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span ID="prompt_filename" class="text"><?php echo prompt_language('la_prompt_DirectoryName'); ?></span></td>
<td>
- <input type="text" name="filename" id="filename" tabindex="1" class="text" size="63" value="<?php echo $c->Get('Filename'); ?>">
+ <input type="text" name="filename" id="filename" tabindex="4" class="text" size="63" value="<?php echo $c->Get('Filename'); ?>">
</td>
<td>&nbsp;</td>
</tr>
+ <tr <?php int_table_color(); ?>>
+ <td valign="top"><span ID="prompt_category_template" class="text"><?php echo prompt_language('la_fld_DefaultCategoryTemplate'); ?></span></td>
+ <td>
+ <input type="text" name="category_template" tabindex="5" class="text" size="40" value="<?php echo $c->Get('CategoryTemplate'); ?>">
+ </td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr <?php int_table_color(); ?>>
+ <td valign="top"><span ID="prompt_item_template" class="text"><?php echo prompt_language('la_fld_DefaultItemTemplate'); ?></span></td>
+ <td>
+ <input type="text" name="item_template" tabindex="6" class="text" size="40" value="<?php echo $c->Get('ItemTemplate'); ?>">
+ </td>
+ <td>&nbsp;</td>
+ </tr>
+
<?php int_subsection_title(prompt_language("la_tab_Properties")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_status" class="text"><?php echo prompt_language("la_prompt_Status"); ?></span></td>
<td>
- <input type="radio" tabindex="3" name="status" class="text" value="1" <?php if($c->Get("Status") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Active"); ?>
- <input type="radio" tabindex="3" name="status" class="text" value="2" <?php if($c->Get("Status") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Pending"); ?>
- <input type="radio" tabindex="3" name="status" class="text" value="0" <?php if($c->Get("Status") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Disabled"); ?>
+ <input type="radio" tabindex="7" name="status" class="text" value="1" <?php if($c->Get("Status") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Active"); ?>
+ <input type="radio" tabindex="7" name="status" class="text" value="2" <?php if($c->Get("Status") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Pending"); ?>
+ <input type="radio" tabindex="7" name="status" class="text" value="0" <?php if($c->Get("Status") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Disabled"); ?>
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_itemnew" class="text"><?php echo prompt_language("la_prompt_New"); ?></span></td>
<td>
- <input type="radio" tabindex="4" name="itemnew" class="text" value="2" <?php if($c->Get("NewItem") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Auto"); ?>
- <input type="radio" tabindex="4" name="itemnew" class="text" value="1" <?php if($c->Get("NewItem") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Always"); ?>
- <input type="radio" tabindex="4" name="itemnew" class="text" value="0" <?php if($c->Get("NewItem") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Never"); ?>
+ <input type="radio" tabindex="8" name="itemnew" class="text" value="2" <?php if($c->Get("NewItem") == 2) echo "checked"; ?>><?php echo prompt_language("la_val_Auto"); ?>
+ <input type="radio" tabindex="8" name="itemnew" class="text" value="1" <?php if($c->Get("NewItem") == 1) echo "checked"; ?>><?php echo prompt_language("la_val_Always"); ?>
+ <input type="radio" tabindex="8" name="itemnew" class="text" value="0" <?php if($c->Get("NewItem") == 0) echo "checked"; ?>><?php echo prompt_language("la_val_Never"); ?>
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_cat_pick" class="text"><?php echo prompt_language("la_prompt_EditorsPick"); ?></span></td>
<td>
- <input type="checkbox" tabindex="5" name="cat_pick" class="text" value="1" <?php if($c->Get("EditorsPick") == 1) echo "checked"; ?>>
+ <input type="checkbox" tabindex="9" name="cat_pick" class="text" value="1" <?php if($c->Get("EditorsPick") == 1) echo "checked"; ?>>
</td>
<td class="text">&nbsp;</td>
</tr>
<TR <?php int_table_color(); ?> >
<TD><span id="prompt_Priority" class="text"><?php echo prompt_language("la_prompt_Priority"); ?></span></TD>
- <TD><input type=text SIZE="5" tabindex="6" NAME="Priority" VALUE="<?php echo $c->Get("Priority"); ?>"></TD>
+ <TD><input type=text SIZE="5" tabindex="10" NAME="Priority" VALUE="<?php echo $c->Get("Priority"); ?>"></TD>
<TD>&nbsp;</TD>
</TR>
<tr <?php int_table_color(); ?>>
<td valign="top" ID="prompt_cat_date" class="text"> <?php echo prompt_language("la_prompt_CreatedOn"); ?> </td>
<td>
- <input type="text" ValidationType="date,exists" tabindex="7" name="cat_date" id="cat_date_selector" datepickerIcon="../images/ddarrow.gif" class="text" size="20" value="<?php echo $c->parsetag("cat_date"); ?>">
+ <input type="text" ValidationType="date,exists" tabindex="11" name="cat_date" id="cat_date_selector" datepickerIcon="../images/ddarrow.gif" class="text" size="20" value="<?php echo $c->parsetag("cat_date"); ?>">
<span class="small"><?php echo prompt_language("la_prompt_DateFormat"); ?></span>
</td>
<td>
<?php if( IsDebugMode() ) echo '<b>DBG:</b> '.adodb_date('M d. Y H:i:s', $c->get('Modified') ); ?>
</td>
</tr>
<?php int_subsection_title(prompt_language("la_Sectionheader_MetaInformation")); ?>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_meta_keywords" class="text"><?php echo prompt_language("la_prompt_MetaKeywords"); ?></span></td>
<td>
- <input type="text" name="meta_keywords" tabindex="8" class="text" size="30" value="<?php echo $c->parsetag("cat_metakeywords"); ?>">
+ <input type="text" name="meta_keywords" tabindex="12" class="text" size="30" value="<?php echo $c->parsetag("cat_metakeywords"); ?>">
</td>
<td class="text">&nbsp;</td>
</tr>
<tr <?php int_table_color(); ?>>
<td valign="top"><span id="prompt_meta_desc" class="text"><?php echo prompt_language("la_prompt_MetaDescription"); ?></span></td>
<td>
- <textarea name="meta_desc" tabindex="9" cols="60" rows="2" class="text"><?php echo inp_textarea_unescape($c->parsetag("cat_metadesc")); ?></textarea>
+ <textarea name="meta_desc" tabindex="13" cols="60" rows="2" class="text"><?php echo inp_textarea_unescape($c->parsetag("cat_metadesc")); ?></textarea>
</td>
<td class="text">&nbsp;</td>
</tr>
-<?php
+<?php
+
$CustomFieldUI = $objCustomFields->GetFieldUIList(TRUE);
if($CustomFieldUI->NumItems()>0)
{
$objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData");
if((int)$c->Get("ResourceId")>0)
{
$objCustomDataList->LoadResource($c->Get("ResourceId"));
}
$headings = $CustomFieldUI->GetHeadingList();
//echo "<PRE>";print_r($objCustomFields); echo "</PRE>";
+ $tab_index = 14;
for($i=0;$i<=count($headings);$i++)
{
$h = $headings[$i];
if(strlen($h))
{
int_subsection_title(prompt_language($h));
$Items = $CustomFieldUI->GetHeadingItems($h);
foreach($Items as $f)
{
$n = substr($f->name,1);
$cfield = $objCustomFields->GetItemByField("FieldName",$n,FALSE);
if (is_object($cfield)) {
$f->default_value = $c->GetCustomFieldValue($n, '', 0, true);
}
print "<tr ".int_table_color_ret().">\n";
print " <td valign=\"top\" class=\"text\">".$f->GetPrompt()."</td>\n";
- print " <td nowrap>".$f->ItemFormElement()."</TD>";
+ print " <td nowrap>".$f->ItemFormElement($tab_index++)."</TD>";
if(is_object($f->NextItem))
{
$n = $f->NextItem;
- print " <td>".$n->ItemFormElement()."</TD>";
+ print " <td>".$n->ItemFormElement($tab_index++)."</TD>";
}
else
print " <td><span class=\"text\">&nbsp;</span></td>\n";
print "</tr>\n";
}
}
}
}
?>
<input type="hidden" name="ParentId" value="<?php echo $c->Get("ParentId"); ?>">
<input type="hidden" name="CategoryId" value="<?php echo $c->parsetag("cat_id"); ?>">
<input type="hidden" name="Action" value="<?php echo $action; ?>">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
</table>
<script src="<?php echo $adminURL; ?>/include/calendar.js"></script>
<SCRIPT language="JavaScript">
initCalendar("cat_date_selector", CalDateFormat);
function reflect_filename()
{
var $checked = document.getElementById('auto_filename').checked;
document.getElementById('filename').readOnly = $checked;
}
reflect_filename();
</SCRIPT>
<FORM method="POST" NAME="save_edit" ID="save_edit">
<input type="hidden" name="CatEditStatus" VALUE="0">
</FORM>
<?php
MarkFields('category');
int_footer();
?>
\ No newline at end of file
Property changes on: trunk/admin/category/addcategory.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.17
\ No newline at end of property

Event Timeline