Skip to content

Commit

Permalink
Highlight of required fields should be only in edit mode
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/bookmarks/card.php
  • Loading branch information
marcosgdf authored and eldy committed Nov 24, 2014
1 parent 6159591 commit 601710a
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions htdocs/bookmarks/card.php
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -150,11 +151,11 @@
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';

print_fiche_titre($langs->trans("NewBookmark"));

dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');

print '<table class="border" width="100%">';

print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
Expand All @@ -176,14 +177,14 @@
print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';

print '</table><br>';

print '<div align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'" name="create"> &nbsp; ';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
print '</div>';

print '</form>';

dol_fiche_end();
}

Expand Down Expand Up @@ -213,12 +214,31 @@

print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>'.$bookmark->ref.'</td></tr>';

print '<tr><td>'.$langs->trans("BookmarkTitle").'</td><td>';
print '<tr><td>';
if ($action == 'edit') {
print '<span class="fieldrequired">';
}

print $langs->trans("BookmarkTitle");

if ($action == 'edit') {
print '</span>';
}

print '</td><td>';
if ($action == 'edit') print '<input class="flat" name="title" size="30" value="'.(isset($_POST["title"])?$_POST["title"]:$bookmark->title).'">';
else print $bookmark->title;
print '</td></tr>';

print '<tr><td>'.$langs->trans("UrlOrLink").'</td><td>';
print '<tr><td>';
if ($action == 'edit') {
print '<span class="fieldrequired">';
}
print $langs->trans("UrlOrLink");
if ($action == 'edit') {
print '</span>';
}
print '</td><td>';
if ($action == 'edit') print '<input class="flat" name="url" size="80" value="'.(isset($_POST["url"])?$_POST["url"]:$bookmark->url).'">';
else print '<a href="'.(preg_match('/^http/i',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'"'.($bookmark->target?' target="_blank"':'').'>'.$bookmark->url.'</a>';
print '</td></tr>';
Expand Down Expand Up @@ -268,7 +288,7 @@
print '</table>';

if ($action == 'edit') print '<br><div align="center"><input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></div>';

if ($action == 'edit') print '</form>';

dol_fiche_end();
Expand Down

0 comments on commit 601710a

Please sign in to comment.