/
editlabel_view.php
93 lines (85 loc) · 4.88 KB
/
editlabel_view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<div class='header'>
<input type='image' src='<?php echo $sImageURL; ?>close.png' style='float:right;'
onclick="window.open('<?php echo $this->createUrl("admin/labels/sa/view/lid/".$lid); ?>', '_top')" alt='<?php eT("Close"); ?>'/>
<?php if ($action == "newlabelset") { eT("Create or import new label set(s)");}
else {eT("Edit label set"); } ?>
</div>
<div id='tabs'>
<ul>
<li><a href='#neweditlblset0'><?php echo $tabitem; ?>
</a></li>
<?php if ($action == "newlabelset"){ ?>
<li><a href='#neweditlblset1'><?php eT("Import label set(s)"); ?></a></li>
<?php } ?>
</ul>
<div id='neweditlblset0'>
<?php echo CHtml::form(array("admin/labels/sa/process"), 'post',array('class'=>'form30','id'=>'labelsetform','onsubmit'=>"return isEmpty(document.getElementById('label_name'), '".gT("Error: You have to enter a name for this label set.","js")."')")); ?>
<ul>
<li><label for='label_name'><?php eT("Set name:"); ?></label>
<input type='hidden' name='languageids' id='languageids' value='<?php echo $langids; ?>' />
<?php echo CHtml::textField('label_name',isset($lbname)?$lbname:"",array('maxlength'=>100,'size'=>50)); ?>
</li>
<li><label><?php eT("Languages:"); ?></label>
<?php
$aAvailableLang=getLanguageDataRestricted (false, Yii::app()->session['adminlang']);
$aLang=array();
foreach ($aAvailableLang as $lang => $aLanguage)
{
$aLang[$lang]=html_entity_decode($aLanguage['description'], ENT_QUOTES, 'UTF-8')." (".html_entity_decode($aLanguage['nativedescription'], ENT_QUOTES, 'UTF-8').")";
}
// Adding existing lang
foreach ($langidsarray as $lang)
{
if(!isset($aLang[$lang]))
{
$aLangInfo=getLanguageNameFromCode($lang);
$aLang[$lang]=html_entity_decode($aLangInfo[0], ENT_QUOTES, 'UTF-8')." (".html_entity_decode($aLangInfo[1], ENT_QUOTES, 'UTF-8').")";
}
}
$this->widget('ext.bootstrap.widgets.TbSelect2', array(
'name' => 'languages',
'data'=>$aLang,
'value' => $langidsarray,
'options' => array(
'width' => "js: function(){ return Math.max.apply(null, $(this.element).find('option').map(function() { return $(this).text().length; }))+'em' }",
),
'htmlOptions' => array(
'multiple' => 'multiple',
'required' => 'required',
'placeholder' => gt("You need at least one language in a labelset."),
),
));
?>
</li></ul>
<p><input type='submit' value='<?php if ($action == "newlabelset") {eT("Save");}
else {eT("Update");} ?>' />
<input type='hidden' name='action' value='<?php if ($action == "newlabelset") {echo "insertlabelset";} else {echo "updateset";} ?>' />
<?php if ($action == "editlabelset") { ?>
<input type='hidden' name='lid' value='<?php echo $lblid; ?>' />
<?php } ?>
</form>
</div>
<?php if ($action == "newlabelset"){ ?>
<div id='neweditlblset1'>
<?php echo CHtml::form(array("admin/labels/sa/import"), 'post',array('enctype'=>'multipart/form-data','id'=>'importlabels','name'=>"importlabels")); ?>
<div class='header ui-widget-header'>
<?php eT("Import label set(s)"); ?>
</div><ul>
<li><label for='the_file'>
<?php eT("Select label set file (*.lsl):"); ?></label>
<input id='the_file' name='the_file' type='file'/>
</li>
<li><label for='checkforduplicates'>
<?php eT("Don't import if label set already exists:"); ?></label>
<input name='checkforduplicates' id='checkforduplicates' type='checkbox' checked='checked' />
</li>
<li><label for='translinksfields'>
<?php eT("Convert resources links?"); ?></label>
<input name='translinksfields' id='translinksfields' type='checkbox' checked='checked' />
</li></ul>
<p><input type='submit' value='<?php eT("Import label set(s)"); ?>' />
<input type='hidden' name='action' value='importlabels' />
</form></div>
</div>
<?php } ?>
</div>